upload
Browse files- .gitattributes +1 -0
- added_tokens.json +24 -0
- config.json +30 -0
- generation_config.json +6 -0
- latest +1 -0
- merges.txt +0 -0
- model.safetensors +3 -0
- special_tokens_map.json +31 -0
- tokenizer.json +3 -0
- tokenizer_config.json +208 -0
- trainer_state.json +1223 -0
- training_args.bin +3 -0
- vocab.json +0 -0
- zero_to_fp32.py +674 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
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 |
+
}
|
config.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/lustre/fsn1/projects/rech/gkb/uua32zb/grand_challenge/checkpoints/Arab/Qwen__Qwen2.5-1.5B-annealing_only-Arab-fineweb2-0.0001LR-8192CL-2GAS-2BS-3EPOCHS-0.9BETA1-0.95BETA2-cosineLRSCHEDULER/",
|
3 |
+
"architectures": [
|
4 |
+
"Qwen2ForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 151643,
|
8 |
+
"eos_token_id": 151643,
|
9 |
+
"hidden_act": "silu",
|
10 |
+
"hidden_size": 1536,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"intermediate_size": 8960,
|
13 |
+
"max_position_embeddings": 131072,
|
14 |
+
"max_window_layers": 28,
|
15 |
+
"model_type": "qwen2",
|
16 |
+
"num_attention_heads": 12,
|
17 |
+
"num_hidden_layers": 28,
|
18 |
+
"num_key_value_heads": 2,
|
19 |
+
"rms_norm_eps": 1e-06,
|
20 |
+
"rope_scaling": null,
|
21 |
+
"rope_theta": 1000000.0,
|
22 |
+
"sliding_window": null,
|
23 |
+
"tie_word_embeddings": true,
|
24 |
+
"torch_dtype": "bfloat16",
|
25 |
+
"transformers_version": "4.46.1",
|
26 |
+
"use_cache": false,
|
27 |
+
"use_mrope": false,
|
28 |
+
"use_sliding_window": false,
|
29 |
+
"vocab_size": 151936
|
30 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token_id": 151643,
|
3 |
+
"eos_token_id": 151643,
|
4 |
+
"max_new_tokens": 2048,
|
5 |
+
"transformers_version": "4.46.1"
|
6 |
+
}
|
latest
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
global_step8500
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f9666a226a65a6bad25dbcbe0920b45f26415bb57fcedcab371612b2766c433e
|
3 |
+
size 3554214752
|
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": "<|im_end|>",
|
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
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
|
|
|
|
|
|
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": "<|im_end|>",
|
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 |
+
}
|
trainer_state.json
ADDED
@@ -0,0 +1,1223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"best_metric": null,
|
3 |
+
"best_model_checkpoint": null,
|
4 |
+
"epoch": 0.941124366817062,
|
5 |
+
"eval_steps": 500.0,
|
6 |
+
"global_step": 8500,
|
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.005536025687159188,
|
13 |
+
"grad_norm": 0.3439372479915619,
|
14 |
+
"learning_rate": 9.999243694725429e-05,
|
15 |
+
"loss": 0.5743,
|
16 |
+
"step": 50
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"epoch": 0.011072051374318376,
|
20 |
+
"grad_norm": 0.3828931152820587,
|
21 |
+
"learning_rate": 9.99697500770078e-05,
|
22 |
+
"loss": 0.5609,
|
23 |
+
"step": 100
|
24 |
+
},
|
25 |
+
{
|
26 |
+
"epoch": 0.016608077061477565,
|
27 |
+
"grad_norm": 0.3481367528438568,
|
28 |
+
"learning_rate": 9.993194625254041e-05,
|
29 |
+
"loss": 0.5661,
|
30 |
+
"step": 150
|
31 |
+
},
|
32 |
+
{
|
33 |
+
"epoch": 0.022144102748636752,
|
34 |
+
"grad_norm": 0.3216044306755066,
|
35 |
+
"learning_rate": 9.987903691034485e-05,
|
36 |
+
"loss": 0.5729,
|
37 |
+
"step": 200
|
38 |
+
},
|
39 |
+
{
|
40 |
+
"epoch": 0.027680128435795943,
|
41 |
+
"grad_norm": 0.3202624022960663,
|
42 |
+
"learning_rate": 9.981103805666695e-05,
|
43 |
+
"loss": 0.5682,
|
44 |
+
"step": 250
|
45 |
+
},
|
46 |
+
{
|
47 |
+
"epoch": 0.03321615412295513,
|
48 |
+
"grad_norm": 0.32036539912223816,
|
49 |
+
"learning_rate": 9.972797026266339e-05,
|
50 |
+
"loss": 0.5744,
|
51 |
+
"step": 300
|
52 |
+
},
|
53 |
+
{
|
54 |
+
"epoch": 0.03875217981011432,
|
55 |
+
"grad_norm": 0.29840943217277527,
|
56 |
+
"learning_rate": 9.962985865817845e-05,
|
57 |
+
"loss": 0.5737,
|
58 |
+
"step": 350
|
59 |
+
},
|
60 |
+
{
|
61 |
+
"epoch": 0.044288205497273504,
|
62 |
+
"grad_norm": 0.3060721457004547,
|
63 |
+
"learning_rate": 9.951673292414175e-05,
|
64 |
+
"loss": 0.5748,
|
65 |
+
"step": 400
|
66 |
+
},
|
67 |
+
{
|
68 |
+
"epoch": 0.049824231184432695,
|
69 |
+
"grad_norm": 0.29271894693374634,
|
70 |
+
"learning_rate": 9.9388627283589e-05,
|
71 |
+
"loss": 0.5717,
|
72 |
+
"step": 450
|
73 |
+
},
|
74 |
+
{
|
75 |
+
"epoch": 0.055360256871591886,
|
76 |
+
"grad_norm": 0.30329838395118713,
|
77 |
+
"learning_rate": 9.92455804913089e-05,
|
78 |
+
"loss": 0.5751,
|
79 |
+
"step": 500
|
80 |
+
},
|
81 |
+
{
|
82 |
+
"epoch": 0.06089628255875107,
|
83 |
+
"grad_norm": 0.2716081142425537,
|
84 |
+
"learning_rate": 9.90876358221188e-05,
|
85 |
+
"loss": 0.573,
|
86 |
+
"step": 550
|
87 |
+
},
|
88 |
+
{
|
89 |
+
"epoch": 0.06643230824591026,
|
90 |
+
"grad_norm": 0.30109643936157227,
|
91 |
+
"learning_rate": 9.891484105777331e-05,
|
92 |
+
"loss": 0.5753,
|
93 |
+
"step": 600
|
94 |
+
},
|
95 |
+
{
|
96 |
+
"epoch": 0.07196833393306945,
|
97 |
+
"grad_norm": 0.2664714455604553,
|
98 |
+
"learning_rate": 9.872724847250907e-05,
|
99 |
+
"loss": 0.5747,
|
100 |
+
"step": 650
|
101 |
+
},
|
102 |
+
{
|
103 |
+
"epoch": 0.07750435962022864,
|
104 |
+
"grad_norm": 0.29528167843818665,
|
105 |
+
"learning_rate": 9.852491481723078e-05,
|
106 |
+
"loss": 0.5707,
|
107 |
+
"step": 700
|
108 |
+
},
|
109 |
+
{
|
110 |
+
"epoch": 0.08304038530738783,
|
111 |
+
"grad_norm": 0.2820889353752136,
|
112 |
+
"learning_rate": 9.830790130234274e-05,
|
113 |
+
"loss": 0.5738,
|
114 |
+
"step": 750
|
115 |
+
},
|
116 |
+
{
|
117 |
+
"epoch": 0.08857641099454701,
|
118 |
+
"grad_norm": 0.28580889105796814,
|
119 |
+
"learning_rate": 9.80762735792313e-05,
|
120 |
+
"loss": 0.5736,
|
121 |
+
"step": 800
|
122 |
+
},
|
123 |
+
{
|
124 |
+
"epoch": 0.0941124366817062,
|
125 |
+
"grad_norm": 0.2842045724391937,
|
126 |
+
"learning_rate": 9.7830101720404e-05,
|
127 |
+
"loss": 0.5712,
|
128 |
+
"step": 850
|
129 |
+
},
|
130 |
+
{
|
131 |
+
"epoch": 0.09964846236886539,
|
132 |
+
"grad_norm": 0.29261285066604614,
|
133 |
+
"learning_rate": 9.756946019829088e-05,
|
134 |
+
"loss": 0.5699,
|
135 |
+
"step": 900
|
136 |
+
},
|
137 |
+
{
|
138 |
+
"epoch": 0.10518448805602458,
|
139 |
+
"grad_norm": 0.2930528223514557,
|
140 |
+
"learning_rate": 9.729442786271517e-05,
|
141 |
+
"loss": 0.5741,
|
142 |
+
"step": 950
|
143 |
+
},
|
144 |
+
{
|
145 |
+
"epoch": 0.11072051374318377,
|
146 |
+
"grad_norm": 0.2633638083934784,
|
147 |
+
"learning_rate": 9.70050879170393e-05,
|
148 |
+
"loss": 0.5699,
|
149 |
+
"step": 1000
|
150 |
+
},
|
151 |
+
{
|
152 |
+
"epoch": 0.11625653943034296,
|
153 |
+
"grad_norm": 0.262563556432724,
|
154 |
+
"learning_rate": 9.670152789299407e-05,
|
155 |
+
"loss": 0.5727,
|
156 |
+
"step": 1050
|
157 |
+
},
|
158 |
+
{
|
159 |
+
"epoch": 0.12179256511750214,
|
160 |
+
"grad_norm": 0.261879026889801,
|
161 |
+
"learning_rate": 9.638383962419843e-05,
|
162 |
+
"loss": 0.572,
|
163 |
+
"step": 1100
|
164 |
+
},
|
165 |
+
{
|
166 |
+
"epoch": 0.12732859080466133,
|
167 |
+
"grad_norm": 0.41501718759536743,
|
168 |
+
"learning_rate": 9.605211921837773e-05,
|
169 |
+
"loss": 0.5699,
|
170 |
+
"step": 1150
|
171 |
+
},
|
172 |
+
{
|
173 |
+
"epoch": 0.13286461649182052,
|
174 |
+
"grad_norm": 0.2684990465641022,
|
175 |
+
"learning_rate": 9.5706467028289e-05,
|
176 |
+
"loss": 0.5705,
|
177 |
+
"step": 1200
|
178 |
+
},
|
179 |
+
{
|
180 |
+
"epoch": 0.1384006421789797,
|
181 |
+
"grad_norm": 0.2522321045398712,
|
182 |
+
"learning_rate": 9.534698762136204e-05,
|
183 |
+
"loss": 0.5696,
|
184 |
+
"step": 1250
|
185 |
+
},
|
186 |
+
{
|
187 |
+
"epoch": 0.1439366678661389,
|
188 |
+
"grad_norm": 0.3583656847476959,
|
189 |
+
"learning_rate": 9.497378974806551e-05,
|
190 |
+
"loss": 0.5677,
|
191 |
+
"step": 1300
|
192 |
+
},
|
193 |
+
{
|
194 |
+
"epoch": 0.1494726935532981,
|
195 |
+
"grad_norm": 0.24989576637744904,
|
196 |
+
"learning_rate": 9.45869863090074e-05,
|
197 |
+
"loss": 0.5672,
|
198 |
+
"step": 1350
|
199 |
+
},
|
200 |
+
{
|
201 |
+
"epoch": 0.15500871924045728,
|
202 |
+
"grad_norm": 0.25384247303009033,
|
203 |
+
"learning_rate": 9.418669432078016e-05,
|
204 |
+
"loss": 0.5669,
|
205 |
+
"step": 1400
|
206 |
+
},
|
207 |
+
{
|
208 |
+
"epoch": 0.16054474492761647,
|
209 |
+
"grad_norm": 0.2404128462076187,
|
210 |
+
"learning_rate": 9.377303488056066e-05,
|
211 |
+
"loss": 0.5657,
|
212 |
+
"step": 1450
|
213 |
+
},
|
214 |
+
{
|
215 |
+
"epoch": 0.16608077061477566,
|
216 |
+
"grad_norm": 0.2735093832015991,
|
217 |
+
"learning_rate": 9.334613312947549e-05,
|
218 |
+
"loss": 0.5662,
|
219 |
+
"step": 1500
|
220 |
+
},
|
221 |
+
{
|
222 |
+
"epoch": 0.17161679630193485,
|
223 |
+
"grad_norm": 0.25135621428489685,
|
224 |
+
"learning_rate": 9.290611821474307e-05,
|
225 |
+
"loss": 0.5661,
|
226 |
+
"step": 1550
|
227 |
+
},
|
228 |
+
{
|
229 |
+
"epoch": 0.17715282198909402,
|
230 |
+
"grad_norm": 0.2490808069705963,
|
231 |
+
"learning_rate": 9.245312325060375e-05,
|
232 |
+
"loss": 0.5655,
|
233 |
+
"step": 1600
|
234 |
+
},
|
235 |
+
{
|
236 |
+
"epoch": 0.1826888476762532,
|
237 |
+
"grad_norm": 0.254464715719223,
|
238 |
+
"learning_rate": 9.198728527804987e-05,
|
239 |
+
"loss": 0.5652,
|
240 |
+
"step": 1650
|
241 |
+
},
|
242 |
+
{
|
243 |
+
"epoch": 0.1882248733634124,
|
244 |
+
"grad_norm": 0.2614707052707672,
|
245 |
+
"learning_rate": 9.150874522336767e-05,
|
246 |
+
"loss": 0.5647,
|
247 |
+
"step": 1700
|
248 |
+
},
|
249 |
+
{
|
250 |
+
"epoch": 0.1937608990505716,
|
251 |
+
"grad_norm": 0.265312135219574,
|
252 |
+
"learning_rate": 9.101764785550415e-05,
|
253 |
+
"loss": 0.5637,
|
254 |
+
"step": 1750
|
255 |
+
},
|
256 |
+
{
|
257 |
+
"epoch": 0.19929692473773078,
|
258 |
+
"grad_norm": 0.23875299096107483,
|
259 |
+
"learning_rate": 9.051414174227118e-05,
|
260 |
+
"loss": 0.5614,
|
261 |
+
"step": 1800
|
262 |
+
},
|
263 |
+
{
|
264 |
+
"epoch": 0.20483295042488997,
|
265 |
+
"grad_norm": 0.25199180841445923,
|
266 |
+
"learning_rate": 8.999837920540044e-05,
|
267 |
+
"loss": 0.5618,
|
268 |
+
"step": 1850
|
269 |
+
},
|
270 |
+
{
|
271 |
+
"epoch": 0.21036897611204916,
|
272 |
+
"grad_norm": 0.24338677525520325,
|
273 |
+
"learning_rate": 8.947051627446275e-05,
|
274 |
+
"loss": 0.5649,
|
275 |
+
"step": 1900
|
276 |
+
},
|
277 |
+
{
|
278 |
+
"epoch": 0.21590500179920835,
|
279 |
+
"grad_norm": 0.24273960292339325,
|
280 |
+
"learning_rate": 8.89307126396657e-05,
|
281 |
+
"loss": 0.5581,
|
282 |
+
"step": 1950
|
283 |
+
},
|
284 |
+
{
|
285 |
+
"epoch": 0.22144102748636754,
|
286 |
+
"grad_norm": 0.40545448660850525,
|
287 |
+
"learning_rate": 8.837913160354374e-05,
|
288 |
+
"loss": 0.5618,
|
289 |
+
"step": 2000
|
290 |
+
},
|
291 |
+
{
|
292 |
+
"epoch": 0.22697705317352673,
|
293 |
+
"grad_norm": 0.25062185525894165,
|
294 |
+
"learning_rate": 8.781594003155569e-05,
|
295 |
+
"loss": 0.5603,
|
296 |
+
"step": 2050
|
297 |
+
},
|
298 |
+
{
|
299 |
+
"epoch": 0.23251307886068592,
|
300 |
+
"grad_norm": 0.23254728317260742,
|
301 |
+
"learning_rate": 8.724130830160414e-05,
|
302 |
+
"loss": 0.5607,
|
303 |
+
"step": 2100
|
304 |
+
},
|
305 |
+
{
|
306 |
+
"epoch": 0.23804910454784511,
|
307 |
+
"grad_norm": 0.25338929891586304,
|
308 |
+
"learning_rate": 8.66554102524924e-05,
|
309 |
+
"loss": 0.5579,
|
310 |
+
"step": 2150
|
311 |
+
},
|
312 |
+
{
|
313 |
+
"epoch": 0.24358513023500428,
|
314 |
+
"grad_norm": 0.31788700819015503,
|
315 |
+
"learning_rate": 8.605842313133444e-05,
|
316 |
+
"loss": 0.5591,
|
317 |
+
"step": 2200
|
318 |
+
},
|
319 |
+
{
|
320 |
+
"epoch": 0.24912115592216347,
|
321 |
+
"grad_norm": 0.24001486599445343,
|
322 |
+
"learning_rate": 8.545052753993368e-05,
|
323 |
+
"loss": 0.5598,
|
324 |
+
"step": 2250
|
325 |
+
},
|
326 |
+
{
|
327 |
+
"epoch": 0.25465718160932266,
|
328 |
+
"grad_norm": 1.3120613098144531,
|
329 |
+
"learning_rate": 8.483190738014701e-05,
|
330 |
+
"loss": 0.5539,
|
331 |
+
"step": 2300
|
332 |
+
},
|
333 |
+
{
|
334 |
+
"epoch": 0.2601932072964819,
|
335 |
+
"grad_norm": 0.23131923377513885,
|
336 |
+
"learning_rate": 8.420274979825033e-05,
|
337 |
+
"loss": 0.5548,
|
338 |
+
"step": 2350
|
339 |
+
},
|
340 |
+
{
|
341 |
+
"epoch": 0.26572923298364104,
|
342 |
+
"grad_norm": 0.23763211071491241,
|
343 |
+
"learning_rate": 8.356324512832276e-05,
|
344 |
+
"loss": 0.5548,
|
345 |
+
"step": 2400
|
346 |
+
},
|
347 |
+
{
|
348 |
+
"epoch": 0.27126525867080026,
|
349 |
+
"grad_norm": 0.2329683154821396,
|
350 |
+
"learning_rate": 8.291358683466625e-05,
|
351 |
+
"loss": 0.5537,
|
352 |
+
"step": 2450
|
353 |
+
},
|
354 |
+
{
|
355 |
+
"epoch": 0.2768012843579594,
|
356 |
+
"grad_norm": 0.23742693662643433,
|
357 |
+
"learning_rate": 8.225397145327851e-05,
|
358 |
+
"loss": 0.5534,
|
359 |
+
"step": 2500
|
360 |
+
},
|
361 |
+
{
|
362 |
+
"epoch": 0.2823373100451186,
|
363 |
+
"grad_norm": 0.244510680437088,
|
364 |
+
"learning_rate": 8.158459853239634e-05,
|
365 |
+
"loss": 0.5552,
|
366 |
+
"step": 2550
|
367 |
+
},
|
368 |
+
{
|
369 |
+
"epoch": 0.2878733357322778,
|
370 |
+
"grad_norm": 0.23719392716884613,
|
371 |
+
"learning_rate": 8.090567057212808e-05,
|
372 |
+
"loss": 0.5533,
|
373 |
+
"step": 2600
|
374 |
+
},
|
375 |
+
{
|
376 |
+
"epoch": 0.29340936141943696,
|
377 |
+
"grad_norm": 0.22732912003993988,
|
378 |
+
"learning_rate": 8.021739296319266e-05,
|
379 |
+
"loss": 0.551,
|
380 |
+
"step": 2650
|
381 |
+
},
|
382 |
+
{
|
383 |
+
"epoch": 0.2989453871065962,
|
384 |
+
"grad_norm": 0.23341135680675507,
|
385 |
+
"learning_rate": 7.95199739247845e-05,
|
386 |
+
"loss": 0.5498,
|
387 |
+
"step": 2700
|
388 |
+
},
|
389 |
+
{
|
390 |
+
"epoch": 0.30448141279375535,
|
391 |
+
"grad_norm": 0.26524463295936584,
|
392 |
+
"learning_rate": 7.881362444158249e-05,
|
393 |
+
"loss": 0.5481,
|
394 |
+
"step": 2750
|
395 |
+
},
|
396 |
+
{
|
397 |
+
"epoch": 0.31001743848091456,
|
398 |
+
"grad_norm": 1.088100552558899,
|
399 |
+
"learning_rate": 7.809855819992263e-05,
|
400 |
+
"loss": 0.5506,
|
401 |
+
"step": 2800
|
402 |
+
},
|
403 |
+
{
|
404 |
+
"epoch": 0.3155534641680737,
|
405 |
+
"grad_norm": 0.22746309638023376,
|
406 |
+
"learning_rate": 7.737499152315298e-05,
|
407 |
+
"loss": 0.5469,
|
408 |
+
"step": 2850
|
409 |
+
},
|
410 |
+
{
|
411 |
+
"epoch": 0.32108948985523295,
|
412 |
+
"grad_norm": 0.23455417156219482,
|
413 |
+
"learning_rate": 7.664314330619122e-05,
|
414 |
+
"loss": 0.5442,
|
415 |
+
"step": 2900
|
416 |
+
},
|
417 |
+
{
|
418 |
+
"epoch": 0.3266255155423921,
|
419 |
+
"grad_norm": 0.2275807410478592,
|
420 |
+
"learning_rate": 7.590323494930396e-05,
|
421 |
+
"loss": 0.5488,
|
422 |
+
"step": 2950
|
423 |
+
},
|
424 |
+
{
|
425 |
+
"epoch": 0.3321615412295513,
|
426 |
+
"grad_norm": 0.23548050224781036,
|
427 |
+
"learning_rate": 7.515549029112848e-05,
|
428 |
+
"loss": 0.5457,
|
429 |
+
"step": 3000
|
430 |
+
},
|
431 |
+
{
|
432 |
+
"epoch": 0.3376975669167105,
|
433 |
+
"grad_norm": 0.27617892622947693,
|
434 |
+
"learning_rate": 7.440013554095635e-05,
|
435 |
+
"loss": 0.5477,
|
436 |
+
"step": 3050
|
437 |
+
},
|
438 |
+
{
|
439 |
+
"epoch": 0.3432335926038697,
|
440 |
+
"grad_norm": 0.22806765139102936,
|
441 |
+
"learning_rate": 7.363739921030026e-05,
|
442 |
+
"loss": 0.5438,
|
443 |
+
"step": 3100
|
444 |
+
},
|
445 |
+
{
|
446 |
+
"epoch": 0.34876961829102887,
|
447 |
+
"grad_norm": 0.22560247778892517,
|
448 |
+
"learning_rate": 7.286751204376419e-05,
|
449 |
+
"loss": 0.5434,
|
450 |
+
"step": 3150
|
451 |
+
},
|
452 |
+
{
|
453 |
+
"epoch": 0.35430564397818803,
|
454 |
+
"grad_norm": 0.24336422979831696,
|
455 |
+
"learning_rate": 7.209070694923812e-05,
|
456 |
+
"loss": 0.5441,
|
457 |
+
"step": 3200
|
458 |
+
},
|
459 |
+
{
|
460 |
+
"epoch": 0.35984166966534725,
|
461 |
+
"grad_norm": 0.2279517948627472,
|
462 |
+
"learning_rate": 7.130721892743816e-05,
|
463 |
+
"loss": 0.5392,
|
464 |
+
"step": 3250
|
465 |
+
},
|
466 |
+
{
|
467 |
+
"epoch": 0.3653776953525064,
|
468 |
+
"grad_norm": 0.23315465450286865,
|
469 |
+
"learning_rate": 7.05172850008137e-05,
|
470 |
+
"loss": 0.5421,
|
471 |
+
"step": 3300
|
472 |
+
},
|
473 |
+
{
|
474 |
+
"epoch": 0.37091372103966563,
|
475 |
+
"grad_norm": 0.21792641282081604,
|
476 |
+
"learning_rate": 6.972114414184281e-05,
|
477 |
+
"loss": 0.5385,
|
478 |
+
"step": 3350
|
479 |
+
},
|
480 |
+
{
|
481 |
+
"epoch": 0.3764497467268248,
|
482 |
+
"grad_norm": 0.22232070565223694,
|
483 |
+
"learning_rate": 6.891903720073791e-05,
|
484 |
+
"loss": 0.5393,
|
485 |
+
"step": 3400
|
486 |
+
},
|
487 |
+
{
|
488 |
+
"epoch": 0.381985772413984,
|
489 |
+
"grad_norm": 0.22461949288845062,
|
490 |
+
"learning_rate": 6.811120683258312e-05,
|
491 |
+
"loss": 0.539,
|
492 |
+
"step": 3450
|
493 |
+
},
|
494 |
+
{
|
495 |
+
"epoch": 0.3875217981011432,
|
496 |
+
"grad_norm": 0.2534426748752594,
|
497 |
+
"learning_rate": 6.729789742392578e-05,
|
498 |
+
"loss": 0.5388,
|
499 |
+
"step": 3500
|
500 |
+
},
|
501 |
+
{
|
502 |
+
"epoch": 0.3930578237883024,
|
503 |
+
"grad_norm": 0.23156966269016266,
|
504 |
+
"learning_rate": 6.647935501884414e-05,
|
505 |
+
"loss": 0.5374,
|
506 |
+
"step": 3550
|
507 |
+
},
|
508 |
+
{
|
509 |
+
"epoch": 0.39859384947546156,
|
510 |
+
"grad_norm": 0.22473926842212677,
|
511 |
+
"learning_rate": 6.565582724451361e-05,
|
512 |
+
"loss": 0.5352,
|
513 |
+
"step": 3600
|
514 |
+
},
|
515 |
+
{
|
516 |
+
"epoch": 0.4041298751626208,
|
517 |
+
"grad_norm": 0.21904204785823822,
|
518 |
+
"learning_rate": 6.482756323629396e-05,
|
519 |
+
"loss": 0.5323,
|
520 |
+
"step": 3650
|
521 |
+
},
|
522 |
+
{
|
523 |
+
"epoch": 0.40966590084977994,
|
524 |
+
"grad_norm": 0.2203177511692047,
|
525 |
+
"learning_rate": 6.399481356236042e-05,
|
526 |
+
"loss": 0.5328,
|
527 |
+
"step": 3700
|
528 |
+
},
|
529 |
+
{
|
530 |
+
"epoch": 0.41520192653693916,
|
531 |
+
"grad_norm": 0.22808462381362915,
|
532 |
+
"learning_rate": 6.315783014790135e-05,
|
533 |
+
"loss": 0.5369,
|
534 |
+
"step": 3750
|
535 |
+
},
|
536 |
+
{
|
537 |
+
"epoch": 0.4207379522240983,
|
538 |
+
"grad_norm": 0.22881828248500824,
|
539 |
+
"learning_rate": 6.231686619890517e-05,
|
540 |
+
"loss": 0.5331,
|
541 |
+
"step": 3800
|
542 |
+
},
|
543 |
+
{
|
544 |
+
"epoch": 0.4262739779112575,
|
545 |
+
"grad_norm": 0.2256467193365097,
|
546 |
+
"learning_rate": 6.147217612556002e-05,
|
547 |
+
"loss": 0.5289,
|
548 |
+
"step": 3850
|
549 |
+
},
|
550 |
+
{
|
551 |
+
"epoch": 0.4318100035984167,
|
552 |
+
"grad_norm": 0.2211819589138031,
|
553 |
+
"learning_rate": 6.062401546528903e-05,
|
554 |
+
"loss": 0.5312,
|
555 |
+
"step": 3900
|
556 |
+
},
|
557 |
+
{
|
558 |
+
"epoch": 0.43734602928557587,
|
559 |
+
"grad_norm": 0.22896280884742737,
|
560 |
+
"learning_rate": 5.9772640805444626e-05,
|
561 |
+
"loss": 0.5297,
|
562 |
+
"step": 3950
|
563 |
+
},
|
564 |
+
{
|
565 |
+
"epoch": 0.4428820549727351,
|
566 |
+
"grad_norm": 0.2265992909669876,
|
567 |
+
"learning_rate": 5.891830970568517e-05,
|
568 |
+
"loss": 0.5331,
|
569 |
+
"step": 4000
|
570 |
+
},
|
571 |
+
{
|
572 |
+
"epoch": 0.44841808065989425,
|
573 |
+
"grad_norm": 0.22474776208400726,
|
574 |
+
"learning_rate": 5.806128062005744e-05,
|
575 |
+
"loss": 0.528,
|
576 |
+
"step": 4050
|
577 |
+
},
|
578 |
+
{
|
579 |
+
"epoch": 0.45395410634705347,
|
580 |
+
"grad_norm": 0.21792100369930267,
|
581 |
+
"learning_rate": 5.720181281880862e-05,
|
582 |
+
"loss": 0.5329,
|
583 |
+
"step": 4100
|
584 |
+
},
|
585 |
+
{
|
586 |
+
"epoch": 0.45949013203421263,
|
587 |
+
"grad_norm": 0.224033921957016,
|
588 |
+
"learning_rate": 5.634016630995125e-05,
|
589 |
+
"loss": 0.5275,
|
590 |
+
"step": 4150
|
591 |
+
},
|
592 |
+
{
|
593 |
+
"epoch": 0.46502615772137185,
|
594 |
+
"grad_norm": 0.22141297161579132,
|
595 |
+
"learning_rate": 5.547660176060513e-05,
|
596 |
+
"loss": 0.5285,
|
597 |
+
"step": 4200
|
598 |
+
},
|
599 |
+
{
|
600 |
+
"epoch": 0.470562183408531,
|
601 |
+
"grad_norm": 0.22379058599472046,
|
602 |
+
"learning_rate": 5.4611380418139714e-05,
|
603 |
+
"loss": 0.5267,
|
604 |
+
"step": 4250
|
605 |
+
},
|
606 |
+
{
|
607 |
+
"epoch": 0.47609820909569023,
|
608 |
+
"grad_norm": 0.21981391310691833,
|
609 |
+
"learning_rate": 5.374476403114096e-05,
|
610 |
+
"loss": 0.5276,
|
611 |
+
"step": 4300
|
612 |
+
},
|
613 |
+
{
|
614 |
+
"epoch": 0.4816342347828494,
|
615 |
+
"grad_norm": 0.21584829688072205,
|
616 |
+
"learning_rate": 5.287701477022671e-05,
|
617 |
+
"loss": 0.5259,
|
618 |
+
"step": 4350
|
619 |
+
},
|
620 |
+
{
|
621 |
+
"epoch": 0.48717026047000855,
|
622 |
+
"grad_norm": 0.21814610064029694,
|
623 |
+
"learning_rate": 5.2008395148734135e-05,
|
624 |
+
"loss": 0.5229,
|
625 |
+
"step": 4400
|
626 |
+
},
|
627 |
+
{
|
628 |
+
"epoch": 0.49270628615716777,
|
629 |
+
"grad_norm": 0.21903090178966522,
|
630 |
+
"learning_rate": 5.113916794330382e-05,
|
631 |
+
"loss": 0.5225,
|
632 |
+
"step": 4450
|
633 |
+
},
|
634 |
+
{
|
635 |
+
"epoch": 0.49824231184432693,
|
636 |
+
"grad_norm": 0.21363414824008942,
|
637 |
+
"learning_rate": 5.0269596114383844e-05,
|
638 |
+
"loss": 0.5226,
|
639 |
+
"step": 4500
|
640 |
+
},
|
641 |
+
{
|
642 |
+
"epoch": 0.5037783375314862,
|
643 |
+
"grad_norm": 0.21449269354343414,
|
644 |
+
"learning_rate": 4.939994272667855e-05,
|
645 |
+
"loss": 0.5194,
|
646 |
+
"step": 4550
|
647 |
+
},
|
648 |
+
{
|
649 |
+
"epoch": 0.5093143632186453,
|
650 |
+
"grad_norm": 0.2134004533290863,
|
651 |
+
"learning_rate": 4.853047086956558e-05,
|
652 |
+
"loss": 0.5201,
|
653 |
+
"step": 4600
|
654 |
+
},
|
655 |
+
{
|
656 |
+
"epoch": 0.5148503889058045,
|
657 |
+
"grad_norm": 0.2227301150560379,
|
658 |
+
"learning_rate": 4.766144357750563e-05,
|
659 |
+
"loss": 0.5231,
|
660 |
+
"step": 4650
|
661 |
+
},
|
662 |
+
{
|
663 |
+
"epoch": 0.5203864145929638,
|
664 |
+
"grad_norm": 0.21659956872463226,
|
665 |
+
"learning_rate": 4.679312375046853e-05,
|
666 |
+
"loss": 0.5186,
|
667 |
+
"step": 4700
|
668 |
+
},
|
669 |
+
{
|
670 |
+
"epoch": 0.5259224402801229,
|
671 |
+
"grad_norm": 0.22292132675647736,
|
672 |
+
"learning_rate": 4.5925774074400415e-05,
|
673 |
+
"loss": 0.517,
|
674 |
+
"step": 4750
|
675 |
+
},
|
676 |
+
{
|
677 |
+
"epoch": 0.5314584659672821,
|
678 |
+
"grad_norm": 0.21309538185596466,
|
679 |
+
"learning_rate": 4.5059656941755244e-05,
|
680 |
+
"loss": 0.5207,
|
681 |
+
"step": 4800
|
682 |
+
},
|
683 |
+
{
|
684 |
+
"epoch": 0.5369944916544412,
|
685 |
+
"grad_norm": 0.222327321767807,
|
686 |
+
"learning_rate": 4.419503437211533e-05,
|
687 |
+
"loss": 0.5184,
|
688 |
+
"step": 4850
|
689 |
+
},
|
690 |
+
{
|
691 |
+
"epoch": 0.5425305173416005,
|
692 |
+
"grad_norm": 0.21690316498279572,
|
693 |
+
"learning_rate": 4.333216793292463e-05,
|
694 |
+
"loss": 0.5176,
|
695 |
+
"step": 4900
|
696 |
+
},
|
697 |
+
{
|
698 |
+
"epoch": 0.5480665430287597,
|
699 |
+
"grad_norm": 0.21055321395397186,
|
700 |
+
"learning_rate": 4.247131866035886e-05,
|
701 |
+
"loss": 0.515,
|
702 |
+
"step": 4950
|
703 |
+
},
|
704 |
+
{
|
705 |
+
"epoch": 0.5536025687159188,
|
706 |
+
"grad_norm": 0.2189202904701233,
|
707 |
+
"learning_rate": 4.161274698035618e-05,
|
708 |
+
"loss": 0.5128,
|
709 |
+
"step": 5000
|
710 |
+
},
|
711 |
+
{
|
712 |
+
"epoch": 0.559138594403078,
|
713 |
+
"grad_norm": 0.2133471965789795,
|
714 |
+
"learning_rate": 4.0756712629832675e-05,
|
715 |
+
"loss": 0.5141,
|
716 |
+
"step": 5050
|
717 |
+
},
|
718 |
+
{
|
719 |
+
"epoch": 0.5646746200902372,
|
720 |
+
"grad_norm": 0.2180759310722351,
|
721 |
+
"learning_rate": 3.990347457810612e-05,
|
722 |
+
"loss": 0.5151,
|
723 |
+
"step": 5100
|
724 |
+
},
|
725 |
+
{
|
726 |
+
"epoch": 0.5702106457773964,
|
727 |
+
"grad_norm": 0.22086185216903687,
|
728 |
+
"learning_rate": 3.9053290948552164e-05,
|
729 |
+
"loss": 0.5151,
|
730 |
+
"step": 5150
|
731 |
+
},
|
732 |
+
{
|
733 |
+
"epoch": 0.5757466714645556,
|
734 |
+
"grad_norm": 0.2056632786989212,
|
735 |
+
"learning_rate": 3.820641894051613e-05,
|
736 |
+
"loss": 0.5131,
|
737 |
+
"step": 5200
|
738 |
+
},
|
739 |
+
{
|
740 |
+
"epoch": 0.5812826971517148,
|
741 |
+
"grad_norm": 0.21264417469501495,
|
742 |
+
"learning_rate": 3.736311475150464e-05,
|
743 |
+
"loss": 0.5116,
|
744 |
+
"step": 5250
|
745 |
+
},
|
746 |
+
{
|
747 |
+
"epoch": 0.5868187228388739,
|
748 |
+
"grad_norm": 0.2104145884513855,
|
749 |
+
"learning_rate": 3.65236334996802e-05,
|
750 |
+
"loss": 0.5107,
|
751 |
+
"step": 5300
|
752 |
+
},
|
753 |
+
{
|
754 |
+
"epoch": 0.5923547485260332,
|
755 |
+
"grad_norm": 0.21011343598365784,
|
756 |
+
"learning_rate": 3.568822914668225e-05,
|
757 |
+
"loss": 0.5109,
|
758 |
+
"step": 5350
|
759 |
+
},
|
760 |
+
{
|
761 |
+
"epoch": 0.5978907742131924,
|
762 |
+
"grad_norm": 0.20390474796295166,
|
763 |
+
"learning_rate": 3.4857154420798246e-05,
|
764 |
+
"loss": 0.5103,
|
765 |
+
"step": 5400
|
766 |
+
},
|
767 |
+
{
|
768 |
+
"epoch": 0.6034267999003515,
|
769 |
+
"grad_norm": 0.211042582988739,
|
770 |
+
"learning_rate": 3.4030660740507654e-05,
|
771 |
+
"loss": 0.5125,
|
772 |
+
"step": 5450
|
773 |
+
},
|
774 |
+
{
|
775 |
+
"epoch": 0.6089628255875107,
|
776 |
+
"grad_norm": 0.20937225222587585,
|
777 |
+
"learning_rate": 3.32089981384224e-05,
|
778 |
+
"loss": 0.5083,
|
779 |
+
"step": 5500
|
780 |
+
},
|
781 |
+
{
|
782 |
+
"epoch": 0.61449885127467,
|
783 |
+
"grad_norm": 0.21997790038585663,
|
784 |
+
"learning_rate": 3.239241518564649e-05,
|
785 |
+
"loss": 0.5075,
|
786 |
+
"step": 5550
|
787 |
+
},
|
788 |
+
{
|
789 |
+
"epoch": 0.6200348769618291,
|
790 |
+
"grad_norm": 0.21026423573493958,
|
791 |
+
"learning_rate": 3.158115891657757e-05,
|
792 |
+
"loss": 0.5059,
|
793 |
+
"step": 5600
|
794 |
+
},
|
795 |
+
{
|
796 |
+
"epoch": 0.6255709026489883,
|
797 |
+
"grad_norm": 0.2174540013074875,
|
798 |
+
"learning_rate": 3.0775474754173836e-05,
|
799 |
+
"loss": 0.5068,
|
800 |
+
"step": 5650
|
801 |
+
},
|
802 |
+
{
|
803 |
+
"epoch": 0.6311069283361475,
|
804 |
+
"grad_norm": 0.34200409054756165,
|
805 |
+
"learning_rate": 2.9975606435707905e-05,
|
806 |
+
"loss": 0.5057,
|
807 |
+
"step": 5700
|
808 |
+
},
|
809 |
+
{
|
810 |
+
"epoch": 0.6366429540233066,
|
811 |
+
"grad_norm": 0.22012512385845184,
|
812 |
+
"learning_rate": 2.9181795939031088e-05,
|
813 |
+
"loss": 0.5041,
|
814 |
+
"step": 5750
|
815 |
+
},
|
816 |
+
{
|
817 |
+
"epoch": 0.6421789797104659,
|
818 |
+
"grad_norm": 0.2161373794078827,
|
819 |
+
"learning_rate": 2.839428340936966e-05,
|
820 |
+
"loss": 0.5071,
|
821 |
+
"step": 5800
|
822 |
+
},
|
823 |
+
{
|
824 |
+
"epoch": 0.647715005397625,
|
825 |
+
"grad_norm": 0.21077008545398712,
|
826 |
+
"learning_rate": 2.761330708667557e-05,
|
827 |
+
"loss": 0.5032,
|
828 |
+
"step": 5850
|
829 |
+
},
|
830 |
+
{
|
831 |
+
"epoch": 0.6532510310847842,
|
832 |
+
"grad_norm": 0.21698136627674103,
|
833 |
+
"learning_rate": 2.6839103233553692e-05,
|
834 |
+
"loss": 0.502,
|
835 |
+
"step": 5900
|
836 |
+
},
|
837 |
+
{
|
838 |
+
"epoch": 0.6587870567719434,
|
839 |
+
"grad_norm": 0.21964408457279205,
|
840 |
+
"learning_rate": 2.6071906063787154e-05,
|
841 |
+
"loss": 0.4997,
|
842 |
+
"step": 5950
|
843 |
+
},
|
844 |
+
{
|
845 |
+
"epoch": 0.6643230824591027,
|
846 |
+
"grad_norm": 0.21225056052207947,
|
847 |
+
"learning_rate": 2.5311947671482373e-05,
|
848 |
+
"loss": 0.5028,
|
849 |
+
"step": 6000
|
850 |
+
},
|
851 |
+
{
|
852 |
+
"epoch": 0.6698591081462618,
|
853 |
+
"grad_norm": 0.20255029201507568,
|
854 |
+
"learning_rate": 2.4559457960855564e-05,
|
855 |
+
"loss": 0.5004,
|
856 |
+
"step": 6050
|
857 |
+
},
|
858 |
+
{
|
859 |
+
"epoch": 0.675395133833421,
|
860 |
+
"grad_norm": 0.2110464870929718,
|
861 |
+
"learning_rate": 2.381466457668165e-05,
|
862 |
+
"loss": 0.5032,
|
863 |
+
"step": 6100
|
864 |
+
},
|
865 |
+
{
|
866 |
+
"epoch": 0.6809311595205801,
|
867 |
+
"grad_norm": 0.2102268934249878,
|
868 |
+
"learning_rate": 2.307779283542655e-05,
|
869 |
+
"loss": 0.4993,
|
870 |
+
"step": 6150
|
871 |
+
},
|
872 |
+
{
|
873 |
+
"epoch": 0.6864671852077394,
|
874 |
+
"grad_norm": 0.20706956088542938,
|
875 |
+
"learning_rate": 2.234906565708412e-05,
|
876 |
+
"loss": 0.4993,
|
877 |
+
"step": 6200
|
878 |
+
},
|
879 |
+
{
|
880 |
+
"epoch": 0.6920032108948986,
|
881 |
+
"grad_norm": 0.20903447270393372,
|
882 |
+
"learning_rate": 2.162870349773785e-05,
|
883 |
+
"loss": 0.5021,
|
884 |
+
"step": 6250
|
885 |
+
},
|
886 |
+
{
|
887 |
+
"epoch": 0.6975392365820577,
|
888 |
+
"grad_norm": 1.246344804763794,
|
889 |
+
"learning_rate": 2.0916924282868017e-05,
|
890 |
+
"loss": 0.5,
|
891 |
+
"step": 6300
|
892 |
+
},
|
893 |
+
{
|
894 |
+
"epoch": 0.7030752622692169,
|
895 |
+
"grad_norm": 0.217108353972435,
|
896 |
+
"learning_rate": 2.021394334142444e-05,
|
897 |
+
"loss": 0.501,
|
898 |
+
"step": 6350
|
899 |
+
},
|
900 |
+
{
|
901 |
+
"epoch": 0.7086112879563761,
|
902 |
+
"grad_norm": 0.21456560492515564,
|
903 |
+
"learning_rate": 1.9519973340684694e-05,
|
904 |
+
"loss": 0.5004,
|
905 |
+
"step": 6400
|
906 |
+
},
|
907 |
+
{
|
908 |
+
"epoch": 0.7141473136435353,
|
909 |
+
"grad_norm": 0.4793643355369568,
|
910 |
+
"learning_rate": 1.8835224221917575e-05,
|
911 |
+
"loss": 0.4963,
|
912 |
+
"step": 6450
|
913 |
+
},
|
914 |
+
{
|
915 |
+
"epoch": 0.7196833393306945,
|
916 |
+
"grad_norm": 0.20427371561527252,
|
917 |
+
"learning_rate": 1.8159903136871163e-05,
|
918 |
+
"loss": 0.4983,
|
919 |
+
"step": 6500
|
920 |
+
},
|
921 |
+
{
|
922 |
+
"epoch": 0.7252193650178537,
|
923 |
+
"grad_norm": 0.21231062710285187,
|
924 |
+
"learning_rate": 1.749421438510494e-05,
|
925 |
+
"loss": 0.4981,
|
926 |
+
"step": 6550
|
927 |
+
},
|
928 |
+
{
|
929 |
+
"epoch": 0.7307553907050128,
|
930 |
+
"grad_norm": 0.2009134292602539,
|
931 |
+
"learning_rate": 1.6838359352184576e-05,
|
932 |
+
"loss": 0.4962,
|
933 |
+
"step": 6600
|
934 |
+
},
|
935 |
+
{
|
936 |
+
"epoch": 0.7362914163921721,
|
937 |
+
"grad_norm": 0.21329347789287567,
|
938 |
+
"learning_rate": 1.6192536448758384e-05,
|
939 |
+
"loss": 0.4924,
|
940 |
+
"step": 6650
|
941 |
+
},
|
942 |
+
{
|
943 |
+
"epoch": 0.7418274420793313,
|
944 |
+
"grad_norm": 0.20288462936878204,
|
945 |
+
"learning_rate": 1.5556941050533636e-05,
|
946 |
+
"loss": 0.4933,
|
947 |
+
"step": 6700
|
948 |
+
},
|
949 |
+
{
|
950 |
+
"epoch": 0.7473634677664904,
|
951 |
+
"grad_norm": 0.20821629464626312,
|
952 |
+
"learning_rate": 1.4931765439171253e-05,
|
953 |
+
"loss": 0.4937,
|
954 |
+
"step": 6750
|
955 |
+
},
|
956 |
+
{
|
957 |
+
"epoch": 0.7528994934536496,
|
958 |
+
"grad_norm": 0.21015210449695587,
|
959 |
+
"learning_rate": 1.43171987441162e-05,
|
960 |
+
"loss": 0.4946,
|
961 |
+
"step": 6800
|
962 |
+
},
|
963 |
+
{
|
964 |
+
"epoch": 0.7584355191408089,
|
965 |
+
"grad_norm": 0.2095811516046524,
|
966 |
+
"learning_rate": 1.3713426885381659e-05,
|
967 |
+
"loss": 0.4902,
|
968 |
+
"step": 6850
|
969 |
+
},
|
970 |
+
{
|
971 |
+
"epoch": 0.763971544827968,
|
972 |
+
"grad_norm": 0.20578137040138245,
|
973 |
+
"learning_rate": 1.3120632517304204e-05,
|
974 |
+
"loss": 0.4942,
|
975 |
+
"step": 6900
|
976 |
+
},
|
977 |
+
{
|
978 |
+
"epoch": 0.7695075705151272,
|
979 |
+
"grad_norm": 0.20409756898880005,
|
980 |
+
"learning_rate": 1.2538994973286766e-05,
|
981 |
+
"loss": 0.4918,
|
982 |
+
"step": 6950
|
983 |
+
},
|
984 |
+
{
|
985 |
+
"epoch": 0.7750435962022864,
|
986 |
+
"grad_norm": 0.20583651959896088,
|
987 |
+
"learning_rate": 1.1968690211546323e-05,
|
988 |
+
"loss": 0.4894,
|
989 |
+
"step": 7000
|
990 |
+
},
|
991 |
+
{
|
992 |
+
"epoch": 0.7805796218894455,
|
993 |
+
"grad_norm": 0.2010050117969513,
|
994 |
+
"learning_rate": 1.1409890761882624e-05,
|
995 |
+
"loss": 0.4926,
|
996 |
+
"step": 7050
|
997 |
+
},
|
998 |
+
{
|
999 |
+
"epoch": 0.7861156475766048,
|
1000 |
+
"grad_norm": 0.2147577702999115,
|
1001 |
+
"learning_rate": 1.086276567348415e-05,
|
1002 |
+
"loss": 0.4912,
|
1003 |
+
"step": 7100
|
1004 |
+
},
|
1005 |
+
{
|
1006 |
+
"epoch": 0.791651673263764,
|
1007 |
+
"grad_norm": 0.21157945692539215,
|
1008 |
+
"learning_rate": 1.0327480463787014e-05,
|
1009 |
+
"loss": 0.4923,
|
1010 |
+
"step": 7150
|
1011 |
+
},
|
1012 |
+
{
|
1013 |
+
"epoch": 0.7971876989509231,
|
1014 |
+
"grad_norm": 0.21193242073059082,
|
1015 |
+
"learning_rate": 9.804197068402181e-06,
|
1016 |
+
"loss": 0.4911,
|
1017 |
+
"step": 7200
|
1018 |
+
},
|
1019 |
+
{
|
1020 |
+
"epoch": 0.8027237246380823,
|
1021 |
+
"grad_norm": 0.20365694165229797,
|
1022 |
+
"learning_rate": 9.293073792126483e-06,
|
1023 |
+
"loss": 0.4896,
|
1024 |
+
"step": 7250
|
1025 |
+
},
|
1026 |
+
{
|
1027 |
+
"epoch": 0.8082597503252416,
|
1028 |
+
"grad_norm": 0.20320066809654236,
|
1029 |
+
"learning_rate": 8.794265261051837e-06,
|
1030 |
+
"loss": 0.4887,
|
1031 |
+
"step": 7300
|
1032 |
+
},
|
1033 |
+
{
|
1034 |
+
"epoch": 0.8137957760124007,
|
1035 |
+
"grad_norm": 0.20599696040153503,
|
1036 |
+
"learning_rate": 8.307922375787452e-06,
|
1037 |
+
"loss": 0.4921,
|
1038 |
+
"step": 7350
|
1039 |
+
},
|
1040 |
+
{
|
1041 |
+
"epoch": 0.8193318016995599,
|
1042 |
+
"grad_norm": 0.2039978951215744,
|
1043 |
+
"learning_rate": 7.834192265809086e-06,
|
1044 |
+
"loss": 0.4882,
|
1045 |
+
"step": 7400
|
1046 |
+
},
|
1047 |
+
{
|
1048 |
+
"epoch": 0.824867827386719,
|
1049 |
+
"grad_norm": 0.22645381093025208,
|
1050 |
+
"learning_rate": 7.3732182449491035e-06,
|
1051 |
+
"loss": 0.4883,
|
1052 |
+
"step": 7450
|
1053 |
+
},
|
1054 |
+
{
|
1055 |
+
"epoch": 0.8304038530738783,
|
1056 |
+
"grad_norm": 0.20420923829078674,
|
1057 |
+
"learning_rate": 6.925139768040861e-06,
|
1058 |
+
"loss": 0.4926,
|
1059 |
+
"step": 7500
|
1060 |
+
},
|
1061 |
+
{
|
1062 |
+
"epoch": 0.8359398787610375,
|
1063 |
+
"grad_norm": 0.20432165265083313,
|
1064 |
+
"learning_rate": 6.490092388730573e-06,
|
1065 |
+
"loss": 0.4892,
|
1066 |
+
"step": 7550
|
1067 |
+
},
|
1068 |
+
{
|
1069 |
+
"epoch": 0.8414759044481966,
|
1070 |
+
"grad_norm": 0.20835673809051514,
|
1071 |
+
"learning_rate": 6.068207718469299e-06,
|
1072 |
+
"loss": 0.4909,
|
1073 |
+
"step": 7600
|
1074 |
+
},
|
1075 |
+
{
|
1076 |
+
"epoch": 0.8470119301353558,
|
1077 |
+
"grad_norm": 0.208354651927948,
|
1078 |
+
"learning_rate": 5.659613386697599e-06,
|
1079 |
+
"loss": 0.4858,
|
1080 |
+
"step": 7650
|
1081 |
+
},
|
1082 |
+
{
|
1083 |
+
"epoch": 0.852547955822515,
|
1084 |
+
"grad_norm": 0.20932409167289734,
|
1085 |
+
"learning_rate": 5.26443300223477e-06,
|
1086 |
+
"loss": 0.4874,
|
1087 |
+
"step": 7700
|
1088 |
+
},
|
1089 |
+
{
|
1090 |
+
"epoch": 0.8580839815096742,
|
1091 |
+
"grad_norm": 0.2009408324956894,
|
1092 |
+
"learning_rate": 4.882786115884486e-06,
|
1093 |
+
"loss": 0.4868,
|
1094 |
+
"step": 7750
|
1095 |
+
},
|
1096 |
+
{
|
1097 |
+
"epoch": 0.8636200071968334,
|
1098 |
+
"grad_norm": 0.2020995020866394,
|
1099 |
+
"learning_rate": 4.5147881842680155e-06,
|
1100 |
+
"loss": 0.4869,
|
1101 |
+
"step": 7800
|
1102 |
+
},
|
1103 |
+
{
|
1104 |
+
"epoch": 0.8691560328839926,
|
1105 |
+
"grad_norm": 0.2013290524482727,
|
1106 |
+
"learning_rate": 4.1605505348960575e-06,
|
1107 |
+
"loss": 0.4874,
|
1108 |
+
"step": 7850
|
1109 |
+
},
|
1110 |
+
{
|
1111 |
+
"epoch": 0.8746920585711517,
|
1112 |
+
"grad_norm": 0.20548592507839203,
|
1113 |
+
"learning_rate": 3.820180332489653e-06,
|
1114 |
+
"loss": 0.4861,
|
1115 |
+
"step": 7900
|
1116 |
+
},
|
1117 |
+
{
|
1118 |
+
"epoch": 0.880228084258311,
|
1119 |
+
"grad_norm": 0.2057260423898697,
|
1120 |
+
"learning_rate": 3.493780546560588e-06,
|
1121 |
+
"loss": 0.486,
|
1122 |
+
"step": 7950
|
1123 |
+
},
|
1124 |
+
{
|
1125 |
+
"epoch": 0.8857641099454702,
|
1126 |
+
"grad_norm": 0.20100025832653046,
|
1127 |
+
"learning_rate": 3.1814499202607375e-06,
|
1128 |
+
"loss": 0.4897,
|
1129 |
+
"step": 8000
|
1130 |
+
},
|
1131 |
+
{
|
1132 |
+
"epoch": 0.8913001356326293,
|
1133 |
+
"grad_norm": 0.1988091915845871,
|
1134 |
+
"learning_rate": 2.8832829405101234e-06,
|
1135 |
+
"loss": 0.4853,
|
1136 |
+
"step": 8050
|
1137 |
+
},
|
1138 |
+
{
|
1139 |
+
"epoch": 0.8968361613197885,
|
1140 |
+
"grad_norm": 0.2371445745229721,
|
1141 |
+
"learning_rate": 2.5993698094125496e-06,
|
1142 |
+
"loss": 0.482,
|
1143 |
+
"step": 8100
|
1144 |
+
},
|
1145 |
+
{
|
1146 |
+
"epoch": 0.9023721870069477,
|
1147 |
+
"grad_norm": 0.39132463932037354,
|
1148 |
+
"learning_rate": 2.329796416967445e-06,
|
1149 |
+
"loss": 0.488,
|
1150 |
+
"step": 8150
|
1151 |
+
},
|
1152 |
+
{
|
1153 |
+
"epoch": 0.9079082126941069,
|
1154 |
+
"grad_norm": 0.204506054520607,
|
1155 |
+
"learning_rate": 2.074644315086244e-06,
|
1156 |
+
"loss": 0.486,
|
1157 |
+
"step": 8200
|
1158 |
+
},
|
1159 |
+
{
|
1160 |
+
"epoch": 0.9134442383812661,
|
1161 |
+
"grad_norm": 0.20363277196884155,
|
1162 |
+
"learning_rate": 1.8339906929211338e-06,
|
1163 |
+
"loss": 0.4861,
|
1164 |
+
"step": 8250
|
1165 |
+
},
|
1166 |
+
{
|
1167 |
+
"epoch": 0.9189802640684253,
|
1168 |
+
"grad_norm": 0.20154082775115967,
|
1169 |
+
"learning_rate": 1.607908353513632e-06,
|
1170 |
+
"loss": 0.4868,
|
1171 |
+
"step": 8300
|
1172 |
+
},
|
1173 |
+
{
|
1174 |
+
"epoch": 0.9245162897555844,
|
1175 |
+
"grad_norm": 0.19429387152194977,
|
1176 |
+
"learning_rate": 1.3964656917700491e-06,
|
1177 |
+
"loss": 0.4842,
|
1178 |
+
"step": 8350
|
1179 |
+
},
|
1180 |
+
{
|
1181 |
+
"epoch": 0.9300523154427437,
|
1182 |
+
"grad_norm": 0.2060394138097763,
|
1183 |
+
"learning_rate": 1.1997266737705294e-06,
|
1184 |
+
"loss": 0.4851,
|
1185 |
+
"step": 8400
|
1186 |
+
},
|
1187 |
+
{
|
1188 |
+
"epoch": 0.9355883411299029,
|
1189 |
+
"grad_norm": 0.19958224892616272,
|
1190 |
+
"learning_rate": 1.017750817417873e-06,
|
1191 |
+
"loss": 0.4812,
|
1192 |
+
"step": 8450
|
1193 |
+
},
|
1194 |
+
{
|
1195 |
+
"epoch": 0.941124366817062,
|
1196 |
+
"grad_norm": 0.19916601479053497,
|
1197 |
+
"learning_rate": 8.50593174432096e-07,
|
1198 |
+
"loss": 0.4836,
|
1199 |
+
"step": 8500
|
1200 |
+
}
|
1201 |
+
],
|
1202 |
+
"logging_steps": 50,
|
1203 |
+
"max_steps": 9031,
|
1204 |
+
"num_input_tokens_seen": 0,
|
1205 |
+
"num_train_epochs": 1,
|
1206 |
+
"save_steps": 500,
|
1207 |
+
"stateful_callbacks": {
|
1208 |
+
"TrainerControl": {
|
1209 |
+
"args": {
|
1210 |
+
"should_epoch_stop": false,
|
1211 |
+
"should_evaluate": false,
|
1212 |
+
"should_log": false,
|
1213 |
+
"should_save": true,
|
1214 |
+
"should_training_stop": false
|
1215 |
+
},
|
1216 |
+
"attributes": {}
|
1217 |
+
}
|
1218 |
+
},
|
1219 |
+
"total_flos": 3.7611267462793265e+19,
|
1220 |
+
"train_batch_size": 2,
|
1221 |
+
"trial_name": null,
|
1222 |
+
"trial_params": null
|
1223 |
+
}
|
training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cf146d6399bd68012f9046fdac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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|