Cartinoe5930 commited on
Commit
eb970b6
·
verified ·
1 Parent(s): 27b16ab

Upload folder using huggingface_hub

Browse files
.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,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "outputs_qalign/out_stage_1",
3
+ "architectures": [
4
+ "Qwen2ForCausalLM"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "eos_token_id": 151645,
8
+ "hidden_act": "silu",
9
+ "hidden_size": 1536,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 8960,
12
+ "max_position_embeddings": 32768,
13
+ "max_window_layers": 21,
14
+ "model_type": "qwen2",
15
+ "num_attention_heads": 12,
16
+ "num_hidden_layers": 28,
17
+ "num_key_value_heads": 2,
18
+ "rms_norm_eps": 1e-06,
19
+ "rope_scaling": null,
20
+ "rope_theta": 1000000.0,
21
+ "sliding_window": 32768,
22
+ "tie_word_embeddings": true,
23
+ "torch_dtype": "bfloat16",
24
+ "transformers_version": "4.49.0",
25
+ "use_cache": false,
26
+ "use_sliding_window": false,
27
+ "vocab_size": 151936
28
+ }
generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "repetition_penalty": 1.1,
10
+ "temperature": 0.7,
11
+ "top_k": 20,
12
+ "top_p": 0.8,
13
+ "transformers_version": "4.49.0"
14
+ }
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step194
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:1a01411c2fd299535b0f63d54a8bcf5de65cb46ed5faa14a201d4b974139808e
3
+ size 3554214752
rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6cb795a5cea0baa625c50007a6c9da09c6bbb5c16b560424070384a479e7d8a6
3
+ size 14512
rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5f19604377bd828eb366c68946ad997a4ff4d69beaeea93ee58915135768ec63
3
+ size 14512
scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1bf927aeba7884e78dc27a27c5832aad0eefccdeed21230a97d2305c9ee44eff
3
+ size 1064
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
30
+ }
31
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
3
+ size 11421896
tokenizer_config.json ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ }
181
+ },
182
+ "additional_special_tokens": [
183
+ "<|im_start|>",
184
+ "<|im_end|>",
185
+ "<|object_ref_start|>",
186
+ "<|object_ref_end|>",
187
+ "<|box_start|>",
188
+ "<|box_end|>",
189
+ "<|quad_start|>",
190
+ "<|quad_end|>",
191
+ "<|vision_start|>",
192
+ "<|vision_end|>",
193
+ "<|vision_pad|>",
194
+ "<|image_pad|>",
195
+ "<|video_pad|>"
196
+ ],
197
+ "bos_token": null,
198
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are Qwen, created by Alibaba Cloud. 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 Qwen, created by Alibaba Cloud. You 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
+ "extra_special_tokens": {},
203
+ "model_max_length": 131072,
204
+ "pad_token": "<|endoftext|>",
205
+ "split_special_tokens": false,
206
+ "tokenizer_class": "Qwen2Tokenizer",
207
+ "unk_token": null
208
+ }
trainer_state.json ADDED
@@ -0,0 +1,1399 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.9980707395498393,
5
+ "eval_steps": 500,
6
+ "global_step": 194,
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.005144694533762058,
13
+ "grad_norm": 3.161365032196045,
14
+ "learning_rate": 1.111111111111111e-06,
15
+ "loss": 0.7146,
16
+ "step": 1
17
+ },
18
+ {
19
+ "epoch": 0.010289389067524116,
20
+ "grad_norm": 3.145214080810547,
21
+ "learning_rate": 2.222222222222222e-06,
22
+ "loss": 0.6479,
23
+ "step": 2
24
+ },
25
+ {
26
+ "epoch": 0.015434083601286173,
27
+ "grad_norm": 3.2331063747406006,
28
+ "learning_rate": 3.3333333333333333e-06,
29
+ "loss": 0.5785,
30
+ "step": 3
31
+ },
32
+ {
33
+ "epoch": 0.020578778135048232,
34
+ "grad_norm": 3.2699339389801025,
35
+ "learning_rate": 4.444444444444444e-06,
36
+ "loss": 0.6538,
37
+ "step": 4
38
+ },
39
+ {
40
+ "epoch": 0.02572347266881029,
41
+ "grad_norm": 3.1358041763305664,
42
+ "learning_rate": 5.555555555555557e-06,
43
+ "loss": 0.651,
44
+ "step": 5
45
+ },
46
+ {
47
+ "epoch": 0.030868167202572346,
48
+ "grad_norm": 2.0558807849884033,
49
+ "learning_rate": 6.666666666666667e-06,
50
+ "loss": 0.5806,
51
+ "step": 6
52
+ },
53
+ {
54
+ "epoch": 0.0360128617363344,
55
+ "grad_norm": 1.1790688037872314,
56
+ "learning_rate": 7.77777777777778e-06,
57
+ "loss": 0.5116,
58
+ "step": 7
59
+ },
60
+ {
61
+ "epoch": 0.041157556270096464,
62
+ "grad_norm": 0.9816439747810364,
63
+ "learning_rate": 8.888888888888888e-06,
64
+ "loss": 0.5529,
65
+ "step": 8
66
+ },
67
+ {
68
+ "epoch": 0.04630225080385852,
69
+ "grad_norm": 0.8186548352241516,
70
+ "learning_rate": 1e-05,
71
+ "loss": 0.5629,
72
+ "step": 9
73
+ },
74
+ {
75
+ "epoch": 0.05144694533762058,
76
+ "grad_norm": 0.9718908667564392,
77
+ "learning_rate": 9.999279082014233e-06,
78
+ "loss": 0.5076,
79
+ "step": 10
80
+ },
81
+ {
82
+ "epoch": 0.05659163987138264,
83
+ "grad_norm": 0.8055087327957153,
84
+ "learning_rate": 9.997116535946028e-06,
85
+ "loss": 0.5523,
86
+ "step": 11
87
+ },
88
+ {
89
+ "epoch": 0.06173633440514469,
90
+ "grad_norm": 0.7194182872772217,
91
+ "learning_rate": 9.993512985402724e-06,
92
+ "loss": 0.5105,
93
+ "step": 12
94
+ },
95
+ {
96
+ "epoch": 0.06688102893890675,
97
+ "grad_norm": 0.9174315929412842,
98
+ "learning_rate": 9.988469469530086e-06,
99
+ "loss": 0.5066,
100
+ "step": 13
101
+ },
102
+ {
103
+ "epoch": 0.0720257234726688,
104
+ "grad_norm": 1.0070743560791016,
105
+ "learning_rate": 9.981987442712634e-06,
106
+ "loss": 0.5679,
107
+ "step": 14
108
+ },
109
+ {
110
+ "epoch": 0.07717041800643087,
111
+ "grad_norm": 0.7564347982406616,
112
+ "learning_rate": 9.974068774154252e-06,
113
+ "loss": 0.4988,
114
+ "step": 15
115
+ },
116
+ {
117
+ "epoch": 0.08231511254019293,
118
+ "grad_norm": 0.7040192484855652,
119
+ "learning_rate": 9.964715747339178e-06,
120
+ "loss": 0.5261,
121
+ "step": 16
122
+ },
123
+ {
124
+ "epoch": 0.08745980707395498,
125
+ "grad_norm": 0.6901726722717285,
126
+ "learning_rate": 9.95393105937351e-06,
127
+ "loss": 0.5519,
128
+ "step": 17
129
+ },
130
+ {
131
+ "epoch": 0.09260450160771704,
132
+ "grad_norm": 0.5697789788246155,
133
+ "learning_rate": 9.941717820207461e-06,
134
+ "loss": 0.4733,
135
+ "step": 18
136
+ },
137
+ {
138
+ "epoch": 0.0977491961414791,
139
+ "grad_norm": 0.5673728585243225,
140
+ "learning_rate": 9.928079551738542e-06,
141
+ "loss": 0.5225,
142
+ "step": 19
143
+ },
144
+ {
145
+ "epoch": 0.10289389067524116,
146
+ "grad_norm": 0.5412207841873169,
147
+ "learning_rate": 9.913020186795967e-06,
148
+ "loss": 0.5622,
149
+ "step": 20
150
+ },
151
+ {
152
+ "epoch": 0.10803858520900321,
153
+ "grad_norm": 0.5939576029777527,
154
+ "learning_rate": 9.89654406800655e-06,
155
+ "loss": 0.5056,
156
+ "step": 21
157
+ },
158
+ {
159
+ "epoch": 0.11318327974276528,
160
+ "grad_norm": 0.5736626386642456,
161
+ "learning_rate": 9.878655946542443e-06,
162
+ "loss": 0.5236,
163
+ "step": 22
164
+ },
165
+ {
166
+ "epoch": 0.11832797427652733,
167
+ "grad_norm": 0.5959703326225281,
168
+ "learning_rate": 9.85936098075104e-06,
169
+ "loss": 0.5045,
170
+ "step": 23
171
+ },
172
+ {
173
+ "epoch": 0.12347266881028938,
174
+ "grad_norm": 0.5663568377494812,
175
+ "learning_rate": 9.838664734667496e-06,
176
+ "loss": 0.5815,
177
+ "step": 24
178
+ },
179
+ {
180
+ "epoch": 0.12861736334405144,
181
+ "grad_norm": 0.5114029049873352,
182
+ "learning_rate": 9.81657317641022e-06,
183
+ "loss": 0.496,
184
+ "step": 25
185
+ },
186
+ {
187
+ "epoch": 0.1337620578778135,
188
+ "grad_norm": 0.5281174182891846,
189
+ "learning_rate": 9.79309267645989e-06,
190
+ "loss": 0.5243,
191
+ "step": 26
192
+ },
193
+ {
194
+ "epoch": 0.13890675241157557,
195
+ "grad_norm": 0.5573230981826782,
196
+ "learning_rate": 9.768230005822394e-06,
197
+ "loss": 0.5015,
198
+ "step": 27
199
+ },
200
+ {
201
+ "epoch": 0.1440514469453376,
202
+ "grad_norm": 0.5166211128234863,
203
+ "learning_rate": 9.741992334076309e-06,
204
+ "loss": 0.5105,
205
+ "step": 28
206
+ },
207
+ {
208
+ "epoch": 0.14919614147909968,
209
+ "grad_norm": 0.4607759118080139,
210
+ "learning_rate": 9.714387227305422e-06,
211
+ "loss": 0.4665,
212
+ "step": 29
213
+ },
214
+ {
215
+ "epoch": 0.15434083601286175,
216
+ "grad_norm": 0.504697322845459,
217
+ "learning_rate": 9.68542264591692e-06,
218
+ "loss": 0.5532,
219
+ "step": 30
220
+ },
221
+ {
222
+ "epoch": 0.1594855305466238,
223
+ "grad_norm": 0.4975253641605377,
224
+ "learning_rate": 9.65510694234587e-06,
225
+ "loss": 0.477,
226
+ "step": 31
227
+ },
228
+ {
229
+ "epoch": 0.16463022508038586,
230
+ "grad_norm": 0.5030412673950195,
231
+ "learning_rate": 9.623448858646658e-06,
232
+ "loss": 0.493,
233
+ "step": 32
234
+ },
235
+ {
236
+ "epoch": 0.16977491961414792,
237
+ "grad_norm": 0.489597350358963,
238
+ "learning_rate": 9.590457523972055e-06,
239
+ "loss": 0.4568,
240
+ "step": 33
241
+ },
242
+ {
243
+ "epoch": 0.17491961414790996,
244
+ "grad_norm": 0.5580692887306213,
245
+ "learning_rate": 9.55614245194068e-06,
246
+ "loss": 0.5396,
247
+ "step": 34
248
+ },
249
+ {
250
+ "epoch": 0.18006430868167203,
251
+ "grad_norm": 0.5050625801086426,
252
+ "learning_rate": 9.520513537893574e-06,
253
+ "loss": 0.5133,
254
+ "step": 35
255
+ },
256
+ {
257
+ "epoch": 0.18520900321543407,
258
+ "grad_norm": 0.5139254927635193,
259
+ "learning_rate": 9.48358105604072e-06,
260
+ "loss": 0.5307,
261
+ "step": 36
262
+ },
263
+ {
264
+ "epoch": 0.19035369774919614,
265
+ "grad_norm": 0.5394223928451538,
266
+ "learning_rate": 9.445355656498284e-06,
267
+ "loss": 0.5027,
268
+ "step": 37
269
+ },
270
+ {
271
+ "epoch": 0.1954983922829582,
272
+ "grad_norm": 0.4914088845252991,
273
+ "learning_rate": 9.40584836221749e-06,
274
+ "loss": 0.5215,
275
+ "step": 38
276
+ },
277
+ {
278
+ "epoch": 0.20064308681672025,
279
+ "grad_norm": 0.4907187521457672,
280
+ "learning_rate": 9.365070565805941e-06,
281
+ "loss": 0.5195,
282
+ "step": 39
283
+ },
284
+ {
285
+ "epoch": 0.2057877813504823,
286
+ "grad_norm": 0.49707943201065063,
287
+ "learning_rate": 9.323034026242378e-06,
288
+ "loss": 0.5493,
289
+ "step": 40
290
+ },
291
+ {
292
+ "epoch": 0.21093247588424438,
293
+ "grad_norm": 0.49830377101898193,
294
+ "learning_rate": 9.279750865485772e-06,
295
+ "loss": 0.4917,
296
+ "step": 41
297
+ },
298
+ {
299
+ "epoch": 0.21607717041800642,
300
+ "grad_norm": 0.5180136561393738,
301
+ "learning_rate": 9.235233564979756e-06,
302
+ "loss": 0.5193,
303
+ "step": 42
304
+ },
305
+ {
306
+ "epoch": 0.2212218649517685,
307
+ "grad_norm": 0.49484989047050476,
308
+ "learning_rate": 9.18949496205337e-06,
309
+ "loss": 0.5472,
310
+ "step": 43
311
+ },
312
+ {
313
+ "epoch": 0.22636655948553056,
314
+ "grad_norm": 0.4955751895904541,
315
+ "learning_rate": 9.142548246219212e-06,
316
+ "loss": 0.4818,
317
+ "step": 44
318
+ },
319
+ {
320
+ "epoch": 0.2315112540192926,
321
+ "grad_norm": 0.4689135253429413,
322
+ "learning_rate": 9.09440695537001e-06,
323
+ "loss": 0.4677,
324
+ "step": 45
325
+ },
326
+ {
327
+ "epoch": 0.23665594855305466,
328
+ "grad_norm": 0.5169051289558411,
329
+ "learning_rate": 9.045084971874738e-06,
330
+ "loss": 0.5033,
331
+ "step": 46
332
+ },
333
+ {
334
+ "epoch": 0.24180064308681673,
335
+ "grad_norm": 0.46415960788726807,
336
+ "learning_rate": 8.994596518575393e-06,
337
+ "loss": 0.4803,
338
+ "step": 47
339
+ },
340
+ {
341
+ "epoch": 0.24694533762057877,
342
+ "grad_norm": 0.4593764543533325,
343
+ "learning_rate": 8.942956154685596e-06,
344
+ "loss": 0.4792,
345
+ "step": 48
346
+ },
347
+ {
348
+ "epoch": 0.25209003215434084,
349
+ "grad_norm": 0.49039268493652344,
350
+ "learning_rate": 8.890178771592198e-06,
351
+ "loss": 0.5189,
352
+ "step": 49
353
+ },
354
+ {
355
+ "epoch": 0.2572347266881029,
356
+ "grad_norm": 0.48655083775520325,
357
+ "learning_rate": 8.836279588561084e-06,
358
+ "loss": 0.4865,
359
+ "step": 50
360
+ },
361
+ {
362
+ "epoch": 0.262379421221865,
363
+ "grad_norm": 0.4769374132156372,
364
+ "learning_rate": 8.781274148348438e-06,
365
+ "loss": 0.4924,
366
+ "step": 51
367
+ },
368
+ {
369
+ "epoch": 0.267524115755627,
370
+ "grad_norm": 0.47683149576187134,
371
+ "learning_rate": 8.725178312718727e-06,
372
+ "loss": 0.4901,
373
+ "step": 52
374
+ },
375
+ {
376
+ "epoch": 0.27266881028938905,
377
+ "grad_norm": 0.47773587703704834,
378
+ "learning_rate": 8.668008257870684e-06,
379
+ "loss": 0.4531,
380
+ "step": 53
381
+ },
382
+ {
383
+ "epoch": 0.27781350482315115,
384
+ "grad_norm": 0.47025877237319946,
385
+ "learning_rate": 8.609780469772623e-06,
386
+ "loss": 0.5129,
387
+ "step": 54
388
+ },
389
+ {
390
+ "epoch": 0.2829581993569132,
391
+ "grad_norm": 0.486856073141098,
392
+ "learning_rate": 8.550511739408428e-06,
393
+ "loss": 0.507,
394
+ "step": 55
395
+ },
396
+ {
397
+ "epoch": 0.2881028938906752,
398
+ "grad_norm": 0.4797123968601227,
399
+ "learning_rate": 8.490219157935589e-06,
400
+ "loss": 0.4873,
401
+ "step": 56
402
+ },
403
+ {
404
+ "epoch": 0.2932475884244373,
405
+ "grad_norm": 0.4642903208732605,
406
+ "learning_rate": 8.428920111756658e-06,
407
+ "loss": 0.4609,
408
+ "step": 57
409
+ },
410
+ {
411
+ "epoch": 0.29839228295819936,
412
+ "grad_norm": 0.48866933584213257,
413
+ "learning_rate": 8.366632277505598e-06,
414
+ "loss": 0.5264,
415
+ "step": 58
416
+ },
417
+ {
418
+ "epoch": 0.3035369774919614,
419
+ "grad_norm": 0.4838912785053253,
420
+ "learning_rate": 8.303373616950408e-06,
421
+ "loss": 0.4981,
422
+ "step": 59
423
+ },
424
+ {
425
+ "epoch": 0.3086816720257235,
426
+ "grad_norm": 0.47218450903892517,
427
+ "learning_rate": 8.239162371813552e-06,
428
+ "loss": 0.501,
429
+ "step": 60
430
+ },
431
+ {
432
+ "epoch": 0.31382636655948554,
433
+ "grad_norm": 0.48886698484420776,
434
+ "learning_rate": 8.17401705851163e-06,
435
+ "loss": 0.4924,
436
+ "step": 61
437
+ },
438
+ {
439
+ "epoch": 0.3189710610932476,
440
+ "grad_norm": 0.4737836718559265,
441
+ "learning_rate": 8.107956462815862e-06,
442
+ "loss": 0.5106,
443
+ "step": 62
444
+ },
445
+ {
446
+ "epoch": 0.32411575562700967,
447
+ "grad_norm": 0.44688716530799866,
448
+ "learning_rate": 8.040999634434883e-06,
449
+ "loss": 0.4655,
450
+ "step": 63
451
+ },
452
+ {
453
+ "epoch": 0.3292604501607717,
454
+ "grad_norm": 0.49828943610191345,
455
+ "learning_rate": 7.973165881521435e-06,
456
+ "loss": 0.5314,
457
+ "step": 64
458
+ },
459
+ {
460
+ "epoch": 0.33440514469453375,
461
+ "grad_norm": 0.4544566571712494,
462
+ "learning_rate": 7.90447476510452e-06,
463
+ "loss": 0.4624,
464
+ "step": 65
465
+ },
466
+ {
467
+ "epoch": 0.33954983922829585,
468
+ "grad_norm": 0.45815807580947876,
469
+ "learning_rate": 7.834946093448658e-06,
470
+ "loss": 0.4801,
471
+ "step": 66
472
+ },
473
+ {
474
+ "epoch": 0.3446945337620579,
475
+ "grad_norm": 0.4789896607398987,
476
+ "learning_rate": 7.764599916341817e-06,
477
+ "loss": 0.547,
478
+ "step": 67
479
+ },
480
+ {
481
+ "epoch": 0.3498392282958199,
482
+ "grad_norm": 0.47594505548477173,
483
+ "learning_rate": 7.69345651931372e-06,
484
+ "loss": 0.5217,
485
+ "step": 68
486
+ },
487
+ {
488
+ "epoch": 0.35498392282958197,
489
+ "grad_norm": 0.46930596232414246,
490
+ "learning_rate": 7.621536417786159e-06,
491
+ "loss": 0.4578,
492
+ "step": 69
493
+ },
494
+ {
495
+ "epoch": 0.36012861736334406,
496
+ "grad_norm": 0.45879995822906494,
497
+ "learning_rate": 7.548860351157028e-06,
498
+ "loss": 0.454,
499
+ "step": 70
500
+ },
501
+ {
502
+ "epoch": 0.3652733118971061,
503
+ "grad_norm": 0.48580196499824524,
504
+ "learning_rate": 7.475449276819753e-06,
505
+ "loss": 0.4777,
506
+ "step": 71
507
+ },
508
+ {
509
+ "epoch": 0.37041800643086814,
510
+ "grad_norm": 0.5085631012916565,
511
+ "learning_rate": 7.401324364119872e-06,
512
+ "loss": 0.5395,
513
+ "step": 72
514
+ },
515
+ {
516
+ "epoch": 0.37556270096463024,
517
+ "grad_norm": 0.45636940002441406,
518
+ "learning_rate": 7.326506988250488e-06,
519
+ "loss": 0.4908,
520
+ "step": 73
521
+ },
522
+ {
523
+ "epoch": 0.3807073954983923,
524
+ "grad_norm": 0.4770854711532593,
525
+ "learning_rate": 7.251018724088367e-06,
526
+ "loss": 0.5052,
527
+ "step": 74
528
+ },
529
+ {
530
+ "epoch": 0.3858520900321543,
531
+ "grad_norm": 0.49636557698249817,
532
+ "learning_rate": 7.174881339972448e-06,
533
+ "loss": 0.54,
534
+ "step": 75
535
+ },
536
+ {
537
+ "epoch": 0.3909967845659164,
538
+ "grad_norm": 0.4442436099052429,
539
+ "learning_rate": 7.09811679142657e-06,
540
+ "loss": 0.476,
541
+ "step": 76
542
+ },
543
+ {
544
+ "epoch": 0.39614147909967845,
545
+ "grad_norm": 0.46588826179504395,
546
+ "learning_rate": 7.020747214828221e-06,
547
+ "loss": 0.5081,
548
+ "step": 77
549
+ },
550
+ {
551
+ "epoch": 0.4012861736334405,
552
+ "grad_norm": 0.48112452030181885,
553
+ "learning_rate": 6.942794921025127e-06,
554
+ "loss": 0.48,
555
+ "step": 78
556
+ },
557
+ {
558
+ "epoch": 0.4064308681672026,
559
+ "grad_norm": 0.47660669684410095,
560
+ "learning_rate": 6.864282388901544e-06,
561
+ "loss": 0.4935,
562
+ "step": 79
563
+ },
564
+ {
565
+ "epoch": 0.4115755627009646,
566
+ "grad_norm": 0.4866008162498474,
567
+ "learning_rate": 6.785232258896078e-06,
568
+ "loss": 0.5333,
569
+ "step": 80
570
+ },
571
+ {
572
+ "epoch": 0.41672025723472667,
573
+ "grad_norm": 0.455619215965271,
574
+ "learning_rate": 6.705667326472926e-06,
575
+ "loss": 0.499,
576
+ "step": 81
577
+ },
578
+ {
579
+ "epoch": 0.42186495176848876,
580
+ "grad_norm": 0.46027281880378723,
581
+ "learning_rate": 6.625610535548418e-06,
582
+ "loss": 0.4728,
583
+ "step": 82
584
+ },
585
+ {
586
+ "epoch": 0.4270096463022508,
587
+ "grad_norm": 0.44711652398109436,
588
+ "learning_rate": 6.545084971874738e-06,
589
+ "loss": 0.5353,
590
+ "step": 83
591
+ },
592
+ {
593
+ "epoch": 0.43215434083601284,
594
+ "grad_norm": 0.48993319272994995,
595
+ "learning_rate": 6.464113856382752e-06,
596
+ "loss": 0.4929,
597
+ "step": 84
598
+ },
599
+ {
600
+ "epoch": 0.43729903536977494,
601
+ "grad_norm": 0.42511484026908875,
602
+ "learning_rate": 6.382720538485856e-06,
603
+ "loss": 0.4592,
604
+ "step": 85
605
+ },
606
+ {
607
+ "epoch": 0.442443729903537,
608
+ "grad_norm": 0.5443476438522339,
609
+ "learning_rate": 6.3009284893467655e-06,
610
+ "loss": 0.5057,
611
+ "step": 86
612
+ },
613
+ {
614
+ "epoch": 0.447588424437299,
615
+ "grad_norm": 0.49420294165611267,
616
+ "learning_rate": 6.218761295109209e-06,
617
+ "loss": 0.5119,
618
+ "step": 87
619
+ },
620
+ {
621
+ "epoch": 0.4527331189710611,
622
+ "grad_norm": 0.5062916278839111,
623
+ "learning_rate": 6.136242650096451e-06,
624
+ "loss": 0.5031,
625
+ "step": 88
626
+ },
627
+ {
628
+ "epoch": 0.45787781350482315,
629
+ "grad_norm": 0.49038904905319214,
630
+ "learning_rate": 6.053396349978632e-06,
631
+ "loss": 0.508,
632
+ "step": 89
633
+ },
634
+ {
635
+ "epoch": 0.4630225080385852,
636
+ "grad_norm": 0.4432820677757263,
637
+ "learning_rate": 5.970246284910877e-06,
638
+ "loss": 0.4359,
639
+ "step": 90
640
+ },
641
+ {
642
+ "epoch": 0.4681672025723473,
643
+ "grad_norm": 0.48448362946510315,
644
+ "learning_rate": 5.886816432644155e-06,
645
+ "loss": 0.4852,
646
+ "step": 91
647
+ },
648
+ {
649
+ "epoch": 0.4733118971061093,
650
+ "grad_norm": 0.4854327142238617,
651
+ "learning_rate": 5.803130851610887e-06,
652
+ "loss": 0.4811,
653
+ "step": 92
654
+ },
655
+ {
656
+ "epoch": 0.47845659163987136,
657
+ "grad_norm": 0.4899016320705414,
658
+ "learning_rate": 5.719213673987277e-06,
659
+ "loss": 0.5486,
660
+ "step": 93
661
+ },
662
+ {
663
+ "epoch": 0.48360128617363346,
664
+ "grad_norm": 0.49537014961242676,
665
+ "learning_rate": 5.635089098734394e-06,
666
+ "loss": 0.5107,
667
+ "step": 94
668
+ },
669
+ {
670
+ "epoch": 0.4887459807073955,
671
+ "grad_norm": 0.4889853298664093,
672
+ "learning_rate": 5.550781384619974e-06,
673
+ "loss": 0.4948,
674
+ "step": 95
675
+ },
676
+ {
677
+ "epoch": 0.49389067524115754,
678
+ "grad_norm": 0.46976524591445923,
679
+ "learning_rate": 5.466314843222993e-06,
680
+ "loss": 0.4913,
681
+ "step": 96
682
+ },
683
+ {
684
+ "epoch": 0.49903536977491963,
685
+ "grad_norm": 0.4508555233478546,
686
+ "learning_rate": 5.381713831923008e-06,
687
+ "loss": 0.4752,
688
+ "step": 97
689
+ },
690
+ {
691
+ "epoch": 0.5041800643086817,
692
+ "grad_norm": 0.48454639315605164,
693
+ "learning_rate": 5.297002746876284e-06,
694
+ "loss": 0.5265,
695
+ "step": 98
696
+ },
697
+ {
698
+ "epoch": 0.5093247588424438,
699
+ "grad_norm": 0.48890259861946106,
700
+ "learning_rate": 5.212206015980742e-06,
701
+ "loss": 0.4924,
702
+ "step": 99
703
+ },
704
+ {
705
+ "epoch": 0.5144694533762058,
706
+ "grad_norm": 0.47355538606643677,
707
+ "learning_rate": 5.127348091831755e-06,
708
+ "loss": 0.477,
709
+ "step": 100
710
+ },
711
+ {
712
+ "epoch": 0.5196141479099678,
713
+ "grad_norm": 0.48057636618614197,
714
+ "learning_rate": 5.042453444670829e-06,
715
+ "loss": 0.4687,
716
+ "step": 101
717
+ },
718
+ {
719
+ "epoch": 0.52475884244373,
720
+ "grad_norm": 0.4773067235946655,
721
+ "learning_rate": 4.957546555329174e-06,
722
+ "loss": 0.4999,
723
+ "step": 102
724
+ },
725
+ {
726
+ "epoch": 0.5299035369774919,
727
+ "grad_norm": 0.474159300327301,
728
+ "learning_rate": 4.872651908168244e-06,
729
+ "loss": 0.5025,
730
+ "step": 103
731
+ },
732
+ {
733
+ "epoch": 0.535048231511254,
734
+ "grad_norm": 0.5089556574821472,
735
+ "learning_rate": 4.78779398401926e-06,
736
+ "loss": 0.509,
737
+ "step": 104
738
+ },
739
+ {
740
+ "epoch": 0.5401929260450161,
741
+ "grad_norm": 0.4812917411327362,
742
+ "learning_rate": 4.702997253123716e-06,
743
+ "loss": 0.5066,
744
+ "step": 105
745
+ },
746
+ {
747
+ "epoch": 0.5453376205787781,
748
+ "grad_norm": 0.4695838689804077,
749
+ "learning_rate": 4.618286168076993e-06,
750
+ "loss": 0.5186,
751
+ "step": 106
752
+ },
753
+ {
754
+ "epoch": 0.5504823151125402,
755
+ "grad_norm": 0.46560072898864746,
756
+ "learning_rate": 4.533685156777008e-06,
757
+ "loss": 0.4899,
758
+ "step": 107
759
+ },
760
+ {
761
+ "epoch": 0.5556270096463023,
762
+ "grad_norm": 0.4533552825450897,
763
+ "learning_rate": 4.449218615380029e-06,
764
+ "loss": 0.486,
765
+ "step": 108
766
+ },
767
+ {
768
+ "epoch": 0.5607717041800643,
769
+ "grad_norm": 0.46256566047668457,
770
+ "learning_rate": 4.364910901265607e-06,
771
+ "loss": 0.5113,
772
+ "step": 109
773
+ },
774
+ {
775
+ "epoch": 0.5659163987138264,
776
+ "grad_norm": 0.483781635761261,
777
+ "learning_rate": 4.280786326012724e-06,
778
+ "loss": 0.4721,
779
+ "step": 110
780
+ },
781
+ {
782
+ "epoch": 0.5710610932475885,
783
+ "grad_norm": 0.45272862911224365,
784
+ "learning_rate": 4.196869148389114e-06,
785
+ "loss": 0.5051,
786
+ "step": 111
787
+ },
788
+ {
789
+ "epoch": 0.5762057877813505,
790
+ "grad_norm": 0.4708820879459381,
791
+ "learning_rate": 4.113183567355846e-06,
792
+ "loss": 0.487,
793
+ "step": 112
794
+ },
795
+ {
796
+ "epoch": 0.5813504823151125,
797
+ "grad_norm": 0.5137550830841064,
798
+ "learning_rate": 4.029753715089124e-06,
799
+ "loss": 0.5195,
800
+ "step": 113
801
+ },
802
+ {
803
+ "epoch": 0.5864951768488746,
804
+ "grad_norm": 0.47741350531578064,
805
+ "learning_rate": 3.94660365002137e-06,
806
+ "loss": 0.5042,
807
+ "step": 114
808
+ },
809
+ {
810
+ "epoch": 0.5916398713826366,
811
+ "grad_norm": 0.5155045986175537,
812
+ "learning_rate": 3.863757349903551e-06,
813
+ "loss": 0.471,
814
+ "step": 115
815
+ },
816
+ {
817
+ "epoch": 0.5967845659163987,
818
+ "grad_norm": 0.46846747398376465,
819
+ "learning_rate": 3.781238704890793e-06,
820
+ "loss": 0.5166,
821
+ "step": 116
822
+ },
823
+ {
824
+ "epoch": 0.6019292604501608,
825
+ "grad_norm": 0.4709222912788391,
826
+ "learning_rate": 3.6990715106532353e-06,
827
+ "loss": 0.5094,
828
+ "step": 117
829
+ },
830
+ {
831
+ "epoch": 0.6070739549839228,
832
+ "grad_norm": 0.5091134309768677,
833
+ "learning_rate": 3.6172794615141448e-06,
834
+ "loss": 0.4486,
835
+ "step": 118
836
+ },
837
+ {
838
+ "epoch": 0.6122186495176849,
839
+ "grad_norm": 0.4649624824523926,
840
+ "learning_rate": 3.5358861436172487e-06,
841
+ "loss": 0.5048,
842
+ "step": 119
843
+ },
844
+ {
845
+ "epoch": 0.617363344051447,
846
+ "grad_norm": 0.5000843405723572,
847
+ "learning_rate": 3.4549150281252635e-06,
848
+ "loss": 0.4784,
849
+ "step": 120
850
+ },
851
+ {
852
+ "epoch": 0.622508038585209,
853
+ "grad_norm": 0.4720861613750458,
854
+ "learning_rate": 3.374389464451583e-06,
855
+ "loss": 0.4794,
856
+ "step": 121
857
+ },
858
+ {
859
+ "epoch": 0.6276527331189711,
860
+ "grad_norm": 0.47109055519104004,
861
+ "learning_rate": 3.2943326735270766e-06,
862
+ "loss": 0.4828,
863
+ "step": 122
864
+ },
865
+ {
866
+ "epoch": 0.6327974276527332,
867
+ "grad_norm": 0.4736097455024719,
868
+ "learning_rate": 3.2147677411039236e-06,
869
+ "loss": 0.4627,
870
+ "step": 123
871
+ },
872
+ {
873
+ "epoch": 0.6379421221864952,
874
+ "grad_norm": 0.4775114059448242,
875
+ "learning_rate": 3.1357176110984578e-06,
876
+ "loss": 0.4861,
877
+ "step": 124
878
+ },
879
+ {
880
+ "epoch": 0.6430868167202572,
881
+ "grad_norm": 0.46678417921066284,
882
+ "learning_rate": 3.0572050789748732e-06,
883
+ "loss": 0.4946,
884
+ "step": 125
885
+ },
886
+ {
887
+ "epoch": 0.6482315112540193,
888
+ "grad_norm": 0.44837188720703125,
889
+ "learning_rate": 2.9792527851717805e-06,
890
+ "loss": 0.5074,
891
+ "step": 126
892
+ },
893
+ {
894
+ "epoch": 0.6533762057877813,
895
+ "grad_norm": 0.4877527952194214,
896
+ "learning_rate": 2.90188320857343e-06,
897
+ "loss": 0.5205,
898
+ "step": 127
899
+ },
900
+ {
901
+ "epoch": 0.6585209003215434,
902
+ "grad_norm": 0.4547199308872223,
903
+ "learning_rate": 2.8251186600275533e-06,
904
+ "loss": 0.4647,
905
+ "step": 128
906
+ },
907
+ {
908
+ "epoch": 0.6636655948553055,
909
+ "grad_norm": 0.45252618193626404,
910
+ "learning_rate": 2.748981275911633e-06,
911
+ "loss": 0.5093,
912
+ "step": 129
913
+ },
914
+ {
915
+ "epoch": 0.6688102893890675,
916
+ "grad_norm": 0.4427642822265625,
917
+ "learning_rate": 2.6734930117495133e-06,
918
+ "loss": 0.4422,
919
+ "step": 130
920
+ },
921
+ {
922
+ "epoch": 0.6739549839228296,
923
+ "grad_norm": 0.47340139746665955,
924
+ "learning_rate": 2.598675635880129e-06,
925
+ "loss": 0.475,
926
+ "step": 131
927
+ },
928
+ {
929
+ "epoch": 0.6790996784565917,
930
+ "grad_norm": 0.47648149728775024,
931
+ "learning_rate": 2.524550723180249e-06,
932
+ "loss": 0.4729,
933
+ "step": 132
934
+ },
935
+ {
936
+ "epoch": 0.6842443729903537,
937
+ "grad_norm": 0.4834476709365845,
938
+ "learning_rate": 2.4511396488429727e-06,
939
+ "loss": 0.4899,
940
+ "step": 133
941
+ },
942
+ {
943
+ "epoch": 0.6893890675241158,
944
+ "grad_norm": 0.45669957995414734,
945
+ "learning_rate": 2.3784635822138424e-06,
946
+ "loss": 0.5043,
947
+ "step": 134
948
+ },
949
+ {
950
+ "epoch": 0.6945337620578779,
951
+ "grad_norm": 0.4470764696598053,
952
+ "learning_rate": 2.306543480686281e-06,
953
+ "loss": 0.4704,
954
+ "step": 135
955
+ },
956
+ {
957
+ "epoch": 0.6996784565916399,
958
+ "grad_norm": 0.4960187077522278,
959
+ "learning_rate": 2.2354000836581834e-06,
960
+ "loss": 0.5208,
961
+ "step": 136
962
+ },
963
+ {
964
+ "epoch": 0.704823151125402,
965
+ "grad_norm": 0.4489913284778595,
966
+ "learning_rate": 2.1650539065513415e-06,
967
+ "loss": 0.4592,
968
+ "step": 137
969
+ },
970
+ {
971
+ "epoch": 0.7099678456591639,
972
+ "grad_norm": 0.46100521087646484,
973
+ "learning_rate": 2.0955252348954806e-06,
974
+ "loss": 0.4452,
975
+ "step": 138
976
+ },
977
+ {
978
+ "epoch": 0.715112540192926,
979
+ "grad_norm": 0.4687739908695221,
980
+ "learning_rate": 2.0268341184785674e-06,
981
+ "loss": 0.5146,
982
+ "step": 139
983
+ },
984
+ {
985
+ "epoch": 0.7202572347266881,
986
+ "grad_norm": 0.4546753168106079,
987
+ "learning_rate": 1.959000365565119e-06,
988
+ "loss": 0.4707,
989
+ "step": 140
990
+ },
991
+ {
992
+ "epoch": 0.7254019292604501,
993
+ "grad_norm": 0.4647018015384674,
994
+ "learning_rate": 1.8920435371841394e-06,
995
+ "loss": 0.4379,
996
+ "step": 141
997
+ },
998
+ {
999
+ "epoch": 0.7305466237942122,
1000
+ "grad_norm": 0.473733127117157,
1001
+ "learning_rate": 1.8259829414883728e-06,
1002
+ "loss": 0.4845,
1003
+ "step": 142
1004
+ },
1005
+ {
1006
+ "epoch": 0.7356913183279743,
1007
+ "grad_norm": 0.49459928274154663,
1008
+ "learning_rate": 1.7608376281864502e-06,
1009
+ "loss": 0.5376,
1010
+ "step": 143
1011
+ },
1012
+ {
1013
+ "epoch": 0.7408360128617363,
1014
+ "grad_norm": 0.46276187896728516,
1015
+ "learning_rate": 1.6966263830495939e-06,
1016
+ "loss": 0.4691,
1017
+ "step": 144
1018
+ },
1019
+ {
1020
+ "epoch": 0.7459807073954984,
1021
+ "grad_norm": 0.45211291313171387,
1022
+ "learning_rate": 1.633367722494404e-06,
1023
+ "loss": 0.4521,
1024
+ "step": 145
1025
+ },
1026
+ {
1027
+ "epoch": 0.7511254019292605,
1028
+ "grad_norm": 0.4516507387161255,
1029
+ "learning_rate": 1.5710798882433432e-06,
1030
+ "loss": 0.4897,
1031
+ "step": 146
1032
+ },
1033
+ {
1034
+ "epoch": 0.7562700964630225,
1035
+ "grad_norm": 0.46488216519355774,
1036
+ "learning_rate": 1.5097808420644117e-06,
1037
+ "loss": 0.4875,
1038
+ "step": 147
1039
+ },
1040
+ {
1041
+ "epoch": 0.7614147909967846,
1042
+ "grad_norm": 0.47542884945869446,
1043
+ "learning_rate": 1.4494882605915717e-06,
1044
+ "loss": 0.4942,
1045
+ "step": 148
1046
+ },
1047
+ {
1048
+ "epoch": 0.7665594855305466,
1049
+ "grad_norm": 0.4502287209033966,
1050
+ "learning_rate": 1.390219530227378e-06,
1051
+ "loss": 0.482,
1052
+ "step": 149
1053
+ },
1054
+ {
1055
+ "epoch": 0.7717041800643086,
1056
+ "grad_norm": 0.45821210741996765,
1057
+ "learning_rate": 1.3319917421293182e-06,
1058
+ "loss": 0.5331,
1059
+ "step": 150
1060
+ },
1061
+ {
1062
+ "epoch": 0.7768488745980707,
1063
+ "grad_norm": 0.4743272364139557,
1064
+ "learning_rate": 1.2748216872812747e-06,
1065
+ "loss": 0.5326,
1066
+ "step": 151
1067
+ },
1068
+ {
1069
+ "epoch": 0.7819935691318328,
1070
+ "grad_norm": 0.45159199833869934,
1071
+ "learning_rate": 1.2187258516515644e-06,
1072
+ "loss": 0.4824,
1073
+ "step": 152
1074
+ },
1075
+ {
1076
+ "epoch": 0.7871382636655948,
1077
+ "grad_norm": 0.4775025546550751,
1078
+ "learning_rate": 1.1637204114389179e-06,
1079
+ "loss": 0.5049,
1080
+ "step": 153
1081
+ },
1082
+ {
1083
+ "epoch": 0.7922829581993569,
1084
+ "grad_norm": 0.4442935883998871,
1085
+ "learning_rate": 1.1098212284078037e-06,
1086
+ "loss": 0.4555,
1087
+ "step": 154
1088
+ },
1089
+ {
1090
+ "epoch": 0.797427652733119,
1091
+ "grad_norm": 0.4545031487941742,
1092
+ "learning_rate": 1.0570438453144044e-06,
1093
+ "loss": 0.4885,
1094
+ "step": 155
1095
+ },
1096
+ {
1097
+ "epoch": 0.802572347266881,
1098
+ "grad_norm": 0.4795566499233246,
1099
+ "learning_rate": 1.0054034814246093e-06,
1100
+ "loss": 0.5527,
1101
+ "step": 156
1102
+ },
1103
+ {
1104
+ "epoch": 0.8077170418006431,
1105
+ "grad_norm": 0.4730350375175476,
1106
+ "learning_rate": 9.549150281252633e-07,
1107
+ "loss": 0.5218,
1108
+ "step": 157
1109
+ },
1110
+ {
1111
+ "epoch": 0.8128617363344052,
1112
+ "grad_norm": 0.4760991632938385,
1113
+ "learning_rate": 9.055930446299916e-07,
1114
+ "loss": 0.5136,
1115
+ "step": 158
1116
+ },
1117
+ {
1118
+ "epoch": 0.8180064308681672,
1119
+ "grad_norm": 0.4581911563873291,
1120
+ "learning_rate": 8.574517537807897e-07,
1121
+ "loss": 0.5176,
1122
+ "step": 159
1123
+ },
1124
+ {
1125
+ "epoch": 0.8231511254019293,
1126
+ "grad_norm": 0.451224684715271,
1127
+ "learning_rate": 8.105050379466334e-07,
1128
+ "loss": 0.4777,
1129
+ "step": 160
1130
+ },
1131
+ {
1132
+ "epoch": 0.8282958199356913,
1133
+ "grad_norm": 0.46320095658302307,
1134
+ "learning_rate": 7.647664350202461e-07,
1135
+ "loss": 0.4835,
1136
+ "step": 161
1137
+ },
1138
+ {
1139
+ "epoch": 0.8334405144694533,
1140
+ "grad_norm": 0.4722878038883209,
1141
+ "learning_rate": 7.202491345142288e-07,
1142
+ "loss": 0.4445,
1143
+ "step": 162
1144
+ },
1145
+ {
1146
+ "epoch": 0.8385852090032154,
1147
+ "grad_norm": 0.46132737398147583,
1148
+ "learning_rate": 6.769659737576229e-07,
1149
+ "loss": 0.4964,
1150
+ "step": 163
1151
+ },
1152
+ {
1153
+ "epoch": 0.8437299035369775,
1154
+ "grad_norm": 0.478231817483902,
1155
+ "learning_rate": 6.349294341940593e-07,
1156
+ "loss": 0.5356,
1157
+ "step": 164
1158
+ },
1159
+ {
1160
+ "epoch": 0.8488745980707395,
1161
+ "grad_norm": 0.44469162821769714,
1162
+ "learning_rate": 5.941516377825102e-07,
1163
+ "loss": 0.4855,
1164
+ "step": 165
1165
+ },
1166
+ {
1167
+ "epoch": 0.8540192926045016,
1168
+ "grad_norm": 0.48774901032447815,
1169
+ "learning_rate": 5.546443435017146e-07,
1170
+ "loss": 0.4628,
1171
+ "step": 166
1172
+ },
1173
+ {
1174
+ "epoch": 0.8591639871382637,
1175
+ "grad_norm": 0.44260117411613464,
1176
+ "learning_rate": 5.16418943959282e-07,
1177
+ "loss": 0.456,
1178
+ "step": 167
1179
+ },
1180
+ {
1181
+ "epoch": 0.8643086816720257,
1182
+ "grad_norm": 0.48577848076820374,
1183
+ "learning_rate": 4.794864621064266e-07,
1184
+ "loss": 0.4974,
1185
+ "step": 168
1186
+ },
1187
+ {
1188
+ "epoch": 0.8694533762057878,
1189
+ "grad_norm": 0.4491365849971771,
1190
+ "learning_rate": 4.43857548059321e-07,
1191
+ "loss": 0.4811,
1192
+ "step": 169
1193
+ },
1194
+ {
1195
+ "epoch": 0.8745980707395499,
1196
+ "grad_norm": 0.4400619566440582,
1197
+ "learning_rate": 4.095424760279454e-07,
1198
+ "loss": 0.4606,
1199
+ "step": 170
1200
+ },
1201
+ {
1202
+ "epoch": 0.8797427652733119,
1203
+ "grad_norm": 0.4469500184059143,
1204
+ "learning_rate": 3.765511413533429e-07,
1205
+ "loss": 0.512,
1206
+ "step": 171
1207
+ },
1208
+ {
1209
+ "epoch": 0.884887459807074,
1210
+ "grad_norm": 0.45204490423202515,
1211
+ "learning_rate": 3.4489305765413097e-07,
1212
+ "loss": 0.4551,
1213
+ "step": 172
1214
+ },
1215
+ {
1216
+ "epoch": 0.890032154340836,
1217
+ "grad_norm": 0.46731144189834595,
1218
+ "learning_rate": 3.1457735408308153e-07,
1219
+ "loss": 0.4868,
1220
+ "step": 173
1221
+ },
1222
+ {
1223
+ "epoch": 0.895176848874598,
1224
+ "grad_norm": 0.4576306641101837,
1225
+ "learning_rate": 2.85612772694579e-07,
1226
+ "loss": 0.4504,
1227
+ "step": 174
1228
+ },
1229
+ {
1230
+ "epoch": 0.9003215434083601,
1231
+ "grad_norm": 0.4661747217178345,
1232
+ "learning_rate": 2.5800766592369077e-07,
1233
+ "loss": 0.5027,
1234
+ "step": 175
1235
+ },
1236
+ {
1237
+ "epoch": 0.9054662379421222,
1238
+ "grad_norm": 0.44758227467536926,
1239
+ "learning_rate": 2.3176999417760637e-07,
1240
+ "loss": 0.4859,
1241
+ "step": 176
1242
+ },
1243
+ {
1244
+ "epoch": 0.9106109324758842,
1245
+ "grad_norm": 0.4612000584602356,
1246
+ "learning_rate": 2.069073235401109e-07,
1247
+ "loss": 0.5142,
1248
+ "step": 177
1249
+ },
1250
+ {
1251
+ "epoch": 0.9157556270096463,
1252
+ "grad_norm": 0.4407828450202942,
1253
+ "learning_rate": 1.834268235897807e-07,
1254
+ "loss": 0.4805,
1255
+ "step": 178
1256
+ },
1257
+ {
1258
+ "epoch": 0.9209003215434084,
1259
+ "grad_norm": 0.48513102531433105,
1260
+ "learning_rate": 1.6133526533250566e-07,
1261
+ "loss": 0.5101,
1262
+ "step": 179
1263
+ },
1264
+ {
1265
+ "epoch": 0.9260450160771704,
1266
+ "grad_norm": 0.4615355134010315,
1267
+ "learning_rate": 1.4063901924895985e-07,
1268
+ "loss": 0.4986,
1269
+ "step": 180
1270
+ },
1271
+ {
1272
+ "epoch": 0.9311897106109325,
1273
+ "grad_norm": 0.4797261655330658,
1274
+ "learning_rate": 1.2134405345755773e-07,
1275
+ "loss": 0.5108,
1276
+ "step": 181
1277
+ },
1278
+ {
1279
+ "epoch": 0.9363344051446946,
1280
+ "grad_norm": 0.4593569338321686,
1281
+ "learning_rate": 1.0345593199344972e-07,
1282
+ "loss": 0.5166,
1283
+ "step": 182
1284
+ },
1285
+ {
1286
+ "epoch": 0.9414790996784566,
1287
+ "grad_norm": 0.478330135345459,
1288
+ "learning_rate": 8.697981320403337e-08,
1289
+ "loss": 0.5229,
1290
+ "step": 183
1291
+ },
1292
+ {
1293
+ "epoch": 0.9466237942122186,
1294
+ "grad_norm": 0.44957953691482544,
1295
+ "learning_rate": 7.192044826145772e-08,
1296
+ "loss": 0.469,
1297
+ "step": 184
1298
+ },
1299
+ {
1300
+ "epoch": 0.9517684887459807,
1301
+ "grad_norm": 0.4661603569984436,
1302
+ "learning_rate": 5.82821797925387e-08,
1303
+ "loss": 0.4792,
1304
+ "step": 185
1305
+ },
1306
+ {
1307
+ "epoch": 0.9569131832797427,
1308
+ "grad_norm": 0.4424455165863037,
1309
+ "learning_rate": 4.60689406264897e-08,
1310
+ "loss": 0.458,
1311
+ "step": 186
1312
+ },
1313
+ {
1314
+ "epoch": 0.9620578778135048,
1315
+ "grad_norm": 0.4485902786254883,
1316
+ "learning_rate": 3.528425266082325e-08,
1317
+ "loss": 0.474,
1318
+ "step": 187
1319
+ },
1320
+ {
1321
+ "epoch": 0.9672025723472669,
1322
+ "grad_norm": 0.43381765484809875,
1323
+ "learning_rate": 2.593122584574892e-08,
1324
+ "loss": 0.4625,
1325
+ "step": 188
1326
+ },
1327
+ {
1328
+ "epoch": 0.9723472668810289,
1329
+ "grad_norm": 0.4678357243537903,
1330
+ "learning_rate": 1.8012557287367394e-08,
1331
+ "loss": 0.4841,
1332
+ "step": 189
1333
+ },
1334
+ {
1335
+ "epoch": 0.977491961414791,
1336
+ "grad_norm": 0.47606784105300903,
1337
+ "learning_rate": 1.1530530469914258e-08,
1338
+ "loss": 0.5369,
1339
+ "step": 190
1340
+ },
1341
+ {
1342
+ "epoch": 0.9826366559485531,
1343
+ "grad_norm": 0.44228696823120117,
1344
+ "learning_rate": 6.487014597275631e-09,
1345
+ "loss": 0.4824,
1346
+ "step": 191
1347
+ },
1348
+ {
1349
+ "epoch": 0.9877813504823151,
1350
+ "grad_norm": 0.4588797390460968,
1351
+ "learning_rate": 2.8834640539737723e-09,
1352
+ "loss": 0.4457,
1353
+ "step": 192
1354
+ },
1355
+ {
1356
+ "epoch": 0.9929260450160772,
1357
+ "grad_norm": 0.46713078022003174,
1358
+ "learning_rate": 7.209179857675664e-10,
1359
+ "loss": 0.5029,
1360
+ "step": 193
1361
+ },
1362
+ {
1363
+ "epoch": 0.9980707395498393,
1364
+ "grad_norm": 0.4522612988948822,
1365
+ "learning_rate": 0.0,
1366
+ "loss": 0.4826,
1367
+ "step": 194
1368
+ },
1369
+ {
1370
+ "epoch": 0.9980707395498393,
1371
+ "eval_loss": 0.46097689867019653,
1372
+ "eval_runtime": 4.0485,
1373
+ "eval_samples_per_second": 30.876,
1374
+ "eval_steps_per_second": 3.952,
1375
+ "step": 194
1376
+ }
1377
+ ],
1378
+ "logging_steps": 1,
1379
+ "max_steps": 194,
1380
+ "num_input_tokens_seen": 0,
1381
+ "num_train_epochs": 1,
1382
+ "save_steps": 500,
1383
+ "stateful_callbacks": {
1384
+ "TrainerControl": {
1385
+ "args": {
1386
+ "should_epoch_stop": false,
1387
+ "should_evaluate": false,
1388
+ "should_log": false,
1389
+ "should_save": true,
1390
+ "should_training_stop": true
1391
+ },
1392
+ "attributes": {}
1393
+ }
1394
+ },
1395
+ "total_flos": 2.384828301479772e+17,
1396
+ "train_batch_size": 8,
1397
+ "trial_name": null,
1398
+ "trial_params": null
1399
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:269e347bc009e0cf055dc17e322a01f1dc99a6655c071f279d056932cc0063ad
3
+ size 10872
vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
zero_to_fp32.py ADDED
@@ -0,0 +1,760 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 gc
25
+ import json
26
+ import numpy as np
27
+ from tqdm import tqdm
28
+ from collections import OrderedDict
29
+ from dataclasses import dataclass
30
+
31
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
32
+ # DeepSpeed data structures it has to be available in the current python environment.
33
+ from deepspeed.utils import logger
34
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
35
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
36
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
37
+
38
+
39
+ @dataclass
40
+ class zero_model_state:
41
+ buffers: dict()
42
+ param_shapes: dict()
43
+ shared_params: list
44
+ ds_version: int
45
+ frozen_param_shapes: dict()
46
+ frozen_param_fragments: dict()
47
+
48
+
49
+ debug = 0
50
+
51
+ # load to cpu
52
+ device = torch.device('cpu')
53
+
54
+
55
+ def atoi(text):
56
+ return int(text) if text.isdigit() else text
57
+
58
+
59
+ def natural_keys(text):
60
+ '''
61
+ alist.sort(key=natural_keys) sorts in human order
62
+ http://nedbatchelder.com/blog/200712/human_sorting.html
63
+ (See Toothy's implementation in the comments)
64
+ '''
65
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
66
+
67
+
68
+ def get_model_state_file(checkpoint_dir, zero_stage):
69
+ if not os.path.isdir(checkpoint_dir):
70
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
71
+
72
+ # there should be only one file
73
+ if zero_stage <= 2:
74
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
75
+ elif zero_stage == 3:
76
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
77
+
78
+ if not os.path.exists(file):
79
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
80
+
81
+ return file
82
+
83
+
84
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
85
+ # XXX: need to test that this simple glob rule works for multi-node setup too
86
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
87
+
88
+ if len(ckpt_files) == 0:
89
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
90
+
91
+ return ckpt_files
92
+
93
+
94
+ def get_optim_files(checkpoint_dir):
95
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
96
+
97
+
98
+ def get_model_state_files(checkpoint_dir):
99
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
100
+
101
+
102
+ def parse_model_states(files):
103
+ zero_model_states = []
104
+ for file in files:
105
+ state_dict = torch.load(file, map_location=device, weights_only=False)
106
+
107
+ if BUFFER_NAMES not in state_dict:
108
+ raise ValueError(f"{file} is not a model state checkpoint")
109
+ buffer_names = state_dict[BUFFER_NAMES]
110
+ if debug:
111
+ print("Found buffers:", buffer_names)
112
+
113
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
114
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
115
+ param_shapes = state_dict[PARAM_SHAPES]
116
+
117
+ # collect parameters that are included in param_shapes
118
+ param_names = []
119
+ for s in param_shapes:
120
+ for name in s.keys():
121
+ param_names.append(name)
122
+
123
+ # update with frozen parameters
124
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
125
+ if frozen_param_shapes is not None:
126
+ if debug:
127
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
128
+ param_names += list(frozen_param_shapes.keys())
129
+
130
+ # handle shared params
131
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
132
+
133
+ ds_version = state_dict.get(DS_VERSION, None)
134
+
135
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
136
+
137
+ z_model_state = zero_model_state(buffers=buffers,
138
+ param_shapes=param_shapes,
139
+ shared_params=shared_params,
140
+ ds_version=ds_version,
141
+ frozen_param_shapes=frozen_param_shapes,
142
+ frozen_param_fragments=frozen_param_fragments)
143
+ zero_model_states.append(z_model_state)
144
+
145
+ return zero_model_states
146
+
147
+
148
+ def parse_optim_states(files, ds_checkpoint_dir):
149
+ total_files = len(files)
150
+ state_dicts = []
151
+ for f in tqdm(files, desc='Loading checkpoint shards'):
152
+ state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
153
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
154
+ # and also handle the case where it was already removed by another helper script
155
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
156
+ state_dicts.append(state_dict)
157
+
158
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
159
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
160
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
161
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
162
+
163
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
164
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
165
+ # use the max of the partition_count to get the dp world_size.
166
+
167
+ if type(world_size) is list:
168
+ world_size = max(world_size)
169
+
170
+ if world_size != total_files:
171
+ raise ValueError(
172
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
173
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
174
+ )
175
+
176
+ # the groups are named differently in each stage
177
+ if zero_stage <= 2:
178
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
179
+ elif zero_stage == 3:
180
+ fp32_groups_key = FP32_FLAT_GROUPS
181
+ else:
182
+ raise ValueError(f"unknown zero stage {zero_stage}")
183
+
184
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
185
+ return zero_stage, world_size, fp32_flat_groups
186
+
187
+
188
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
189
+ """
190
+ Returns fp32 state_dict reconstructed from ds checkpoint
191
+
192
+ Args:
193
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
194
+
195
+ """
196
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
197
+
198
+ optim_files = get_optim_files(ds_checkpoint_dir)
199
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
200
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
201
+
202
+ model_files = get_model_state_files(ds_checkpoint_dir)
203
+
204
+ zero_model_states = parse_model_states(model_files)
205
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
206
+
207
+ if zero_stage <= 2:
208
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
209
+ exclude_frozen_parameters)
210
+ elif zero_stage == 3:
211
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
212
+ exclude_frozen_parameters)
213
+
214
+
215
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
216
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
217
+ return
218
+
219
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
220
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
221
+
222
+ if debug:
223
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
224
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
225
+
226
+ wanted_params = len(frozen_param_shapes)
227
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
228
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
229
+ print(f'Frozen params: Have {avail_numel} numels to process.')
230
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
231
+
232
+ total_params = 0
233
+ total_numel = 0
234
+ for name, shape in frozen_param_shapes.items():
235
+ total_params += 1
236
+ unpartitioned_numel = shape.numel()
237
+ total_numel += unpartitioned_numel
238
+
239
+ state_dict[name] = frozen_param_fragments[name]
240
+
241
+ if debug:
242
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
243
+
244
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
245
+
246
+
247
+ def _has_callable(obj, fn):
248
+ attr = getattr(obj, fn, None)
249
+ return callable(attr)
250
+
251
+
252
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
253
+ param_shapes = zero_model_states[0].param_shapes
254
+
255
+ # Reconstruction protocol:
256
+ #
257
+ # XXX: document this
258
+
259
+ if debug:
260
+ for i in range(world_size):
261
+ for j in range(len(fp32_flat_groups[0])):
262
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
263
+
264
+ # XXX: memory usage doubles here (zero2)
265
+ num_param_groups = len(fp32_flat_groups[0])
266
+ merged_single_partition_of_fp32_groups = []
267
+ for i in range(num_param_groups):
268
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
269
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
270
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
271
+ avail_numel = sum(
272
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
273
+
274
+ if debug:
275
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
276
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
277
+ # not asserting if there is a mismatch due to possible padding
278
+ print(f"Have {avail_numel} numels to process.")
279
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
280
+
281
+ # params
282
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
283
+ # out-of-core computing solution
284
+ total_numel = 0
285
+ total_params = 0
286
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
287
+ offset = 0
288
+ avail_numel = full_single_fp32_vector.numel()
289
+ for name, shape in shapes.items():
290
+
291
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
292
+ total_numel += unpartitioned_numel
293
+ total_params += 1
294
+
295
+ if debug:
296
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
297
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
298
+ offset += unpartitioned_numel
299
+
300
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
301
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
302
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
303
+ # live optimizer object, so we are checking that the numbers are within the right range
304
+ align_to = 2 * world_size
305
+
306
+ def zero2_align(x):
307
+ return align_to * math.ceil(x / align_to)
308
+
309
+ if debug:
310
+ print(f"original offset={offset}, avail_numel={avail_numel}")
311
+
312
+ offset = zero2_align(offset)
313
+ avail_numel = zero2_align(avail_numel)
314
+
315
+ if debug:
316
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
317
+
318
+ # Sanity check
319
+ if offset != avail_numel:
320
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
321
+
322
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
323
+
324
+
325
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
326
+ exclude_frozen_parameters):
327
+ state_dict = OrderedDict()
328
+
329
+ # buffers
330
+ buffers = zero_model_states[0].buffers
331
+ state_dict.update(buffers)
332
+ if debug:
333
+ print(f"added {len(buffers)} buffers")
334
+
335
+ if not exclude_frozen_parameters:
336
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
337
+
338
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
339
+
340
+ # recover shared parameters
341
+ for pair in zero_model_states[0].shared_params:
342
+ if pair[1] in state_dict:
343
+ state_dict[pair[0]] = state_dict[pair[1]]
344
+
345
+ return state_dict
346
+
347
+
348
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
349
+ remainder = unpartitioned_numel % world_size
350
+ padding_numel = (world_size - remainder) if remainder else 0
351
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
352
+ return partitioned_numel, padding_numel
353
+
354
+
355
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
356
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
357
+ return
358
+
359
+ if debug:
360
+ for i in range(world_size):
361
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
362
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
363
+
364
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
365
+ wanted_params = len(frozen_param_shapes)
366
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
367
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
368
+ print(f'Frozen params: Have {avail_numel} numels to process.')
369
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
370
+
371
+ total_params = 0
372
+ total_numel = 0
373
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
374
+ total_params += 1
375
+ unpartitioned_numel = shape.numel()
376
+ total_numel += unpartitioned_numel
377
+
378
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
379
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
380
+
381
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
382
+
383
+ if debug:
384
+ print(
385
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
386
+ )
387
+
388
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
389
+
390
+
391
+ class GatheredTensor:
392
+ """
393
+ A pseudo tensor that collects partitioned weights.
394
+ It is more memory efficient when there are multiple groups.
395
+ """
396
+
397
+ def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
398
+ self.flat_groups = flat_groups
399
+ self.flat_groups_offset = flat_groups_offset
400
+ self.offset = offset
401
+ self.partitioned_numel = partitioned_numel
402
+ self.shape = shape
403
+ self.dtype = self.flat_groups[0][0].dtype
404
+
405
+ def contiguous(self):
406
+ """
407
+ Merge partitioned weights from flat_groups into a single tensor.
408
+ """
409
+ end_idx = self.offset + self.partitioned_numel
410
+ world_size = len(self.flat_groups)
411
+ pad_flat_param_chunks = []
412
+
413
+ for rank_i in range(world_size):
414
+ # for each rank, we need to collect weights from related group/groups
415
+ flat_groups_at_rank_i = self.flat_groups[rank_i]
416
+ start_group_id = None
417
+ end_group_id = None
418
+ for group_id in range(len(self.flat_groups_offset)):
419
+ if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
420
+ start_group_id = group_id
421
+ if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
422
+ end_group_id = group_id
423
+ break
424
+ # collect weights from related group/groups
425
+ for group_id in range(start_group_id, end_group_id + 1):
426
+ flat_tensor = flat_groups_at_rank_i[group_id]
427
+ start_offset = self.offset - self.flat_groups_offset[group_id]
428
+ end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
429
+ pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
430
+
431
+ # collect weights from all ranks
432
+ pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
433
+ param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
434
+ return param
435
+
436
+
437
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
438
+ param_shapes = zero_model_states[0].param_shapes
439
+ avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
440
+
441
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
442
+ # param, re-consolidating each param, while dealing with padding if any
443
+
444
+ # merge list of dicts, preserving order
445
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
446
+
447
+ if debug:
448
+ for i in range(world_size):
449
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
450
+
451
+ wanted_params = len(param_shapes)
452
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
453
+ # not asserting if there is a mismatch due to possible padding
454
+ avail_numel = fp32_flat_groups[0].numel() * world_size
455
+ print(f"Trainable params: Have {avail_numel} numels to process.")
456
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
457
+
458
+ # params
459
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
460
+ # out-of-core computing solution
461
+ offset = 0
462
+ total_numel = 0
463
+ total_params = 0
464
+ flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
465
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
466
+ unpartitioned_numel = shape.numel()
467
+ total_numel += unpartitioned_numel
468
+ total_params += 1
469
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
470
+
471
+ if debug:
472
+ print(
473
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
474
+ )
475
+
476
+ # memory efficient tensor
477
+ tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
478
+ state_dict[name] = tensor
479
+ offset += partitioned_numel
480
+
481
+ offset *= world_size
482
+
483
+ # Sanity check
484
+ if offset != avail_numel:
485
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
486
+
487
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
488
+
489
+
490
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
491
+ exclude_frozen_parameters):
492
+ state_dict = OrderedDict()
493
+
494
+ # buffers
495
+ buffers = zero_model_states[0].buffers
496
+ state_dict.update(buffers)
497
+ if debug:
498
+ print(f"added {len(buffers)} buffers")
499
+
500
+ if not exclude_frozen_parameters:
501
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
502
+
503
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
504
+
505
+ # recover shared parameters
506
+ for pair in zero_model_states[0].shared_params:
507
+ if pair[1] in state_dict:
508
+ state_dict[pair[0]] = state_dict[pair[1]]
509
+
510
+ return state_dict
511
+
512
+
513
+ def to_torch_tensor(state_dict, return_empty_tensor=False):
514
+ """
515
+ Convert state_dict of GatheredTensor to torch tensor
516
+ """
517
+ torch_state_dict = {}
518
+ converted_tensors = {}
519
+ for name, tensor in state_dict.items():
520
+ tensor_id = id(tensor)
521
+ if tensor_id in converted_tensors: # shared tensors
522
+ shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
523
+ torch_state_dict[name] = shared_tensor
524
+ else:
525
+ converted_tensors[tensor_id] = name
526
+ if return_empty_tensor:
527
+ torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
528
+ else:
529
+ torch_state_dict[name] = tensor.contiguous()
530
+ return torch_state_dict
531
+
532
+
533
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
534
+ tag=None,
535
+ exclude_frozen_parameters=False,
536
+ lazy_mode=False):
537
+ """
538
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
539
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
540
+ via a model hub.
541
+
542
+ Args:
543
+ - ``checkpoint_dir``: path to the desired checkpoint folder
544
+ - ``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``
545
+ - ``exclude_frozen_parameters``: exclude frozen parameters
546
+ - ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
547
+ Convert the pesduo tensor to torch tensor by ``.contiguous()``
548
+
549
+ Returns:
550
+ - pytorch ``state_dict``
551
+
552
+ A typical usage might be ::
553
+
554
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
555
+ # do the training and checkpoint saving
556
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
557
+ model = model.cpu() # move to cpu
558
+ model.load_state_dict(state_dict)
559
+ # submit to model hub or save the model to share with others
560
+
561
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
562
+ application. i.e. you will need to re-initialize the deepspeed engine, since
563
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
564
+
565
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
566
+
567
+ Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
568
+ You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
569
+ the checkpoint. Or you can load state_dict in lazy mode ::
570
+
571
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
572
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
573
+ for name, lazy_tensor in state_dict.item():
574
+ tensor = lazy_tensor.contiguous() # to cpu
575
+ print(name, tensor)
576
+ # del tensor to release memory if it no longer in use
577
+ """
578
+ if tag is None:
579
+ latest_path = os.path.join(checkpoint_dir, 'latest')
580
+ if os.path.isfile(latest_path):
581
+ with open(latest_path, 'r') as fd:
582
+ tag = fd.read().strip()
583
+ else:
584
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
585
+
586
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
587
+
588
+ if not os.path.isdir(ds_checkpoint_dir):
589
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
590
+
591
+ state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
592
+ if lazy_mode:
593
+ return state_dict
594
+ else:
595
+ return to_torch_tensor(state_dict)
596
+
597
+
598
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
599
+ output_dir,
600
+ max_shard_size="5GB",
601
+ safe_serialization=False,
602
+ tag=None,
603
+ exclude_frozen_parameters=False):
604
+ """
605
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
606
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
607
+
608
+ Args:
609
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
610
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
611
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
612
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
613
+ - ``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``
614
+ - ``exclude_frozen_parameters``: exclude frozen parameters
615
+ """
616
+
617
+ # Dependency pre-check
618
+ if safe_serialization:
619
+ try:
620
+ from safetensors.torch import save_file
621
+ except ImportError:
622
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
623
+ raise
624
+ if max_shard_size is not None:
625
+ try:
626
+ from huggingface_hub import split_torch_state_dict_into_shards
627
+ except ImportError:
628
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
629
+ raise
630
+
631
+ # Convert zero checkpoint to state_dict
632
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
633
+ tag,
634
+ exclude_frozen_parameters,
635
+ lazy_mode=True)
636
+
637
+ # Shard the model if it is too big.
638
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
639
+ if max_shard_size is not None:
640
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
641
+ # an memory-efficient approach for sharding
642
+ empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
643
+ state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
644
+ filename_pattern=filename_pattern,
645
+ max_shard_size=max_shard_size)
646
+ else:
647
+ from collections import namedtuple
648
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
649
+ state_dict_split = StateDictSplit(is_sharded=False,
650
+ filename_to_tensors={weights_name: list(state_dict.keys())})
651
+
652
+ # Save the model by shard
653
+ os.makedirs(output_dir, exist_ok=True)
654
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
655
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
656
+ shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
657
+ shard_state_dict = to_torch_tensor(shard_state_dict)
658
+ output_path = os.path.join(output_dir, shard_file)
659
+ if safe_serialization:
660
+ save_file(shard_state_dict, output_path, metadata={"format": "pt"})
661
+ else:
662
+ torch.save(shard_state_dict, output_path)
663
+ # release the memory of current shard
664
+ for tensor_name in list(shard_state_dict.keys()):
665
+ del state_dict[tensor_name]
666
+ del shard_state_dict[tensor_name]
667
+ del shard_state_dict
668
+ gc.collect()
669
+
670
+ # Save index if sharded
671
+ if state_dict_split.is_sharded:
672
+ index = {
673
+ "metadata": state_dict_split.metadata,
674
+ "weight_map": state_dict_split.tensor_to_filename,
675
+ }
676
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
677
+ save_index_file = os.path.join(output_dir, save_index_file)
678
+ with open(save_index_file, "w", encoding="utf-8") as f:
679
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
680
+ f.write(content)
681
+
682
+
683
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
684
+ """
685
+ 1. Put the provided model to cpu
686
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
687
+ 3. Load it into the provided model
688
+
689
+ Args:
690
+ - ``model``: the model object to update
691
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
692
+ - ``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``
693
+
694
+ Returns:
695
+ - ``model`: modified model
696
+
697
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
698
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
699
+ conveniently placed for you in the checkpoint folder.
700
+
701
+ A typical usage might be ::
702
+
703
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
704
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
705
+ # submit to model hub or save the model to share with others
706
+
707
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
708
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
709
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
710
+
711
+ """
712
+ logger.info(f"Extracting fp32 weights")
713
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
714
+
715
+ logger.info(f"Overwriting model with fp32 weights")
716
+ model = model.cpu()
717
+ model.load_state_dict(state_dict, strict=False)
718
+
719
+ return model
720
+
721
+
722
+ if __name__ == "__main__":
723
+ parser = argparse.ArgumentParser()
724
+ parser.add_argument("checkpoint_dir",
725
+ type=str,
726
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
727
+ parser.add_argument("output_dir",
728
+ type=str,
729
+ help="directory to the pytorch fp32 state_dict output files"
730
+ "(e.g. path/checkpoint-12-output/)")
731
+ parser.add_argument(
732
+ "--max_shard_size",
733
+ type=str,
734
+ default="5GB",
735
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
736
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
737
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
738
+ "without CPU OOM issues.")
739
+ parser.add_argument(
740
+ "--safe_serialization",
741
+ default=False,
742
+ action='store_true',
743
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
744
+ parser.add_argument("-t",
745
+ "--tag",
746
+ type=str,
747
+ default=None,
748
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
749
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
750
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
751
+ args = parser.parse_args()
752
+
753
+ debug = args.debug
754
+
755
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
756
+ args.output_dir,
757
+ max_shard_size=args.max_shard_size,
758
+ safe_serialization=args.safe_serialization,
759
+ tag=args.tag,
760
+ exclude_frozen_parameters=args.exclude_frozen_parameters)