sumuks commited on
Commit
53d1306
·
verified ·
1 Parent(s): e265c23

Upload folder using huggingface_hub

Browse files
Files changed (41) hide show
  1. checkpoint-1000/README.md +202 -0
  2. checkpoint-1000/adapter_config.json +34 -0
  3. checkpoint-1000/adapter_model.safetensors +3 -0
  4. checkpoint-1000/added_tokens.json +24 -0
  5. checkpoint-1000/latest +1 -0
  6. checkpoint-1000/merges.txt +0 -0
  7. checkpoint-1000/special_tokens_map.json +31 -0
  8. checkpoint-1000/tokenizer.json +3 -0
  9. checkpoint-1000/tokenizer_config.json +208 -0
  10. checkpoint-1000/trainer_state.json +749 -0
  11. checkpoint-1000/training_args.bin +3 -0
  12. checkpoint-1000/vocab.json +0 -0
  13. checkpoint-1000/zero_to_fp32.py +674 -0
  14. checkpoint-1500/README.md +202 -0
  15. checkpoint-1500/adapter_config.json +34 -0
  16. checkpoint-1500/adapter_model.safetensors +3 -0
  17. checkpoint-1500/added_tokens.json +24 -0
  18. checkpoint-1500/latest +1 -0
  19. checkpoint-1500/merges.txt +0 -0
  20. checkpoint-1500/special_tokens_map.json +31 -0
  21. checkpoint-1500/tokenizer.json +3 -0
  22. checkpoint-1500/tokenizer_config.json +208 -0
  23. checkpoint-1500/trainer_state.json +1107 -0
  24. checkpoint-1500/training_args.bin +3 -0
  25. checkpoint-1500/vocab.json +0 -0
  26. checkpoint-1500/zero_to_fp32.py +674 -0
  27. checkpoint-500/README.md +202 -0
  28. checkpoint-500/adapter_config.json +34 -0
  29. checkpoint-500/adapter_model.safetensors +3 -0
  30. checkpoint-500/added_tokens.json +24 -0
  31. checkpoint-500/latest +1 -0
  32. checkpoint-500/merges.txt +0 -0
  33. checkpoint-500/special_tokens_map.json +31 -0
  34. checkpoint-500/tokenizer.json +3 -0
  35. checkpoint-500/tokenizer_config.json +208 -0
  36. checkpoint-500/trainer_state.json +391 -0
  37. checkpoint-500/training_args.bin +3 -0
  38. checkpoint-500/vocab.json +0 -0
  39. checkpoint-500/zero_to_fp32.py +674 -0
  40. trainer_log.jsonl +35 -0
  41. upload.py +11 -0
