Asteris commited on
Commit
6f17105
·
verified ·
1 Parent(s): 12a0411

Upload 16 files

Browse files
README.md CHANGED
@@ -1,3 +1,202 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen2.5-7B
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.13.2
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-7B",
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.05,
15
+ "megatron_config": null,
16
+ "megatron_core": "megatron.core",
17
+ "modules_to_save": null,
18
+ "peft_type": "LORA",
19
+ "r": 64,
20
+ "rank_pattern": {},
21
+ "revision": null,
22
+ "target_modules": [
23
+ "down_proj",
24
+ "q_proj",
25
+ "o_proj",
26
+ "v_proj",
27
+ "up_proj",
28
+ "gate_proj",
29
+ "k_proj"
30
+ ],
31
+ "task_type": "CAUSAL_LM",
32
+ "use_dora": false,
33
+ "use_rslora": false
34
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78ecf58e6042ef5bb264de1efdb5a697a5f3d058311fee824b2f33e016044efe
3
+ size 323014168
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
+ }
global_step3750/mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3fe5d301fbdf6ea1a5a6a59bec25a8580ad325dbe3933e162572c1778ca7224
3
+ size 328967600
global_step3750/zero_pp_rank_0_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22cfcebfe678d3c231d351e85bfba20e327b9b18598bdf615a748533542893db
3
+ size 1937815469
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step3750
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98b76c8287641de7cc96e56274701d828e2a821d61b87e77cff3fb4cd172bc77
3
+ size 14244
special_tokens_map.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": "<|endoftext|>"
25
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_eos_token": true,
4
+ "add_prefix_space": false,
5
+ "added_tokens_decoder": {
6
+ "151643": {
7
+ "content": "<|endoftext|>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "151644": {
15
+ "content": "<|im_start|>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "151645": {
23
+ "content": "<|im_end|>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ },
30
+ "151646": {
31
+ "content": "<|object_ref_start|>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false,
36
+ "special": true
37
+ },
38
+ "151647": {
39
+ "content": "<|object_ref_end|>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false,
44
+ "special": true
45
+ },
46
+ "151648": {
47
+ "content": "<|box_start|>",
48
+ "lstrip": false,
49
+ "normalized": false,
50
+ "rstrip": false,
51
+ "single_word": false,
52
+ "special": true
53
+ },
54
+ "151649": {
55
+ "content": "<|box_end|>",
56
+ "lstrip": false,
57
+ "normalized": false,
58
+ "rstrip": false,
59
+ "single_word": false,
60
+ "special": true
61
+ },
62
+ "151650": {
63
+ "content": "<|quad_start|>",
64
+ "lstrip": false,
65
+ "normalized": false,
66
+ "rstrip": false,
67
+ "single_word": false,
68
+ "special": true
69
+ },
70
+ "151651": {
71
+ "content": "<|quad_end|>",
72
+ "lstrip": false,
73
+ "normalized": false,
74
+ "rstrip": false,
75
+ "single_word": false,
76
+ "special": true
77
+ },
78
+ "151652": {
79
+ "content": "<|vision_start|>",
80
+ "lstrip": false,
81
+ "normalized": false,
82
+ "rstrip": false,
83
+ "single_word": false,
84
+ "special": true
85
+ },
86
+ "151653": {
87
+ "content": "<|vision_end|>",
88
+ "lstrip": false,
89
+ "normalized": false,
90
+ "rstrip": false,
91
+ "single_word": false,
92
+ "special": true
93
+ },
94
+ "151654": {
95
+ "content": "<|vision_pad|>",
96
+ "lstrip": false,
97
+ "normalized": false,
98
+ "rstrip": false,
99
+ "single_word": false,
100
+ "special": true
101
+ },
102
+ "151655": {
103
+ "content": "<|image_pad|>",
104
+ "lstrip": false,
105
+ "normalized": false,
106
+ "rstrip": false,
107
+ "single_word": false,
108
+ "special": true
109
+ },
110
+ "151656": {
111
+ "content": "<|video_pad|>",
112
+ "lstrip": false,
113
+ "normalized": false,
114
+ "rstrip": false,
115
+ "single_word": false,
116
+ "special": true
117
+ },
118
+ "151657": {
119
+ "content": "<tool_call>",
120
+ "lstrip": false,
121
+ "normalized": false,
122
+ "rstrip": false,
123
+ "single_word": false,
124
+ "special": false
125
+ },
126
+ "151658": {
127
+ "content": "</tool_call>",
128
+ "lstrip": false,
129
+ "normalized": false,
130
+ "rstrip": false,
131
+ "single_word": false,
132
+ "special": false
133
+ },
134
+ "151659": {
135
+ "content": "<|fim_prefix|>",
136
+ "lstrip": false,
137
+ "normalized": false,
138
+ "rstrip": false,
139
+ "single_word": false,
140
+ "special": false
141
+ },
142
+ "151660": {
143
+ "content": "<|fim_middle|>",
144
+ "lstrip": false,
145
+ "normalized": false,
146
+ "rstrip": false,
147
+ "single_word": false,
148
+ "special": false
149
+ },
150
+ "151661": {
151
+ "content": "<|fim_suffix|>",
152
+ "lstrip": false,
153
+ "normalized": false,
154
+ "rstrip": false,
155
+ "single_word": false,
156
+ "special": false
157
+ },
158
+ "151662": {
159
+ "content": "<|fim_pad|>",
160
+ "lstrip": false,
161
+ "normalized": false,
162
+ "rstrip": false,
163
+ "single_word": false,
164
+ "special": false
165
+ },
166
+ "151663": {
167
+ "content": "<|repo_name|>",
168
+ "lstrip": false,
169
+ "normalized": false,
170
+ "rstrip": false,
171
+ "single_word": false,
172
+ "special": false
173
+ },
174
+ "151664": {
175
+ "content": "<|file_sep|>",
176
+ "lstrip": false,
177
+ "normalized": false,
178
+ "rstrip": false,
179
+ "single_word": false,
180
+ "special": false
181
+ }
182
+ },
183
+ "additional_special_tokens": [
184
+ "<|im_start|>",
185
+ "<|im_end|>",
186
+ "<|object_ref_start|>",
187
+ "<|object_ref_end|>",
188
+ "<|box_start|>",
189
+ "<|box_end|>",
190
+ "<|quad_start|>",
191
+ "<|quad_end|>",
192
+ "<|vision_start|>",
193
+ "<|vision_end|>",
194
+ "<|vision_pad|>",
195
+ "<|image_pad|>",
196
+ "<|video_pad|>"
197
+ ],
198
+ "bos_token": null,
199
+ "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",
200
+ "clean_up_tokenization_spaces": false,
201
+ "eos_token": "<|endoftext|>",
202
+ "errors": "replace",
203
+ "model_max_length": 131072,
204
+ "pad_token": "<|endoftext|>",
205
+ "padding_side": "left",
206
+ "split_special_tokens": false,
207
+ "tokenizer_class": "Qwen2Tokenizer",
208
+ "unk_token": null
209
+ }
trainer_state.json ADDED
@@ -0,0 +1,1542 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.07284240787863483,
5
+ "eval_steps": 75,
6
+ "global_step": 1875,
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.0003884928420193858,
13
+ "grad_norm": 0.49890583753585815,
14
+ "learning_rate": 7.759200756309999e-05,
15
+ "loss": 1.8971,
16
+ "step": 10
17
+ },
18
+ {
19
+ "epoch": 0.0007769856840387716,
20
+ "grad_norm": 1.6535608768463135,
21
+ "learning_rate": 0.0001,
22
+ "loss": 1.6661,
23
+ "step": 20
24
+ },
25
+ {
26
+ "epoch": 0.0011654785260581573,
27
+ "grad_norm": 1.0714327096939087,
28
+ "learning_rate": 0.0001,
29
+ "loss": 1.4684,
30
+ "step": 30
31
+ },
32
+ {
33
+ "epoch": 0.0015539713680775432,
34
+ "grad_norm": 0.6442272067070007,
35
+ "learning_rate": 0.0001,
36
+ "loss": 1.5553,
37
+ "step": 40
38
+ },
39
+ {
40
+ "epoch": 0.0019424642100969289,
41
+ "grad_norm": 0.818639874458313,
42
+ "learning_rate": 0.0001,
43
+ "loss": 1.5007,
44
+ "step": 50
45
+ },
46
+ {
47
+ "epoch": 0.0023309570521163146,
48
+ "grad_norm": 1.3463096618652344,
49
+ "learning_rate": 0.0001,
50
+ "loss": 1.2678,
51
+ "step": 60
52
+ },
53
+ {
54
+ "epoch": 0.0027194498941357005,
55
+ "grad_norm": 0.8409688472747803,
56
+ "learning_rate": 0.0001,
57
+ "loss": 1.4836,
58
+ "step": 70
59
+ },
60
+ {
61
+ "epoch": 0.0029136963151453936,
62
+ "eval_loss": 1.4955415725708008,
63
+ "eval_runtime": 328.1939,
64
+ "eval_samples_per_second": 1.587,
65
+ "eval_steps_per_second": 1.587,
66
+ "step": 75
67
+ },
68
+ {
69
+ "epoch": 0.0031079427361550864,
70
+ "grad_norm": 0.49311453104019165,
71
+ "learning_rate": 0.0001,
72
+ "loss": 1.5626,
73
+ "step": 80
74
+ },
75
+ {
76
+ "epoch": 0.0034964355781744723,
77
+ "grad_norm": 0.5505372881889343,
78
+ "learning_rate": 0.0001,
79
+ "loss": 1.4427,
80
+ "step": 90
81
+ },
82
+ {
83
+ "epoch": 0.0038849284201938577,
84
+ "grad_norm": 1.1296964883804321,
85
+ "learning_rate": 0.0001,
86
+ "loss": 1.4702,
87
+ "step": 100
88
+ },
89
+ {
90
+ "epoch": 0.004273421262213244,
91
+ "grad_norm": 1.38261878490448,
92
+ "learning_rate": 0.0001,
93
+ "loss": 1.5806,
94
+ "step": 110
95
+ },
96
+ {
97
+ "epoch": 0.004661914104232629,
98
+ "grad_norm": 0.5213516354560852,
99
+ "learning_rate": 0.0001,
100
+ "loss": 1.4675,
101
+ "step": 120
102
+ },
103
+ {
104
+ "epoch": 0.0050504069462520155,
105
+ "grad_norm": 2.93784761428833,
106
+ "learning_rate": 0.0001,
107
+ "loss": 1.6413,
108
+ "step": 130
109
+ },
110
+ {
111
+ "epoch": 0.005438899788271401,
112
+ "grad_norm": 0.6772735118865967,
113
+ "learning_rate": 0.0001,
114
+ "loss": 1.2942,
115
+ "step": 140
116
+ },
117
+ {
118
+ "epoch": 0.005827392630290787,
119
+ "grad_norm": 1.1066700220108032,
120
+ "learning_rate": 0.0001,
121
+ "loss": 1.4082,
122
+ "step": 150
123
+ },
124
+ {
125
+ "epoch": 0.005827392630290787,
126
+ "eval_loss": 1.4717903137207031,
127
+ "eval_runtime": 419.3037,
128
+ "eval_samples_per_second": 1.243,
129
+ "eval_steps_per_second": 1.243,
130
+ "step": 150
131
+ },
132
+ {
133
+ "epoch": 0.006215885472310173,
134
+ "grad_norm": 0.5077598690986633,
135
+ "learning_rate": 0.0001,
136
+ "loss": 1.6572,
137
+ "step": 160
138
+ },
139
+ {
140
+ "epoch": 0.006604378314329558,
141
+ "grad_norm": 0.5666481256484985,
142
+ "learning_rate": 0.0001,
143
+ "loss": 1.7344,
144
+ "step": 170
145
+ },
146
+ {
147
+ "epoch": 0.0069928711563489445,
148
+ "grad_norm": 0.7042965888977051,
149
+ "learning_rate": 0.0001,
150
+ "loss": 1.3634,
151
+ "step": 180
152
+ },
153
+ {
154
+ "epoch": 0.00738136399836833,
155
+ "grad_norm": 0.6379776000976562,
156
+ "learning_rate": 0.0001,
157
+ "loss": 1.6191,
158
+ "step": 190
159
+ },
160
+ {
161
+ "epoch": 0.0077698568403877155,
162
+ "grad_norm": 0.7309342622756958,
163
+ "learning_rate": 0.0001,
164
+ "loss": 1.2186,
165
+ "step": 200
166
+ },
167
+ {
168
+ "epoch": 0.008158349682407102,
169
+ "grad_norm": 1.4138643741607666,
170
+ "learning_rate": 0.0001,
171
+ "loss": 1.5201,
172
+ "step": 210
173
+ },
174
+ {
175
+ "epoch": 0.008546842524426487,
176
+ "grad_norm": 1.3856728076934814,
177
+ "learning_rate": 0.0001,
178
+ "loss": 1.4056,
179
+ "step": 220
180
+ },
181
+ {
182
+ "epoch": 0.00874108894543618,
183
+ "eval_loss": 1.473658800125122,
184
+ "eval_runtime": 413.7612,
185
+ "eval_samples_per_second": 1.259,
186
+ "eval_steps_per_second": 1.259,
187
+ "step": 225
188
+ },
189
+ {
190
+ "epoch": 0.008935335366445873,
191
+ "grad_norm": 1.1668083667755127,
192
+ "learning_rate": 0.0001,
193
+ "loss": 1.5261,
194
+ "step": 230
195
+ },
196
+ {
197
+ "epoch": 0.009323828208465258,
198
+ "grad_norm": 0.719367265701294,
199
+ "learning_rate": 0.0001,
200
+ "loss": 1.4151,
201
+ "step": 240
202
+ },
203
+ {
204
+ "epoch": 0.009712321050484645,
205
+ "grad_norm": 0.7443403005599976,
206
+ "learning_rate": 0.0001,
207
+ "loss": 1.3723,
208
+ "step": 250
209
+ },
210
+ {
211
+ "epoch": 0.010100813892504031,
212
+ "grad_norm": 0.8915978670120239,
213
+ "learning_rate": 0.0001,
214
+ "loss": 1.5165,
215
+ "step": 260
216
+ },
217
+ {
218
+ "epoch": 0.010489306734523416,
219
+ "grad_norm": 0.7369945049285889,
220
+ "learning_rate": 0.0001,
221
+ "loss": 1.4225,
222
+ "step": 270
223
+ },
224
+ {
225
+ "epoch": 0.010877799576542802,
226
+ "grad_norm": 1.2632057666778564,
227
+ "learning_rate": 0.0001,
228
+ "loss": 1.3462,
229
+ "step": 280
230
+ },
231
+ {
232
+ "epoch": 0.011266292418562187,
233
+ "grad_norm": 1.6178512573242188,
234
+ "learning_rate": 0.0001,
235
+ "loss": 1.4283,
236
+ "step": 290
237
+ },
238
+ {
239
+ "epoch": 0.011654785260581575,
240
+ "grad_norm": 2.717789649963379,
241
+ "learning_rate": 0.0001,
242
+ "loss": 1.4773,
243
+ "step": 300
244
+ },
245
+ {
246
+ "epoch": 0.011654785260581575,
247
+ "eval_loss": 1.4709599018096924,
248
+ "eval_runtime": 410.5517,
249
+ "eval_samples_per_second": 1.269,
250
+ "eval_steps_per_second": 1.269,
251
+ "step": 300
252
+ },
253
+ {
254
+ "epoch": 0.01204327810260096,
255
+ "grad_norm": 3.8710834980010986,
256
+ "learning_rate": 0.0001,
257
+ "loss": 1.4183,
258
+ "step": 310
259
+ },
260
+ {
261
+ "epoch": 0.012431770944620345,
262
+ "grad_norm": 1.1690031290054321,
263
+ "learning_rate": 0.0001,
264
+ "loss": 1.6159,
265
+ "step": 320
266
+ },
267
+ {
268
+ "epoch": 0.012820263786639731,
269
+ "grad_norm": 1.422135829925537,
270
+ "learning_rate": 0.0001,
271
+ "loss": 1.5327,
272
+ "step": 330
273
+ },
274
+ {
275
+ "epoch": 0.013208756628659116,
276
+ "grad_norm": 1.353925347328186,
277
+ "learning_rate": 0.0001,
278
+ "loss": 1.4782,
279
+ "step": 340
280
+ },
281
+ {
282
+ "epoch": 0.013597249470678504,
283
+ "grad_norm": 0.8083727359771729,
284
+ "learning_rate": 0.0001,
285
+ "loss": 1.3199,
286
+ "step": 350
287
+ },
288
+ {
289
+ "epoch": 0.013985742312697889,
290
+ "grad_norm": 0.6409865021705627,
291
+ "learning_rate": 0.0001,
292
+ "loss": 1.3829,
293
+ "step": 360
294
+ },
295
+ {
296
+ "epoch": 0.014374235154717275,
297
+ "grad_norm": 1.9057331085205078,
298
+ "learning_rate": 0.0001,
299
+ "loss": 1.3386,
300
+ "step": 370
301
+ },
302
+ {
303
+ "epoch": 0.014568481575726967,
304
+ "eval_loss": 1.4621069431304932,
305
+ "eval_runtime": 410.8963,
306
+ "eval_samples_per_second": 1.268,
307
+ "eval_steps_per_second": 1.268,
308
+ "step": 375
309
+ },
310
+ {
311
+ "epoch": 0.01476272799673666,
312
+ "grad_norm": 1.4260625839233398,
313
+ "learning_rate": 0.0001,
314
+ "loss": 1.4447,
315
+ "step": 380
316
+ },
317
+ {
318
+ "epoch": 0.015151220838756045,
319
+ "grad_norm": 2.0252511501312256,
320
+ "learning_rate": 0.0001,
321
+ "loss": 1.4396,
322
+ "step": 390
323
+ },
324
+ {
325
+ "epoch": 0.015539713680775431,
326
+ "grad_norm": 1.5493030548095703,
327
+ "learning_rate": 0.0001,
328
+ "loss": 1.5377,
329
+ "step": 400
330
+ },
331
+ {
332
+ "epoch": 0.015928206522794818,
333
+ "grad_norm": 1.5620871782302856,
334
+ "learning_rate": 0.0001,
335
+ "loss": 1.5368,
336
+ "step": 410
337
+ },
338
+ {
339
+ "epoch": 0.016316699364814204,
340
+ "grad_norm": 1.8342182636260986,
341
+ "learning_rate": 0.0001,
342
+ "loss": 1.4932,
343
+ "step": 420
344
+ },
345
+ {
346
+ "epoch": 0.01670519220683359,
347
+ "grad_norm": 0.8918685913085938,
348
+ "learning_rate": 0.0001,
349
+ "loss": 1.4847,
350
+ "step": 430
351
+ },
352
+ {
353
+ "epoch": 0.017093685048852975,
354
+ "grad_norm": 1.4548940658569336,
355
+ "learning_rate": 0.0001,
356
+ "loss": 1.5184,
357
+ "step": 440
358
+ },
359
+ {
360
+ "epoch": 0.01748217789087236,
361
+ "grad_norm": 1.4839730262756348,
362
+ "learning_rate": 0.0001,
363
+ "loss": 1.4276,
364
+ "step": 450
365
+ },
366
+ {
367
+ "epoch": 0.01748217789087236,
368
+ "eval_loss": 1.4603033065795898,
369
+ "eval_runtime": 408.9003,
370
+ "eval_samples_per_second": 1.274,
371
+ "eval_steps_per_second": 1.274,
372
+ "step": 450
373
+ },
374
+ {
375
+ "epoch": 0.017870670732891746,
376
+ "grad_norm": 0.6719891428947449,
377
+ "learning_rate": 0.0001,
378
+ "loss": 1.3042,
379
+ "step": 460
380
+ },
381
+ {
382
+ "epoch": 0.01825916357491113,
383
+ "grad_norm": 0.8530905246734619,
384
+ "learning_rate": 0.0001,
385
+ "loss": 1.454,
386
+ "step": 470
387
+ },
388
+ {
389
+ "epoch": 0.018647656416930516,
390
+ "grad_norm": 0.8087925910949707,
391
+ "learning_rate": 0.0001,
392
+ "loss": 1.4225,
393
+ "step": 480
394
+ },
395
+ {
396
+ "epoch": 0.019036149258949905,
397
+ "grad_norm": 2.091627359390259,
398
+ "learning_rate": 0.0001,
399
+ "loss": 1.4617,
400
+ "step": 490
401
+ },
402
+ {
403
+ "epoch": 0.01942464210096929,
404
+ "grad_norm": 2.1747212409973145,
405
+ "learning_rate": 0.0001,
406
+ "loss": 1.5124,
407
+ "step": 500
408
+ },
409
+ {
410
+ "epoch": 0.019813134942988676,
411
+ "grad_norm": 1.7147002220153809,
412
+ "learning_rate": 0.0001,
413
+ "loss": 1.4442,
414
+ "step": 510
415
+ },
416
+ {
417
+ "epoch": 0.020201627785008062,
418
+ "grad_norm": 0.7326516509056091,
419
+ "learning_rate": 0.0001,
420
+ "loss": 1.4376,
421
+ "step": 520
422
+ },
423
+ {
424
+ "epoch": 0.020395874206017753,
425
+ "eval_loss": 1.4605984687805176,
426
+ "eval_runtime": 418.9148,
427
+ "eval_samples_per_second": 1.244,
428
+ "eval_steps_per_second": 1.244,
429
+ "step": 525
430
+ },
431
+ {
432
+ "epoch": 0.020590120627027447,
433
+ "grad_norm": 1.7703779935836792,
434
+ "learning_rate": 0.0001,
435
+ "loss": 1.4911,
436
+ "step": 530
437
+ },
438
+ {
439
+ "epoch": 0.020978613469046833,
440
+ "grad_norm": 0.8552814722061157,
441
+ "learning_rate": 0.0001,
442
+ "loss": 1.4079,
443
+ "step": 540
444
+ },
445
+ {
446
+ "epoch": 0.021367106311066218,
447
+ "grad_norm": 1.0003011226654053,
448
+ "learning_rate": 0.0001,
449
+ "loss": 1.5769,
450
+ "step": 550
451
+ },
452
+ {
453
+ "epoch": 0.021755599153085604,
454
+ "grad_norm": 1.0176352262496948,
455
+ "learning_rate": 0.0001,
456
+ "loss": 1.2431,
457
+ "step": 560
458
+ },
459
+ {
460
+ "epoch": 0.02214409199510499,
461
+ "grad_norm": 1.8341186046600342,
462
+ "learning_rate": 0.0001,
463
+ "loss": 1.5053,
464
+ "step": 570
465
+ },
466
+ {
467
+ "epoch": 0.022532584837124375,
468
+ "grad_norm": 0.7317614555358887,
469
+ "learning_rate": 0.0001,
470
+ "loss": 1.5135,
471
+ "step": 580
472
+ },
473
+ {
474
+ "epoch": 0.02292107767914376,
475
+ "grad_norm": 1.3072996139526367,
476
+ "learning_rate": 0.0001,
477
+ "loss": 1.2935,
478
+ "step": 590
479
+ },
480
+ {
481
+ "epoch": 0.02330957052116315,
482
+ "grad_norm": 0.5384438633918762,
483
+ "learning_rate": 0.0001,
484
+ "loss": 1.4028,
485
+ "step": 600
486
+ },
487
+ {
488
+ "epoch": 0.02330957052116315,
489
+ "eval_loss": 1.457323670387268,
490
+ "eval_runtime": 419.1828,
491
+ "eval_samples_per_second": 1.243,
492
+ "eval_steps_per_second": 1.243,
493
+ "step": 600
494
+ },
495
+ {
496
+ "epoch": 0.023698063363182535,
497
+ "grad_norm": 0.6213059425354004,
498
+ "learning_rate": 0.0001,
499
+ "loss": 1.3461,
500
+ "step": 610
501
+ },
502
+ {
503
+ "epoch": 0.02408655620520192,
504
+ "grad_norm": 0.9022939801216125,
505
+ "learning_rate": 0.0001,
506
+ "loss": 1.458,
507
+ "step": 620
508
+ },
509
+ {
510
+ "epoch": 0.024475049047221305,
511
+ "grad_norm": 1.511841893196106,
512
+ "learning_rate": 0.0001,
513
+ "loss": 1.3387,
514
+ "step": 630
515
+ },
516
+ {
517
+ "epoch": 0.02486354188924069,
518
+ "grad_norm": 1.193332552909851,
519
+ "learning_rate": 0.0001,
520
+ "loss": 1.25,
521
+ "step": 640
522
+ },
523
+ {
524
+ "epoch": 0.025252034731260076,
525
+ "grad_norm": 0.664730429649353,
526
+ "learning_rate": 0.0001,
527
+ "loss": 1.4608,
528
+ "step": 650
529
+ },
530
+ {
531
+ "epoch": 0.025640527573279462,
532
+ "grad_norm": 0.9817675352096558,
533
+ "learning_rate": 0.0001,
534
+ "loss": 1.4694,
535
+ "step": 660
536
+ },
537
+ {
538
+ "epoch": 0.026029020415298847,
539
+ "grad_norm": 0.8713122606277466,
540
+ "learning_rate": 0.0001,
541
+ "loss": 1.6154,
542
+ "step": 670
543
+ },
544
+ {
545
+ "epoch": 0.026223266836308542,
546
+ "eval_loss": 1.4552098512649536,
547
+ "eval_runtime": 418.233,
548
+ "eval_samples_per_second": 1.246,
549
+ "eval_steps_per_second": 1.246,
550
+ "step": 675
551
+ },
552
+ {
553
+ "epoch": 0.026417513257318233,
554
+ "grad_norm": 0.8656709790229797,
555
+ "learning_rate": 0.0001,
556
+ "loss": 1.6028,
557
+ "step": 680
558
+ },
559
+ {
560
+ "epoch": 0.02680600609933762,
561
+ "grad_norm": 0.7827064990997314,
562
+ "learning_rate": 0.0001,
563
+ "loss": 1.454,
564
+ "step": 690
565
+ },
566
+ {
567
+ "epoch": 0.027194498941357007,
568
+ "grad_norm": 0.8780921101570129,
569
+ "learning_rate": 0.0001,
570
+ "loss": 1.377,
571
+ "step": 700
572
+ },
573
+ {
574
+ "epoch": 0.027582991783376393,
575
+ "grad_norm": 0.664682149887085,
576
+ "learning_rate": 0.0001,
577
+ "loss": 1.3761,
578
+ "step": 710
579
+ },
580
+ {
581
+ "epoch": 0.027971484625395778,
582
+ "grad_norm": 1.6883013248443604,
583
+ "learning_rate": 0.0001,
584
+ "loss": 1.293,
585
+ "step": 720
586
+ },
587
+ {
588
+ "epoch": 0.028359977467415164,
589
+ "grad_norm": 0.6659910082817078,
590
+ "learning_rate": 0.0001,
591
+ "loss": 1.3595,
592
+ "step": 730
593
+ },
594
+ {
595
+ "epoch": 0.02874847030943455,
596
+ "grad_norm": 1.0495606660842896,
597
+ "learning_rate": 0.0001,
598
+ "loss": 1.3881,
599
+ "step": 740
600
+ },
601
+ {
602
+ "epoch": 0.029136963151453935,
603
+ "grad_norm": 2.0675432682037354,
604
+ "learning_rate": 0.0001,
605
+ "loss": 1.3353,
606
+ "step": 750
607
+ },
608
+ {
609
+ "epoch": 0.029136963151453935,
610
+ "eval_loss": 1.4496526718139648,
611
+ "eval_runtime": 412.105,
612
+ "eval_samples_per_second": 1.264,
613
+ "eval_steps_per_second": 1.264,
614
+ "step": 750
615
+ },
616
+ {
617
+ "epoch": 0.02952545599347332,
618
+ "grad_norm": 2.147975444793701,
619
+ "learning_rate": 0.0001,
620
+ "loss": 1.4715,
621
+ "step": 760
622
+ },
623
+ {
624
+ "epoch": 0.029913948835492706,
625
+ "grad_norm": 1.4400185346603394,
626
+ "learning_rate": 0.0001,
627
+ "loss": 1.704,
628
+ "step": 770
629
+ },
630
+ {
631
+ "epoch": 0.03030244167751209,
632
+ "grad_norm": 0.5840633511543274,
633
+ "learning_rate": 0.0001,
634
+ "loss": 1.2531,
635
+ "step": 780
636
+ },
637
+ {
638
+ "epoch": 0.030690934519531476,
639
+ "grad_norm": 1.9958975315093994,
640
+ "learning_rate": 0.0001,
641
+ "loss": 1.6409,
642
+ "step": 790
643
+ },
644
+ {
645
+ "epoch": 0.031079427361550862,
646
+ "grad_norm": 0.4322706460952759,
647
+ "learning_rate": 0.0001,
648
+ "loss": 1.3866,
649
+ "step": 800
650
+ },
651
+ {
652
+ "epoch": 0.03146792020357025,
653
+ "grad_norm": 0.9608808755874634,
654
+ "learning_rate": 0.0001,
655
+ "loss": 1.2862,
656
+ "step": 810
657
+ },
658
+ {
659
+ "epoch": 0.031856413045589636,
660
+ "grad_norm": 1.0402257442474365,
661
+ "learning_rate": 0.0001,
662
+ "loss": 1.4305,
663
+ "step": 820
664
+ },
665
+ {
666
+ "epoch": 0.03205065946659933,
667
+ "eval_loss": 1.4473251104354858,
668
+ "eval_runtime": 410.7169,
669
+ "eval_samples_per_second": 1.269,
670
+ "eval_steps_per_second": 1.269,
671
+ "step": 825
672
+ },
673
+ {
674
+ "epoch": 0.03224490588760902,
675
+ "grad_norm": 0.6171532273292542,
676
+ "learning_rate": 0.0001,
677
+ "loss": 1.2107,
678
+ "step": 830
679
+ },
680
+ {
681
+ "epoch": 0.03263339872962841,
682
+ "grad_norm": 1.6381995677947998,
683
+ "learning_rate": 0.0001,
684
+ "loss": 1.5369,
685
+ "step": 840
686
+ },
687
+ {
688
+ "epoch": 0.03302189157164779,
689
+ "grad_norm": 0.5398985743522644,
690
+ "learning_rate": 0.0001,
691
+ "loss": 1.4939,
692
+ "step": 850
693
+ },
694
+ {
695
+ "epoch": 0.03341038441366718,
696
+ "grad_norm": 1.1927576065063477,
697
+ "learning_rate": 0.0001,
698
+ "loss": 1.459,
699
+ "step": 860
700
+ },
701
+ {
702
+ "epoch": 0.03379887725568657,
703
+ "grad_norm": 0.5355756878852844,
704
+ "learning_rate": 0.0001,
705
+ "loss": 1.4591,
706
+ "step": 870
707
+ },
708
+ {
709
+ "epoch": 0.03418737009770595,
710
+ "grad_norm": 1.0324468612670898,
711
+ "learning_rate": 0.0001,
712
+ "loss": 1.4079,
713
+ "step": 880
714
+ },
715
+ {
716
+ "epoch": 0.03457586293972534,
717
+ "grad_norm": 0.9082580804824829,
718
+ "learning_rate": 0.0001,
719
+ "loss": 1.4703,
720
+ "step": 890
721
+ },
722
+ {
723
+ "epoch": 0.03496435578174472,
724
+ "grad_norm": 1.0036635398864746,
725
+ "learning_rate": 0.0001,
726
+ "loss": 1.2948,
727
+ "step": 900
728
+ },
729
+ {
730
+ "epoch": 0.03496435578174472,
731
+ "eval_loss": 1.4607137441635132,
732
+ "eval_runtime": 418.5246,
733
+ "eval_samples_per_second": 1.245,
734
+ "eval_steps_per_second": 1.245,
735
+ "step": 900
736
+ },
737
+ {
738
+ "epoch": 0.03535284862376411,
739
+ "grad_norm": 0.7732622027397156,
740
+ "learning_rate": 0.0001,
741
+ "loss": 1.5017,
742
+ "step": 910
743
+ },
744
+ {
745
+ "epoch": 0.03574134146578349,
746
+ "grad_norm": 0.7425190806388855,
747
+ "learning_rate": 0.0001,
748
+ "loss": 1.4275,
749
+ "step": 920
750
+ },
751
+ {
752
+ "epoch": 0.03612983430780288,
753
+ "grad_norm": 0.6782093644142151,
754
+ "learning_rate": 0.0001,
755
+ "loss": 1.4424,
756
+ "step": 930
757
+ },
758
+ {
759
+ "epoch": 0.03651832714982226,
760
+ "grad_norm": 0.6914064288139343,
761
+ "learning_rate": 0.0001,
762
+ "loss": 1.49,
763
+ "step": 940
764
+ },
765
+ {
766
+ "epoch": 0.03690681999184165,
767
+ "grad_norm": 1.2722946405410767,
768
+ "learning_rate": 0.0001,
769
+ "loss": 1.4737,
770
+ "step": 950
771
+ },
772
+ {
773
+ "epoch": 0.03729531283386103,
774
+ "grad_norm": 0.9967614412307739,
775
+ "learning_rate": 0.0001,
776
+ "loss": 1.3731,
777
+ "step": 960
778
+ },
779
+ {
780
+ "epoch": 0.03768380567588042,
781
+ "grad_norm": 0.5614752173423767,
782
+ "learning_rate": 0.0001,
783
+ "loss": 1.3554,
784
+ "step": 970
785
+ },
786
+ {
787
+ "epoch": 0.037878052096890116,
788
+ "eval_loss": 1.4594156742095947,
789
+ "eval_runtime": 414.1638,
790
+ "eval_samples_per_second": 1.258,
791
+ "eval_steps_per_second": 1.258,
792
+ "step": 975
793
+ },
794
+ {
795
+ "epoch": 0.03807229851789981,
796
+ "grad_norm": 1.496825933456421,
797
+ "learning_rate": 0.0001,
798
+ "loss": 1.3043,
799
+ "step": 980
800
+ },
801
+ {
802
+ "epoch": 0.03846079135991919,
803
+ "grad_norm": 0.5324123501777649,
804
+ "learning_rate": 0.0001,
805
+ "loss": 1.5467,
806
+ "step": 990
807
+ },
808
+ {
809
+ "epoch": 0.03884928420193858,
810
+ "grad_norm": 2.828305959701538,
811
+ "learning_rate": 0.0001,
812
+ "loss": 1.4766,
813
+ "step": 1000
814
+ },
815
+ {
816
+ "epoch": 0.039237777043957964,
817
+ "grad_norm": 1.0788389444351196,
818
+ "learning_rate": 0.0001,
819
+ "loss": 1.6391,
820
+ "step": 1010
821
+ },
822
+ {
823
+ "epoch": 0.03962626988597735,
824
+ "grad_norm": 1.3913893699645996,
825
+ "learning_rate": 0.0001,
826
+ "loss": 1.36,
827
+ "step": 1020
828
+ },
829
+ {
830
+ "epoch": 0.040014762727996735,
831
+ "grad_norm": 1.0683279037475586,
832
+ "learning_rate": 0.0001,
833
+ "loss": 1.3993,
834
+ "step": 1030
835
+ },
836
+ {
837
+ "epoch": 0.040403255570016124,
838
+ "grad_norm": 0.14315283298492432,
839
+ "learning_rate": 0.0001,
840
+ "loss": 1.3594,
841
+ "step": 1040
842
+ },
843
+ {
844
+ "epoch": 0.040791748412035506,
845
+ "grad_norm": 1.996098518371582,
846
+ "learning_rate": 0.0001,
847
+ "loss": 1.3501,
848
+ "step": 1050
849
+ },
850
+ {
851
+ "epoch": 0.040791748412035506,
852
+ "eval_loss": 1.4564799070358276,
853
+ "eval_runtime": 407.4512,
854
+ "eval_samples_per_second": 1.279,
855
+ "eval_steps_per_second": 1.279,
856
+ "step": 1050
857
+ },
858
+ {
859
+ "epoch": 0.041180241254054895,
860
+ "grad_norm": 1.9238131046295166,
861
+ "learning_rate": 1e-05,
862
+ "loss": 1.3409,
863
+ "step": 1060
864
+ },
865
+ {
866
+ "epoch": 0.04156873409607428,
867
+ "grad_norm": 0.561337947845459,
868
+ "learning_rate": 1e-05,
869
+ "loss": 1.3931,
870
+ "step": 1070
871
+ },
872
+ {
873
+ "epoch": 0.041957226938093665,
874
+ "grad_norm": 0.6750600934028625,
875
+ "learning_rate": 1e-05,
876
+ "loss": 1.3055,
877
+ "step": 1080
878
+ },
879
+ {
880
+ "epoch": 0.042345719780113054,
881
+ "grad_norm": 1.6704535484313965,
882
+ "learning_rate": 1e-05,
883
+ "loss": 1.4371,
884
+ "step": 1090
885
+ },
886
+ {
887
+ "epoch": 0.042734212622132436,
888
+ "grad_norm": 0.6073994636535645,
889
+ "learning_rate": 1e-05,
890
+ "loss": 1.5461,
891
+ "step": 1100
892
+ },
893
+ {
894
+ "epoch": 0.043122705464151825,
895
+ "grad_norm": 1.1396293640136719,
896
+ "learning_rate": 1e-05,
897
+ "loss": 1.4749,
898
+ "step": 1110
899
+ },
900
+ {
901
+ "epoch": 0.04351119830617121,
902
+ "grad_norm": 0.6748817563056946,
903
+ "learning_rate": 1e-05,
904
+ "loss": 1.4803,
905
+ "step": 1120
906
+ },
907
+ {
908
+ "epoch": 0.0437054447271809,
909
+ "eval_loss": 1.4066863059997559,
910
+ "eval_runtime": 198.1965,
911
+ "eval_samples_per_second": 2.629,
912
+ "eval_steps_per_second": 2.629,
913
+ "step": 1125
914
+ },
915
+ {
916
+ "epoch": 0.043899691148190596,
917
+ "grad_norm": 0.8130941987037659,
918
+ "learning_rate": 1e-05,
919
+ "loss": 1.4579,
920
+ "step": 1130
921
+ },
922
+ {
923
+ "epoch": 0.04428818399020998,
924
+ "grad_norm": 0.5348241329193115,
925
+ "learning_rate": 1e-05,
926
+ "loss": 1.3988,
927
+ "step": 1140
928
+ },
929
+ {
930
+ "epoch": 0.04467667683222937,
931
+ "grad_norm": 0.6961309313774109,
932
+ "learning_rate": 1e-05,
933
+ "loss": 1.4051,
934
+ "step": 1150
935
+ },
936
+ {
937
+ "epoch": 0.04506516967424875,
938
+ "grad_norm": 0.8562794923782349,
939
+ "learning_rate": 1e-05,
940
+ "loss": 1.3631,
941
+ "step": 1160
942
+ },
943
+ {
944
+ "epoch": 0.04545366251626814,
945
+ "grad_norm": 0.6999790668487549,
946
+ "learning_rate": 1e-05,
947
+ "loss": 1.4532,
948
+ "step": 1170
949
+ },
950
+ {
951
+ "epoch": 0.04584215535828752,
952
+ "grad_norm": 0.5127655267715454,
953
+ "learning_rate": 1e-05,
954
+ "loss": 1.4715,
955
+ "step": 1180
956
+ },
957
+ {
958
+ "epoch": 0.04623064820030691,
959
+ "grad_norm": 1.5171382427215576,
960
+ "learning_rate": 1e-05,
961
+ "loss": 1.2901,
962
+ "step": 1190
963
+ },
964
+ {
965
+ "epoch": 0.0466191410423263,
966
+ "grad_norm": 0.7225420475006104,
967
+ "learning_rate": 1e-05,
968
+ "loss": 1.2778,
969
+ "step": 1200
970
+ },
971
+ {
972
+ "epoch": 0.0466191410423263,
973
+ "eval_loss": 1.4001317024230957,
974
+ "eval_runtime": 199.2632,
975
+ "eval_samples_per_second": 2.615,
976
+ "eval_steps_per_second": 2.615,
977
+ "step": 1200
978
+ },
979
+ {
980
+ "epoch": 0.04700763388434568,
981
+ "grad_norm": 1.5108428001403809,
982
+ "learning_rate": 1e-05,
983
+ "loss": 1.6175,
984
+ "step": 1210
985
+ },
986
+ {
987
+ "epoch": 0.04739612672636507,
988
+ "grad_norm": 1.1392805576324463,
989
+ "learning_rate": 1e-05,
990
+ "loss": 1.3466,
991
+ "step": 1220
992
+ },
993
+ {
994
+ "epoch": 0.04778461956838445,
995
+ "grad_norm": 0.94669109582901,
996
+ "learning_rate": 1e-05,
997
+ "loss": 1.3415,
998
+ "step": 1230
999
+ },
1000
+ {
1001
+ "epoch": 0.04817311241040384,
1002
+ "grad_norm": 0.8593105673789978,
1003
+ "learning_rate": 1e-05,
1004
+ "loss": 1.3334,
1005
+ "step": 1240
1006
+ },
1007
+ {
1008
+ "epoch": 0.04856160525242322,
1009
+ "grad_norm": 0.8188263773918152,
1010
+ "learning_rate": 1e-05,
1011
+ "loss": 1.4602,
1012
+ "step": 1250
1013
+ },
1014
+ {
1015
+ "epoch": 0.04895009809444261,
1016
+ "grad_norm": 0.6875782608985901,
1017
+ "learning_rate": 1e-05,
1018
+ "loss": 1.3261,
1019
+ "step": 1260
1020
+ },
1021
+ {
1022
+ "epoch": 0.04933859093646199,
1023
+ "grad_norm": 1.8237006664276123,
1024
+ "learning_rate": 1e-05,
1025
+ "loss": 1.5862,
1026
+ "step": 1270
1027
+ },
1028
+ {
1029
+ "epoch": 0.04953283735747169,
1030
+ "eval_loss": 1.3970199823379517,
1031
+ "eval_runtime": 205.8088,
1032
+ "eval_samples_per_second": 2.531,
1033
+ "eval_steps_per_second": 2.531,
1034
+ "step": 1275
1035
+ },
1036
+ {
1037
+ "epoch": 0.04972708377848138,
1038
+ "grad_norm": 1.319785237312317,
1039
+ "learning_rate": 1e-05,
1040
+ "loss": 1.3576,
1041
+ "step": 1280
1042
+ },
1043
+ {
1044
+ "epoch": 0.050115576620500764,
1045
+ "grad_norm": 1.727789282798767,
1046
+ "learning_rate": 1e-05,
1047
+ "loss": 1.5409,
1048
+ "step": 1290
1049
+ },
1050
+ {
1051
+ "epoch": 0.05050406946252015,
1052
+ "grad_norm": 0.9914244413375854,
1053
+ "learning_rate": 1e-05,
1054
+ "loss": 1.3503,
1055
+ "step": 1300
1056
+ },
1057
+ {
1058
+ "epoch": 0.05089256230453954,
1059
+ "grad_norm": 1.8328955173492432,
1060
+ "learning_rate": 1e-05,
1061
+ "loss": 1.5384,
1062
+ "step": 1310
1063
+ },
1064
+ {
1065
+ "epoch": 0.051281055146558924,
1066
+ "grad_norm": 1.7998759746551514,
1067
+ "learning_rate": 1e-05,
1068
+ "loss": 1.4807,
1069
+ "step": 1320
1070
+ },
1071
+ {
1072
+ "epoch": 0.05166954798857831,
1073
+ "grad_norm": 1.53579843044281,
1074
+ "learning_rate": 1e-05,
1075
+ "loss": 1.4255,
1076
+ "step": 1330
1077
+ },
1078
+ {
1079
+ "epoch": 0.052058040830597695,
1080
+ "grad_norm": 0.9572857022285461,
1081
+ "learning_rate": 1e-05,
1082
+ "loss": 1.4547,
1083
+ "step": 1340
1084
+ },
1085
+ {
1086
+ "epoch": 0.052446533672617084,
1087
+ "grad_norm": 0.6299539804458618,
1088
+ "learning_rate": 1e-05,
1089
+ "loss": 1.2758,
1090
+ "step": 1350
1091
+ },
1092
+ {
1093
+ "epoch": 0.052446533672617084,
1094
+ "eval_loss": 1.394976258277893,
1095
+ "eval_runtime": 206.0718,
1096
+ "eval_samples_per_second": 2.528,
1097
+ "eval_steps_per_second": 2.528,
1098
+ "step": 1350
1099
+ },
1100
+ {
1101
+ "epoch": 0.052835026514636466,
1102
+ "grad_norm": 1.1869505643844604,
1103
+ "learning_rate": 1e-05,
1104
+ "loss": 1.2709,
1105
+ "step": 1360
1106
+ },
1107
+ {
1108
+ "epoch": 0.053223519356655855,
1109
+ "grad_norm": 0.5684358477592468,
1110
+ "learning_rate": 1e-05,
1111
+ "loss": 1.3306,
1112
+ "step": 1370
1113
+ },
1114
+ {
1115
+ "epoch": 0.05361201219867524,
1116
+ "grad_norm": 0.5880847573280334,
1117
+ "learning_rate": 1e-05,
1118
+ "loss": 1.3093,
1119
+ "step": 1380
1120
+ },
1121
+ {
1122
+ "epoch": 0.054000505040694625,
1123
+ "grad_norm": 0.6990231275558472,
1124
+ "learning_rate": 1e-05,
1125
+ "loss": 1.4534,
1126
+ "step": 1390
1127
+ },
1128
+ {
1129
+ "epoch": 0.054388997882714014,
1130
+ "grad_norm": 1.0700093507766724,
1131
+ "learning_rate": 1e-05,
1132
+ "loss": 1.3294,
1133
+ "step": 1400
1134
+ },
1135
+ {
1136
+ "epoch": 0.054777490724733396,
1137
+ "grad_norm": 1.044433832168579,
1138
+ "learning_rate": 1e-05,
1139
+ "loss": 1.4177,
1140
+ "step": 1410
1141
+ },
1142
+ {
1143
+ "epoch": 0.055165983566752785,
1144
+ "grad_norm": 2.6891329288482666,
1145
+ "learning_rate": 1e-05,
1146
+ "loss": 1.4451,
1147
+ "step": 1420
1148
+ },
1149
+ {
1150
+ "epoch": 0.05536022998776247,
1151
+ "eval_loss": 1.3934379816055298,
1152
+ "eval_runtime": 204.0926,
1153
+ "eval_samples_per_second": 2.553,
1154
+ "eval_steps_per_second": 2.553,
1155
+ "step": 1425
1156
+ },
1157
+ {
1158
+ "epoch": 0.05555447640877217,
1159
+ "grad_norm": 0.4769861698150635,
1160
+ "learning_rate": 1e-05,
1161
+ "loss": 1.3179,
1162
+ "step": 1430
1163
+ },
1164
+ {
1165
+ "epoch": 0.055942969250791556,
1166
+ "grad_norm": 1.0731093883514404,
1167
+ "learning_rate": 1e-05,
1168
+ "loss": 1.47,
1169
+ "step": 1440
1170
+ },
1171
+ {
1172
+ "epoch": 0.05633146209281094,
1173
+ "grad_norm": 1.016760230064392,
1174
+ "learning_rate": 1e-05,
1175
+ "loss": 1.5151,
1176
+ "step": 1450
1177
+ },
1178
+ {
1179
+ "epoch": 0.05671995493483033,
1180
+ "grad_norm": 1.5259450674057007,
1181
+ "learning_rate": 1e-05,
1182
+ "loss": 1.4038,
1183
+ "step": 1460
1184
+ },
1185
+ {
1186
+ "epoch": 0.05710844777684971,
1187
+ "grad_norm": 0.654501736164093,
1188
+ "learning_rate": 1e-05,
1189
+ "loss": 1.3135,
1190
+ "step": 1470
1191
+ },
1192
+ {
1193
+ "epoch": 0.0574969406188691,
1194
+ "grad_norm": 0.6827269196510315,
1195
+ "learning_rate": 1e-05,
1196
+ "loss": 1.2978,
1197
+ "step": 1480
1198
+ },
1199
+ {
1200
+ "epoch": 0.05788543346088848,
1201
+ "grad_norm": 0.5111151933670044,
1202
+ "learning_rate": 1e-05,
1203
+ "loss": 1.4352,
1204
+ "step": 1490
1205
+ },
1206
+ {
1207
+ "epoch": 0.05827392630290787,
1208
+ "grad_norm": 1.9571446180343628,
1209
+ "learning_rate": 1e-05,
1210
+ "loss": 1.4764,
1211
+ "step": 1500
1212
+ },
1213
+ {
1214
+ "epoch": 0.05827392630290787,
1215
+ "eval_loss": 1.3912627696990967,
1216
+ "eval_runtime": 204.5081,
1217
+ "eval_samples_per_second": 2.548,
1218
+ "eval_steps_per_second": 2.548,
1219
+ "step": 1500
1220
+ },
1221
+ {
1222
+ "epoch": 0.05866241914492726,
1223
+ "grad_norm": 0.8712412714958191,
1224
+ "learning_rate": 1e-05,
1225
+ "loss": 1.3778,
1226
+ "step": 1510
1227
+ },
1228
+ {
1229
+ "epoch": 0.05905091198694664,
1230
+ "grad_norm": 0.7130087018013,
1231
+ "learning_rate": 1e-05,
1232
+ "loss": 1.3266,
1233
+ "step": 1520
1234
+ },
1235
+ {
1236
+ "epoch": 0.05943940482896603,
1237
+ "grad_norm": 1.6288388967514038,
1238
+ "learning_rate": 1e-05,
1239
+ "loss": 1.4783,
1240
+ "step": 1530
1241
+ },
1242
+ {
1243
+ "epoch": 0.05982789767098541,
1244
+ "grad_norm": 2.629760503768921,
1245
+ "learning_rate": 1e-05,
1246
+ "loss": 1.6038,
1247
+ "step": 1540
1248
+ },
1249
+ {
1250
+ "epoch": 0.0602163905130048,
1251
+ "grad_norm": 1.0394636392593384,
1252
+ "learning_rate": 1e-05,
1253
+ "loss": 1.4683,
1254
+ "step": 1550
1255
+ },
1256
+ {
1257
+ "epoch": 0.06060488335502418,
1258
+ "grad_norm": 1.128451943397522,
1259
+ "learning_rate": 1e-05,
1260
+ "loss": 1.4578,
1261
+ "step": 1560
1262
+ },
1263
+ {
1264
+ "epoch": 0.06099337619704357,
1265
+ "grad_norm": 2.473900079727173,
1266
+ "learning_rate": 1e-05,
1267
+ "loss": 1.4326,
1268
+ "step": 1570
1269
+ },
1270
+ {
1271
+ "epoch": 0.061187622618053265,
1272
+ "eval_loss": 1.3889408111572266,
1273
+ "eval_runtime": 205.5592,
1274
+ "eval_samples_per_second": 2.535,
1275
+ "eval_steps_per_second": 2.535,
1276
+ "step": 1575
1277
+ },
1278
+ {
1279
+ "epoch": 0.06138186903906295,
1280
+ "grad_norm": 1.940373182296753,
1281
+ "learning_rate": 1e-05,
1282
+ "loss": 1.5117,
1283
+ "step": 1580
1284
+ },
1285
+ {
1286
+ "epoch": 0.06177036188108234,
1287
+ "grad_norm": 0.7575955986976624,
1288
+ "learning_rate": 1e-05,
1289
+ "loss": 1.3894,
1290
+ "step": 1590
1291
+ },
1292
+ {
1293
+ "epoch": 0.062158854723101724,
1294
+ "grad_norm": 1.4801169633865356,
1295
+ "learning_rate": 1e-05,
1296
+ "loss": 1.3132,
1297
+ "step": 1600
1298
+ },
1299
+ {
1300
+ "epoch": 0.0625473475651211,
1301
+ "grad_norm": 1.291632890701294,
1302
+ "learning_rate": 1e-05,
1303
+ "loss": 1.3286,
1304
+ "step": 1610
1305
+ },
1306
+ {
1307
+ "epoch": 0.0629358404071405,
1308
+ "grad_norm": 1.9607435464859009,
1309
+ "learning_rate": 1e-05,
1310
+ "loss": 1.3005,
1311
+ "step": 1620
1312
+ },
1313
+ {
1314
+ "epoch": 0.06332433324915988,
1315
+ "grad_norm": 0.8362483382225037,
1316
+ "learning_rate": 1e-05,
1317
+ "loss": 1.4172,
1318
+ "step": 1630
1319
+ },
1320
+ {
1321
+ "epoch": 0.06371282609117927,
1322
+ "grad_norm": 1.3649120330810547,
1323
+ "learning_rate": 1e-05,
1324
+ "loss": 1.6757,
1325
+ "step": 1640
1326
+ },
1327
+ {
1328
+ "epoch": 0.06410131893319866,
1329
+ "grad_norm": 1.0758274793624878,
1330
+ "learning_rate": 1e-05,
1331
+ "loss": 1.3867,
1332
+ "step": 1650
1333
+ },
1334
+ {
1335
+ "epoch": 0.06410131893319866,
1336
+ "eval_loss": 1.3888965845108032,
1337
+ "eval_runtime": 205.6882,
1338
+ "eval_samples_per_second": 2.533,
1339
+ "eval_steps_per_second": 2.533,
1340
+ "step": 1650
1341
+ },
1342
+ {
1343
+ "epoch": 0.06448981177521804,
1344
+ "grad_norm": 0.8754805326461792,
1345
+ "learning_rate": 1e-05,
1346
+ "loss": 1.3389,
1347
+ "step": 1660
1348
+ },
1349
+ {
1350
+ "epoch": 0.06487830461723743,
1351
+ "grad_norm": 0.7831467986106873,
1352
+ "learning_rate": 1e-05,
1353
+ "loss": 1.4257,
1354
+ "step": 1670
1355
+ },
1356
+ {
1357
+ "epoch": 0.06526679745925681,
1358
+ "grad_norm": 0.4581933915615082,
1359
+ "learning_rate": 1e-05,
1360
+ "loss": 1.3556,
1361
+ "step": 1680
1362
+ },
1363
+ {
1364
+ "epoch": 0.0656552903012762,
1365
+ "grad_norm": 0.9837825894355774,
1366
+ "learning_rate": 1e-05,
1367
+ "loss": 1.3184,
1368
+ "step": 1690
1369
+ },
1370
+ {
1371
+ "epoch": 0.06604378314329558,
1372
+ "grad_norm": 1.005288004875183,
1373
+ "learning_rate": 1e-05,
1374
+ "loss": 1.2944,
1375
+ "step": 1700
1376
+ },
1377
+ {
1378
+ "epoch": 0.06643227598531497,
1379
+ "grad_norm": 0.9397820234298706,
1380
+ "learning_rate": 1e-05,
1381
+ "loss": 1.4305,
1382
+ "step": 1710
1383
+ },
1384
+ {
1385
+ "epoch": 0.06682076882733436,
1386
+ "grad_norm": 2.7833900451660156,
1387
+ "learning_rate": 1e-05,
1388
+ "loss": 1.3273,
1389
+ "step": 1720
1390
+ },
1391
+ {
1392
+ "epoch": 0.06701501524834405,
1393
+ "eval_loss": 1.3884316682815552,
1394
+ "eval_runtime": 206.1573,
1395
+ "eval_samples_per_second": 2.527,
1396
+ "eval_steps_per_second": 2.527,
1397
+ "step": 1725
1398
+ },
1399
+ {
1400
+ "epoch": 0.06720926166935375,
1401
+ "grad_norm": 1.1208202838897705,
1402
+ "learning_rate": 1e-05,
1403
+ "loss": 1.2229,
1404
+ "step": 1730
1405
+ },
1406
+ {
1407
+ "epoch": 0.06759775451137313,
1408
+ "grad_norm": 0.5742992758750916,
1409
+ "learning_rate": 1e-05,
1410
+ "loss": 1.3349,
1411
+ "step": 1740
1412
+ },
1413
+ {
1414
+ "epoch": 0.06798624735339251,
1415
+ "grad_norm": 0.7946904897689819,
1416
+ "learning_rate": 1e-05,
1417
+ "loss": 1.3682,
1418
+ "step": 1750
1419
+ },
1420
+ {
1421
+ "epoch": 0.0683747401954119,
1422
+ "grad_norm": 0.7263549566268921,
1423
+ "learning_rate": 1e-05,
1424
+ "loss": 1.5025,
1425
+ "step": 1760
1426
+ },
1427
+ {
1428
+ "epoch": 0.06876323303743129,
1429
+ "grad_norm": 0.8954797387123108,
1430
+ "learning_rate": 1e-05,
1431
+ "loss": 1.4383,
1432
+ "step": 1770
1433
+ },
1434
+ {
1435
+ "epoch": 0.06915172587945068,
1436
+ "grad_norm": 0.6124446392059326,
1437
+ "learning_rate": 1e-05,
1438
+ "loss": 1.3322,
1439
+ "step": 1780
1440
+ },
1441
+ {
1442
+ "epoch": 0.06954021872147005,
1443
+ "grad_norm": 1.140678882598877,
1444
+ "learning_rate": 1e-05,
1445
+ "loss": 1.5233,
1446
+ "step": 1790
1447
+ },
1448
+ {
1449
+ "epoch": 0.06992871156348944,
1450
+ "grad_norm": 7.1586689949035645,
1451
+ "learning_rate": 1e-05,
1452
+ "loss": 1.3691,
1453
+ "step": 1800
1454
+ },
1455
+ {
1456
+ "epoch": 0.06992871156348944,
1457
+ "eval_loss": 1.387437105178833,
1458
+ "eval_runtime": 204.4312,
1459
+ "eval_samples_per_second": 2.549,
1460
+ "eval_steps_per_second": 2.549,
1461
+ "step": 1800
1462
+ },
1463
+ {
1464
+ "epoch": 0.07031720440550883,
1465
+ "grad_norm": 0.634140133857727,
1466
+ "learning_rate": 1e-05,
1467
+ "loss": 1.3735,
1468
+ "step": 1810
1469
+ },
1470
+ {
1471
+ "epoch": 0.07070569724752822,
1472
+ "grad_norm": 0.7632227540016174,
1473
+ "learning_rate": 1e-05,
1474
+ "loss": 1.3542,
1475
+ "step": 1820
1476
+ },
1477
+ {
1478
+ "epoch": 0.07109419008954761,
1479
+ "grad_norm": 0.7211370468139648,
1480
+ "learning_rate": 1e-05,
1481
+ "loss": 1.2832,
1482
+ "step": 1830
1483
+ },
1484
+ {
1485
+ "epoch": 0.07148268293156698,
1486
+ "grad_norm": 0.7608075737953186,
1487
+ "learning_rate": 1e-05,
1488
+ "loss": 1.5292,
1489
+ "step": 1840
1490
+ },
1491
+ {
1492
+ "epoch": 0.07187117577358637,
1493
+ "grad_norm": 0.8131744265556335,
1494
+ "learning_rate": 1e-05,
1495
+ "loss": 1.4005,
1496
+ "step": 1850
1497
+ },
1498
+ {
1499
+ "epoch": 0.07225966861560576,
1500
+ "grad_norm": 0.6415278911590576,
1501
+ "learning_rate": 1e-05,
1502
+ "loss": 1.4455,
1503
+ "step": 1860
1504
+ },
1505
+ {
1506
+ "epoch": 0.07264816145762515,
1507
+ "grad_norm": 2.333056688308716,
1508
+ "learning_rate": 1e-05,
1509
+ "loss": 1.4367,
1510
+ "step": 1870
1511
+ },
1512
+ {
1513
+ "epoch": 0.07284240787863483,
1514
+ "eval_loss": 1.3867840766906738,
1515
+ "eval_runtime": 205.2163,
1516
+ "eval_samples_per_second": 2.539,
1517
+ "eval_steps_per_second": 2.539,
1518
+ "step": 1875
1519
+ }
1520
+ ],
1521
+ "logging_steps": 10,
1522
+ "max_steps": 3600,
1523
+ "num_input_tokens_seen": 0,
1524
+ "num_train_epochs": 1,
1525
+ "save_steps": 75,
1526
+ "stateful_callbacks": {
1527
+ "TrainerControl": {
1528
+ "args": {
1529
+ "should_epoch_stop": false,
1530
+ "should_evaluate": false,
1531
+ "should_log": false,
1532
+ "should_save": true,
1533
+ "should_training_stop": false
1534
+ },
1535
+ "attributes": {}
1536
+ }
1537
+ },
1538
+ "total_flos": 8.331378819072e+16,
1539
+ "train_batch_size": 1,
1540
+ "trial_name": null,
1541
+ "trial_params": null
1542
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1357f2f95116f571e7f20f337ece9446f8849c2418f238a6195a193e9e17bd5a
3
+ size 7608
vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
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)