keryszhan commited on
Commit
d14f0b5
·
verified ·
1 Parent(s): 0f817a2

Upload recovered code-plan SFT LoRA

Browse files
README.md CHANGED
@@ -1,3 +1,94 @@
1
  ---
2
- license: openmdw-1.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ library_name: peft
3
+ license: apache-2.0
4
+ base_model: Qwen/Qwen2.5-Coder-7B
5
+ datasets:
6
+ - keryszhan/agent-code-rl-artifacts
7
+ pipeline_tag: text-generation
8
+ language:
9
+ - en
10
+ - zh
11
+ tags:
12
+ - code
13
+ - code-generation
14
+ - llama-factory
15
+ - lora
16
+ - reasoning
17
  ---
18
+
19
+ # Qwen2.5-Coder-7B Code-Plan SFT LoRA
20
+
21
+ LoRA adapter trained on four-step planning followed by Python code generation.
22
+ The adapter is a recovered artifact from the Agent Code RL project; it is the
23
+ SFT starting point used before the later PRM/GRPO work.
24
+
25
+ This is an adapter, not a standalone model. Load it with
26
+ `Qwen/Qwen2.5-Coder-7B`.
27
+
28
+ ## Usage
29
+
30
+ ```python
31
+ from peft import PeftModel
32
+ from transformers import AutoModelForCausalLM, AutoTokenizer
33
+
34
+ base_id = "Qwen/Qwen2.5-Coder-7B"
35
+ adapter_id = "keryszhan/qwen2.5-coder-7b-code-plan-sft"
36
+
37
+ tokenizer = AutoTokenizer.from_pretrained(base_id, trust_remote_code=True)
38
+ model = AutoModelForCausalLM.from_pretrained(
39
+ base_id,
40
+ device_map="auto",
41
+ torch_dtype="auto",
42
+ trust_remote_code=True,
43
+ )
44
+ model = PeftModel.from_pretrained(model, adapter_id)
45
+ ```
46
+
47
+ The training examples use an instruction/response format. Responses contain
48
+ four explicit reasoning steps and one Python code block; callers should preserve
49
+ that protocol when constructing prompts.
50
+
51
+ ## Training
52
+
53
+ - Base model: `Qwen/Qwen2.5-Coder-7B`
54
+ - Method: LoRA SFT via LLaMA-Factory
55
+ - Rank / alpha / dropout: 16 / 16 / 0.05
56
+ - Target modules: attention and MLP projection layers
57
+ - Learning rate: `2e-4`
58
+ - Effective batch size: 16
59
+ - Epochs: 3
60
+ - Seed: 42
61
+ - Final step: 177
62
+ - Recorded training loss: 0.3711
63
+
64
+ Recorded framework versions: PEFT 0.15.1, Transformers 4.51.3,
65
+ PyTorch 2.5.1+cu121, Datasets 3.5.0, and Tokenizers 0.21.1.
66
+
67
+ ## Evaluation evidence
68
+
69
+ Recovered project records report approximately 44.8% for the base model and
70
+ 61.29% for an SFT evaluation. A separate 122-item `prm_val` evaluation records
71
+ 70 passes (57.38%). These historical measurements were not reconstructed from
72
+ scratch during repository cleanup, so treat them as project evidence rather
73
+ than a standardized leaderboard result.
74
+
75
+ The later GRPO evaluation files must not be attributed to this adapter: the
76
+ final GRPO adapter is no longer available, and one candidate result has no
77
+ checkpoint identity.
78
+
79
+ ## Limitations
80
+
81
+ - Generates and may execute Python code; use an actual sandbox for untrusted output.
82
+ - Trained on HumanEval/MBPP-derived tasks and should not be used to claim an
83
+ uncontaminated benchmark result on those task families.
84
+ - The model may emit incorrect reasoning, insecure code, or non-terminating code.
85
+ - Training-data redistribution is tracked separately from this model release.
86
+
87
+ The related process dataset is maintained at
88
+ [`keryszhan/agent-code-rl-artifacts`](https://huggingface.co/datasets/keryszhan/agent-code-rl-artifacts).
89
+
90
+ ## License
91
+
92
+ The base model is Apache-2.0. This adapter is released under Apache-2.0 subject
93
+ to the terms and attribution requirements of the base model and applicable
94
+ training-data licenses.
adapter_config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "Qwen/Qwen2.5-Coder-7B",
5
+ "bias": "none",
6
+ "corda_config": null,
7
+ "eva_config": null,
8
+ "exclude_modules": null,
9
+ "fan_in_fan_out": false,
10
+ "inference_mode": true,
11
+ "init_lora_weights": true,
12
+ "layer_replication": null,
13
+ "layers_pattern": null,
14
+ "layers_to_transform": null,
15
+ "loftq_config": {},
16
+ "lora_alpha": 16,
17
+ "lora_bias": false,
18
+ "lora_dropout": 0.05,
19
+ "megatron_config": null,
20
+ "megatron_core": "megatron.core",
21
+ "modules_to_save": null,
22
+ "peft_type": "LORA",
23
+ "r": 16,
24
+ "rank_pattern": {},
25
+ "revision": null,
26
+ "target_modules": [
27
+ "gate_proj",
28
+ "k_proj",
29
+ "q_proj",
30
+ "v_proj",
31
+ "o_proj",
32
+ "down_proj",
33
+ "up_proj"
34
+ ],
35
+ "task_type": "CAUSAL_LM",
36
+ "trainable_token_indices": null,
37
+ "use_dora": false,
38
+ "use_rslora": false
39
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:099806554d5b0080448a5e7f1d46faeeb7bed35703f05c2f734b98200fa2fce4
3
+ size 161533192
train_results.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 2.962025316455696,
3
+ "total_flos": 1.1532158740468531e+17,
4
+ "train_loss": 0.37109487339601677,
5
+ "train_runtime": 1389.7366,
6
+ "train_samples_per_second": 2.046,
7
+ "train_steps_per_second": 0.127
8
+ }
trainer_log.jsonl ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"current_steps": 10, "total_steps": 177, "loss": 0.634, "lr": 0.00019984815164333163, "epoch": 0.16877637130801687, "percentage": 5.65, "elapsed_time": "0:01:36", "remaining_time": "0:26:56"}
2
+ {"current_steps": 20, "total_steps": 177, "loss": 0.488, "lr": 0.0001971614350559814, "epoch": 0.33755274261603374, "percentage": 11.3, "elapsed_time": "0:03:09", "remaining_time": "0:24:50"}
3
+ {"current_steps": 30, "total_steps": 177, "loss": 0.4406, "lr": 0.00019120447901834706, "epoch": 0.5063291139240507, "percentage": 16.95, "elapsed_time": "0:04:30", "remaining_time": "0:22:07"}
4
+ {"current_steps": 40, "total_steps": 177, "loss": 0.4385, "lr": 0.0001821777815225245, "epoch": 0.6751054852320675, "percentage": 22.6, "elapsed_time": "0:05:50", "remaining_time": "0:19:58"}
5
+ {"current_steps": 50, "total_steps": 177, "loss": 0.4207, "lr": 0.00017038516128259115, "epoch": 0.8438818565400844, "percentage": 28.25, "elapsed_time": "0:07:10", "remaining_time": "0:18:12"}
6
+ {"current_steps": 60, "total_steps": 177, "loss": 0.407, "lr": 0.00015622353186727544, "epoch": 1.0, "percentage": 33.9, "elapsed_time": "0:08:20", "remaining_time": "0:16:15"}
7
+ {"current_steps": 70, "total_steps": 177, "loss": 0.3725, "lr": 0.00014016954246529696, "epoch": 1.1687763713080168, "percentage": 39.55, "elapsed_time": "0:09:38", "remaining_time": "0:14:44"}
8
+ {"current_steps": 80, "total_steps": 177, "loss": 0.3632, "lr": 0.00012276353492572935, "epoch": 1.3375527426160336, "percentage": 45.2, "elapsed_time": "0:10:56", "remaining_time": "0:13:16"}
9
+ {"current_steps": 90, "total_steps": 177, "loss": 0.3574, "lr": 0.00010459135704399718, "epoch": 1.5063291139240507, "percentage": 50.85, "elapsed_time": "0:12:14", "remaining_time": "0:11:49"}
10
+ {"current_steps": 100, "total_steps": 177, "loss": 0.3303, "lr": 8.626464421815919e-05, "epoch": 1.6751054852320675, "percentage": 56.5, "elapsed_time": "0:13:29", "remaining_time": "0:10:23"}
11
+ {"current_steps": 110, "total_steps": 177, "loss": 0.3385, "lr": 6.840023315140475e-05, "epoch": 1.8438818565400843, "percentage": 62.15, "elapsed_time": "0:14:45", "remaining_time": "0:08:59"}
12
+ {"current_steps": 120, "total_steps": 177, "loss": 0.3286, "lr": 5.159940049010015e-05, "epoch": 2.0, "percentage": 67.8, "elapsed_time": "0:15:55", "remaining_time": "0:07:33"}
13
+ {"current_steps": 130, "total_steps": 177, "loss": 0.2901, "lr": 3.642762517900322e-05, "epoch": 2.168776371308017, "percentage": 73.45, "elapsed_time": "0:17:11", "remaining_time": "0:06:12"}
14
+ {"current_steps": 140, "total_steps": 177, "loss": 0.2916, "lr": 2.339555568810221e-05, "epoch": 2.3375527426160336, "percentage": 79.1, "elapsed_time": "0:18:27", "remaining_time": "0:04:52"}
15
+ {"current_steps": 150, "total_steps": 177, "loss": 0.2865, "lr": 1.294182271221377e-05, "epoch": 2.5063291139240507, "percentage": 84.75, "elapsed_time": "0:19:43", "remaining_time": "0:03:32"}
16
+ {"current_steps": 160, "total_steps": 177, "loss": 0.2854, "lr": 5.418275829936537e-06, "epoch": 2.6751054852320673, "percentage": 90.4, "elapsed_time": "0:21:01", "remaining_time": "0:02:14"}
17
+ {"current_steps": 170, "total_steps": 177, "loss": 0.2898, "lr": 1.0781410234342094e-06, "epoch": 2.8438818565400843, "percentage": 96.05, "elapsed_time": "0:22:15", "remaining_time": "0:00:54"}
18
+ {"current_steps": 177, "total_steps": 177, "epoch": 2.962025316455696, "percentage": 100.0, "elapsed_time": "0:23:09", "remaining_time": "0:00:00"}
trainer_state.json ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 2.962025316455696,
6
+ "eval_steps": 500,
7
+ "global_step": 177,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.16877637130801687,
14
+ "grad_norm": 0.1649426966905594,
15
+ "learning_rate": 0.00019984815164333163,
16
+ "loss": 0.634,
17
+ "step": 10
18
+ },
19
+ {
20
+ "epoch": 0.33755274261603374,
21
+ "grad_norm": 0.09811161458492279,
22
+ "learning_rate": 0.0001971614350559814,
23
+ "loss": 0.488,
24
+ "step": 20
25
+ },
26
+ {
27
+ "epoch": 0.5063291139240507,
28
+ "grad_norm": 0.12041426450014114,
29
+ "learning_rate": 0.00019120447901834706,
30
+ "loss": 0.4406,
31
+ "step": 30
32
+ },
33
+ {
34
+ "epoch": 0.6751054852320675,
35
+ "grad_norm": 0.11681783199310303,
36
+ "learning_rate": 0.0001821777815225245,
37
+ "loss": 0.4385,
38
+ "step": 40
39
+ },
40
+ {
41
+ "epoch": 0.8438818565400844,
42
+ "grad_norm": 0.12966671586036682,
43
+ "learning_rate": 0.00017038516128259115,
44
+ "loss": 0.4207,
45
+ "step": 50
46
+ },
47
+ {
48
+ "epoch": 1.0,
49
+ "grad_norm": 0.2353854924440384,
50
+ "learning_rate": 0.00015622353186727544,
51
+ "loss": 0.407,
52
+ "step": 60
53
+ },
54
+ {
55
+ "epoch": 1.1687763713080168,
56
+ "grad_norm": 0.172561913728714,
57
+ "learning_rate": 0.00014016954246529696,
58
+ "loss": 0.3725,
59
+ "step": 70
60
+ },
61
+ {
62
+ "epoch": 1.3375527426160336,
63
+ "grad_norm": 0.162893146276474,
64
+ "learning_rate": 0.00012276353492572935,
65
+ "loss": 0.3632,
66
+ "step": 80
67
+ },
68
+ {
69
+ "epoch": 1.5063291139240507,
70
+ "grad_norm": 0.1781071275472641,
71
+ "learning_rate": 0.00010459135704399718,
72
+ "loss": 0.3574,
73
+ "step": 90
74
+ },
75
+ {
76
+ "epoch": 1.6751054852320675,
77
+ "grad_norm": 0.2111092209815979,
78
+ "learning_rate": 8.626464421815919e-05,
79
+ "loss": 0.3303,
80
+ "step": 100
81
+ },
82
+ {
83
+ "epoch": 1.8438818565400843,
84
+ "grad_norm": 0.20615039765834808,
85
+ "learning_rate": 6.840023315140475e-05,
86
+ "loss": 0.3385,
87
+ "step": 110
88
+ },
89
+ {
90
+ "epoch": 2.0,
91
+ "grad_norm": 0.49355044960975647,
92
+ "learning_rate": 5.159940049010015e-05,
93
+ "loss": 0.3286,
94
+ "step": 120
95
+ },
96
+ {
97
+ "epoch": 2.168776371308017,
98
+ "grad_norm": 0.22129110991954803,
99
+ "learning_rate": 3.642762517900322e-05,
100
+ "loss": 0.2901,
101
+ "step": 130
102
+ },
103
+ {
104
+ "epoch": 2.3375527426160336,
105
+ "grad_norm": 0.22937293350696564,
106
+ "learning_rate": 2.339555568810221e-05,
107
+ "loss": 0.2916,
108
+ "step": 140
109
+ },
110
+ {
111
+ "epoch": 2.5063291139240507,
112
+ "grad_norm": 0.2439713031053543,
113
+ "learning_rate": 1.294182271221377e-05,
114
+ "loss": 0.2865,
115
+ "step": 150
116
+ },
117
+ {
118
+ "epoch": 2.6751054852320673,
119
+ "grad_norm": 0.23686474561691284,
120
+ "learning_rate": 5.418275829936537e-06,
121
+ "loss": 0.2854,
122
+ "step": 160
123
+ },
124
+ {
125
+ "epoch": 2.8438818565400843,
126
+ "grad_norm": 0.2566355764865875,
127
+ "learning_rate": 1.0781410234342094e-06,
128
+ "loss": 0.2898,
129
+ "step": 170
130
+ },
131
+ {
132
+ "epoch": 2.962025316455696,
133
+ "step": 177,
134
+ "total_flos": 1.1532158740468531e+17,
135
+ "train_loss": 0.37109487339601677,
136
+ "train_runtime": 1389.7366,
137
+ "train_samples_per_second": 2.046,
138
+ "train_steps_per_second": 0.127
139
+ }
140
+ ],
141
+ "logging_steps": 10,
142
+ "max_steps": 177,
143
+ "num_input_tokens_seen": 0,
144
+ "num_train_epochs": 3,
145
+ "save_steps": 200,
146
+ "stateful_callbacks": {
147
+ "TrainerControl": {
148
+ "args": {
149
+ "should_epoch_stop": false,
150
+ "should_evaluate": false,
151
+ "should_log": false,
152
+ "should_save": true,
153
+ "should_training_stop": true
154
+ },
155
+ "attributes": {}
156
+ }
157
+ },
158
+ "total_flos": 1.1532158740468531e+17,
159
+ "train_batch_size": 1,
160
+ "trial_name": null,
161
+ "trial_params": null
162
+ }
training_loss.png ADDED