checkpoint-1000/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen2.5-72B
3
+ library_name: peft
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.12.0
checkpoint-1000/adapter_config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "Qwen/Qwen2.5-72B",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": true,
9
+ "layer_replication": null,
10
+ "layers_pattern": null,
11
+ "layers_to_transform": null,
12
+ "loftq_config": {},
13
+ "lora_alpha": 32,
14
+ "lora_dropout": 0.0,
15
+ "megatron_config": null,
16
+ "megatron_core": "megatron.core",
17
+ "modules_to_save": null,
18
+ "peft_type": "LORA",
19
+ "r": 128,
20
+ "rank_pattern": {},
21
+ "revision": null,
22
+ "target_modules": [
23
+ "gate_proj",
24
+ "v_proj",
25
+ "k_proj",
26
+ "down_proj",
27
+ "o_proj",
28
+ "q_proj",
29
+ "up_proj"
30
+ ],
31
+ "task_type": "CAUSAL_LM",
32
+ "use_dora": false,
33
+ "use_rslora": true
34
+ }
checkpoint-1000/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87da4e11eb9b86473cf5676cfe2c6c7cb66578a988b8ee51d625b8d1fb608a19
3
+ size 3368705968
checkpoint-1000/added_tokens.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</tool_call>": 151658,
3
+ "<tool_call>": 151657,
4
+ "<|box_end|>": 151649,
5
+ "<|box_start|>": 151648,
6
+ "<|endoftext|>": 151643,
7
+ "<|file_sep|>": 151664,
8
+ "<|fim_middle|>": 151660,
9
+ "<|fim_pad|>": 151662,
10
+ "<|fim_prefix|>": 151659,
11
+ "<|fim_suffix|>": 151661,
12
+ "<|im_end|>": 151645,
13
+ "<|im_start|>": 151644,
14
+ "<|image_pad|>": 151655,
15
+ "<|object_ref_end|>": 151647,
16
+ "<|object_ref_start|>": 151646,
17
+ "<|quad_end|>": 151651,
18
+ "<|quad_start|>": 151650,
19
+ "<|repo_name|>": 151663,
20
+ "<|video_pad|>": 151656,
21
+ "<|vision_end|>": 151653,
22
+ "<|vision_pad|>": 151654,
23
+ "<|vision_start|>": 151652
24
+ }
checkpoint-1000/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step1000
checkpoint-1000/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-1000/special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|endoftext|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
checkpoint-1000/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
3
+ size 11421896
checkpoint-1000/tokenizer_config.json ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ }
181
+ },
182
+ "additional_special_tokens": [
183
+ "<|im_start|>",
184
+ "<|im_end|>",
185
+ "<|object_ref_start|>",
186
+ "<|object_ref_end|>",
187
+ "<|box_start|>",
188
+ "<|box_end|>",
189
+ "<|quad_start|>",
190
+ "<|quad_end|>",
191
+ "<|vision_start|>",
192
+ "<|vision_end|>",
193
+ "<|vision_pad|>",
194
+ "<|image_pad|>",
195
+ "<|video_pad|>"
196
+ ],
197
+ "bos_token": null,
198
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
199
+ "clean_up_tokenization_spaces": false,
200
+ "eos_token": "<|endoftext|>",
201
+ "errors": "replace",
202
+ "model_max_length": 131072,
203
+ "pad_token": "<|endoftext|>",
204
+ "padding_side": "right",
205
+ "split_special_tokens": false,
206
+ "tokenizer_class": "Qwen2Tokenizer",
207
+ "unk_token": null
208
+ }
checkpoint-1000/trainer_state.json ADDED
@@ -0,0 +1,749 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.6028181749679753,
5
+ "eval_steps": 400,
6
+ "global_step": 1000,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.006028181749679753,
13
+ "grad_norm": 0.38845974438826136,
14
+ "learning_rate": 1.0040160642570282e-06,
15
+ "loss": 1.6618,
16
+ "step": 10
17
+ },
18
+ {
19
+ "epoch": 0.012056363499359506,
20
+ "grad_norm": 0.255603405930248,
21
+ "learning_rate": 2.0080321285140564e-06,
22
+ "loss": 1.6698,
23
+ "step": 20
24
+ },
25
+ {
26
+ "epoch": 0.01808454524903926,
27
+ "grad_norm": 0.20116505722657768,
28
+ "learning_rate": 3.0120481927710846e-06,
29
+ "loss": 1.6264,
30
+ "step": 30
31
+ },
32
+ {
33
+ "epoch": 0.02411272699871901,
34
+ "grad_norm": 0.1795881732266397,
35
+ "learning_rate": 4.016064257028113e-06,
36
+ "loss": 1.6025,
37
+ "step": 40
38
+ },
39
+ {
40
+ "epoch": 0.030140908748398764,
41
+ "grad_norm": 0.14600421495766222,
42
+ "learning_rate": 5.020080321285141e-06,
43
+ "loss": 1.5584,
44
+ "step": 50
45
+ },
46
+ {
47
+ "epoch": 0.03616909049807852,
48
+ "grad_norm": 0.1170942466306718,
49
+ "learning_rate": 6.024096385542169e-06,
50
+ "loss": 1.5604,
51
+ "step": 60
52
+ },
53
+ {
54
+ "epoch": 0.04219727224775827,
55
+ "grad_norm": 0.2445974669666656,
56
+ "learning_rate": 7.028112449799197e-06,
57
+ "loss": 1.5057,
58
+ "step": 70
59
+ },
60
+ {
61
+ "epoch": 0.04822545399743802,
62
+ "grad_norm": 0.11238025351136724,
63
+ "learning_rate": 8.032128514056226e-06,
64
+ "loss": 1.4724,
65
+ "step": 80
66
+ },
67
+ {
68
+ "epoch": 0.05425363574711778,
69
+ "grad_norm": 0.13639577534070754,
70
+ "learning_rate": 9.036144578313253e-06,
71
+ "loss": 1.4962,
72
+ "step": 90
73
+ },
74
+ {
75
+ "epoch": 0.06028181749679753,
76
+ "grad_norm": 0.17113178431310286,
77
+ "learning_rate": 1.0040160642570281e-05,
78
+ "loss": 1.4765,
79
+ "step": 100
80
+ },
81
+ {
82
+ "epoch": 0.06630999924647728,
83
+ "grad_norm": 0.4795401637258333,
84
+ "learning_rate": 1.104417670682731e-05,
85
+ "loss": 1.4468,
86
+ "step": 110
87
+ },
88
+ {
89
+ "epoch": 0.07233818099615703,
90
+ "grad_norm": 0.13385762516900662,
91
+ "learning_rate": 1.2048192771084338e-05,
92
+ "loss": 1.4134,
93
+ "step": 120
94
+ },
95
+ {
96
+ "epoch": 0.07836636274583679,
97
+ "grad_norm": 0.12303707813666019,
98
+ "learning_rate": 1.3052208835341367e-05,
99
+ "loss": 1.4191,
100
+ "step": 130
101
+ },
102
+ {
103
+ "epoch": 0.08439454449551655,
104
+ "grad_norm": 0.10822073133399364,
105
+ "learning_rate": 1.4056224899598394e-05,
106
+ "loss": 1.397,
107
+ "step": 140
108
+ },
109
+ {
110
+ "epoch": 0.09042272624519629,
111
+ "grad_norm": 0.1109270134990499,
112
+ "learning_rate": 1.5060240963855424e-05,
113
+ "loss": 1.3818,
114
+ "step": 150
115
+ },
116
+ {
117
+ "epoch": 0.09645090799487605,
118
+ "grad_norm": 0.14622173134033867,
119
+ "learning_rate": 1.606425702811245e-05,
120
+ "loss": 1.4002,
121
+ "step": 160
122
+ },
123
+ {
124
+ "epoch": 0.1024790897445558,
125
+ "grad_norm": 0.10587626114414271,
126
+ "learning_rate": 1.706827309236948e-05,
127
+ "loss": 1.4123,
128
+ "step": 170
129
+ },
130
+ {
131
+ "epoch": 0.10850727149423556,
132
+ "grad_norm": 0.10302196814593138,
133
+ "learning_rate": 1.8072289156626505e-05,
134
+ "loss": 1.4016,
135
+ "step": 180
136
+ },
137
+ {
138
+ "epoch": 0.1145354532439153,
139
+ "grad_norm": 0.1359849724314843,
140
+ "learning_rate": 1.9076305220883535e-05,
141
+ "loss": 1.404,
142
+ "step": 190
143
+ },
144
+ {
145
+ "epoch": 0.12056363499359506,
146
+ "grad_norm": 0.10587622358885339,
147
+ "learning_rate": 2.0080321285140562e-05,
148
+ "loss": 1.4019,
149
+ "step": 200
150
+ },
151
+ {
152
+ "epoch": 0.1265918167432748,
153
+ "grad_norm": 0.15017595066321648,
154
+ "learning_rate": 2.1084337349397593e-05,
155
+ "loss": 1.393,
156
+ "step": 210
157
+ },
158
+ {
159
+ "epoch": 0.13261999849295456,
160
+ "grad_norm": 0.19475575142022897,
161
+ "learning_rate": 2.208835341365462e-05,
162
+ "loss": 1.3876,
163
+ "step": 220
164
+ },
165
+ {
166
+ "epoch": 0.1386481802426343,
167
+ "grad_norm": 0.12084095277263424,
168
+ "learning_rate": 2.309236947791165e-05,
169
+ "loss": 1.3916,
170
+ "step": 230
171
+ },
172
+ {
173
+ "epoch": 0.14467636199231407,
174
+ "grad_norm": 0.11857482977859173,
175
+ "learning_rate": 2.4096385542168677e-05,
176
+ "loss": 1.4056,
177
+ "step": 240
178
+ },
179
+ {
180
+ "epoch": 0.15070454374199382,
181
+ "grad_norm": 0.1403959719635503,
182
+ "learning_rate": 2.5100401606425704e-05,
183
+ "loss": 1.3935,
184
+ "step": 250
185
+ },
186
+ {
187
+ "epoch": 0.15673272549167358,
188
+ "grad_norm": 0.10800155257965392,
189
+ "learning_rate": 2.6104417670682734e-05,
190
+ "loss": 1.3826,
191
+ "step": 260
192
+ },
193
+ {
194
+ "epoch": 0.16276090724135334,
195
+ "grad_norm": 0.10598439909830581,
196
+ "learning_rate": 2.7108433734939758e-05,
197
+ "loss": 1.3999,
198
+ "step": 270
199
+ },
200
+ {
201
+ "epoch": 0.1687890889910331,
202
+ "grad_norm": 0.10753449693494475,
203
+ "learning_rate": 2.8112449799196788e-05,
204
+ "loss": 1.4047,
205
+ "step": 280
206
+ },
207
+ {
208
+ "epoch": 0.17481727074071282,
209
+ "grad_norm": 0.36718328659037996,
210
+ "learning_rate": 2.911646586345382e-05,
211
+ "loss": 1.3935,
212
+ "step": 290
213
+ },
214
+ {
215
+ "epoch": 0.18084545249039258,
216
+ "grad_norm": 0.10611900000479042,
217
+ "learning_rate": 3.012048192771085e-05,
218
+ "loss": 1.3736,
219
+ "step": 300
220
+ },
221
+ {
222
+ "epoch": 0.18687363424007233,
223
+ "grad_norm": 0.11901555220652378,
224
+ "learning_rate": 3.112449799196787e-05,
225
+ "loss": 1.3927,
226
+ "step": 310
227
+ },
228
+ {
229
+ "epoch": 0.1929018159897521,
230
+ "grad_norm": 0.118935148513695,
231
+ "learning_rate": 3.21285140562249e-05,
232
+ "loss": 1.3636,
233
+ "step": 320
234
+ },
235
+ {
236
+ "epoch": 0.19892999773943185,
237
+ "grad_norm": 0.1974545721831922,
238
+ "learning_rate": 3.313253012048193e-05,
239
+ "loss": 1.3892,
240
+ "step": 330
241
+ },
242
+ {
243
+ "epoch": 0.2049581794891116,
244
+ "grad_norm": 0.13145409772199562,
245
+ "learning_rate": 3.413654618473896e-05,
246
+ "loss": 1.3756,
247
+ "step": 340
248
+ },
249
+ {
250
+ "epoch": 0.21098636123879136,
251
+ "grad_norm": 0.11064380941915805,
252
+ "learning_rate": 3.5140562248995983e-05,
253
+ "loss": 1.3935,
254
+ "step": 350
255
+ },
256
+ {
257
+ "epoch": 0.21701454298847112,
258
+ "grad_norm": 0.12160423827639648,
259
+ "learning_rate": 3.614457831325301e-05,
260
+ "loss": 1.3698,
261
+ "step": 360
262
+ },
263
+ {
264
+ "epoch": 0.22304272473815084,
265
+ "grad_norm": 0.10349641889173723,
266
+ "learning_rate": 3.7148594377510044e-05,
267
+ "loss": 1.3771,
268
+ "step": 370
269
+ },
270
+ {
271
+ "epoch": 0.2290709064878306,
272
+ "grad_norm": 0.10682144059511894,
273
+ "learning_rate": 3.815261044176707e-05,
274
+ "loss": 1.3768,
275
+ "step": 380
276
+ },
277
+ {
278
+ "epoch": 0.23509908823751036,
279
+ "grad_norm": 0.11625245619819907,
280
+ "learning_rate": 3.91566265060241e-05,
281
+ "loss": 1.3795,
282
+ "step": 390
283
+ },
284
+ {
285
+ "epoch": 0.2411272699871901,
286
+ "grad_norm": 0.10327726962763091,
287
+ "learning_rate": 4.0160642570281125e-05,
288
+ "loss": 1.3987,
289
+ "step": 400
290
+ },
291
+ {
292
+ "epoch": 0.2411272699871901,
293
+ "eval_loss": 1.3548544645309448,
294
+ "eval_runtime": 148.2269,
295
+ "eval_samples_per_second": 7.239,
296
+ "eval_steps_per_second": 0.911,
297
+ "step": 400
298
+ },
299
+ {
300
+ "epoch": 0.24715545173686987,
301
+ "grad_norm": 0.10660530950921367,
302
+ "learning_rate": 4.116465863453816e-05,
303
+ "loss": 1.3886,
304
+ "step": 410
305
+ },
306
+ {
307
+ "epoch": 0.2531836334865496,
308
+ "grad_norm": 0.10405582985373843,
309
+ "learning_rate": 4.2168674698795186e-05,
310
+ "loss": 1.3645,
311
+ "step": 420
312
+ },
313
+ {
314
+ "epoch": 0.2592118152362294,
315
+ "grad_norm": 0.3318479326670041,
316
+ "learning_rate": 4.317269076305221e-05,
317
+ "loss": 1.3591,
318
+ "step": 430
319
+ },
320
+ {
321
+ "epoch": 0.2652399969859091,
322
+ "grad_norm": 0.10840544026201794,
323
+ "learning_rate": 4.417670682730924e-05,
324
+ "loss": 1.3805,
325
+ "step": 440
326
+ },
327
+ {
328
+ "epoch": 0.2712681787355889,
329
+ "grad_norm": 0.10730056620740543,
330
+ "learning_rate": 4.5180722891566266e-05,
331
+ "loss": 1.3888,
332
+ "step": 450
333
+ },
334
+ {
335
+ "epoch": 0.2772963604852686,
336
+ "grad_norm": 0.10699620793474768,
337
+ "learning_rate": 4.61847389558233e-05,
338
+ "loss": 1.3935,
339
+ "step": 460
340
+ },
341
+ {
342
+ "epoch": 0.2833245422349484,
343
+ "grad_norm": 0.10595493402596641,
344
+ "learning_rate": 4.718875502008032e-05,
345
+ "loss": 1.3659,
346
+ "step": 470
347
+ },
348
+ {
349
+ "epoch": 0.28935272398462814,
350
+ "grad_norm": 0.14234040947748414,
351
+ "learning_rate": 4.8192771084337354e-05,
352
+ "loss": 1.371,
353
+ "step": 480
354
+ },
355
+ {
356
+ "epoch": 0.29538090573430786,
357
+ "grad_norm": 0.1095349792774781,
358
+ "learning_rate": 4.919678714859438e-05,
359
+ "loss": 1.3647,
360
+ "step": 490
361
+ },
362
+ {
363
+ "epoch": 0.30140908748398765,
364
+ "grad_norm": 0.10655792946130023,
365
+ "learning_rate": 4.999997536857586e-05,
366
+ "loss": 1.3606,
367
+ "step": 500
368
+ },
369
+ {
370
+ "epoch": 0.3074372692336674,
371
+ "grad_norm": 0.14187369639959496,
372
+ "learning_rate": 4.999911327382711e-05,
373
+ "loss": 1.3952,
374
+ "step": 510
375
+ },
376
+ {
377
+ "epoch": 0.31346545098334716,
378
+ "grad_norm": 0.11221249471828258,
379
+ "learning_rate": 4.999701965640725e-05,
380
+ "loss": 1.3696,
381
+ "step": 520
382
+ },
383
+ {
384
+ "epoch": 0.3194936327330269,
385
+ "grad_norm": 0.11623924334950517,
386
+ "learning_rate": 4.9993694619453435e-05,
387
+ "loss": 1.3806,
388
+ "step": 530
389
+ },
390
+ {
391
+ "epoch": 0.3255218144827067,
392
+ "grad_norm": 0.09756519177369154,
393
+ "learning_rate": 4.998913832676579e-05,
394
+ "loss": 1.3307,
395
+ "step": 540
396
+ },
397
+ {
398
+ "epoch": 0.3315499962323864,
399
+ "grad_norm": 0.10068308440088464,
400
+ "learning_rate": 4.9983351002799416e-05,
401
+ "loss": 1.3808,
402
+ "step": 550
403
+ },
404
+ {
405
+ "epoch": 0.3375781779820662,
406
+ "grad_norm": 0.10281210912536574,
407
+ "learning_rate": 4.9976332932653225e-05,
408
+ "loss": 1.3491,
409
+ "step": 560
410
+ },
411
+ {
412
+ "epoch": 0.3436063597317459,
413
+ "grad_norm": 0.11134959395711537,
414
+ "learning_rate": 4.996808446205599e-05,
415
+ "loss": 1.3621,
416
+ "step": 570
417
+ },
418
+ {
419
+ "epoch": 0.34963454148142564,
420
+ "grad_norm": 0.10551082322799996,
421
+ "learning_rate": 4.9958605997349264e-05,
422
+ "loss": 1.3412,
423
+ "step": 580
424
+ },
425
+ {
426
+ "epoch": 0.3556627232311054,
427
+ "grad_norm": 0.10677290661324353,
428
+ "learning_rate": 4.994789800546737e-05,
429
+ "loss": 1.3623,
430
+ "step": 590
431
+ },
432
+ {
433
+ "epoch": 0.36169090498078516,
434
+ "grad_norm": 0.10716617749224472,
435
+ "learning_rate": 4.993596101391443e-05,
436
+ "loss": 1.3606,
437
+ "step": 600
438
+ },
439
+ {
440
+ "epoch": 0.36771908673046494,
441
+ "grad_norm": 0.11677420750343206,
442
+ "learning_rate": 4.99227956107383e-05,
443
+ "loss": 1.3485,
444
+ "step": 610
445
+ },
446
+ {
447
+ "epoch": 0.37374726848014467,
448
+ "grad_norm": 0.11130663386773537,
449
+ "learning_rate": 4.990840244450171e-05,
450
+ "loss": 1.3496,
451
+ "step": 620
452
+ },
453
+ {
454
+ "epoch": 0.37977545022982445,
455
+ "grad_norm": 0.1146856303733156,
456
+ "learning_rate": 4.989278222425021e-05,
457
+ "loss": 1.3026,
458
+ "step": 630
459
+ },
460
+ {
461
+ "epoch": 0.3858036319795042,
462
+ "grad_norm": 0.10717267360067521,
463
+ "learning_rate": 4.987593571947733e-05,
464
+ "loss": 1.3544,
465
+ "step": 640
466
+ },
467
+ {
468
+ "epoch": 0.3918318137291839,
469
+ "grad_norm": 0.12176386523595194,
470
+ "learning_rate": 4.985786376008659e-05,
471
+ "loss": 1.3271,
472
+ "step": 650
473
+ },
474
+ {
475
+ "epoch": 0.3978599954788637,
476
+ "grad_norm": 0.11520452966234733,
477
+ "learning_rate": 4.983856723635067e-05,
478
+ "loss": 1.3663,
479
+ "step": 660
480
+ },
481
+ {
482
+ "epoch": 0.4038881772285434,
483
+ "grad_norm": 0.1342901348076113,
484
+ "learning_rate": 4.981804709886756e-05,
485
+ "loss": 1.335,
486
+ "step": 670
487
+ },
488
+ {
489
+ "epoch": 0.4099163589782232,
490
+ "grad_norm": 0.12009183498218759,
491
+ "learning_rate": 4.9796304358513695e-05,
492
+ "loss": 1.3344,
493
+ "step": 680
494
+ },
495
+ {
496
+ "epoch": 0.41594454072790293,
497
+ "grad_norm": 0.11290080480825251,
498
+ "learning_rate": 4.977334008639417e-05,
499
+ "loss": 1.3302,
500
+ "step": 690
501
+ },
502
+ {
503
+ "epoch": 0.4219727224775827,
504
+ "grad_norm": 0.12117529129793933,
505
+ "learning_rate": 4.974915541378997e-05,
506
+ "loss": 1.3583,
507
+ "step": 700
508
+ },
509
+ {
510
+ "epoch": 0.42800090422726245,
511
+ "grad_norm": 0.12106414674081765,
512
+ "learning_rate": 4.972375153210228e-05,
513
+ "loss": 1.3205,
514
+ "step": 710
515
+ },
516
+ {
517
+ "epoch": 0.43402908597694223,
518
+ "grad_norm": 0.16181404734070373,
519
+ "learning_rate": 4.969712969279372e-05,
520
+ "loss": 1.3114,
521
+ "step": 720
522
+ },
523
+ {
524
+ "epoch": 0.44005726772662196,
525
+ "grad_norm": 0.13118653046898843,
526
+ "learning_rate": 4.966929120732675e-05,
527
+ "loss": 1.3346,
528
+ "step": 730
529
+ },
530
+ {
531
+ "epoch": 0.4460854494763017,
532
+ "grad_norm": 0.12384193345851267,
533
+ "learning_rate": 4.964023744709906e-05,
534
+ "loss": 1.3178,
535
+ "step": 740
536
+ },
537
+ {
538
+ "epoch": 0.45211363122598147,
539
+ "grad_norm": 0.13158056407059576,
540
+ "learning_rate": 4.960996984337599e-05,
541
+ "loss": 1.3072,
542
+ "step": 750
543
+ },
544
+ {
545
+ "epoch": 0.4581418129756612,
546
+ "grad_norm": 0.1271187477839215,
547
+ "learning_rate": 4.957848988722003e-05,
548
+ "loss": 1.3184,
549
+ "step": 760
550
+ },
551
+ {
552
+ "epoch": 0.464169994725341,
553
+ "grad_norm": 0.1271182236921431,
554
+ "learning_rate": 4.954579912941738e-05,
555
+ "loss": 1.3052,
556
+ "step": 770
557
+ },
558
+ {
559
+ "epoch": 0.4701981764750207,
560
+ "grad_norm": 0.13793244616584555,
561
+ "learning_rate": 4.951189918040153e-05,
562
+ "loss": 1.3156,
563
+ "step": 780
564
+ },
565
+ {
566
+ "epoch": 0.4762263582247005,
567
+ "grad_norm": 0.143375429890016,
568
+ "learning_rate": 4.9476791710173954e-05,
569
+ "loss": 1.3057,
570
+ "step": 790
571
+ },
572
+ {
573
+ "epoch": 0.4822545399743802,
574
+ "grad_norm": 0.13873715683631677,
575
+ "learning_rate": 4.94404784482218e-05,
576
+ "loss": 1.3239,
577
+ "step": 800
578
+ },
579
+ {
580
+ "epoch": 0.4822545399743802,
581
+ "eval_loss": 1.2957444190979004,
582
+ "eval_runtime": 149.3128,
583
+ "eval_samples_per_second": 7.186,
584
+ "eval_steps_per_second": 0.904,
585
+ "step": 800
586
+ },
587
+ {
588
+ "epoch": 0.48828272172405995,
589
+ "grad_norm": 0.12229796207948938,
590
+ "learning_rate": 4.940296118343274e-05,
591
+ "loss": 1.3356,
592
+ "step": 810
593
+ },
594
+ {
595
+ "epoch": 0.49431090347373974,
596
+ "grad_norm": 0.13903783244410667,
597
+ "learning_rate": 4.936424176400681e-05,
598
+ "loss": 1.3142,
599
+ "step": 820
600
+ },
601
+ {
602
+ "epoch": 0.5003390852234195,
603
+ "grad_norm": 0.15694334320231693,
604
+ "learning_rate": 4.9324322097365385e-05,
605
+ "loss": 1.3203,
606
+ "step": 830
607
+ },
608
+ {
609
+ "epoch": 0.5063672669730992,
610
+ "grad_norm": 0.1473003918483972,
611
+ "learning_rate": 4.9283204150057186e-05,
612
+ "loss": 1.3443,
613
+ "step": 840
614
+ },
615
+ {
616
+ "epoch": 0.512395448722779,
617
+ "grad_norm": 0.13719045426198556,
618
+ "learning_rate": 4.924088994766144e-05,
619
+ "loss": 1.3207,
620
+ "step": 850
621
+ },
622
+ {
623
+ "epoch": 0.5184236304724588,
624
+ "grad_norm": 0.1446409431503074,
625
+ "learning_rate": 4.919738157468806e-05,
626
+ "loss": 1.3367,
627
+ "step": 860
628
+ },
629
+ {
630
+ "epoch": 0.5244518122221385,
631
+ "grad_norm": 0.144976185376708,
632
+ "learning_rate": 4.915268117447498e-05,
633
+ "loss": 1.2926,
634
+ "step": 870
635
+ },
636
+ {
637
+ "epoch": 0.5304799939718182,
638
+ "grad_norm": 0.1432747729307118,
639
+ "learning_rate": 4.910679094908256e-05,
640
+ "loss": 1.2687,
641
+ "step": 880
642
+ },
643
+ {
644
+ "epoch": 0.536508175721498,
645
+ "grad_norm": 0.14816151870596467,
646
+ "learning_rate": 4.9059713159185087e-05,
647
+ "loss": 1.3066,
648
+ "step": 890
649
+ },
650
+ {
651
+ "epoch": 0.5425363574711778,
652
+ "grad_norm": 0.15312077289707232,
653
+ "learning_rate": 4.901145012395945e-05,
654
+ "loss": 1.2715,
655
+ "step": 900
656
+ },
657
+ {
658
+ "epoch": 0.5485645392208575,
659
+ "grad_norm": 0.14921082023451226,
660
+ "learning_rate": 4.896200422097087e-05,
661
+ "loss": 1.2854,
662
+ "step": 910
663
+ },
664
+ {
665
+ "epoch": 0.5545927209705372,
666
+ "grad_norm": 0.18249086322702504,
667
+ "learning_rate": 4.891137788605575e-05,
668
+ "loss": 1.2938,
669
+ "step": 920
670
+ },
671
+ {
672
+ "epoch": 0.560620902720217,
673
+ "grad_norm": 0.17799127506373516,
674
+ "learning_rate": 4.8859573613201725e-05,
675
+ "loss": 1.2771,
676
+ "step": 930
677
+ },
678
+ {
679
+ "epoch": 0.5666490844698968,
680
+ "grad_norm": 0.1567560038538035,
681
+ "learning_rate": 4.880659395442478e-05,
682
+ "loss": 1.2775,
683
+ "step": 940
684
+ },
685
+ {
686
+ "epoch": 0.5726772662195765,
687
+ "grad_norm": 0.2702719829446041,
688
+ "learning_rate": 4.87524415196435e-05,
689
+ "loss": 1.2998,
690
+ "step": 950
691
+ },
692
+ {
693
+ "epoch": 0.5787054479692563,
694
+ "grad_norm": 0.15756638200428358,
695
+ "learning_rate": 4.8697118976550574e-05,
696
+ "loss": 1.3046,
697
+ "step": 960
698
+ },
699
+ {
700
+ "epoch": 0.584733629718936,
701
+ "grad_norm": 0.16571471050973857,
702
+ "learning_rate": 4.86406290504813e-05,
703
+ "loss": 1.2965,
704
+ "step": 970
705
+ },
706
+ {
707
+ "epoch": 0.5907618114686157,
708
+ "grad_norm": 0.1623678481384679,
709
+ "learning_rate": 4.8582974524279365e-05,
710
+ "loss": 1.2865,
711
+ "step": 980
712
+ },
713
+ {
714
+ "epoch": 0.5967899932182955,
715
+ "grad_norm": 0.17039779398050892,
716
+ "learning_rate": 4.8524158238159756e-05,
717
+ "loss": 1.3065,
718
+ "step": 990
719
+ },
720
+ {
721
+ "epoch": 0.6028181749679753,
722
+ "grad_norm": 0.1645102791020125,
723
+ "learning_rate": 4.8464183089568824e-05,
724
+ "loss": 1.28,
725
+ "step": 1000
726
+ }
727
+ ],
728
+ "logging_steps": 10,
729
+ "max_steps": 4974,
730
+ "num_input_tokens_seen": 0,
731
+ "num_train_epochs": 3,
732
+ "save_steps": 500,
733
+ "stateful_callbacks": {
734
+ "TrainerControl": {
735
+ "args": {
736
+ "should_epoch_stop": false,
737
+ "should_evaluate": false,
738
+ "should_log": false,
739
+ "should_save": true,
740
+ "should_training_stop": false
741
+ },
742
+ "attributes": {}
743
+ }
744
+ },
745
+ "total_flos": 1681269511421952.0,
746
+ "train_batch_size": 1,
747
+ "trial_name": null,
748
+ "trial_params": null
749
+ }
checkpoint-1000/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2923841ae243af669d09fc75f56460b83329158b7b6379ad1b1afd5c369cdb7a
3
+ size 7224
checkpoint-1000/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-1000/zero_to_fp32.py ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example:
14
+ # python zero_to_fp32.py . output_dir/
15
+ # or
16
+ # python zero_to_fp32.py . output_dir/ --safe_serialization
17
+
18
+ import argparse
19
+ import torch
20
+ import glob
21
+ import math
22
+ import os
23
+ import re
24
+ import json
25
+ from tqdm import tqdm
26
+ from collections import OrderedDict
27
+ from dataclasses import dataclass
28
+
29
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
30
+ # DeepSpeed data structures it has to be available in the current python environment.
31
+ from deepspeed.utils import logger
32
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
33
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
34
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
35
+
36
+
37
+ @dataclass
38
+ class zero_model_state:
39
+ buffers: dict()
40
+ param_shapes: dict()
41
+ shared_params: list
42
+ ds_version: int
43
+ frozen_param_shapes: dict()
44
+ frozen_param_fragments: dict()
45
+
46
+
47
+ debug = 0
48
+
49
+ # load to cpu
50
+ device = torch.device('cpu')
51
+
52
+
53
+ def atoi(text):
54
+ return int(text) if text.isdigit() else text
55
+
56
+
57
+ def natural_keys(text):
58
+ '''
59
+ alist.sort(key=natural_keys) sorts in human order
60
+ http://nedbatchelder.com/blog/200712/human_sorting.html
61
+ (See Toothy's implementation in the comments)
62
+ '''
63
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
64
+
65
+
66
+ def get_model_state_file(checkpoint_dir, zero_stage):
67
+ if not os.path.isdir(checkpoint_dir):
68
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
69
+
70
+ # there should be only one file
71
+ if zero_stage <= 2:
72
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
73
+ elif zero_stage == 3:
74
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
75
+
76
+ if not os.path.exists(file):
77
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
78
+
79
+ return file
80
+
81
+
82
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
83
+ # XXX: need to test that this simple glob rule works for multi-node setup too
84
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
85
+
86
+ if len(ckpt_files) == 0:
87
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
88
+
89
+ return ckpt_files
90
+
91
+
92
+ def get_optim_files(checkpoint_dir):
93
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
94
+
95
+
96
+ def get_model_state_files(checkpoint_dir):
97
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
98
+
99
+
100
+ def parse_model_states(files):
101
+ zero_model_states = []
102
+ for file in files:
103
+ state_dict = torch.load(file, map_location=device)
104
+
105
+ if BUFFER_NAMES not in state_dict:
106
+ raise ValueError(f"{file} is not a model state checkpoint")
107
+ buffer_names = state_dict[BUFFER_NAMES]
108
+ if debug:
109
+ print("Found buffers:", buffer_names)
110
+
111
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
112
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
113
+ param_shapes = state_dict[PARAM_SHAPES]
114
+
115
+ # collect parameters that are included in param_shapes
116
+ param_names = []
117
+ for s in param_shapes:
118
+ for name in s.keys():
119
+ param_names.append(name)
120
+
121
+ # update with frozen parameters
122
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
123
+ if frozen_param_shapes is not None:
124
+ if debug:
125
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
126
+ param_names += list(frozen_param_shapes.keys())
127
+
128
+ # handle shared params
129
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
130
+
131
+ ds_version = state_dict.get(DS_VERSION, None)
132
+
133
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
134
+
135
+ z_model_state = zero_model_state(buffers=buffers,
136
+ param_shapes=param_shapes,
137
+ shared_params=shared_params,
138
+ ds_version=ds_version,
139
+ frozen_param_shapes=frozen_param_shapes,
140
+ frozen_param_fragments=frozen_param_fragments)
141
+ zero_model_states.append(z_model_state)
142
+
143
+ return zero_model_states
144
+
145
+
146
+ def parse_optim_states(files, ds_checkpoint_dir):
147
+ total_files = len(files)
148
+ state_dicts = []
149
+ for f in files:
150
+ state_dict = torch.load(f, map_location=device)
151
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
152
+ # and also handle the case where it was already removed by another helper script
153
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
154
+ state_dicts.append(state_dict)
155
+
156
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
157
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
158
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
159
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
160
+
161
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
162
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
163
+ # use the max of the partition_count to get the dp world_size.
164
+
165
+ if type(world_size) is list:
166
+ world_size = max(world_size)
167
+
168
+ if world_size != total_files:
169
+ raise ValueError(
170
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
171
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
172
+ )
173
+
174
+ # the groups are named differently in each stage
175
+ if zero_stage <= 2:
176
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
177
+ elif zero_stage == 3:
178
+ fp32_groups_key = FP32_FLAT_GROUPS
179
+ else:
180
+ raise ValueError(f"unknown zero stage {zero_stage}")
181
+
182
+ if zero_stage <= 2:
183
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
184
+ elif zero_stage == 3:
185
+ # if there is more than one param group, there will be multiple flattened tensors - one
186
+ # flattened tensor per group - for simplicity merge them into a single tensor
187
+ #
188
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
189
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
190
+
191
+ fp32_flat_groups = [
192
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
193
+ ]
194
+
195
+ return zero_stage, world_size, fp32_flat_groups
196
+
197
+
198
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
199
+ """
200
+ Returns fp32 state_dict reconstructed from ds checkpoint
201
+
202
+ Args:
203
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
204
+
205
+ """
206
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
207
+
208
+ optim_files = get_optim_files(ds_checkpoint_dir)
209
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
210
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
211
+
212
+ model_files = get_model_state_files(ds_checkpoint_dir)
213
+
214
+ zero_model_states = parse_model_states(model_files)
215
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
216
+
217
+ if zero_stage <= 2:
218
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
219
+ exclude_frozen_parameters)
220
+ elif zero_stage == 3:
221
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
222
+ exclude_frozen_parameters)
223
+
224
+
225
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
226
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
227
+ return
228
+
229
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
230
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
231
+
232
+ if debug:
233
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
234
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
235
+
236
+ wanted_params = len(frozen_param_shapes)
237
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
238
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
239
+ print(f'Frozen params: Have {avail_numel} numels to process.')
240
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
241
+
242
+ total_params = 0
243
+ total_numel = 0
244
+ for name, shape in frozen_param_shapes.items():
245
+ total_params += 1
246
+ unpartitioned_numel = shape.numel()
247
+ total_numel += unpartitioned_numel
248
+
249
+ state_dict[name] = frozen_param_fragments[name]
250
+
251
+ if debug:
252
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
253
+
254
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
255
+
256
+
257
+ def _has_callable(obj, fn):
258
+ attr = getattr(obj, fn, None)
259
+ return callable(attr)
260
+
261
+
262
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
263
+ param_shapes = zero_model_states[0].param_shapes
264
+
265
+ # Reconstruction protocol:
266
+ #
267
+ # XXX: document this
268
+
269
+ if debug:
270
+ for i in range(world_size):
271
+ for j in range(len(fp32_flat_groups[0])):
272
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
273
+
274
+ # XXX: memory usage doubles here (zero2)
275
+ num_param_groups = len(fp32_flat_groups[0])
276
+ merged_single_partition_of_fp32_groups = []
277
+ for i in range(num_param_groups):
278
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
279
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
280
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
281
+ avail_numel = sum(
282
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
283
+
284
+ if debug:
285
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
286
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
287
+ # not asserting if there is a mismatch due to possible padding
288
+ print(f"Have {avail_numel} numels to process.")
289
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
290
+
291
+ # params
292
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
293
+ # out-of-core computing solution
294
+ total_numel = 0
295
+ total_params = 0
296
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
297
+ offset = 0
298
+ avail_numel = full_single_fp32_vector.numel()
299
+ for name, shape in shapes.items():
300
+
301
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
302
+ total_numel += unpartitioned_numel
303
+ total_params += 1
304
+
305
+ if debug:
306
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
307
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
308
+ offset += unpartitioned_numel
309
+
310
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
311
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
312
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
313
+ # live optimizer object, so we are checking that the numbers are within the right range
314
+ align_to = 2 * world_size
315
+
316
+ def zero2_align(x):
317
+ return align_to * math.ceil(x / align_to)
318
+
319
+ if debug:
320
+ print(f"original offset={offset}, avail_numel={avail_numel}")
321
+
322
+ offset = zero2_align(offset)
323
+ avail_numel = zero2_align(avail_numel)
324
+
325
+ if debug:
326
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
327
+
328
+ # Sanity check
329
+ if offset != avail_numel:
330
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
331
+
332
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
333
+
334
+
335
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
336
+ exclude_frozen_parameters):
337
+ state_dict = OrderedDict()
338
+
339
+ # buffers
340
+ buffers = zero_model_states[0].buffers
341
+ state_dict.update(buffers)
342
+ if debug:
343
+ print(f"added {len(buffers)} buffers")
344
+
345
+ if not exclude_frozen_parameters:
346
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
347
+
348
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
349
+
350
+ # recover shared parameters
351
+ for pair in zero_model_states[0].shared_params:
352
+ if pair[1] in state_dict:
353
+ state_dict[pair[0]] = state_dict[pair[1]]
354
+
355
+ return state_dict
356
+
357
+
358
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
359
+ remainder = unpartitioned_numel % world_size
360
+ padding_numel = (world_size - remainder) if remainder else 0
361
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
362
+ return partitioned_numel, padding_numel
363
+
364
+
365
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
366
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
367
+ return
368
+
369
+ if debug:
370
+ for i in range(world_size):
371
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
372
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
373
+
374
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
375
+ wanted_params = len(frozen_param_shapes)
376
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
377
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
378
+ print(f'Frozen params: Have {avail_numel} numels to process.')
379
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
380
+
381
+ total_params = 0
382
+ total_numel = 0
383
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
384
+ total_params += 1
385
+ unpartitioned_numel = shape.numel()
386
+ total_numel += unpartitioned_numel
387
+
388
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
389
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
390
+
391
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
392
+
393
+ if debug:
394
+ print(
395
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
396
+ )
397
+
398
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
399
+
400
+
401
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
402
+ param_shapes = zero_model_states[0].param_shapes
403
+ avail_numel = fp32_flat_groups[0].numel() * world_size
404
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
405
+ # param, re-consolidating each param, while dealing with padding if any
406
+
407
+ # merge list of dicts, preserving order
408
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
409
+
410
+ if debug:
411
+ for i in range(world_size):
412
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
413
+
414
+ wanted_params = len(param_shapes)
415
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
416
+ # not asserting if there is a mismatch due to possible padding
417
+ avail_numel = fp32_flat_groups[0].numel() * world_size
418
+ print(f"Trainable params: Have {avail_numel} numels to process.")
419
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
420
+
421
+ # params
422
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
423
+ # out-of-core computing solution
424
+ offset = 0
425
+ total_numel = 0
426
+ total_params = 0
427
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering Sharded Weights'):
428
+ unpartitioned_numel = shape.numel()
429
+ total_numel += unpartitioned_numel
430
+ total_params += 1
431
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
432
+
433
+ if debug:
434
+ print(
435
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
436
+ )
437
+
438
+ # XXX: memory usage doubles here
439
+ state_dict[name] = torch.cat(
440
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
441
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
442
+ offset += partitioned_numel
443
+
444
+ offset *= world_size
445
+
446
+ # Sanity check
447
+ if offset != avail_numel:
448
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
449
+
450
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
451
+
452
+
453
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
454
+ exclude_frozen_parameters):
455
+ state_dict = OrderedDict()
456
+
457
+ # buffers
458
+ buffers = zero_model_states[0].buffers
459
+ state_dict.update(buffers)
460
+ if debug:
461
+ print(f"added {len(buffers)} buffers")
462
+
463
+ if not exclude_frozen_parameters:
464
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
465
+
466
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
467
+
468
+ # recover shared parameters
469
+ for pair in zero_model_states[0].shared_params:
470
+ if pair[1] in state_dict:
471
+ state_dict[pair[0]] = state_dict[pair[1]]
472
+
473
+ return state_dict
474
+
475
+
476
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None, exclude_frozen_parameters=False):
477
+ """
478
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
479
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
480
+ via a model hub.
481
+
482
+ Args:
483
+ - ``checkpoint_dir``: path to the desired checkpoint folder
484
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
485
+ - ``exclude_frozen_parameters``: exclude frozen parameters
486
+
487
+ Returns:
488
+ - pytorch ``state_dict``
489
+
490
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
491
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
492
+ the checkpoint.
493
+
494
+ A typical usage might be ::
495
+
496
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
497
+ # do the training and checkpoint saving
498
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
499
+ model = model.cpu() # move to cpu
500
+ model.load_state_dict(state_dict)
501
+ # submit to model hub or save the model to share with others
502
+
503
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
504
+ application. i.e. you will need to re-initialize the deepspeed engine, since
505
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
506
+
507
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
508
+
509
+ """
510
+ if tag is None:
511
+ latest_path = os.path.join(checkpoint_dir, 'latest')
512
+ if os.path.isfile(latest_path):
513
+ with open(latest_path, 'r') as fd:
514
+ tag = fd.read().strip()
515
+ else:
516
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
517
+
518
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
519
+
520
+ if not os.path.isdir(ds_checkpoint_dir):
521
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
522
+
523
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
524
+
525
+
526
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
527
+ output_dir,
528
+ max_shard_size="5GB",
529
+ safe_serialization=False,
530
+ tag=None,
531
+ exclude_frozen_parameters=False):
532
+ """
533
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
534
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
535
+
536
+ Args:
537
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
538
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
539
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
540
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
541
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
542
+ - ``exclude_frozen_parameters``: exclude frozen parameters
543
+ """
544
+ # Dependency pre-check
545
+ if safe_serialization:
546
+ try:
547
+ from safetensors.torch import save_file
548
+ except ImportError:
549
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
550
+ raise
551
+ if max_shard_size is not None:
552
+ try:
553
+ from huggingface_hub import split_torch_state_dict_into_shards
554
+ except ImportError:
555
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
556
+ raise
557
+
558
+ # Convert zero checkpoint to state_dict
559
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag, exclude_frozen_parameters)
560
+
561
+ # Shard the model if it is too big.
562
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
563
+ if max_shard_size is not None:
564
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
565
+ state_dict_split = split_torch_state_dict_into_shards(state_dict,
566
+ filename_pattern=filename_pattern,
567
+ max_shard_size=max_shard_size)
568
+ else:
569
+ from collections import namedtuple
570
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
571
+ state_dict_split = StateDictSplit(is_sharded=False,
572
+ filename_to_tensors={weights_name: list(state_dict.keys())})
573
+
574
+ # Save the model
575
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
576
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
577
+ shard = {tensor: state_dict[tensor].contiguous() for tensor in tensors}
578
+ output_path = os.path.join(output_dir, shard_file)
579
+ if safe_serialization:
580
+ save_file(shard, output_path, metadata={"format": "pt"})
581
+ else:
582
+ torch.save(shard, output_path)
583
+
584
+ # Save index if sharded
585
+ if state_dict_split.is_sharded:
586
+ index = {
587
+ "metadata": state_dict_split.metadata,
588
+ "weight_map": state_dict_split.tensor_to_filename,
589
+ }
590
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
591
+ save_index_file = os.path.join(output_dir, save_index_file)
592
+ with open(save_index_file, "w", encoding="utf-8") as f:
593
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
594
+ f.write(content)
595
+
596
+
597
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
598
+ """
599
+ 1. Put the provided model to cpu
600
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
601
+ 3. Load it into the provided model
602
+
603
+ Args:
604
+ - ``model``: the model object to update
605
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
606
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
607
+
608
+ Returns:
609
+ - ``model`: modified model
610
+
611
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
612
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
613
+ conveniently placed for you in the checkpoint folder.
614
+
615
+ A typical usage might be ::
616
+
617
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
618
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
619
+ # submit to model hub or save the model to share with others
620
+
621
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
622
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
623
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
624
+
625
+ """
626
+ logger.info(f"Extracting fp32 weights")
627
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
628
+
629
+ logger.info(f"Overwriting model with fp32 weights")
630
+ model = model.cpu()
631
+ model.load_state_dict(state_dict, strict=False)
632
+
633
+ return model
634
+
635
+
636
+ if __name__ == "__main__":
637
+ parser = argparse.ArgumentParser()
638
+ parser.add_argument("checkpoint_dir",
639
+ type=str,
640
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
641
+ parser.add_argument("output_dir",
642
+ type=str,
643
+ help="directory to the pytorch fp32 state_dict output files"
644
+ "(e.g. path/checkpoint-12-output/)")
645
+ parser.add_argument(
646
+ "--max_shard_size",
647
+ type=str,
648
+ default="5GB",
649
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
650
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
651
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
652
+ "without CPU OOM issues.")
653
+ parser.add_argument(
654
+ "--safe_serialization",
655
+ default=False,
656
+ action='store_true',
657
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
658
+ parser.add_argument("-t",
659
+ "--tag",
660
+ type=str,
661
+ default=None,
662
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
663
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
664
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
665
+ args = parser.parse_args()
666
+
667
+ debug = args.debug
668
+
669
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
670
+ args.output_dir,
671
+ max_shard_size=args.max_shard_size,
672
+ safe_serialization=args.safe_serialization,
673
+ tag=args.tag,
674
+ exclude_frozen_parameters=args.exclude_frozen_parameters)
checkpoint-1500/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen2.5-72B
3
+ library_name: peft
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.12.0
checkpoint-1500/adapter_config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "Qwen/Qwen2.5-72B",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": true,
9
+ "layer_replication": null,
10
+ "layers_pattern": null,
11
+ "layers_to_transform": null,
12
+ "loftq_config": {},
13
+ "lora_alpha": 32,
14
+ "lora_dropout": 0.0,
15
+ "megatron_config": null,
16
+ "megatron_core": "megatron.core",
17
+ "modules_to_save": null,
18
+ "peft_type": "LORA",
19
+ "r": 128,
20
+ "rank_pattern": {},
21
+ "revision": null,
22
+ "target_modules": [
23
+ "gate_proj",
24
+ "v_proj",
25
+ "k_proj",
26
+ "down_proj",
27
+ "o_proj",
28
+ "q_proj",
29
+ "up_proj"
30
+ ],
31
+ "task_type": "CAUSAL_LM",
32
+ "use_dora": false,
33
+ "use_rslora": true
34
+ }
checkpoint-1500/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:64c634ca19ad69941d46c8634e8ac11531af827d3636611c3aea48a1bb92c394
3
+ size 3368705968
checkpoint-1500/added_tokens.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</tool_call>": 151658,
3
+ "<tool_call>": 151657,
4
+ "<|box_end|>": 151649,
5
+ "<|box_start|>": 151648,
6
+ "<|endoftext|>": 151643,
7
+ "<|file_sep|>": 151664,
8
+ "<|fim_middle|>": 151660,
9
+ "<|fim_pad|>": 151662,
10
+ "<|fim_prefix|>": 151659,
11
+ "<|fim_suffix|>": 151661,
12
+ "<|im_end|>": 151645,
13
+ "<|im_start|>": 151644,
14
+ "<|image_pad|>": 151655,
15
+ "<|object_ref_end|>": 151647,
16
+ "<|object_ref_start|>": 151646,
17
+ "<|quad_end|>": 151651,
18
+ "<|quad_start|>": 151650,
19
+ "<|repo_name|>": 151663,
20
+ "<|video_pad|>": 151656,
21
+ "<|vision_end|>": 151653,
22
+ "<|vision_pad|>": 151654,
23
+ "<|vision_start|>": 151652
24
+ }
checkpoint-1500/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step1500
checkpoint-1500/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-1500/special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|endoftext|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
checkpoint-1500/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
3
+ size 11421896
checkpoint-1500/tokenizer_config.json ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ }
181
+ },
182
+ "additional_special_tokens": [
183
+ "<|im_start|>",
184
+ "<|im_end|>",
185
+ "<|object_ref_start|>",
186
+ "<|object_ref_end|>",
187
+ "<|box_start|>",
188
+ "<|box_end|>",
189
+ "<|quad_start|>",
190
+ "<|quad_end|>",
191
+ "<|vision_start|>",
192
+ "<|vision_end|>",
193
+ "<|vision_pad|>",
194
+ "<|image_pad|>",
195
+ "<|video_pad|>"
196
+ ],
197
+ "bos_token": null,
198
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
199
+ "clean_up_tokenization_spaces": false,
200
+ "eos_token": "<|endoftext|>",
201
+ "errors": "replace",
202
+ "model_max_length": 131072,
203
+ "pad_token": "<|endoftext|>",
204
+ "padding_side": "right",
205
+ "split_special_tokens": false,
206
+ "tokenizer_class": "Qwen2Tokenizer",
207
+ "unk_token": null
208
+ }
checkpoint-1500/trainer_state.json ADDED
@@ -0,0 +1,1107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.9042272624519629,
5
+ "eval_steps": 400,
6
+ "global_step": 1500,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.006028181749679753,
13
+ "grad_norm": 0.38845974438826136,
14
+ "learning_rate": 1.0040160642570282e-06,
15
+ "loss": 1.6618,
16
+ "step": 10
17
+ },
18
+ {
19
+ "epoch": 0.012056363499359506,
20
+ "grad_norm": 0.255603405930248,
21
+ "learning_rate": 2.0080321285140564e-06,
22
+ "loss": 1.6698,
23
+ "step": 20
24
+ },
25
+ {
26
+ "epoch": 0.01808454524903926,
27
+ "grad_norm": 0.20116505722657768,
28
+ "learning_rate": 3.0120481927710846e-06,
29
+ "loss": 1.6264,
30
+ "step": 30
31
+ },
32
+ {
33
+ "epoch": 0.02411272699871901,
34
+ "grad_norm": 0.1795881732266397,
35
+ "learning_rate": 4.016064257028113e-06,
36
+ "loss": 1.6025,
37
+ "step": 40
38
+ },
39
+ {
40
+ "epoch": 0.030140908748398764,
41
+ "grad_norm": 0.14600421495766222,
42
+ "learning_rate": 5.020080321285141e-06,
43
+ "loss": 1.5584,
44
+ "step": 50
45
+ },
46
+ {
47
+ "epoch": 0.03616909049807852,
48
+ "grad_norm": 0.1170942466306718,
49
+ "learning_rate": 6.024096385542169e-06,
50
+ "loss": 1.5604,
51
+ "step": 60
52
+ },
53
+ {
54
+ "epoch": 0.04219727224775827,
55
+ "grad_norm": 0.2445974669666656,
56
+ "learning_rate": 7.028112449799197e-06,
57
+ "loss": 1.5057,
58
+ "step": 70
59
+ },
60
+ {
61
+ "epoch": 0.04822545399743802,
62
+ "grad_norm": 0.11238025351136724,
63
+ "learning_rate": 8.032128514056226e-06,
64
+ "loss": 1.4724,
65
+ "step": 80
66
+ },
67
+ {
68
+ "epoch": 0.05425363574711778,
69
+ "grad_norm": 0.13639577534070754,
70
+ "learning_rate": 9.036144578313253e-06,
71
+ "loss": 1.4962,
72
+ "step": 90
73
+ },
74
+ {
75
+ "epoch": 0.06028181749679753,
76
+ "grad_norm": 0.17113178431310286,
77
+ "learning_rate": 1.0040160642570281e-05,
78
+ "loss": 1.4765,
79
+ "step": 100
80
+ },
81
+ {
82
+ "epoch": 0.06630999924647728,
83
+ "grad_norm": 0.4795401637258333,
84
+ "learning_rate": 1.104417670682731e-05,
85
+ "loss": 1.4468,
86
+ "step": 110
87
+ },
88
+ {
89
+ "epoch": 0.07233818099615703,
90
+ "grad_norm": 0.13385762516900662,
91
+ "learning_rate": 1.2048192771084338e-05,
92
+ "loss": 1.4134,
93
+ "step": 120
94
+ },
95
+ {
96
+ "epoch": 0.07836636274583679,
97
+ "grad_norm": 0.12303707813666019,
98
+ "learning_rate": 1.3052208835341367e-05,
99
+ "loss": 1.4191,
100
+ "step": 130
101
+ },
102
+ {
103
+ "epoch": 0.08439454449551655,
104
+ "grad_norm": 0.10822073133399364,
105
+ "learning_rate": 1.4056224899598394e-05,
106
+ "loss": 1.397,
107
+ "step": 140
108
+ },
109
+ {
110
+ "epoch": 0.09042272624519629,
111
+ "grad_norm": 0.1109270134990499,
112
+ "learning_rate": 1.5060240963855424e-05,
113
+ "loss": 1.3818,
114
+ "step": 150
115
+ },
116
+ {
117
+ "epoch": 0.09645090799487605,
118
+ "grad_norm": 0.14622173134033867,
119
+ "learning_rate": 1.606425702811245e-05,
120
+ "loss": 1.4002,
121
+ "step": 160
122
+ },
123
+ {
124
+ "epoch": 0.1024790897445558,
125
+ "grad_norm": 0.10587626114414271,
126
+ "learning_rate": 1.706827309236948e-05,
127
+ "loss": 1.4123,
128
+ "step": 170
129
+ },
130
+ {
131
+ "epoch": 0.10850727149423556,
132
+ "grad_norm": 0.10302196814593138,
133
+ "learning_rate": 1.8072289156626505e-05,
134
+ "loss": 1.4016,
135
+ "step": 180
136
+ },
137
+ {
138
+ "epoch": 0.1145354532439153,
139
+ "grad_norm": 0.1359849724314843,
140
+ "learning_rate": 1.9076305220883535e-05,
141
+ "loss": 1.404,
142
+ "step": 190
143
+ },
144
+ {
145
+ "epoch": 0.12056363499359506,
146
+ "grad_norm": 0.10587622358885339,
147
+ "learning_rate": 2.0080321285140562e-05,
148
+ "loss": 1.4019,
149
+ "step": 200
150
+ },
151
+ {
152
+ "epoch": 0.1265918167432748,
153
+ "grad_norm": 0.15017595066321648,
154
+ "learning_rate": 2.1084337349397593e-05,
155
+ "loss": 1.393,
156
+ "step": 210
157
+ },
158
+ {
159
+ "epoch": 0.13261999849295456,
160
+ "grad_norm": 0.19475575142022897,
161
+ "learning_rate": 2.208835341365462e-05,
162
+ "loss": 1.3876,
163
+ "step": 220
164
+ },
165
+ {
166
+ "epoch": 0.1386481802426343,
167
+ "grad_norm": 0.12084095277263424,
168
+ "learning_rate": 2.309236947791165e-05,
169
+ "loss": 1.3916,
170
+ "step": 230
171
+ },
172
+ {
173
+ "epoch": 0.14467636199231407,
174
+ "grad_norm": 0.11857482977859173,
175
+ "learning_rate": 2.4096385542168677e-05,
176
+ "loss": 1.4056,
177
+ "step": 240
178
+ },
179
+ {
180
+ "epoch": 0.15070454374199382,
181
+ "grad_norm": 0.1403959719635503,
182
+ "learning_rate": 2.5100401606425704e-05,
183
+ "loss": 1.3935,
184
+ "step": 250
185
+ },
186
+ {
187
+ "epoch": 0.15673272549167358,
188
+ "grad_norm": 0.10800155257965392,
189
+ "learning_rate": 2.6104417670682734e-05,
190
+ "loss": 1.3826,
191
+ "step": 260
192
+ },
193
+ {
194
+ "epoch": 0.16276090724135334,
195
+ "grad_norm": 0.10598439909830581,
196
+ "learning_rate": 2.7108433734939758e-05,
197
+ "loss": 1.3999,
198
+ "step": 270
199
+ },
200
+ {
201
+ "epoch": 0.1687890889910331,
202
+ "grad_norm": 0.10753449693494475,
203
+ "learning_rate": 2.8112449799196788e-05,
204
+ "loss": 1.4047,
205
+ "step": 280
206
+ },
207
+ {
208
+ "epoch": 0.17481727074071282,
209
+ "grad_norm": 0.36718328659037996,
210
+ "learning_rate": 2.911646586345382e-05,
211
+ "loss": 1.3935,
212
+ "step": 290
213
+ },
214
+ {
215
+ "epoch": 0.18084545249039258,
216
+ "grad_norm": 0.10611900000479042,
217
+ "learning_rate": 3.012048192771085e-05,
218
+ "loss": 1.3736,
219
+ "step": 300
220
+ },
221
+ {
222
+ "epoch": 0.18687363424007233,
223
+ "grad_norm": 0.11901555220652378,
224
+ "learning_rate": 3.112449799196787e-05,
225
+ "loss": 1.3927,
226
+ "step": 310
227
+ },
228
+ {
229
+ "epoch": 0.1929018159897521,
230
+ "grad_norm": 0.118935148513695,
231
+ "learning_rate": 3.21285140562249e-05,
232
+ "loss": 1.3636,
233
+ "step": 320
234
+ },
235
+ {
236
+ "epoch": 0.19892999773943185,
237
+ "grad_norm": 0.1974545721831922,
238
+ "learning_rate": 3.313253012048193e-05,
239
+ "loss": 1.3892,
240
+ "step": 330
241
+ },
242
+ {
243
+ "epoch": 0.2049581794891116,
244
+ "grad_norm": 0.13145409772199562,
245
+ "learning_rate": 3.413654618473896e-05,
246
+ "loss": 1.3756,
247
+ "step": 340
248
+ },
249
+ {
250
+ "epoch": 0.21098636123879136,
251
+ "grad_norm": 0.11064380941915805,
252
+ "learning_rate": 3.5140562248995983e-05,
253
+ "loss": 1.3935,
254
+ "step": 350
255
+ },
256
+ {
257
+ "epoch": 0.21701454298847112,
258
+ "grad_norm": 0.12160423827639648,
259
+ "learning_rate": 3.614457831325301e-05,
260
+ "loss": 1.3698,
261
+ "step": 360
262
+ },
263
+ {
264
+ "epoch": 0.22304272473815084,
265
+ "grad_norm": 0.10349641889173723,
266
+ "learning_rate": 3.7148594377510044e-05,
267
+ "loss": 1.3771,
268
+ "step": 370
269
+ },
270
+ {
271
+ "epoch": 0.2290709064878306,
272
+ "grad_norm": 0.10682144059511894,
273
+ "learning_rate": 3.815261044176707e-05,
274
+ "loss": 1.3768,
275
+ "step": 380
276
+ },
277
+ {
278
+ "epoch": 0.23509908823751036,
279
+ "grad_norm": 0.11625245619819907,
280
+ "learning_rate": 3.91566265060241e-05,
281
+ "loss": 1.3795,
282
+ "step": 390
283
+ },
284
+ {
285
+ "epoch": 0.2411272699871901,
286
+ "grad_norm": 0.10327726962763091,
287
+ "learning_rate": 4.0160642570281125e-05,
288
+ "loss": 1.3987,
289
+ "step": 400
290
+ },
291
+ {
292
+ "epoch": 0.2411272699871901,
293
+ "eval_loss": 1.3548544645309448,
294
+ "eval_runtime": 148.2269,
295
+ "eval_samples_per_second": 7.239,
296
+ "eval_steps_per_second": 0.911,
297
+ "step": 400
298
+ },
299
+ {
300
+ "epoch": 0.24715545173686987,
301
+ "grad_norm": 0.10660530950921367,
302
+ "learning_rate": 4.116465863453816e-05,
303
+ "loss": 1.3886,
304
+ "step": 410
305
+ },
306
+ {
307
+ "epoch": 0.2531836334865496,
308
+ "grad_norm": 0.10405582985373843,
309
+ "learning_rate": 4.2168674698795186e-05,
310
+ "loss": 1.3645,
311
+ "step": 420
312
+ },
313
+ {
314
+ "epoch": 0.2592118152362294,
315
+ "grad_norm": 0.3318479326670041,
316
+ "learning_rate": 4.317269076305221e-05,
317
+ "loss": 1.3591,
318
+ "step": 430
319
+ },
320
+ {
321
+ "epoch": 0.2652399969859091,
322
+ "grad_norm": 0.10840544026201794,
323
+ "learning_rate": 4.417670682730924e-05,
324
+ "loss": 1.3805,
325
+ "step": 440
326
+ },
327
+ {
328
+ "epoch": 0.2712681787355889,
329
+ "grad_norm": 0.10730056620740543,
330
+ "learning_rate": 4.5180722891566266e-05,
331
+ "loss": 1.3888,
332
+ "step": 450
333
+ },
334
+ {
335
+ "epoch": 0.2772963604852686,
336
+ "grad_norm": 0.10699620793474768,
337
+ "learning_rate": 4.61847389558233e-05,
338
+ "loss": 1.3935,
339
+ "step": 460
340
+ },
341
+ {
342
+ "epoch": 0.2833245422349484,
343
+ "grad_norm": 0.10595493402596641,
344
+ "learning_rate": 4.718875502008032e-05,
345
+ "loss": 1.3659,
346
+ "step": 470
347
+ },
348
+ {
349
+ "epoch": 0.28935272398462814,
350
+ "grad_norm": 0.14234040947748414,
351
+ "learning_rate": 4.8192771084337354e-05,
352
+ "loss": 1.371,
353
+ "step": 480
354
+ },
355
+ {
356
+ "epoch": 0.29538090573430786,
357
+ "grad_norm": 0.1095349792774781,
358
+ "learning_rate": 4.919678714859438e-05,
359
+ "loss": 1.3647,
360
+ "step": 490
361
+ },
362
+ {
363
+ "epoch": 0.30140908748398765,
364
+ "grad_norm": 0.10655792946130023,
365
+ "learning_rate": 4.999997536857586e-05,
366
+ "loss": 1.3606,
367
+ "step": 500
368
+ },
369
+ {
370
+ "epoch": 0.3074372692336674,
371
+ "grad_norm": 0.14187369639959496,
372
+ "learning_rate": 4.999911327382711e-05,
373
+ "loss": 1.3952,
374
+ "step": 510
375
+ },
376
+ {
377
+ "epoch": 0.31346545098334716,
378
+ "grad_norm": 0.11221249471828258,
379
+ "learning_rate": 4.999701965640725e-05,
380
+ "loss": 1.3696,
381
+ "step": 520
382
+ },
383
+ {
384
+ "epoch": 0.3194936327330269,
385
+ "grad_norm": 0.11623924334950517,
386
+ "learning_rate": 4.9993694619453435e-05,
387
+ "loss": 1.3806,
388
+ "step": 530
389
+ },
390
+ {
391
+ "epoch": 0.3255218144827067,
392
+ "grad_norm": 0.09756519177369154,
393
+ "learning_rate": 4.998913832676579e-05,
394
+ "loss": 1.3307,
395
+ "step": 540
396
+ },
397
+ {
398
+ "epoch": 0.3315499962323864,
399
+ "grad_norm": 0.10068308440088464,
400
+ "learning_rate": 4.9983351002799416e-05,
401
+ "loss": 1.3808,
402
+ "step": 550
403
+ },
404
+ {
405
+ "epoch": 0.3375781779820662,
406
+ "grad_norm": 0.10281210912536574,
407
+ "learning_rate": 4.9976332932653225e-05,
408
+ "loss": 1.3491,
409
+ "step": 560
410
+ },
411
+ {
412
+ "epoch": 0.3436063597317459,
413
+ "grad_norm": 0.11134959395711537,
414
+ "learning_rate": 4.996808446205599e-05,
415
+ "loss": 1.3621,
416
+ "step": 570
417
+ },
418
+ {
419
+ "epoch": 0.34963454148142564,
420
+ "grad_norm": 0.10551082322799996,
421
+ "learning_rate": 4.9958605997349264e-05,
422
+ "loss": 1.3412,
423
+ "step": 580
424
+ },
425
+ {
426
+ "epoch": 0.3556627232311054,
427
+ "grad_norm": 0.10677290661324353,
428
+ "learning_rate": 4.994789800546737e-05,
429
+ "loss": 1.3623,
430
+ "step": 590
431
+ },
432
+ {
433
+ "epoch": 0.36169090498078516,
434
+ "grad_norm": 0.10716617749224472,
435
+ "learning_rate": 4.993596101391443e-05,
436
+ "loss": 1.3606,
437
+ "step": 600
438
+ },
439
+ {
440
+ "epoch": 0.36771908673046494,
441
+ "grad_norm": 0.11677420750343206,
442
+ "learning_rate": 4.99227956107383e-05,
443
+ "loss": 1.3485,
444
+ "step": 610
445
+ },
446
+ {
447
+ "epoch": 0.37374726848014467,
448
+ "grad_norm": 0.11130663386773537,
449
+ "learning_rate": 4.990840244450171e-05,
450
+ "loss": 1.3496,
451
+ "step": 620
452
+ },
453
+ {
454
+ "epoch": 0.37977545022982445,
455
+ "grad_norm": 0.1146856303733156,
456
+ "learning_rate": 4.989278222425021e-05,
457
+ "loss": 1.3026,
458
+ "step": 630
459
+ },
460
+ {
461
+ "epoch": 0.3858036319795042,
462
+ "grad_norm": 0.10717267360067521,
463
+ "learning_rate": 4.987593571947733e-05,
464
+ "loss": 1.3544,
465
+ "step": 640
466
+ },
467
+ {
468
+ "epoch": 0.3918318137291839,
469
+ "grad_norm": 0.12176386523595194,
470
+ "learning_rate": 4.985786376008659e-05,
471
+ "loss": 1.3271,
472
+ "step": 650
473
+ },
474
+ {
475
+ "epoch": 0.3978599954788637,
476
+ "grad_norm": 0.11520452966234733,
477
+ "learning_rate": 4.983856723635067e-05,
478
+ "loss": 1.3663,
479
+ "step": 660
480
+ },
481
+ {
482
+ "epoch": 0.4038881772285434,
483
+ "grad_norm": 0.1342901348076113,
484
+ "learning_rate": 4.981804709886756e-05,
485
+ "loss": 1.335,
486
+ "step": 670
487
+ },
488
+ {
489
+ "epoch": 0.4099163589782232,
490
+ "grad_norm": 0.12009183498218759,
491
+ "learning_rate": 4.9796304358513695e-05,
492
+ "loss": 1.3344,
493
+ "step": 680
494
+ },
495
+ {
496
+ "epoch": 0.41594454072790293,
497
+ "grad_norm": 0.11290080480825251,
498
+ "learning_rate": 4.977334008639417e-05,
499
+ "loss": 1.3302,
500
+ "step": 690
501
+ },
502
+ {
503
+ "epoch": 0.4219727224775827,
504
+ "grad_norm": 0.12117529129793933,
505
+ "learning_rate": 4.974915541378997e-05,
506
+ "loss": 1.3583,
507
+ "step": 700
508
+ },
509
+ {
510
+ "epoch": 0.42800090422726245,
511
+ "grad_norm": 0.12106414674081765,
512
+ "learning_rate": 4.972375153210228e-05,
513
+ "loss": 1.3205,
514
+ "step": 710
515
+ },
516
+ {
517
+ "epoch": 0.43402908597694223,
518
+ "grad_norm": 0.16181404734070373,
519
+ "learning_rate": 4.969712969279372e-05,
520
+ "loss": 1.3114,
521
+ "step": 720
522
+ },
523
+ {
524
+ "epoch": 0.44005726772662196,
525
+ "grad_norm": 0.13118653046898843,
526
+ "learning_rate": 4.966929120732675e-05,
527
+ "loss": 1.3346,
528
+ "step": 730
529
+ },
530
+ {
531
+ "epoch": 0.4460854494763017,
532
+ "grad_norm": 0.12384193345851267,
533
+ "learning_rate": 4.964023744709906e-05,
534
+ "loss": 1.3178,
535
+ "step": 740
536
+ },
537
+ {
538
+ "epoch": 0.45211363122598147,
539
+ "grad_norm": 0.13158056407059576,
540
+ "learning_rate": 4.960996984337599e-05,
541
+ "loss": 1.3072,
542
+ "step": 750
543
+ },
544
+ {
545
+ "epoch": 0.4581418129756612,
546
+ "grad_norm": 0.1271187477839215,
547
+ "learning_rate": 4.957848988722003e-05,
548
+ "loss": 1.3184,
549
+ "step": 760
550
+ },
551
+ {
552
+ "epoch": 0.464169994725341,
553
+ "grad_norm": 0.1271182236921431,
554
+ "learning_rate": 4.954579912941738e-05,
555
+ "loss": 1.3052,
556
+ "step": 770
557
+ },
558
+ {
559
+ "epoch": 0.4701981764750207,
560
+ "grad_norm": 0.13793244616584555,
561
+ "learning_rate": 4.951189918040153e-05,
562
+ "loss": 1.3156,
563
+ "step": 780
564
+ },
565
+ {
566
+ "epoch": 0.4762263582247005,
567
+ "grad_norm": 0.143375429890016,
568
+ "learning_rate": 4.9476791710173954e-05,
569
+ "loss": 1.3057,
570
+ "step": 790
571
+ },
572
+ {
573
+ "epoch": 0.4822545399743802,
574
+ "grad_norm": 0.13873715683631677,
575
+ "learning_rate": 4.94404784482218e-05,
576
+ "loss": 1.3239,
577
+ "step": 800
578
+ },
579
+ {
580
+ "epoch": 0.4822545399743802,
581
+ "eval_loss": 1.2957444190979004,
582
+ "eval_runtime": 149.3128,
583
+ "eval_samples_per_second": 7.186,
584
+ "eval_steps_per_second": 0.904,
585
+ "step": 800
586
+ },
587
+ {
588
+ "epoch": 0.48828272172405995,
589
+ "grad_norm": 0.12229796207948938,
590
+ "learning_rate": 4.940296118343274e-05,
591
+ "loss": 1.3356,
592
+ "step": 810
593
+ },
594
+ {
595
+ "epoch": 0.49431090347373974,
596
+ "grad_norm": 0.13903783244410667,
597
+ "learning_rate": 4.936424176400681e-05,
598
+ "loss": 1.3142,
599
+ "step": 820
600
+ },
601
+ {
602
+ "epoch": 0.5003390852234195,
603
+ "grad_norm": 0.15694334320231693,
604
+ "learning_rate": 4.9324322097365385e-05,
605
+ "loss": 1.3203,
606
+ "step": 830
607
+ },
608
+ {
609
+ "epoch": 0.5063672669730992,
610
+ "grad_norm": 0.1473003918483972,
611
+ "learning_rate": 4.9283204150057186e-05,
612
+ "loss": 1.3443,
613
+ "step": 840
614
+ },
615
+ {
616
+ "epoch": 0.512395448722779,
617
+ "grad_norm": 0.13719045426198556,
618
+ "learning_rate": 4.924088994766144e-05,
619
+ "loss": 1.3207,
620
+ "step": 850
621
+ },
622
+ {
623
+ "epoch": 0.5184236304724588,
624
+ "grad_norm": 0.1446409431503074,
625
+ "learning_rate": 4.919738157468806e-05,
626
+ "loss": 1.3367,
627
+ "step": 860
628
+ },
629
+ {
630
+ "epoch": 0.5244518122221385,
631
+ "grad_norm": 0.144976185376708,
632
+ "learning_rate": 4.915268117447498e-05,
633
+ "loss": 1.2926,
634
+ "step": 870
635
+ },
636
+ {
637
+ "epoch": 0.5304799939718182,
638
+ "grad_norm": 0.1432747729307118,
639
+ "learning_rate": 4.910679094908256e-05,
640
+ "loss": 1.2687,
641
+ "step": 880
642
+ },
643
+ {
644
+ "epoch": 0.536508175721498,
645
+ "grad_norm": 0.14816151870596467,
646
+ "learning_rate": 4.9059713159185087e-05,
647
+ "loss": 1.3066,
648
+ "step": 890
649
+ },
650
+ {
651
+ "epoch": 0.5425363574711778,
652
+ "grad_norm": 0.15312077289707232,
653
+ "learning_rate": 4.901145012395945e-05,
654
+ "loss": 1.2715,
655
+ "step": 900
656
+ },
657
+ {
658
+ "epoch": 0.5485645392208575,
659
+ "grad_norm": 0.14921082023451226,
660
+ "learning_rate": 4.896200422097087e-05,
661
+ "loss": 1.2854,
662
+ "step": 910
663
+ },
664
+ {
665
+ "epoch": 0.5545927209705372,
666
+ "grad_norm": 0.18249086322702504,
667
+ "learning_rate": 4.891137788605575e-05,
668
+ "loss": 1.2938,
669
+ "step": 920
670
+ },
671
+ {
672
+ "epoch": 0.560620902720217,
673
+ "grad_norm": 0.17799127506373516,
674
+ "learning_rate": 4.8859573613201725e-05,
675
+ "loss": 1.2771,
676
+ "step": 930
677
+ },
678
+ {
679
+ "epoch": 0.5666490844698968,
680
+ "grad_norm": 0.1567560038538035,
681
+ "learning_rate": 4.880659395442478e-05,
682
+ "loss": 1.2775,
683
+ "step": 940
684
+ },
685
+ {
686
+ "epoch": 0.5726772662195765,
687
+ "grad_norm": 0.2702719829446041,
688
+ "learning_rate": 4.87524415196435e-05,
689
+ "loss": 1.2998,
690
+ "step": 950
691
+ },
692
+ {
693
+ "epoch": 0.5787054479692563,
694
+ "grad_norm": 0.15756638200428358,
695
+ "learning_rate": 4.8697118976550574e-05,
696
+ "loss": 1.3046,
697
+ "step": 960
698
+ },
699
+ {
700
+ "epoch": 0.584733629718936,
701
+ "grad_norm": 0.16571471050973857,
702
+ "learning_rate": 4.86406290504813e-05,
703
+ "loss": 1.2965,
704
+ "step": 970
705
+ },
706
+ {
707
+ "epoch": 0.5907618114686157,
708
+ "grad_norm": 0.1623678481384679,
709
+ "learning_rate": 4.8582974524279365e-05,
710
+ "loss": 1.2865,
711
+ "step": 980
712
+ },
713
+ {
714
+ "epoch": 0.5967899932182955,
715
+ "grad_norm": 0.17039779398050892,
716
+ "learning_rate": 4.8524158238159756e-05,
717
+ "loss": 1.3065,
718
+ "step": 990
719
+ },
720
+ {
721
+ "epoch": 0.6028181749679753,
722
+ "grad_norm": 0.1645102791020125,
723
+ "learning_rate": 4.8464183089568824e-05,
724
+ "loss": 1.28,
725
+ "step": 1000
726
+ },
727
+ {
728
+ "epoch": 0.6088463567176551,
729
+ "grad_norm": 0.16365223749524835,
730
+ "learning_rate": 4.8403052033041596e-05,
731
+ "loss": 1.2719,
732
+ "step": 1010
733
+ },
734
+ {
735
+ "epoch": 0.6148745384673348,
736
+ "grad_norm": 0.1602190503029676,
737
+ "learning_rate": 4.834076808005614e-05,
738
+ "loss": 1.2818,
739
+ "step": 1020
740
+ },
741
+ {
742
+ "epoch": 0.6209027202170145,
743
+ "grad_norm": 0.15949490297225546,
744
+ "learning_rate": 4.827733429888531e-05,
745
+ "loss": 1.2691,
746
+ "step": 1030
747
+ },
748
+ {
749
+ "epoch": 0.6269309019666943,
750
+ "grad_norm": 0.17146084316633475,
751
+ "learning_rate": 4.821275381444552e-05,
752
+ "loss": 1.2657,
753
+ "step": 1040
754
+ },
755
+ {
756
+ "epoch": 0.632959083716374,
757
+ "grad_norm": 0.2405045374229408,
758
+ "learning_rate": 4.814702980814284e-05,
759
+ "loss": 1.2472,
760
+ "step": 1050
761
+ },
762
+ {
763
+ "epoch": 0.6389872654660538,
764
+ "grad_norm": 0.18854187339515996,
765
+ "learning_rate": 4.8080165517716267e-05,
766
+ "loss": 1.2411,
767
+ "step": 1060
768
+ },
769
+ {
770
+ "epoch": 0.6450154472157336,
771
+ "grad_norm": 0.17120145629647163,
772
+ "learning_rate": 4.80121642370782e-05,
773
+ "loss": 1.2865,
774
+ "step": 1070
775
+ },
776
+ {
777
+ "epoch": 0.6510436289654133,
778
+ "grad_norm": 0.17879749041413,
779
+ "learning_rate": 4.794302931615223e-05,
780
+ "loss": 1.2572,
781
+ "step": 1080
782
+ },
783
+ {
784
+ "epoch": 0.657071810715093,
785
+ "grad_norm": 0.18362233795953198,
786
+ "learning_rate": 4.7872764160708044e-05,
787
+ "loss": 1.2823,
788
+ "step": 1090
789
+ },
790
+ {
791
+ "epoch": 0.6630999924647728,
792
+ "grad_norm": 0.1827563529393702,
793
+ "learning_rate": 4.780137223219369e-05,
794
+ "loss": 1.2308,
795
+ "step": 1100
796
+ },
797
+ {
798
+ "epoch": 0.6691281742144526,
799
+ "grad_norm": 0.1864429907321282,
800
+ "learning_rate": 4.772885704756506e-05,
801
+ "loss": 1.2522,
802
+ "step": 1110
803
+ },
804
+ {
805
+ "epoch": 0.6751563559641324,
806
+ "grad_norm": 0.1906552054233093,
807
+ "learning_rate": 4.7655222179112595e-05,
808
+ "loss": 1.2485,
809
+ "step": 1120
810
+ },
811
+ {
812
+ "epoch": 0.681184537713812,
813
+ "grad_norm": 0.17584845483906592,
814
+ "learning_rate": 4.758047125428537e-05,
815
+ "loss": 1.2466,
816
+ "step": 1130
817
+ },
818
+ {
819
+ "epoch": 0.6872127194634918,
820
+ "grad_norm": 0.1832614435939446,
821
+ "learning_rate": 4.750460795551235e-05,
822
+ "loss": 1.2473,
823
+ "step": 1140
824
+ },
825
+ {
826
+ "epoch": 0.6932409012131716,
827
+ "grad_norm": 0.19068207255760805,
828
+ "learning_rate": 4.742763602002097e-05,
829
+ "loss": 1.2306,
830
+ "step": 1150
831
+ },
832
+ {
833
+ "epoch": 0.6992690829628513,
834
+ "grad_norm": 0.1869186315862799,
835
+ "learning_rate": 4.7349559239653064e-05,
836
+ "loss": 1.2189,
837
+ "step": 1160
838
+ },
839
+ {
840
+ "epoch": 0.7052972647125311,
841
+ "grad_norm": 0.19138057977743592,
842
+ "learning_rate": 4.727038146067807e-05,
843
+ "loss": 1.2387,
844
+ "step": 1170
845
+ },
846
+ {
847
+ "epoch": 0.7113254464622109,
848
+ "grad_norm": 0.19645994544271753,
849
+ "learning_rate": 4.719010658360352e-05,
850
+ "loss": 1.2351,
851
+ "step": 1180
852
+ },
853
+ {
854
+ "epoch": 0.7173536282118906,
855
+ "grad_norm": 0.2014637466767444,
856
+ "learning_rate": 4.710873856298294e-05,
857
+ "loss": 1.2104,
858
+ "step": 1190
859
+ },
860
+ {
861
+ "epoch": 0.7233818099615703,
862
+ "grad_norm": 0.19947019583870831,
863
+ "learning_rate": 4.702628140722096e-05,
864
+ "loss": 1.2473,
865
+ "step": 1200
866
+ },
867
+ {
868
+ "epoch": 0.7233818099615703,
869
+ "eval_loss": 1.2005627155303955,
870
+ "eval_runtime": 148.1529,
871
+ "eval_samples_per_second": 7.243,
872
+ "eval_steps_per_second": 0.911,
873
+ "step": 1200
874
+ },
875
+ {
876
+ "epoch": 0.7294099917112501,
877
+ "grad_norm": 0.19388661605991633,
878
+ "learning_rate": 4.694273917837594e-05,
879
+ "loss": 1.2401,
880
+ "step": 1210
881
+ },
882
+ {
883
+ "epoch": 0.7354381734609299,
884
+ "grad_norm": 0.18789271845168903,
885
+ "learning_rate": 4.68581159919598e-05,
886
+ "loss": 1.2115,
887
+ "step": 1220
888
+ },
889
+ {
890
+ "epoch": 0.7414663552106096,
891
+ "grad_norm": 0.19218467798311695,
892
+ "learning_rate": 4.677241601673533e-05,
893
+ "loss": 1.2422,
894
+ "step": 1230
895
+ },
896
+ {
897
+ "epoch": 0.7474945369602893,
898
+ "grad_norm": 0.21068503293560067,
899
+ "learning_rate": 4.6685643474510734e-05,
900
+ "loss": 1.1999,
901
+ "step": 1240
902
+ },
903
+ {
904
+ "epoch": 0.7535227187099691,
905
+ "grad_norm": 0.19334737581694425,
906
+ "learning_rate": 4.659780263993177e-05,
907
+ "loss": 1.221,
908
+ "step": 1250
909
+ },
910
+ {
911
+ "epoch": 0.7595509004596489,
912
+ "grad_norm": 0.2048710364331125,
913
+ "learning_rate": 4.6508897840271086e-05,
914
+ "loss": 1.2278,
915
+ "step": 1260
916
+ },
917
+ {
918
+ "epoch": 0.7655790822093286,
919
+ "grad_norm": 0.2098690852913335,
920
+ "learning_rate": 4.641893345521508e-05,
921
+ "loss": 1.2167,
922
+ "step": 1270
923
+ },
924
+ {
925
+ "epoch": 0.7716072639590084,
926
+ "grad_norm": 0.2020939972391656,
927
+ "learning_rate": 4.6327913916648135e-05,
928
+ "loss": 1.2167,
929
+ "step": 1280
930
+ },
931
+ {
932
+ "epoch": 0.7776354457086881,
933
+ "grad_norm": 0.2074182675506127,
934
+ "learning_rate": 4.6235843708434315e-05,
935
+ "loss": 1.1917,
936
+ "step": 1290
937
+ },
938
+ {
939
+ "epoch": 0.7836636274583678,
940
+ "grad_norm": 0.20016936312104308,
941
+ "learning_rate": 4.6142727366196414e-05,
942
+ "loss": 1.2114,
943
+ "step": 1300
944
+ },
945
+ {
946
+ "epoch": 0.7896918092080476,
947
+ "grad_norm": 0.2042491026784662,
948
+ "learning_rate": 4.604856947709262e-05,
949
+ "loss": 1.1986,
950
+ "step": 1310
951
+ },
952
+ {
953
+ "epoch": 0.7957199909577274,
954
+ "grad_norm": 0.20627892432976563,
955
+ "learning_rate": 4.595337467959045e-05,
956
+ "loss": 1.2017,
957
+ "step": 1320
958
+ },
959
+ {
960
+ "epoch": 0.8017481727074072,
961
+ "grad_norm": 0.21410992106242302,
962
+ "learning_rate": 4.5857147663238304e-05,
963
+ "loss": 1.176,
964
+ "step": 1330
965
+ },
966
+ {
967
+ "epoch": 0.8077763544570868,
968
+ "grad_norm": 0.21385257654543013,
969
+ "learning_rate": 4.575989316843439e-05,
970
+ "loss": 1.161,
971
+ "step": 1340
972
+ },
973
+ {
974
+ "epoch": 0.8138045362067666,
975
+ "grad_norm": 0.21113493885158413,
976
+ "learning_rate": 4.566161598619325e-05,
977
+ "loss": 1.1943,
978
+ "step": 1350
979
+ },
980
+ {
981
+ "epoch": 0.8198327179564464,
982
+ "grad_norm": 0.21613784562223093,
983
+ "learning_rate": 4.556232095790972e-05,
984
+ "loss": 1.2033,
985
+ "step": 1360
986
+ },
987
+ {
988
+ "epoch": 0.8258608997061262,
989
+ "grad_norm": 0.2076738251013475,
990
+ "learning_rate": 4.5462012975120455e-05,
991
+ "loss": 1.1786,
992
+ "step": 1370
993
+ },
994
+ {
995
+ "epoch": 0.8318890814558059,
996
+ "grad_norm": 0.23044201851165344,
997
+ "learning_rate": 4.5360696979262905e-05,
998
+ "loss": 1.1796,
999
+ "step": 1380
1000
+ },
1001
+ {
1002
+ "epoch": 0.8379172632054857,
1003
+ "grad_norm": 0.22883008001886568,
1004
+ "learning_rate": 4.525837796143194e-05,
1005
+ "loss": 1.1728,
1006
+ "step": 1390
1007
+ },
1008
+ {
1009
+ "epoch": 0.8439454449551654,
1010
+ "grad_norm": 0.2306946921683779,
1011
+ "learning_rate": 4.5155060962133945e-05,
1012
+ "loss": 1.1764,
1013
+ "step": 1400
1014
+ },
1015
+ {
1016
+ "epoch": 0.8499736267048451,
1017
+ "grad_norm": 0.23157892679877035,
1018
+ "learning_rate": 4.505075107103852e-05,
1019
+ "loss": 1.1832,
1020
+ "step": 1410
1021
+ },
1022
+ {
1023
+ "epoch": 0.8560018084545249,
1024
+ "grad_norm": 0.21742897363969343,
1025
+ "learning_rate": 4.494545342672775e-05,
1026
+ "loss": 1.1734,
1027
+ "step": 1420
1028
+ },
1029
+ {
1030
+ "epoch": 0.8620299902042047,
1031
+ "grad_norm": 0.22825192812741035,
1032
+ "learning_rate": 4.483917321644309e-05,
1033
+ "loss": 1.1736,
1034
+ "step": 1430
1035
+ },
1036
+ {
1037
+ "epoch": 0.8680581719538845,
1038
+ "grad_norm": 0.2275167699698394,
1039
+ "learning_rate": 4.473191567582975e-05,
1040
+ "loss": 1.1658,
1041
+ "step": 1440
1042
+ },
1043
+ {
1044
+ "epoch": 0.8740863537035641,
1045
+ "grad_norm": 0.21961154395854318,
1046
+ "learning_rate": 4.462368608867889e-05,
1047
+ "loss": 1.1845,
1048
+ "step": 1450
1049
+ },
1050
+ {
1051
+ "epoch": 0.8801145354532439,
1052
+ "grad_norm": 0.21525449869450775,
1053
+ "learning_rate": 4.4514489786667205e-05,
1054
+ "loss": 1.1418,
1055
+ "step": 1460
1056
+ },
1057
+ {
1058
+ "epoch": 0.8861427172029237,
1059
+ "grad_norm": 0.22332875240997163,
1060
+ "learning_rate": 4.4404332149094365e-05,
1061
+ "loss": 1.1777,
1062
+ "step": 1470
1063
+ },
1064
+ {
1065
+ "epoch": 0.8921708989526034,
1066
+ "grad_norm": 0.22901308144060187,
1067
+ "learning_rate": 4.429321860261797e-05,
1068
+ "loss": 1.167,
1069
+ "step": 1480
1070
+ },
1071
+ {
1072
+ "epoch": 0.8981990807022832,
1073
+ "grad_norm": 0.22878617308256047,
1074
+ "learning_rate": 4.418115462098624e-05,
1075
+ "loss": 1.1532,
1076
+ "step": 1490
1077
+ },
1078
+ {
1079
+ "epoch": 0.9042272624519629,
1080
+ "grad_norm": 0.2405276526631136,
1081
+ "learning_rate": 4.4068145724768324e-05,
1082
+ "loss": 1.1206,
1083
+ "step": 1500
1084
+ }
1085
+ ],
1086
+ "logging_steps": 10,
1087
+ "max_steps": 4974,
1088
+ "num_input_tokens_seen": 0,
1089
+ "num_train_epochs": 3,
1090
+ "save_steps": 500,
1091
+ "stateful_callbacks": {
1092
+ "TrainerControl": {
1093
+ "args": {
1094
+ "should_epoch_stop": false,
1095
+ "should_evaluate": false,
1096
+ "should_log": false,
1097
+ "should_save": true,
1098
+ "should_training_stop": false
1099
+ },
1100
+ "attributes": {}
1101
+ }
1102
+ },
1103
+ "total_flos": 2522009359613952.0,
1104
+ "train_batch_size": 1,
1105
+ "trial_name": null,
1106
+ "trial_params": null
1107
+ }
checkpoint-1500/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2923841ae243af669d09fc75f56460b83329158b7b6379ad1b1afd5c369cdb7a
3
+ size 7224
checkpoint-1500/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-1500/zero_to_fp32.py ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example:
14
+ # python zero_to_fp32.py . output_dir/
15
+ # or
16
+ # python zero_to_fp32.py . output_dir/ --safe_serialization
17
+
18
+ import argparse
19
+ import torch
20
+ import glob
21
+ import math
22
+ import os
23
+ import re
24
+ import json
25
+ from tqdm import tqdm
26
+ from collections import OrderedDict
27
+ from dataclasses import dataclass
28
+
29
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
30
+ # DeepSpeed data structures it has to be available in the current python environment.
31
+ from deepspeed.utils import logger
32
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
33
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
34
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
35
+
36
+
37
+ @dataclass
38
+ class zero_model_state:
39
+ buffers: dict()
40
+ param_shapes: dict()
41
+ shared_params: list
42
+ ds_version: int
43
+ frozen_param_shapes: dict()
44
+ frozen_param_fragments: dict()
45
+
46
+
47
+ debug = 0
48
+
49
+ # load to cpu
50
+ device = torch.device('cpu')
51
+
52
+
53
+ def atoi(text):
54
+ return int(text) if text.isdigit() else text
55
+
56
+
57
+ def natural_keys(text):
58
+ '''
59
+ alist.sort(key=natural_keys) sorts in human order
60
+ http://nedbatchelder.com/blog/200712/human_sorting.html
61
+ (See Toothy's implementation in the comments)
62
+ '''
63
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
64
+
65
+
66
+ def get_model_state_file(checkpoint_dir, zero_stage):
67
+ if not os.path.isdir(checkpoint_dir):
68
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
69
+
70
+ # there should be only one file
71
+ if zero_stage <= 2:
72
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
73
+ elif zero_stage == 3:
74
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
75
+
76
+ if not os.path.exists(file):
77
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
78
+
79
+ return file
80
+
81
+
82
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
83
+ # XXX: need to test that this simple glob rule works for multi-node setup too
84
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
85
+
86
+ if len(ckpt_files) == 0:
87
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
88
+
89
+ return ckpt_files
90
+
91
+
92
+ def get_optim_files(checkpoint_dir):
93
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
94
+
95
+
96
+ def get_model_state_files(checkpoint_dir):
97
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
98
+
99
+
100
+ def parse_model_states(files):
101
+ zero_model_states = []
102
+ for file in files:
103
+ state_dict = torch.load(file, map_location=device)
104
+
105
+ if BUFFER_NAMES not in state_dict:
106
+ raise ValueError(f"{file} is not a model state checkpoint")
107
+ buffer_names = state_dict[BUFFER_NAMES]
108
+ if debug:
109
+ print("Found buffers:", buffer_names)
110
+
111
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
112
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
113
+ param_shapes = state_dict[PARAM_SHAPES]
114
+
115
+ # collect parameters that are included in param_shapes
116
+ param_names = []
117
+ for s in param_shapes:
118
+ for name in s.keys():
119
+ param_names.append(name)
120
+
121
+ # update with frozen parameters
122
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
123
+ if frozen_param_shapes is not None:
124
+ if debug:
125
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
126
+ param_names += list(frozen_param_shapes.keys())
127
+
128
+ # handle shared params
129
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
130
+
131
+ ds_version = state_dict.get(DS_VERSION, None)
132
+
133
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
134
+
135
+ z_model_state = zero_model_state(buffers=buffers,
136
+ param_shapes=param_shapes,
137
+ shared_params=shared_params,
138
+ ds_version=ds_version,
139
+ frozen_param_shapes=frozen_param_shapes,
140
+ frozen_param_fragments=frozen_param_fragments)
141
+ zero_model_states.append(z_model_state)
142
+
143
+ return zero_model_states
144
+
145
+
146
+ def parse_optim_states(files, ds_checkpoint_dir):
147
+ total_files = len(files)
148
+ state_dicts = []
149
+ for f in files:
150
+ state_dict = torch.load(f, map_location=device)
151
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
152
+ # and also handle the case where it was already removed by another helper script
153
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
154
+ state_dicts.append(state_dict)
155
+
156
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
157
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
158
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
159
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
160
+
161
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
162
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
163
+ # use the max of the partition_count to get the dp world_size.
164
+
165
+ if type(world_size) is list:
166
+ world_size = max(world_size)
167
+
168
+ if world_size != total_files:
169
+ raise ValueError(
170
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
171
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
172
+ )
173
+
174
+ # the groups are named differently in each stage
175
+ if zero_stage <= 2:
176
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
177
+ elif zero_stage == 3:
178
+ fp32_groups_key = FP32_FLAT_GROUPS
179
+ else:
180
+ raise ValueError(f"unknown zero stage {zero_stage}")
181
+
182
+ if zero_stage <= 2:
183
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
184
+ elif zero_stage == 3:
185
+ # if there is more than one param group, there will be multiple flattened tensors - one
186
+ # flattened tensor per group - for simplicity merge them into a single tensor
187
+ #
188
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
189
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
190
+
191
+ fp32_flat_groups = [
192
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
193
+ ]
194
+
195
+ return zero_stage, world_size, fp32_flat_groups
196
+
197
+
198
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
199
+ """
200
+ Returns fp32 state_dict reconstructed from ds checkpoint
201
+
202
+ Args:
203
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
204
+
205
+ """
206
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
207
+
208
+ optim_files = get_optim_files(ds_checkpoint_dir)
209
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
210
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
211
+
212
+ model_files = get_model_state_files(ds_checkpoint_dir)
213
+
214
+ zero_model_states = parse_model_states(model_files)
215
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
216
+
217
+ if zero_stage <= 2:
218
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
219
+ exclude_frozen_parameters)
220
+ elif zero_stage == 3:
221
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
222
+ exclude_frozen_parameters)
223
+
224
+
225
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
226
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
227
+ return
228
+
229
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
230
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
231
+
232
+ if debug:
233
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
234
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
235
+
236
+ wanted_params = len(frozen_param_shapes)
237
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
238
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
239
+ print(f'Frozen params: Have {avail_numel} numels to process.')
240
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
241
+
242
+ total_params = 0
243
+ total_numel = 0
244
+ for name, shape in frozen_param_shapes.items():
245
+ total_params += 1
246
+ unpartitioned_numel = shape.numel()
247
+ total_numel += unpartitioned_numel
248
+
249
+ state_dict[name] = frozen_param_fragments[name]
250
+
251
+ if debug:
252
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
253
+
254
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
255
+
256
+
257
+ def _has_callable(obj, fn):
258
+ attr = getattr(obj, fn, None)
259
+ return callable(attr)
260
+
261
+
262
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
263
+ param_shapes = zero_model_states[0].param_shapes
264
+
265
+ # Reconstruction protocol:
266
+ #
267
+ # XXX: document this
268
+
269
+ if debug:
270
+ for i in range(world_size):
271
+ for j in range(len(fp32_flat_groups[0])):
272
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
273
+
274
+ # XXX: memory usage doubles here (zero2)
275
+ num_param_groups = len(fp32_flat_groups[0])
276
+ merged_single_partition_of_fp32_groups = []
277
+ for i in range(num_param_groups):
278
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
279
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
280
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
281
+ avail_numel = sum(
282
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
283
+
284
+ if debug:
285
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
286
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
287
+ # not asserting if there is a mismatch due to possible padding
288
+ print(f"Have {avail_numel} numels to process.")
289
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
290
+
291
+ # params
292
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
293
+ # out-of-core computing solution
294
+ total_numel = 0
295
+ total_params = 0
296
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
297
+ offset = 0
298
+ avail_numel = full_single_fp32_vector.numel()
299
+ for name, shape in shapes.items():
300
+
301
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
302
+ total_numel += unpartitioned_numel
303
+ total_params += 1
304
+
305
+ if debug:
306
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
307
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
308
+ offset += unpartitioned_numel
309
+
310
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
311
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
312
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
313
+ # live optimizer object, so we are checking that the numbers are within the right range
314
+ align_to = 2 * world_size
315
+
316
+ def zero2_align(x):
317
+ return align_to * math.ceil(x / align_to)
318
+
319
+ if debug:
320
+ print(f"original offset={offset}, avail_numel={avail_numel}")
321
+
322
+ offset = zero2_align(offset)
323
+ avail_numel = zero2_align(avail_numel)
324
+
325
+ if debug:
326
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
327
+
328
+ # Sanity check
329
+ if offset != avail_numel:
330
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
331
+
332
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
333
+
334
+
335
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
336
+ exclude_frozen_parameters):
337
+ state_dict = OrderedDict()
338
+
339
+ # buffers
340
+ buffers = zero_model_states[0].buffers
341
+ state_dict.update(buffers)
342
+ if debug:
343
+ print(f"added {len(buffers)} buffers")
344
+
345
+ if not exclude_frozen_parameters:
346
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
347
+
348
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
349
+
350
+ # recover shared parameters
351
+ for pair in zero_model_states[0].shared_params:
352
+ if pair[1] in state_dict:
353
+ state_dict[pair[0]] = state_dict[pair[1]]
354
+
355
+ return state_dict
356
+
357
+
358
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
359
+ remainder = unpartitioned_numel % world_size
360
+ padding_numel = (world_size - remainder) if remainder else 0
361
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
362
+ return partitioned_numel, padding_numel
363
+
364
+
365
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
366
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
367
+ return
368
+
369
+ if debug:
370
+ for i in range(world_size):
371
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
372
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
373
+
374
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
375
+ wanted_params = len(frozen_param_shapes)
376
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
377
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
378
+ print(f'Frozen params: Have {avail_numel} numels to process.')
379
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
380
+
381
+ total_params = 0
382
+ total_numel = 0
383
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
384
+ total_params += 1
385
+ unpartitioned_numel = shape.numel()
386
+ total_numel += unpartitioned_numel
387
+
388
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
389
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
390
+
391
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
392
+
393
+ if debug:
394
+ print(
395
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
396
+ )
397
+
398
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
399
+
400
+
401
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
402
+ param_shapes = zero_model_states[0].param_shapes
403
+ avail_numel = fp32_flat_groups[0].numel() * world_size
404
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
405
+ # param, re-consolidating each param, while dealing with padding if any
406
+
407
+ # merge list of dicts, preserving order
408
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
409
+
410
+ if debug:
411
+ for i in range(world_size):
412
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
413
+
414
+ wanted_params = len(param_shapes)
415
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
416
+ # not asserting if there is a mismatch due to possible padding
417
+ avail_numel = fp32_flat_groups[0].numel() * world_size
418
+ print(f"Trainable params: Have {avail_numel} numels to process.")
419
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
420
+
421
+ # params
422
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
423
+ # out-of-core computing solution
424
+ offset = 0
425
+ total_numel = 0
426
+ total_params = 0
427
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering Sharded Weights'):
428
+ unpartitioned_numel = shape.numel()
429
+ total_numel += unpartitioned_numel
430
+ total_params += 1
431
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
432
+
433
+ if debug:
434
+ print(
435
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
436
+ )
437
+
438
+ # XXX: memory usage doubles here
439
+ state_dict[name] = torch.cat(
440
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
441
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
442
+ offset += partitioned_numel
443
+
444
+ offset *= world_size
445
+
446
+ # Sanity check
447
+ if offset != avail_numel:
448
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
449
+
450
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
451
+
452
+
453
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
454
+ exclude_frozen_parameters):
455
+ state_dict = OrderedDict()
456
+
457
+ # buffers
458
+ buffers = zero_model_states[0].buffers
459
+ state_dict.update(buffers)
460
+ if debug:
461
+ print(f"added {len(buffers)} buffers")
462
+
463
+ if not exclude_frozen_parameters:
464
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
465
+
466
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
467
+
468
+ # recover shared parameters
469
+ for pair in zero_model_states[0].shared_params:
470
+ if pair[1] in state_dict:
471
+ state_dict[pair[0]] = state_dict[pair[1]]
472
+
473
+ return state_dict
474
+
475
+
476
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None, exclude_frozen_parameters=False):
477
+ """
478
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
479
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
480
+ via a model hub.
481
+
482
+ Args:
483
+ - ``checkpoint_dir``: path to the desired checkpoint folder
484
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
485
+ - ``exclude_frozen_parameters``: exclude frozen parameters
486
+
487
+ Returns:
488
+ - pytorch ``state_dict``
489
+
490
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
491
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
492
+ the checkpoint.
493
+
494
+ A typical usage might be ::
495
+
496
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
497
+ # do the training and checkpoint saving
498
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
499
+ model = model.cpu() # move to cpu
500
+ model.load_state_dict(state_dict)
501
+ # submit to model hub or save the model to share with others
502
+
503
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
504
+ application. i.e. you will need to re-initialize the deepspeed engine, since
505
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
506
+
507
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
508
+
509
+ """
510
+ if tag is None:
511
+ latest_path = os.path.join(checkpoint_dir, 'latest')
512
+ if os.path.isfile(latest_path):
513
+ with open(latest_path, 'r') as fd:
514
+ tag = fd.read().strip()
515
+ else:
516
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
517
+
518
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
519
+
520
+ if not os.path.isdir(ds_checkpoint_dir):
521
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
522
+
523
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
524
+
525
+
526
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
527
+ output_dir,
528
+ max_shard_size="5GB",
529
+ safe_serialization=False,
530
+ tag=None,
531
+ exclude_frozen_parameters=False):
532
+ """
533
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
534
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
535
+
536
+ Args:
537
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
538
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
539
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
540
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
541
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
542
+ - ``exclude_frozen_parameters``: exclude frozen parameters
543
+ """
544
+ # Dependency pre-check
545
+ if safe_serialization:
546
+ try:
547
+ from safetensors.torch import save_file
548
+ except ImportError:
549
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
550
+ raise
551
+ if max_shard_size is not None:
552
+ try:
553
+ from huggingface_hub import split_torch_state_dict_into_shards
554
+ except ImportError:
555
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
556
+ raise
557
+
558
+ # Convert zero checkpoint to state_dict
559
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag, exclude_frozen_parameters)
560
+
561
+ # Shard the model if it is too big.
562
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
563
+ if max_shard_size is not None:
564
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
565
+ state_dict_split = split_torch_state_dict_into_shards(state_dict,
566
+ filename_pattern=filename_pattern,
567
+ max_shard_size=max_shard_size)
568
+ else:
569
+ from collections import namedtuple
570
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
571
+ state_dict_split = StateDictSplit(is_sharded=False,
572
+ filename_to_tensors={weights_name: list(state_dict.keys())})
573
+
574
+ # Save the model
575
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
576
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
577
+ shard = {tensor: state_dict[tensor].contiguous() for tensor in tensors}
578
+ output_path = os.path.join(output_dir, shard_file)
579
+ if safe_serialization:
580
+ save_file(shard, output_path, metadata={"format": "pt"})
581
+ else:
582
+ torch.save(shard, output_path)
583
+
584
+ # Save index if sharded
585
+ if state_dict_split.is_sharded:
586
+ index = {
587
+ "metadata": state_dict_split.metadata,
588
+ "weight_map": state_dict_split.tensor_to_filename,
589
+ }
590
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
591
+ save_index_file = os.path.join(output_dir, save_index_file)
592
+ with open(save_index_file, "w", encoding="utf-8") as f:
593
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
594
+ f.write(content)
595
+
596
+
597
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
598
+ """
599
+ 1. Put the provided model to cpu
600
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
601
+ 3. Load it into the provided model
602
+
603
+ Args:
604
+ - ``model``: the model object to update
605
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
606
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
607
+
608
+ Returns:
609
+ - ``model`: modified model
610
+
611
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
612
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
613
+ conveniently placed for you in the checkpoint folder.
614
+
615
+ A typical usage might be ::
616
+
617
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
618
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
619
+ # submit to model hub or save the model to share with others
620
+
621
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
622
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
623
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
624
+
625
+ """
626
+ logger.info(f"Extracting fp32 weights")
627
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
628
+
629
+ logger.info(f"Overwriting model with fp32 weights")
630
+ model = model.cpu()
631
+ model.load_state_dict(state_dict, strict=False)
632
+
633
+ return model
634
+
635
+
636
+ if __name__ == "__main__":
637
+ parser = argparse.ArgumentParser()
638
+ parser.add_argument("checkpoint_dir",
639
+ type=str,
640
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
641
+ parser.add_argument("output_dir",
642
+ type=str,
643
+ help="directory to the pytorch fp32 state_dict output files"
644
+ "(e.g. path/checkpoint-12-output/)")
645
+ parser.add_argument(
646
+ "--max_shard_size",
647
+ type=str,
648
+ default="5GB",
649
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
650
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
651
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
652
+ "without CPU OOM issues.")
653
+ parser.add_argument(
654
+ "--safe_serialization",
655
+ default=False,
656
+ action='store_true',
657
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
658
+ parser.add_argument("-t",
659
+ "--tag",
660
+ type=str,
661
+ default=None,
662
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
663
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
664
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
665
+ args = parser.parse_args()
666
+
667
+ debug = args.debug
668
+
669
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
670
+ args.output_dir,
671
+ max_shard_size=args.max_shard_size,
672
+ safe_serialization=args.safe_serialization,
673
+ tag=args.tag,
674
+ exclude_frozen_parameters=args.exclude_frozen_parameters)
checkpoint-500/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen2.5-72B
3
+ library_name: peft
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.12.0
checkpoint-500/adapter_config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "Qwen/Qwen2.5-72B",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": true,
9
+ "layer_replication": null,
10
+ "layers_pattern": null,
11
+ "layers_to_transform": null,
12
+ "loftq_config": {},
13
+ "lora_alpha": 32,
14
+ "lora_dropout": 0.0,
15
+ "megatron_config": null,
16
+ "megatron_core": "megatron.core",
17
+ "modules_to_save": null,
18
+ "peft_type": "LORA",
19
+ "r": 128,
20
+ "rank_pattern": {},
21
+ "revision": null,
22
+ "target_modules": [
23
+ "gate_proj",
24
+ "v_proj",
25
+ "k_proj",
26
+ "down_proj",
27
+ "o_proj",
28
+ "q_proj",
29
+ "up_proj"
30
+ ],
31
+ "task_type": "CAUSAL_LM",
32
+ "use_dora": false,
33
+ "use_rslora": true
34
+ }
checkpoint-500/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a51a4b4bb16b47c962bc104cfacda7510d0eedc226edd0475b52b5583e2fdba
3
+ size 3368705968
checkpoint-500/added_tokens.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</tool_call>": 151658,
3
+ "<tool_call>": 151657,
4
+ "<|box_end|>": 151649,
5
+ "<|box_start|>": 151648,
6
+ "<|endoftext|>": 151643,
7
+ "<|file_sep|>": 151664,
8
+ "<|fim_middle|>": 151660,
9
+ "<|fim_pad|>": 151662,
10
+ "<|fim_prefix|>": 151659,
11
+ "<|fim_suffix|>": 151661,
12
+ "<|im_end|>": 151645,
13
+ "<|im_start|>": 151644,
14
+ "<|image_pad|>": 151655,
15
+ "<|object_ref_end|>": 151647,
16
+ "<|object_ref_start|>": 151646,
17
+ "<|quad_end|>": 151651,
18
+ "<|quad_start|>": 151650,
19
+ "<|repo_name|>": 151663,
20
+ "<|video_pad|>": 151656,
21
+ "<|vision_end|>": 151653,
22
+ "<|vision_pad|>": 151654,
23
+ "<|vision_start|>": 151652
24
+ }
checkpoint-500/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step500
checkpoint-500/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-500/special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|endoftext|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
checkpoint-500/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
3
+ size 11421896
checkpoint-500/tokenizer_config.json ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ }
181
+ },
182
+ "additional_special_tokens": [
183
+ "<|im_start|>",
184
+ "<|im_end|>",
185
+ "<|object_ref_start|>",
186
+ "<|object_ref_end|>",
187
+ "<|box_start|>",
188
+ "<|box_end|>",
189
+ "<|quad_start|>",
190
+ "<|quad_end|>",
191
+ "<|vision_start|>",
192
+ "<|vision_end|>",
193
+ "<|vision_pad|>",
194
+ "<|image_pad|>",
195
+ "<|video_pad|>"
196
+ ],
197
+ "bos_token": null,
198
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
199
+ "clean_up_tokenization_spaces": false,
200
+ "eos_token": "<|endoftext|>",
201
+ "errors": "replace",
202
+ "model_max_length": 131072,
203
+ "pad_token": "<|endoftext|>",
204
+ "padding_side": "right",
205
+ "split_special_tokens": false,
206
+ "tokenizer_class": "Qwen2Tokenizer",
207
+ "unk_token": null
208
+ }
checkpoint-500/trainer_state.json ADDED
@@ -0,0 +1,391 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.30140908748398765,
5
+ "eval_steps": 400,
6
+ "global_step": 500,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.006028181749679753,
13
+ "grad_norm": 0.38845974438826136,
14
+ "learning_rate": 1.0040160642570282e-06,
15
+ "loss": 1.6618,
16
+ "step": 10
17
+ },
18
+ {
19
+ "epoch": 0.012056363499359506,
20
+ "grad_norm": 0.255603405930248,
21
+ "learning_rate": 2.0080321285140564e-06,
22
+ "loss": 1.6698,
23
+ "step": 20
24
+ },
25
+ {
26
+ "epoch": 0.01808454524903926,
27
+ "grad_norm": 0.20116505722657768,
28
+ "learning_rate": 3.0120481927710846e-06,
29
+ "loss": 1.6264,
30
+ "step": 30
31
+ },
32
+ {
33
+ "epoch": 0.02411272699871901,
34
+ "grad_norm": 0.1795881732266397,
35
+ "learning_rate": 4.016064257028113e-06,
36
+ "loss": 1.6025,
37
+ "step": 40
38
+ },
39
+ {
40
+ "epoch": 0.030140908748398764,
41
+ "grad_norm": 0.14600421495766222,
42
+ "learning_rate": 5.020080321285141e-06,
43
+ "loss": 1.5584,
44
+ "step": 50
45
+ },
46
+ {
47
+ "epoch": 0.03616909049807852,
48
+ "grad_norm": 0.1170942466306718,
49
+ "learning_rate": 6.024096385542169e-06,
50
+ "loss": 1.5604,
51
+ "step": 60
52
+ },
53
+ {
54
+ "epoch": 0.04219727224775827,
55
+ "grad_norm": 0.2445974669666656,
56
+ "learning_rate": 7.028112449799197e-06,
57
+ "loss": 1.5057,
58
+ "step": 70
59
+ },
60
+ {
61
+ "epoch": 0.04822545399743802,
62
+ "grad_norm": 0.11238025351136724,
63
+ "learning_rate": 8.032128514056226e-06,
64
+ "loss": 1.4724,
65
+ "step": 80
66
+ },
67
+ {
68
+ "epoch": 0.05425363574711778,
69
+ "grad_norm": 0.13639577534070754,
70
+ "learning_rate": 9.036144578313253e-06,
71
+ "loss": 1.4962,
72
+ "step": 90
73
+ },
74
+ {
75
+ "epoch": 0.06028181749679753,
76
+ "grad_norm": 0.17113178431310286,
77
+ "learning_rate": 1.0040160642570281e-05,
78
+ "loss": 1.4765,
79
+ "step": 100
80
+ },
81
+ {
82
+ "epoch": 0.06630999924647728,
83
+ "grad_norm": 0.4795401637258333,
84
+ "learning_rate": 1.104417670682731e-05,
85
+ "loss": 1.4468,
86
+ "step": 110
87
+ },
88
+ {
89
+ "epoch": 0.07233818099615703,
90
+ "grad_norm": 0.13385762516900662,
91
+ "learning_rate": 1.2048192771084338e-05,
92
+ "loss": 1.4134,
93
+ "step": 120
94
+ },
95
+ {
96
+ "epoch": 0.07836636274583679,
97
+ "grad_norm": 0.12303707813666019,
98
+ "learning_rate": 1.3052208835341367e-05,
99
+ "loss": 1.4191,
100
+ "step": 130
101
+ },
102
+ {
103
+ "epoch": 0.08439454449551655,
104
+ "grad_norm": 0.10822073133399364,
105
+ "learning_rate": 1.4056224899598394e-05,
106
+ "loss": 1.397,
107
+ "step": 140
108
+ },
109
+ {
110
+ "epoch": 0.09042272624519629,
111
+ "grad_norm": 0.1109270134990499,
112
+ "learning_rate": 1.5060240963855424e-05,
113
+ "loss": 1.3818,
114
+ "step": 150
115
+ },
116
+ {
117
+ "epoch": 0.09645090799487605,
118
+ "grad_norm": 0.14622173134033867,
119
+ "learning_rate": 1.606425702811245e-05,
120
+ "loss": 1.4002,
121
+ "step": 160
122
+ },
123
+ {
124
+ "epoch": 0.1024790897445558,
125
+ "grad_norm": 0.10587626114414271,
126
+ "learning_rate": 1.706827309236948e-05,
127
+ "loss": 1.4123,
128
+ "step": 170
129
+ },
130
+ {
131
+ "epoch": 0.10850727149423556,
132
+ "grad_norm": 0.10302196814593138,
133
+ "learning_rate": 1.8072289156626505e-05,
134
+ "loss": 1.4016,
135
+ "step": 180
136
+ },
137
+ {
138
+ "epoch": 0.1145354532439153,
139
+ "grad_norm": 0.1359849724314843,
140
+ "learning_rate": 1.9076305220883535e-05,
141
+ "loss": 1.404,
142
+ "step": 190
143
+ },
144
+ {
145
+ "epoch": 0.12056363499359506,
146
+ "grad_norm": 0.10587622358885339,
147
+ "learning_rate": 2.0080321285140562e-05,
148
+ "loss": 1.4019,
149
+ "step": 200
150
+ },
151
+ {
152
+ "epoch": 0.1265918167432748,
153
+ "grad_norm": 0.15017595066321648,
154
+ "learning_rate": 2.1084337349397593e-05,
155
+ "loss": 1.393,
156
+ "step": 210
157
+ },
158
+ {
159
+ "epoch": 0.13261999849295456,
160
+ "grad_norm": 0.19475575142022897,
161
+ "learning_rate": 2.208835341365462e-05,
162
+ "loss": 1.3876,
163
+ "step": 220
164
+ },
165
+ {
166
+ "epoch": 0.1386481802426343,
167
+ "grad_norm": 0.12084095277263424,
168
+ "learning_rate": 2.309236947791165e-05,
169
+ "loss": 1.3916,
170
+ "step": 230
171
+ },
172
+ {
173
+ "epoch": 0.14467636199231407,
174
+ "grad_norm": 0.11857482977859173,
175
+ "learning_rate": 2.4096385542168677e-05,
176
+ "loss": 1.4056,
177
+ "step": 240
178
+ },
179
+ {
180
+ "epoch": 0.15070454374199382,
181
+ "grad_norm": 0.1403959719635503,
182
+ "learning_rate": 2.5100401606425704e-05,
183
+ "loss": 1.3935,
184
+ "step": 250
185
+ },
186
+ {
187
+ "epoch": 0.15673272549167358,
188
+ "grad_norm": 0.10800155257965392,
189
+ "learning_rate": 2.6104417670682734e-05,
190
+ "loss": 1.3826,
191
+ "step": 260
192
+ },
193
+ {
194
+ "epoch": 0.16276090724135334,
195
+ "grad_norm": 0.10598439909830581,
196
+ "learning_rate": 2.7108433734939758e-05,
197
+ "loss": 1.3999,
198
+ "step": 270
199
+ },
200
+ {
201
+ "epoch": 0.1687890889910331,
202
+ "grad_norm": 0.10753449693494475,
203
+ "learning_rate": 2.8112449799196788e-05,
204
+ "loss": 1.4047,
205
+ "step": 280
206
+ },
207
+ {
208
+ "epoch": 0.17481727074071282,
209
+ "grad_norm": 0.36718328659037996,
210
+ "learning_rate": 2.911646586345382e-05,
211
+ "loss": 1.3935,
212
+ "step": 290
213
+ },
214
+ {
215
+ "epoch": 0.18084545249039258,
216
+ "grad_norm": 0.10611900000479042,
217
+ "learning_rate": 3.012048192771085e-05,
218
+ "loss": 1.3736,
219
+ "step": 300
220
+ },
221
+ {
222
+ "epoch": 0.18687363424007233,
223
+ "grad_norm": 0.11901555220652378,
224
+ "learning_rate": 3.112449799196787e-05,
225
+ "loss": 1.3927,
226
+ "step": 310
227
+ },
228
+ {
229
+ "epoch": 0.1929018159897521,
230
+ "grad_norm": 0.118935148513695,
231
+ "learning_rate": 3.21285140562249e-05,
232
+ "loss": 1.3636,
233
+ "step": 320
234
+ },
235
+ {
236
+ "epoch": 0.19892999773943185,
237
+ "grad_norm": 0.1974545721831922,
238
+ "learning_rate": 3.313253012048193e-05,
239
+ "loss": 1.3892,
240
+ "step": 330
241
+ },
242
+ {
243
+ "epoch": 0.2049581794891116,
244
+ "grad_norm": 0.13145409772199562,
245
+ "learning_rate": 3.413654618473896e-05,
246
+ "loss": 1.3756,
247
+ "step": 340
248
+ },
249
+ {
250
+ "epoch": 0.21098636123879136,
251
+ "grad_norm": 0.11064380941915805,
252
+ "learning_rate": 3.5140562248995983e-05,
253
+ "loss": 1.3935,
254
+ "step": 350
255
+ },
256
+ {
257
+ "epoch": 0.21701454298847112,
258
+ "grad_norm": 0.12160423827639648,
259
+ "learning_rate": 3.614457831325301e-05,
260
+ "loss": 1.3698,
261
+ "step": 360
262
+ },
263
+ {
264
+ "epoch": 0.22304272473815084,
265
+ "grad_norm": 0.10349641889173723,
266
+ "learning_rate": 3.7148594377510044e-05,
267
+ "loss": 1.3771,
268
+ "step": 370
269
+ },
270
+ {
271
+ "epoch": 0.2290709064878306,
272
+ "grad_norm": 0.10682144059511894,
273
+ "learning_rate": 3.815261044176707e-05,
274
+ "loss": 1.3768,
275
+ "step": 380
276
+ },
277
+ {
278
+ "epoch": 0.23509908823751036,
279
+ "grad_norm": 0.11625245619819907,
280
+ "learning_rate": 3.91566265060241e-05,
281
+ "loss": 1.3795,
282
+ "step": 390
283
+ },
284
+ {
285
+ "epoch": 0.2411272699871901,
286
+ "grad_norm": 0.10327726962763091,
287
+ "learning_rate": 4.0160642570281125e-05,
288
+ "loss": 1.3987,
289
+ "step": 400
290
+ },
291
+ {
292
+ "epoch": 0.2411272699871901,
293
+ "eval_loss": 1.3548544645309448,
294
+ "eval_runtime": 148.2269,
295
+ "eval_samples_per_second": 7.239,
296
+ "eval_steps_per_second": 0.911,
297
+ "step": 400
298
+ },
299
+ {
300
+ "epoch": 0.24715545173686987,
301
+ "grad_norm": 0.10660530950921367,
302
+ "learning_rate": 4.116465863453816e-05,
303
+ "loss": 1.3886,
304
+ "step": 410
305
+ },
306
+ {
307
+ "epoch": 0.2531836334865496,
308
+ "grad_norm": 0.10405582985373843,
309
+ "learning_rate": 4.2168674698795186e-05,
310
+ "loss": 1.3645,
311
+ "step": 420
312
+ },
313
+ {
314
+ "epoch": 0.2592118152362294,
315
+ "grad_norm": 0.3318479326670041,
316
+ "learning_rate": 4.317269076305221e-05,
317
+ "loss": 1.3591,
318
+ "step": 430
319
+ },
320
+ {
321
+ "epoch": 0.2652399969859091,
322
+ "grad_norm": 0.10840544026201794,
323
+ "learning_rate": 4.417670682730924e-05,
324
+ "loss": 1.3805,
325
+ "step": 440
326
+ },
327
+ {
328
+ "epoch": 0.2712681787355889,
329
+ "grad_norm": 0.10730056620740543,
330
+ "learning_rate": 4.5180722891566266e-05,
331
+ "loss": 1.3888,
332
+ "step": 450
333
+ },
334
+ {
335
+ "epoch": 0.2772963604852686,
336
+ "grad_norm": 0.10699620793474768,
337
+ "learning_rate": 4.61847389558233e-05,
338
+ "loss": 1.3935,
339
+ "step": 460
340
+ },
341
+ {
342
+ "epoch": 0.2833245422349484,
343
+ "grad_norm": 0.10595493402596641,
344
+ "learning_rate": 4.718875502008032e-05,
345
+ "loss": 1.3659,
346
+ "step": 470
347
+ },
348
+ {
349
+ "epoch": 0.28935272398462814,
350
+ "grad_norm": 0.14234040947748414,
351
+ "learning_rate": 4.8192771084337354e-05,
352
+ "loss": 1.371,
353
+ "step": 480
354
+ },
355
+ {
356
+ "epoch": 0.29538090573430786,
357
+ "grad_norm": 0.1095349792774781,
358
+ "learning_rate": 4.919678714859438e-05,
359
+ "loss": 1.3647,
360
+ "step": 490
361
+ },
362
+ {
363
+ "epoch": 0.30140908748398765,
364
+ "grad_norm": 0.10655792946130023,
365
+ "learning_rate": 4.999997536857586e-05,
366
+ "loss": 1.3606,
367
+ "step": 500
368
+ }
369
+ ],
370
+ "logging_steps": 10,
371
+ "max_steps": 4974,
372
+ "num_input_tokens_seen": 0,
373
+ "num_train_epochs": 3,
374
+ "save_steps": 500,
375
+ "stateful_callbacks": {
376
+ "TrainerControl": {
377
+ "args": {
378
+ "should_epoch_stop": false,
379
+ "should_evaluate": false,
380
+ "should_log": false,
381
+ "should_save": true,
382
+ "should_training_stop": false
383
+ },
384
+ "attributes": {}
385
+ }
386
+ },
387
+ "total_flos": 840529663229952.0,
388
+ "train_batch_size": 1,
389
+ "trial_name": null,
390
+ "trial_params": null
391
+ }
checkpoint-500/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2923841ae243af669d09fc75f56460b83329158b7b6379ad1b1afd5c369cdb7a
3
+ size 7224
checkpoint-500/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-500/zero_to_fp32.py ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example:
14
+ # python zero_to_fp32.py . output_dir/
15
+ # or
16
+ # python zero_to_fp32.py . output_dir/ --safe_serialization
17
+
18
+ import argparse
19
+ import torch
20
+ import glob
21
+ import math
22
+ import os
23
+ import re
24
+ import json
25
+ from tqdm import tqdm
26
+ from collections import OrderedDict
27
+ from dataclasses import dataclass
28
+
29
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
30
+ # DeepSpeed data structures it has to be available in the current python environment.
31
+ from deepspeed.utils import logger
32
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
33
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
34
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
35
+
36
+
37
+ @dataclass
38
+ class zero_model_state:
39
+ buffers: dict()
40
+ param_shapes: dict()
41
+ shared_params: list
42
+ ds_version: int
43
+ frozen_param_shapes: dict()
44
+ frozen_param_fragments: dict()
45
+
46
+
47
+ debug = 0
48
+
49
+ # load to cpu
50
+ device = torch.device('cpu')
51
+
52
+
53
+ def atoi(text):
54
+ return int(text) if text.isdigit() else text
55
+
56
+
57
+ def natural_keys(text):
58
+ '''
59
+ alist.sort(key=natural_keys) sorts in human order
60
+ http://nedbatchelder.com/blog/200712/human_sorting.html
61
+ (See Toothy's implementation in the comments)
62
+ '''
63
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
64
+
65
+
66
+ def get_model_state_file(checkpoint_dir, zero_stage):
67
+ if not os.path.isdir(checkpoint_dir):
68
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
69
+
70
+ # there should be only one file
71
+ if zero_stage <= 2:
72
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
73
+ elif zero_stage == 3:
74
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
75
+
76
+ if not os.path.exists(file):
77
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
78
+
79
+ return file
80
+
81
+
82
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
83
+ # XXX: need to test that this simple glob rule works for multi-node setup too
84
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
85
+
86
+ if len(ckpt_files) == 0:
87
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
88
+
89
+ return ckpt_files
90
+
91
+
92
+ def get_optim_files(checkpoint_dir):
93
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
94
+
95
+
96
+ def get_model_state_files(checkpoint_dir):
97
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
98
+
99
+
100
+ def parse_model_states(files):
101
+ zero_model_states = []
102
+ for file in files:
103
+ state_dict = torch.load(file, map_location=device)
104
+
105
+ if BUFFER_NAMES not in state_dict:
106
+ raise ValueError(f"{file} is not a model state checkpoint")
107
+ buffer_names = state_dict[BUFFER_NAMES]
108
+ if debug:
109
+ print("Found buffers:", buffer_names)
110
+
111
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
112
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
113
+ param_shapes = state_dict[PARAM_SHAPES]
114
+
115
+ # collect parameters that are included in param_shapes
116
+ param_names = []
117
+ for s in param_shapes:
118
+ for name in s.keys():
119
+ param_names.append(name)
120
+
121
+ # update with frozen parameters
122
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
123
+ if frozen_param_shapes is not None:
124
+ if debug:
125
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
126
+ param_names += list(frozen_param_shapes.keys())
127
+
128
+ # handle shared params
129
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
130
+
131
+ ds_version = state_dict.get(DS_VERSION, None)
132
+
133
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
134
+
135
+ z_model_state = zero_model_state(buffers=buffers,
136
+ param_shapes=param_shapes,
137
+ shared_params=shared_params,
138
+ ds_version=ds_version,
139
+ frozen_param_shapes=frozen_param_shapes,
140
+ frozen_param_fragments=frozen_param_fragments)
141
+ zero_model_states.append(z_model_state)
142
+
143
+ return zero_model_states
144
+
145
+
146
+ def parse_optim_states(files, ds_checkpoint_dir):
147
+ total_files = len(files)
148
+ state_dicts = []
149
+ for f in files:
150
+ state_dict = torch.load(f, map_location=device)
151
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
152
+ # and also handle the case where it was already removed by another helper script
153
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
154
+ state_dicts.append(state_dict)
155
+
156
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
157
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
158
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
159
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
160
+
161
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
162
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
163
+ # use the max of the partition_count to get the dp world_size.
164
+
165
+ if type(world_size) is list:
166
+ world_size = max(world_size)
167
+
168
+ if world_size != total_files:
169
+ raise ValueError(
170
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
171
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
172
+ )
173
+
174
+ # the groups are named differently in each stage
175
+ if zero_stage <= 2:
176
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
177
+ elif zero_stage == 3:
178
+ fp32_groups_key = FP32_FLAT_GROUPS
179
+ else:
180
+ raise ValueError(f"unknown zero stage {zero_stage}")
181
+
182
+ if zero_stage <= 2:
183
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
184
+ elif zero_stage == 3:
185
+ # if there is more than one param group, there will be multiple flattened tensors - one
186
+ # flattened tensor per group - for simplicity merge them into a single tensor
187
+ #
188
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
189
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
190
+
191
+ fp32_flat_groups = [
192
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
193
+ ]
194
+
195
+ return zero_stage, world_size, fp32_flat_groups
196
+
197
+
198
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
199
+ """
200
+ Returns fp32 state_dict reconstructed from ds checkpoint
201
+
202
+ Args:
203
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
204
+
205
+ """
206
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
207
+
208
+ optim_files = get_optim_files(ds_checkpoint_dir)
209
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
210
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
211
+
212
+ model_files = get_model_state_files(ds_checkpoint_dir)
213
+
214
+ zero_model_states = parse_model_states(model_files)
215
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
216
+
217
+ if zero_stage <= 2:
218
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
219
+ exclude_frozen_parameters)
220
+ elif zero_stage == 3:
221
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
222
+ exclude_frozen_parameters)
223
+
224
+
225
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
226
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
227
+ return
228
+
229
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
230
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
231
+
232
+ if debug:
233
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
234
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
235
+
236
+ wanted_params = len(frozen_param_shapes)
237
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
238
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
239
+ print(f'Frozen params: Have {avail_numel} numels to process.')
240
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
241
+
242
+ total_params = 0
243
+ total_numel = 0
244
+ for name, shape in frozen_param_shapes.items():
245
+ total_params += 1
246
+ unpartitioned_numel = shape.numel()
247
+ total_numel += unpartitioned_numel
248
+
249
+ state_dict[name] = frozen_param_fragments[name]
250
+
251
+ if debug:
252
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
253
+
254
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
255
+
256
+
257
+ def _has_callable(obj, fn):
258
+ attr = getattr(obj, fn, None)
259
+ return callable(attr)
260
+
261
+
262
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
263
+ param_shapes = zero_model_states[0].param_shapes
264
+
265
+ # Reconstruction protocol:
266
+ #
267
+ # XXX: document this
268
+
269
+ if debug:
270
+ for i in range(world_size):
271
+ for j in range(len(fp32_flat_groups[0])):
272
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
273
+
274
+ # XXX: memory usage doubles here (zero2)
275
+ num_param_groups = len(fp32_flat_groups[0])
276
+ merged_single_partition_of_fp32_groups = []
277
+ for i in range(num_param_groups):
278
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
279
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
280
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
281
+ avail_numel = sum(
282
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
283
+
284
+ if debug:
285
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
286
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
287
+ # not asserting if there is a mismatch due to possible padding
288
+ print(f"Have {avail_numel} numels to process.")
289
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
290
+
291
+ # params
292
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
293
+ # out-of-core computing solution
294
+ total_numel = 0
295
+ total_params = 0
296
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
297
+ offset = 0
298
+ avail_numel = full_single_fp32_vector.numel()
299
+ for name, shape in shapes.items():
300
+
301
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
302
+ total_numel += unpartitioned_numel
303
+ total_params += 1
304
+
305
+ if debug:
306
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
307
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
308
+ offset += unpartitioned_numel
309
+
310
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
311
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
312
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
313
+ # live optimizer object, so we are checking that the numbers are within the right range
314
+ align_to = 2 * world_size
315
+
316
+ def zero2_align(x):
317
+ return align_to * math.ceil(x / align_to)
318
+
319
+ if debug:
320
+ print(f"original offset={offset}, avail_numel={avail_numel}")
321
+
322
+ offset = zero2_align(offset)
323
+ avail_numel = zero2_align(avail_numel)
324
+
325
+ if debug:
326
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
327
+
328
+ # Sanity check
329
+ if offset != avail_numel:
330
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
331
+
332
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
333
+
334
+
335
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
336
+ exclude_frozen_parameters):
337
+ state_dict = OrderedDict()
338
+
339
+ # buffers
340
+ buffers = zero_model_states[0].buffers
341
+ state_dict.update(buffers)
342
+ if debug:
343
+ print(f"added {len(buffers)} buffers")
344
+
345
+ if not exclude_frozen_parameters:
346
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
347
+
348
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
349
+
350
+ # recover shared parameters
351
+ for pair in zero_model_states[0].shared_params:
352
+ if pair[1] in state_dict:
353
+ state_dict[pair[0]] = state_dict[pair[1]]
354
+
355
+ return state_dict
356
+
357
+
358
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
359
+ remainder = unpartitioned_numel % world_size
360
+ padding_numel = (world_size - remainder) if remainder else 0
361
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
362
+ return partitioned_numel, padding_numel
363
+
364
+
365
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
366
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
367
+ return
368
+
369
+ if debug:
370
+ for i in range(world_size):
371
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
372
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
373
+
374
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
375
+ wanted_params = len(frozen_param_shapes)
376
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
377
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
378
+ print(f'Frozen params: Have {avail_numel} numels to process.')
379
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
380
+
381
+ total_params = 0
382
+ total_numel = 0
383
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
384
+ total_params += 1
385
+ unpartitioned_numel = shape.numel()
386
+ total_numel += unpartitioned_numel
387
+
388
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
389
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
390
+
391
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
392
+
393
+ if debug:
394
+ print(
395
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
396
+ )
397
+
398
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
399
+
400
+
401
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
402
+ param_shapes = zero_model_states[0].param_shapes
403
+ avail_numel = fp32_flat_groups[0].numel() * world_size
404
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
405
+ # param, re-consolidating each param, while dealing with padding if any
406
+
407
+ # merge list of dicts, preserving order
408
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
409
+
410
+ if debug:
411
+ for i in range(world_size):
412
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
413
+
414
+ wanted_params = len(param_shapes)
415
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
416
+ # not asserting if there is a mismatch due to possible padding
417
+ avail_numel = fp32_flat_groups[0].numel() * world_size
418
+ print(f"Trainable params: Have {avail_numel} numels to process.")
419
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
420
+
421
+ # params
422
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
423
+ # out-of-core computing solution
424
+ offset = 0
425
+ total_numel = 0
426
+ total_params = 0
427
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering Sharded Weights'):
428
+ unpartitioned_numel = shape.numel()
429
+ total_numel += unpartitioned_numel
430
+ total_params += 1
431
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
432
+
433
+ if debug:
434
+ print(
435
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
436
+ )
437
+
438
+ # XXX: memory usage doubles here
439
+ state_dict[name] = torch.cat(
440
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
441
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
442
+ offset += partitioned_numel
443
+
444
+ offset *= world_size
445
+
446
+ # Sanity check
447
+ if offset != avail_numel:
448
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
449
+
450
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
451
+
452
+
453
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
454
+ exclude_frozen_parameters):
455
+ state_dict = OrderedDict()
456
+
457
+ # buffers
458
+ buffers = zero_model_states[0].buffers
459
+ state_dict.update(buffers)
460
+ if debug:
461
+ print(f"added {len(buffers)} buffers")
462
+
463
+ if not exclude_frozen_parameters:
464
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
465
+
466
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
467
+
468
+ # recover shared parameters
469
+ for pair in zero_model_states[0].shared_params:
470
+ if pair[1] in state_dict:
471
+ state_dict[pair[0]] = state_dict[pair[1]]
472
+
473
+ return state_dict
474
+
475
+
476
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None, exclude_frozen_parameters=False):
477
+ """
478
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
479
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
480
+ via a model hub.
481
+
482
+ Args:
483
+ - ``checkpoint_dir``: path to the desired checkpoint folder
484
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
485
+ - ``exclude_frozen_parameters``: exclude frozen parameters
486
+
487
+ Returns:
488
+ - pytorch ``state_dict``
489
+
490
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
491
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
492
+ the checkpoint.
493
+
494
+ A typical usage might be ::
495
+
496
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
497
+ # do the training and checkpoint saving
498
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
499
+ model = model.cpu() # move to cpu
500
+ model.load_state_dict(state_dict)
501
+ # submit to model hub or save the model to share with others
502
+
503
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
504
+ application. i.e. you will need to re-initialize the deepspeed engine, since
505
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
506
+
507
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
508
+
509
+ """
510
+ if tag is None:
511
+ latest_path = os.path.join(checkpoint_dir, 'latest')
512
+ if os.path.isfile(latest_path):
513
+ with open(latest_path, 'r') as fd:
514
+ tag = fd.read().strip()
515
+ else:
516
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
517
+
518
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
519
+
520
+ if not os.path.isdir(ds_checkpoint_dir):
521
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
522
+
523
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
524
+
525
+
526
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
527
+ output_dir,
528
+ max_shard_size="5GB",
529
+ safe_serialization=False,
530
+ tag=None,
531
+ exclude_frozen_parameters=False):
532
+ """
533
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
534
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
535
+
536
+ Args:
537
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
538
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
539
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
540
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
541
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
542
+ - ``exclude_frozen_parameters``: exclude frozen parameters
543
+ """
544
+ # Dependency pre-check
545
+ if safe_serialization:
546
+ try:
547
+ from safetensors.torch import save_file
548
+ except ImportError:
549
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
550
+ raise
551
+ if max_shard_size is not None:
552
+ try:
553
+ from huggingface_hub import split_torch_state_dict_into_shards
554
+ except ImportError:
555
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
556
+ raise
557
+
558
+ # Convert zero checkpoint to state_dict
559
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag, exclude_frozen_parameters)
560
+
561
+ # Shard the model if it is too big.
562
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
563
+ if max_shard_size is not None:
564
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
565
+ state_dict_split = split_torch_state_dict_into_shards(state_dict,
566
+ filename_pattern=filename_pattern,
567
+ max_shard_size=max_shard_size)
568
+ else:
569
+ from collections import namedtuple
570
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
571
+ state_dict_split = StateDictSplit(is_sharded=False,
572
+ filename_to_tensors={weights_name: list(state_dict.keys())})
573
+
574
+ # Save the model
575
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
576
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
577
+ shard = {tensor: state_dict[tensor].contiguous() for tensor in tensors}
578
+ output_path = os.path.join(output_dir, shard_file)
579
+ if safe_serialization:
580
+ save_file(shard, output_path, metadata={"format": "pt"})
581
+ else:
582
+ torch.save(shard, output_path)
583
+
584
+ # Save index if sharded
585
+ if state_dict_split.is_sharded:
586
+ index = {
587
+ "metadata": state_dict_split.metadata,
588
+ "weight_map": state_dict_split.tensor_to_filename,
589
+ }
590
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
591
+ save_index_file = os.path.join(output_dir, save_index_file)
592
+ with open(save_index_file, "w", encoding="utf-8") as f:
593
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
594
+ f.write(content)
595
+
596
+
597
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
598
+ """
599
+ 1. Put the provided model to cpu
600
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
601
+ 3. Load it into the provided model
602
+
603
+ Args:
604
+ - ``model``: the model object to update
605
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
606
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
607
+
608
+ Returns:
609
+ - ``model`: modified model
610
+
611
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
612
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
613
+ conveniently placed for you in the checkpoint folder.
614
+
615
+ A typical usage might be ::
616
+
617
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
618
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
619
+ # submit to model hub or save the model to share with others
620
+
621
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
622
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
623
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
624
+
625
+ """
626
+ logger.info(f"Extracting fp32 weights")
627
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
628
+
629
+ logger.info(f"Overwriting model with fp32 weights")
630
+ model = model.cpu()
631
+ model.load_state_dict(state_dict, strict=False)
632
+
633
+ return model
634
+
635
+
636
+ if __name__ == "__main__":
637
+ parser = argparse.ArgumentParser()
638
+ parser.add_argument("checkpoint_dir",
639
+ type=str,
640
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
641
+ parser.add_argument("output_dir",
642
+ type=str,
643
+ help="directory to the pytorch fp32 state_dict output files"
644
+ "(e.g. path/checkpoint-12-output/)")
645
+ parser.add_argument(
646
+ "--max_shard_size",
647
+ type=str,
648
+ default="5GB",
649
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
650
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
651
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
652
+ "without CPU OOM issues.")
653
+ parser.add_argument(
654
+ "--safe_serialization",
655
+ default=False,
656
+ action='store_true',
657
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
658
+ parser.add_argument("-t",
659
+ "--tag",
660
+ type=str,
661
+ default=None,
662
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
663
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
664
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
665
+ args = parser.parse_args()
666
+
667
+ debug = args.debug
668
+
669
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
670
+ args.output_dir,
671
+ max_shard_size=args.max_shard_size,
672
+ safe_serialization=args.safe_serialization,
673
+ tag=args.tag,
674
+ exclude_frozen_parameters=args.exclude_frozen_parameters)
trainer_log.jsonl CHANGED
@@ -151,3 +151,38 @@
151
  {"current_steps": 1480, "total_steps": 4974, "loss": 1.167, "lr": 4.429321860261797e-05, "epoch": 0.8921708989526034, "percentage": 29.75, "elapsed_time": "10:19:03", "remaining_time": "1 day, 0:21:29"}
152
  {"current_steps": 1490, "total_steps": 4974, "loss": 1.1532, "lr": 4.418115462098624e-05, "epoch": 0.8981990807022832, "percentage": 29.96, "elapsed_time": "10:23:10", "remaining_time": "1 day, 0:17:08"}
153
  {"current_steps": 1500, "total_steps": 4974, "loss": 1.1206, "lr": 4.4068145724768324e-05, "epoch": 0.9042272624519629, "percentage": 30.16, "elapsed_time": "10:27:17", "remaining_time": "1 day, 0:12:47"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  {"current_steps": 1480, "total_steps": 4974, "loss": 1.167, "lr": 4.429321860261797e-05, "epoch": 0.8921708989526034, "percentage": 29.75, "elapsed_time": "10:19:03", "remaining_time": "1 day, 0:21:29"}
152
  {"current_steps": 1490, "total_steps": 4974, "loss": 1.1532, "lr": 4.418115462098624e-05, "epoch": 0.8981990807022832, "percentage": 29.96, "elapsed_time": "10:23:10", "remaining_time": "1 day, 0:17:08"}
153
  {"current_steps": 1500, "total_steps": 4974, "loss": 1.1206, "lr": 4.4068145724768324e-05, "epoch": 0.9042272624519629, "percentage": 30.16, "elapsed_time": "10:27:17", "remaining_time": "1 day, 0:12:47"}
154
+ {"current_steps": 1510, "total_steps": 4974, "loss": 1.1371, "lr": 4.395419748108241e-05, "epoch": 0.9102554442016427, "percentage": 30.36, "elapsed_time": "10:33:44", "remaining_time": "1 day, 0:13:49"}
155
+ {"current_steps": 1520, "total_steps": 4974, "loss": 1.1286, "lr": 4.383931550332141e-05, "epoch": 0.9162836259513224, "percentage": 30.56, "elapsed_time": "10:37:50", "remaining_time": "1 day, 0:09:25"}
156
+ {"current_steps": 1530, "total_steps": 4974, "loss": 1.1195, "lr": 4.3723505450876454e-05, "epoch": 0.9223118077010022, "percentage": 30.76, "elapsed_time": "10:41:57", "remaining_time": "1 day, 0:05:02"}
157
+ {"current_steps": 1540, "total_steps": 4974, "loss": 1.1548, "lr": 4.360677302885812e-05, "epoch": 0.928339989450682, "percentage": 30.96, "elapsed_time": "10:46:04", "remaining_time": "1 day, 0:00:39"}
158
+ {"current_steps": 1550, "total_steps": 4974, "loss": 1.1395, "lr": 4.3489123987815325e-05, "epoch": 0.9343681712003616, "percentage": 31.16, "elapsed_time": "10:50:10", "remaining_time": "23:56:15"}
159
+ {"current_steps": 1560, "total_steps": 4974, "loss": 1.1347, "lr": 4.3370564123452094e-05, "epoch": 0.9403963529500414, "percentage": 31.36, "elapsed_time": "10:54:17", "remaining_time": "23:51:53"}
160
+ {"current_steps": 1570, "total_steps": 4974, "loss": 1.1571, "lr": 4.325109927634202e-05, "epoch": 0.9464245346997212, "percentage": 31.56, "elapsed_time": "10:58:24", "remaining_time": "23:47:32"}
161
+ {"current_steps": 1580, "total_steps": 4974, "loss": 1.1436, "lr": 4.313073533164055e-05, "epoch": 0.952452716449401, "percentage": 31.77, "elapsed_time": "11:02:31", "remaining_time": "23:43:10"}
162
+ {"current_steps": 1590, "total_steps": 4974, "loss": 1.1718, "lr": 4.300947821879507e-05, "epoch": 0.9584808981990807, "percentage": 31.97, "elapsed_time": "11:06:39", "remaining_time": "23:38:51"}
163
+ {"current_steps": 1600, "total_steps": 4974, "loss": 1.1382, "lr": 4.288733391125278e-05, "epoch": 0.9645090799487605, "percentage": 32.17, "elapsed_time": "11:10:47", "remaining_time": "23:34:32"}
164
+ {"current_steps": 1600, "total_steps": 4974, "eval_loss": 1.105757713317871, "epoch": 0.9645090799487605, "percentage": 32.17, "elapsed_time": "11:13:16", "remaining_time": "23:39:46"}
165
+ {"current_steps": 1610, "total_steps": 4974, "loss": 1.1193, "lr": 4.276430842616646e-05, "epoch": 0.9705372616984402, "percentage": 32.37, "elapsed_time": "11:17:22", "remaining_time": "23:35:20"}
166
+ {"current_steps": 1620, "total_steps": 4974, "loss": 1.1415, "lr": 4.264040782409804e-05, "epoch": 0.9765654434481199, "percentage": 32.57, "elapsed_time": "11:21:30", "remaining_time": "23:30:58"}
167
+ {"current_steps": 1630, "total_steps": 4974, "loss": 1.1161, "lr": 4.251563820872002e-05, "epoch": 0.9825936251977997, "percentage": 32.77, "elapsed_time": "11:25:37", "remaining_time": "23:26:34"}
168
+ {"current_steps": 1640, "total_steps": 4974, "loss": 1.1219, "lr": 4.2390005726514815e-05, "epoch": 0.9886218069474795, "percentage": 32.97, "elapsed_time": "11:29:43", "remaining_time": "23:22:10"}
169
+ {"current_steps": 1650, "total_steps": 4974, "loss": 1.1217, "lr": 4.226351656647194e-05, "epoch": 0.9946499886971593, "percentage": 33.17, "elapsed_time": "11:33:50", "remaining_time": "23:17:47"}
170
+ {"current_steps": 1660, "total_steps": 4974, "loss": 1.1582, "lr": 4.2136176959783155e-05, "epoch": 1.001130284078065, "percentage": 33.37, "elapsed_time": "11:37:58", "remaining_time": "23:13:25"}
171
+ {"current_steps": 1670, "total_steps": 4974, "loss": 1.054, "lr": 4.2007993179535446e-05, "epoch": 1.0071584658277446, "percentage": 33.57, "elapsed_time": "11:42:05", "remaining_time": "23:09:02"}
172
+ {"current_steps": 1680, "total_steps": 4974, "loss": 1.0657, "lr": 4.1878971540402044e-05, "epoch": 1.0131866475774245, "percentage": 33.78, "elapsed_time": "11:46:11", "remaining_time": "23:04:39"}
173
+ {"current_steps": 1690, "total_steps": 4974, "loss": 1.0239, "lr": 4.174911839833135e-05, "epoch": 1.0192148293271042, "percentage": 33.98, "elapsed_time": "11:50:18", "remaining_time": "23:00:15"}
174
+ {"current_steps": 1700, "total_steps": 4974, "loss": 1.0504, "lr": 4.1618440150233786e-05, "epoch": 1.025243011076784, "percentage": 34.18, "elapsed_time": "11:54:25", "remaining_time": "22:55:54"}
175
+ {"current_steps": 1710, "total_steps": 4974, "loss": 1.0604, "lr": 4.148694323366668e-05, "epoch": 1.0312711928264637, "percentage": 34.38, "elapsed_time": "11:58:32", "remaining_time": "22:51:31"}
176
+ {"current_steps": 1720, "total_steps": 4974, "loss": 1.0551, "lr": 4.135463412651717e-05, "epoch": 1.0372993745761434, "percentage": 34.58, "elapsed_time": "12:02:38", "remaining_time": "22:47:08"}
177
+ {"current_steps": 1730, "total_steps": 4974, "loss": 1.0581, "lr": 4.122151934668303e-05, "epoch": 1.0433275563258233, "percentage": 34.78, "elapsed_time": "12:06:45", "remaining_time": "22:42:46"}
178
+ {"current_steps": 1740, "total_steps": 4974, "loss": 1.0303, "lr": 4.108760545175163e-05, "epoch": 1.049355738075503, "percentage": 34.98, "elapsed_time": "12:10:52", "remaining_time": "22:38:25"}
179
+ {"current_steps": 1750, "total_steps": 4974, "loss": 1.0619, "lr": 4.095289903867685e-05, "epoch": 1.0553839198251826, "percentage": 35.18, "elapsed_time": "12:14:59", "remaining_time": "22:34:04"}
180
+ {"current_steps": 1760, "total_steps": 4974, "loss": 1.0266, "lr": 4.081740674345414e-05, "epoch": 1.0614121015748625, "percentage": 35.38, "elapsed_time": "12:19:06", "remaining_time": "22:29:43"}
181
+ {"current_steps": 1770, "total_steps": 4974, "loss": 1.0639, "lr": 4.068113524079358e-05, "epoch": 1.0674402833245422, "percentage": 35.59, "elapsed_time": "12:23:13", "remaining_time": "22:25:22"}
182
+ {"current_steps": 1780, "total_steps": 4974, "loss": 1.0521, "lr": 4.0544091243791064e-05, "epoch": 1.073468465074222, "percentage": 35.79, "elapsed_time": "12:27:21", "remaining_time": "22:21:02"}
183
+ {"current_steps": 1790, "total_steps": 4974, "loss": 1.0483, "lr": 4.040628150359761e-05, "epoch": 1.0794966468239018, "percentage": 35.99, "elapsed_time": "12:31:27", "remaining_time": "22:16:40"}
184
+ {"current_steps": 1800, "total_steps": 4974, "loss": 1.0185, "lr": 4.026771280908681e-05, "epoch": 1.0855248285735815, "percentage": 36.19, "elapsed_time": "12:35:34", "remaining_time": "22:12:20"}
185
+ {"current_steps": 1810, "total_steps": 4974, "loss": 1.0469, "lr": 4.0128391986520336e-05, "epoch": 1.0915530103232611, "percentage": 36.39, "elapsed_time": "12:39:42", "remaining_time": "22:08:00"}
186
+ {"current_steps": 1820, "total_steps": 4974, "loss": 1.0388, "lr": 3.998832589921167e-05, "epoch": 1.097581192072941, "percentage": 36.59, "elapsed_time": "12:43:52", "remaining_time": "22:03:46"}
187
+ {"current_steps": 1830, "total_steps": 4974, "loss": 1.0556, "lr": 3.9847521447188034e-05, "epoch": 1.1036093738226207, "percentage": 36.79, "elapsed_time": "12:48:03", "remaining_time": "21:59:33"}
188
+ {"current_steps": 1840, "total_steps": 4974, "loss": 1.0297, "lr": 3.970598556685045e-05, "epoch": 1.1096375555723006, "percentage": 36.99, "elapsed_time": "12:52:11", "remaining_time": "21:55:14"}
upload.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import HfApi
2
+ api = HfApi()
3
+
4
+ # Upload all the content from the local folder to your remote Space.
5
+ # By default, files are uploaded at the root of the repo
6
+ api.upload_folder(
7
+ folder_path="./",
8
+ repo_id="sumuks/qwen2.5-72b-utility-evaluator-r128",
9
+ repo_type="model",
10
+ ignore_patterns=["*.pt", "*.pth"],
11
+ )