Wanfq commited on
Commit
3684748
1 Parent(s): 8b45500

First model version

Browse files
added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "[PAD]": 32000
3
+ }
config.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "../../../PLMs/ft_local/LLAMA/hf/llama-7b",
3
+ "architectures": [
4
+ "LLaMAForCausalLM"
5
+ ],
6
+ "bos_token_id": 1,
7
+ "eos_token_id": 2,
8
+ "hidden_act": "silu",
9
+ "hidden_size": 4096,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 11008,
12
+ "max_sequence_length": 2048,
13
+ "model_type": "llama",
14
+ "num_attention_heads": 32,
15
+ "num_hidden_layers": 32,
16
+ "pad_token_id": 0,
17
+ "rms_norm_eps": 1e-06,
18
+ "tie_word_embeddings": false,
19
+ "torch_dtype": "float16",
20
+ "transformers_version": "4.27.0.dev0",
21
+ "use_cache": true,
22
+ "vocab_size": 32001
23
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "4.27.0.dev0"
7
+ }
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step234
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da612e2a757293805d3d904876bb6b134a00fe0ef32b15f042631abb3266cdb4
3
+ size 26953810889
special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "</s>",
3
+ "eos_token": "</s>",
4
+ "pad_token": "[PAD]",
5
+ "unk_token": "</s>"
6
+ }
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
3
+ size 499723
tokenizer_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "",
3
+ "eos_token": "",
4
+ "model_max_length": 512,
5
+ "padding_side": "right",
6
+ "special_tokens_map_file": "../../../PLMs/ft_local/LLAMA/hf/llama-7b/special_tokens_map.json",
7
+ "tokenizer_class": "LLaMATokenizer",
8
+ "unk_token": ""
9
+ }
trainer_state.json ADDED
@@ -0,0 +1,1429 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 2.9984,
5
+ "global_step": 234,
6
+ "is_hyper_param_search": false,
7
+ "is_local_process_zero": true,
8
+ "is_world_process_zero": true,
9
+ "log_history": [
10
+ {
11
+ "epoch": 0.01,
12
+ "learning_rate": 0.0,
13
+ "loss": 1.0183,
14
+ "step": 1
15
+ },
16
+ {
17
+ "epoch": 0.03,
18
+ "learning_rate": 6.666666666666668e-06,
19
+ "loss": 0.8252,
20
+ "step": 2
21
+ },
22
+ {
23
+ "epoch": 0.04,
24
+ "learning_rate": 1.0566416671474378e-05,
25
+ "loss": 0.8853,
26
+ "step": 3
27
+ },
28
+ {
29
+ "epoch": 0.05,
30
+ "learning_rate": 1.3333333333333337e-05,
31
+ "loss": 0.6674,
32
+ "step": 4
33
+ },
34
+ {
35
+ "epoch": 0.06,
36
+ "learning_rate": 1.5479520632582417e-05,
37
+ "loss": 0.7124,
38
+ "step": 5
39
+ },
40
+ {
41
+ "epoch": 0.08,
42
+ "learning_rate": 1.7233083338141044e-05,
43
+ "loss": 0.6497,
44
+ "step": 6
45
+ },
46
+ {
47
+ "epoch": 0.09,
48
+ "learning_rate": 1.8715699480384028e-05,
49
+ "loss": 0.6226,
50
+ "step": 7
51
+ },
52
+ {
53
+ "epoch": 0.1,
54
+ "learning_rate": 2e-05,
55
+ "loss": 0.6205,
56
+ "step": 8
57
+ },
58
+ {
59
+ "epoch": 0.12,
60
+ "learning_rate": 2e-05,
61
+ "loss": 0.6256,
62
+ "step": 9
63
+ },
64
+ {
65
+ "epoch": 0.13,
66
+ "learning_rate": 1.991150442477876e-05,
67
+ "loss": 0.6366,
68
+ "step": 10
69
+ },
70
+ {
71
+ "epoch": 0.14,
72
+ "learning_rate": 1.9823008849557524e-05,
73
+ "loss": 0.5717,
74
+ "step": 11
75
+ },
76
+ {
77
+ "epoch": 0.15,
78
+ "learning_rate": 1.9734513274336283e-05,
79
+ "loss": 0.6073,
80
+ "step": 12
81
+ },
82
+ {
83
+ "epoch": 0.17,
84
+ "learning_rate": 1.9646017699115046e-05,
85
+ "loss": 0.6069,
86
+ "step": 13
87
+ },
88
+ {
89
+ "epoch": 0.18,
90
+ "learning_rate": 1.9557522123893806e-05,
91
+ "loss": 0.5996,
92
+ "step": 14
93
+ },
94
+ {
95
+ "epoch": 0.19,
96
+ "learning_rate": 1.946902654867257e-05,
97
+ "loss": 0.5885,
98
+ "step": 15
99
+ },
100
+ {
101
+ "epoch": 0.2,
102
+ "learning_rate": 1.9380530973451328e-05,
103
+ "loss": 0.5838,
104
+ "step": 16
105
+ },
106
+ {
107
+ "epoch": 0.22,
108
+ "learning_rate": 1.929203539823009e-05,
109
+ "loss": 0.6094,
110
+ "step": 17
111
+ },
112
+ {
113
+ "epoch": 0.23,
114
+ "learning_rate": 1.9203539823008853e-05,
115
+ "loss": 0.5957,
116
+ "step": 18
117
+ },
118
+ {
119
+ "epoch": 0.24,
120
+ "learning_rate": 1.9115044247787613e-05,
121
+ "loss": 0.625,
122
+ "step": 19
123
+ },
124
+ {
125
+ "epoch": 0.26,
126
+ "learning_rate": 1.9026548672566376e-05,
127
+ "loss": 0.5876,
128
+ "step": 20
129
+ },
130
+ {
131
+ "epoch": 0.27,
132
+ "learning_rate": 1.8938053097345135e-05,
133
+ "loss": 0.5664,
134
+ "step": 21
135
+ },
136
+ {
137
+ "epoch": 0.28,
138
+ "learning_rate": 1.8849557522123894e-05,
139
+ "loss": 0.5474,
140
+ "step": 22
141
+ },
142
+ {
143
+ "epoch": 0.29,
144
+ "learning_rate": 1.8761061946902657e-05,
145
+ "loss": 0.5727,
146
+ "step": 23
147
+ },
148
+ {
149
+ "epoch": 0.31,
150
+ "learning_rate": 1.8672566371681417e-05,
151
+ "loss": 0.5708,
152
+ "step": 24
153
+ },
154
+ {
155
+ "epoch": 0.32,
156
+ "learning_rate": 1.858407079646018e-05,
157
+ "loss": 0.5623,
158
+ "step": 25
159
+ },
160
+ {
161
+ "epoch": 0.33,
162
+ "learning_rate": 1.849557522123894e-05,
163
+ "loss": 0.5544,
164
+ "step": 26
165
+ },
166
+ {
167
+ "epoch": 0.35,
168
+ "learning_rate": 1.8407079646017702e-05,
169
+ "loss": 0.5877,
170
+ "step": 27
171
+ },
172
+ {
173
+ "epoch": 0.36,
174
+ "learning_rate": 1.831858407079646e-05,
175
+ "loss": 0.572,
176
+ "step": 28
177
+ },
178
+ {
179
+ "epoch": 0.37,
180
+ "learning_rate": 1.823008849557522e-05,
181
+ "loss": 0.5372,
182
+ "step": 29
183
+ },
184
+ {
185
+ "epoch": 0.38,
186
+ "learning_rate": 1.8141592920353983e-05,
187
+ "loss": 0.5291,
188
+ "step": 30
189
+ },
190
+ {
191
+ "epoch": 0.4,
192
+ "learning_rate": 1.8053097345132743e-05,
193
+ "loss": 0.5574,
194
+ "step": 31
195
+ },
196
+ {
197
+ "epoch": 0.41,
198
+ "learning_rate": 1.7964601769911506e-05,
199
+ "loss": 0.5402,
200
+ "step": 32
201
+ },
202
+ {
203
+ "epoch": 0.42,
204
+ "learning_rate": 1.7876106194690265e-05,
205
+ "loss": 0.5336,
206
+ "step": 33
207
+ },
208
+ {
209
+ "epoch": 0.44,
210
+ "learning_rate": 1.7787610619469028e-05,
211
+ "loss": 0.5763,
212
+ "step": 34
213
+ },
214
+ {
215
+ "epoch": 0.45,
216
+ "learning_rate": 1.769911504424779e-05,
217
+ "loss": 0.558,
218
+ "step": 35
219
+ },
220
+ {
221
+ "epoch": 0.46,
222
+ "learning_rate": 1.761061946902655e-05,
223
+ "loss": 0.5398,
224
+ "step": 36
225
+ },
226
+ {
227
+ "epoch": 0.47,
228
+ "learning_rate": 1.7522123893805313e-05,
229
+ "loss": 0.5782,
230
+ "step": 37
231
+ },
232
+ {
233
+ "epoch": 0.49,
234
+ "learning_rate": 1.7433628318584072e-05,
235
+ "loss": 0.5383,
236
+ "step": 38
237
+ },
238
+ {
239
+ "epoch": 0.5,
240
+ "learning_rate": 1.7345132743362835e-05,
241
+ "loss": 0.5754,
242
+ "step": 39
243
+ },
244
+ {
245
+ "epoch": 0.51,
246
+ "learning_rate": 1.7256637168141594e-05,
247
+ "loss": 0.5317,
248
+ "step": 40
249
+ },
250
+ {
251
+ "epoch": 0.52,
252
+ "learning_rate": 1.7168141592920354e-05,
253
+ "loss": 0.5415,
254
+ "step": 41
255
+ },
256
+ {
257
+ "epoch": 0.54,
258
+ "learning_rate": 1.7079646017699117e-05,
259
+ "loss": 0.5137,
260
+ "step": 42
261
+ },
262
+ {
263
+ "epoch": 0.55,
264
+ "learning_rate": 1.6991150442477876e-05,
265
+ "loss": 0.5404,
266
+ "step": 43
267
+ },
268
+ {
269
+ "epoch": 0.56,
270
+ "learning_rate": 1.690265486725664e-05,
271
+ "loss": 0.5129,
272
+ "step": 44
273
+ },
274
+ {
275
+ "epoch": 0.58,
276
+ "learning_rate": 1.68141592920354e-05,
277
+ "loss": 0.5379,
278
+ "step": 45
279
+ },
280
+ {
281
+ "epoch": 0.59,
282
+ "learning_rate": 1.672566371681416e-05,
283
+ "loss": 0.5112,
284
+ "step": 46
285
+ },
286
+ {
287
+ "epoch": 0.6,
288
+ "learning_rate": 1.663716814159292e-05,
289
+ "loss": 0.4948,
290
+ "step": 47
291
+ },
292
+ {
293
+ "epoch": 0.61,
294
+ "learning_rate": 1.6548672566371683e-05,
295
+ "loss": 0.5621,
296
+ "step": 48
297
+ },
298
+ {
299
+ "epoch": 0.63,
300
+ "learning_rate": 1.6460176991150443e-05,
301
+ "loss": 0.503,
302
+ "step": 49
303
+ },
304
+ {
305
+ "epoch": 0.64,
306
+ "learning_rate": 1.6371681415929206e-05,
307
+ "loss": 0.538,
308
+ "step": 50
309
+ },
310
+ {
311
+ "epoch": 0.65,
312
+ "learning_rate": 1.628318584070797e-05,
313
+ "loss": 0.5087,
314
+ "step": 51
315
+ },
316
+ {
317
+ "epoch": 0.67,
318
+ "learning_rate": 1.6194690265486728e-05,
319
+ "loss": 0.5171,
320
+ "step": 52
321
+ },
322
+ {
323
+ "epoch": 0.68,
324
+ "learning_rate": 1.6106194690265487e-05,
325
+ "loss": 0.5458,
326
+ "step": 53
327
+ },
328
+ {
329
+ "epoch": 0.69,
330
+ "learning_rate": 1.601769911504425e-05,
331
+ "loss": 0.5558,
332
+ "step": 54
333
+ },
334
+ {
335
+ "epoch": 0.7,
336
+ "learning_rate": 1.592920353982301e-05,
337
+ "loss": 0.5022,
338
+ "step": 55
339
+ },
340
+ {
341
+ "epoch": 0.72,
342
+ "learning_rate": 1.5840707964601772e-05,
343
+ "loss": 0.5301,
344
+ "step": 56
345
+ },
346
+ {
347
+ "epoch": 0.73,
348
+ "learning_rate": 1.5752212389380532e-05,
349
+ "loss": 0.533,
350
+ "step": 57
351
+ },
352
+ {
353
+ "epoch": 0.74,
354
+ "learning_rate": 1.5663716814159295e-05,
355
+ "loss": 0.5295,
356
+ "step": 58
357
+ },
358
+ {
359
+ "epoch": 0.76,
360
+ "learning_rate": 1.5575221238938054e-05,
361
+ "loss": 0.5146,
362
+ "step": 59
363
+ },
364
+ {
365
+ "epoch": 0.77,
366
+ "learning_rate": 1.5486725663716813e-05,
367
+ "loss": 0.4989,
368
+ "step": 60
369
+ },
370
+ {
371
+ "epoch": 0.78,
372
+ "learning_rate": 1.5398230088495576e-05,
373
+ "loss": 0.5032,
374
+ "step": 61
375
+ },
376
+ {
377
+ "epoch": 0.79,
378
+ "learning_rate": 1.5309734513274336e-05,
379
+ "loss": 0.5173,
380
+ "step": 62
381
+ },
382
+ {
383
+ "epoch": 0.81,
384
+ "learning_rate": 1.5221238938053098e-05,
385
+ "loss": 0.506,
386
+ "step": 63
387
+ },
388
+ {
389
+ "epoch": 0.82,
390
+ "learning_rate": 1.513274336283186e-05,
391
+ "loss": 0.4967,
392
+ "step": 64
393
+ },
394
+ {
395
+ "epoch": 0.83,
396
+ "learning_rate": 1.5044247787610619e-05,
397
+ "loss": 0.5163,
398
+ "step": 65
399
+ },
400
+ {
401
+ "epoch": 0.84,
402
+ "learning_rate": 1.4955752212389383e-05,
403
+ "loss": 0.5079,
404
+ "step": 66
405
+ },
406
+ {
407
+ "epoch": 0.86,
408
+ "learning_rate": 1.4867256637168143e-05,
409
+ "loss": 0.5342,
410
+ "step": 67
411
+ },
412
+ {
413
+ "epoch": 0.87,
414
+ "learning_rate": 1.4778761061946904e-05,
415
+ "loss": 0.4903,
416
+ "step": 68
417
+ },
418
+ {
419
+ "epoch": 0.88,
420
+ "learning_rate": 1.4690265486725665e-05,
421
+ "loss": 0.5185,
422
+ "step": 69
423
+ },
424
+ {
425
+ "epoch": 0.9,
426
+ "learning_rate": 1.4601769911504426e-05,
427
+ "loss": 0.5127,
428
+ "step": 70
429
+ },
430
+ {
431
+ "epoch": 0.91,
432
+ "learning_rate": 1.4513274336283187e-05,
433
+ "loss": 0.5051,
434
+ "step": 71
435
+ },
436
+ {
437
+ "epoch": 0.92,
438
+ "learning_rate": 1.4424778761061948e-05,
439
+ "loss": 0.5188,
440
+ "step": 72
441
+ },
442
+ {
443
+ "epoch": 0.93,
444
+ "learning_rate": 1.433628318584071e-05,
445
+ "loss": 0.487,
446
+ "step": 73
447
+ },
448
+ {
449
+ "epoch": 0.95,
450
+ "learning_rate": 1.424778761061947e-05,
451
+ "loss": 0.4731,
452
+ "step": 74
453
+ },
454
+ {
455
+ "epoch": 0.96,
456
+ "learning_rate": 1.4159292035398232e-05,
457
+ "loss": 0.4858,
458
+ "step": 75
459
+ },
460
+ {
461
+ "epoch": 0.97,
462
+ "learning_rate": 1.4070796460176991e-05,
463
+ "loss": 0.4963,
464
+ "step": 76
465
+ },
466
+ {
467
+ "epoch": 0.99,
468
+ "learning_rate": 1.3982300884955752e-05,
469
+ "loss": 0.4749,
470
+ "step": 77
471
+ },
472
+ {
473
+ "epoch": 1.0,
474
+ "learning_rate": 1.3893805309734513e-05,
475
+ "loss": 0.4761,
476
+ "step": 78
477
+ },
478
+ {
479
+ "epoch": 1.01,
480
+ "learning_rate": 1.3805309734513275e-05,
481
+ "loss": 0.4184,
482
+ "step": 79
483
+ },
484
+ {
485
+ "epoch": 1.03,
486
+ "learning_rate": 1.3716814159292036e-05,
487
+ "loss": 0.3704,
488
+ "step": 80
489
+ },
490
+ {
491
+ "epoch": 1.04,
492
+ "learning_rate": 1.3628318584070797e-05,
493
+ "loss": 0.3434,
494
+ "step": 81
495
+ },
496
+ {
497
+ "epoch": 1.05,
498
+ "learning_rate": 1.353982300884956e-05,
499
+ "loss": 0.369,
500
+ "step": 82
501
+ },
502
+ {
503
+ "epoch": 1.06,
504
+ "learning_rate": 1.345132743362832e-05,
505
+ "loss": 0.363,
506
+ "step": 83
507
+ },
508
+ {
509
+ "epoch": 1.08,
510
+ "learning_rate": 1.3362831858407082e-05,
511
+ "loss": 0.3729,
512
+ "step": 84
513
+ },
514
+ {
515
+ "epoch": 1.09,
516
+ "learning_rate": 1.3274336283185843e-05,
517
+ "loss": 0.3468,
518
+ "step": 85
519
+ },
520
+ {
521
+ "epoch": 1.1,
522
+ "learning_rate": 1.3185840707964604e-05,
523
+ "loss": 0.326,
524
+ "step": 86
525
+ },
526
+ {
527
+ "epoch": 1.12,
528
+ "learning_rate": 1.3097345132743363e-05,
529
+ "loss": 0.3541,
530
+ "step": 87
531
+ },
532
+ {
533
+ "epoch": 1.13,
534
+ "learning_rate": 1.3008849557522125e-05,
535
+ "loss": 0.3624,
536
+ "step": 88
537
+ },
538
+ {
539
+ "epoch": 1.14,
540
+ "learning_rate": 1.2920353982300886e-05,
541
+ "loss": 0.3518,
542
+ "step": 89
543
+ },
544
+ {
545
+ "epoch": 1.15,
546
+ "learning_rate": 1.2831858407079647e-05,
547
+ "loss": 0.3352,
548
+ "step": 90
549
+ },
550
+ {
551
+ "epoch": 1.17,
552
+ "learning_rate": 1.2743362831858408e-05,
553
+ "loss": 0.3412,
554
+ "step": 91
555
+ },
556
+ {
557
+ "epoch": 1.18,
558
+ "learning_rate": 1.2654867256637169e-05,
559
+ "loss": 0.3465,
560
+ "step": 92
561
+ },
562
+ {
563
+ "epoch": 1.19,
564
+ "learning_rate": 1.256637168141593e-05,
565
+ "loss": 0.3776,
566
+ "step": 93
567
+ },
568
+ {
569
+ "epoch": 1.2,
570
+ "learning_rate": 1.2477876106194691e-05,
571
+ "loss": 0.3375,
572
+ "step": 94
573
+ },
574
+ {
575
+ "epoch": 1.22,
576
+ "learning_rate": 1.2389380530973452e-05,
577
+ "loss": 0.3535,
578
+ "step": 95
579
+ },
580
+ {
581
+ "epoch": 1.23,
582
+ "learning_rate": 1.2300884955752212e-05,
583
+ "loss": 0.3318,
584
+ "step": 96
585
+ },
586
+ {
587
+ "epoch": 1.24,
588
+ "learning_rate": 1.2212389380530973e-05,
589
+ "loss": 0.3501,
590
+ "step": 97
591
+ },
592
+ {
593
+ "epoch": 1.26,
594
+ "learning_rate": 1.2123893805309736e-05,
595
+ "loss": 0.3417,
596
+ "step": 98
597
+ },
598
+ {
599
+ "epoch": 1.27,
600
+ "learning_rate": 1.2035398230088497e-05,
601
+ "loss": 0.3368,
602
+ "step": 99
603
+ },
604
+ {
605
+ "epoch": 1.28,
606
+ "learning_rate": 1.1946902654867258e-05,
607
+ "loss": 0.3467,
608
+ "step": 100
609
+ },
610
+ {
611
+ "epoch": 1.29,
612
+ "learning_rate": 1.1858407079646019e-05,
613
+ "loss": 0.3315,
614
+ "step": 101
615
+ },
616
+ {
617
+ "epoch": 1.31,
618
+ "learning_rate": 1.176991150442478e-05,
619
+ "loss": 0.3402,
620
+ "step": 102
621
+ },
622
+ {
623
+ "epoch": 1.32,
624
+ "learning_rate": 1.1681415929203541e-05,
625
+ "loss": 0.3269,
626
+ "step": 103
627
+ },
628
+ {
629
+ "epoch": 1.33,
630
+ "learning_rate": 1.1592920353982302e-05,
631
+ "loss": 0.3422,
632
+ "step": 104
633
+ },
634
+ {
635
+ "epoch": 1.35,
636
+ "learning_rate": 1.1504424778761064e-05,
637
+ "loss": 0.3521,
638
+ "step": 105
639
+ },
640
+ {
641
+ "epoch": 1.36,
642
+ "learning_rate": 1.1415929203539825e-05,
643
+ "loss": 0.3424,
644
+ "step": 106
645
+ },
646
+ {
647
+ "epoch": 1.37,
648
+ "learning_rate": 1.1327433628318584e-05,
649
+ "loss": 0.3503,
650
+ "step": 107
651
+ },
652
+ {
653
+ "epoch": 1.38,
654
+ "learning_rate": 1.1238938053097345e-05,
655
+ "loss": 0.3461,
656
+ "step": 108
657
+ },
658
+ {
659
+ "epoch": 1.4,
660
+ "learning_rate": 1.1150442477876106e-05,
661
+ "loss": 0.3353,
662
+ "step": 109
663
+ },
664
+ {
665
+ "epoch": 1.41,
666
+ "learning_rate": 1.1061946902654867e-05,
667
+ "loss": 0.3391,
668
+ "step": 110
669
+ },
670
+ {
671
+ "epoch": 1.42,
672
+ "learning_rate": 1.0973451327433629e-05,
673
+ "loss": 0.3136,
674
+ "step": 111
675
+ },
676
+ {
677
+ "epoch": 1.44,
678
+ "learning_rate": 1.088495575221239e-05,
679
+ "loss": 0.3493,
680
+ "step": 112
681
+ },
682
+ {
683
+ "epoch": 1.45,
684
+ "learning_rate": 1.079646017699115e-05,
685
+ "loss": 0.3405,
686
+ "step": 113
687
+ },
688
+ {
689
+ "epoch": 1.46,
690
+ "learning_rate": 1.0707964601769914e-05,
691
+ "loss": 0.3495,
692
+ "step": 114
693
+ },
694
+ {
695
+ "epoch": 1.47,
696
+ "learning_rate": 1.0619469026548675e-05,
697
+ "loss": 0.328,
698
+ "step": 115
699
+ },
700
+ {
701
+ "epoch": 1.49,
702
+ "learning_rate": 1.0530973451327436e-05,
703
+ "loss": 0.3232,
704
+ "step": 116
705
+ },
706
+ {
707
+ "epoch": 1.5,
708
+ "learning_rate": 1.0442477876106197e-05,
709
+ "loss": 0.3452,
710
+ "step": 117
711
+ },
712
+ {
713
+ "epoch": 1.51,
714
+ "learning_rate": 1.0353982300884956e-05,
715
+ "loss": 0.3263,
716
+ "step": 118
717
+ },
718
+ {
719
+ "epoch": 1.52,
720
+ "learning_rate": 1.0265486725663717e-05,
721
+ "loss": 0.3339,
722
+ "step": 119
723
+ },
724
+ {
725
+ "epoch": 1.54,
726
+ "learning_rate": 1.0176991150442479e-05,
727
+ "loss": 0.3299,
728
+ "step": 120
729
+ },
730
+ {
731
+ "epoch": 1.55,
732
+ "learning_rate": 1.008849557522124e-05,
733
+ "loss": 0.3195,
734
+ "step": 121
735
+ },
736
+ {
737
+ "epoch": 1.56,
738
+ "learning_rate": 1e-05,
739
+ "loss": 0.3475,
740
+ "step": 122
741
+ },
742
+ {
743
+ "epoch": 1.58,
744
+ "learning_rate": 9.911504424778762e-06,
745
+ "loss": 0.3392,
746
+ "step": 123
747
+ },
748
+ {
749
+ "epoch": 1.59,
750
+ "learning_rate": 9.823008849557523e-06,
751
+ "loss": 0.3495,
752
+ "step": 124
753
+ },
754
+ {
755
+ "epoch": 1.6,
756
+ "learning_rate": 9.734513274336284e-06,
757
+ "loss": 0.3285,
758
+ "step": 125
759
+ },
760
+ {
761
+ "epoch": 1.61,
762
+ "learning_rate": 9.646017699115045e-06,
763
+ "loss": 0.3412,
764
+ "step": 126
765
+ },
766
+ {
767
+ "epoch": 1.63,
768
+ "learning_rate": 9.557522123893806e-06,
769
+ "loss": 0.3351,
770
+ "step": 127
771
+ },
772
+ {
773
+ "epoch": 1.64,
774
+ "learning_rate": 9.469026548672568e-06,
775
+ "loss": 0.3498,
776
+ "step": 128
777
+ },
778
+ {
779
+ "epoch": 1.65,
780
+ "learning_rate": 9.380530973451329e-06,
781
+ "loss": 0.3475,
782
+ "step": 129
783
+ },
784
+ {
785
+ "epoch": 1.67,
786
+ "learning_rate": 9.29203539823009e-06,
787
+ "loss": 0.3495,
788
+ "step": 130
789
+ },
790
+ {
791
+ "epoch": 1.68,
792
+ "learning_rate": 9.203539823008851e-06,
793
+ "loss": 0.3332,
794
+ "step": 131
795
+ },
796
+ {
797
+ "epoch": 1.69,
798
+ "learning_rate": 9.11504424778761e-06,
799
+ "loss": 0.3136,
800
+ "step": 132
801
+ },
802
+ {
803
+ "epoch": 1.7,
804
+ "learning_rate": 9.026548672566371e-06,
805
+ "loss": 0.3526,
806
+ "step": 133
807
+ },
808
+ {
809
+ "epoch": 1.72,
810
+ "learning_rate": 8.938053097345133e-06,
811
+ "loss": 0.3336,
812
+ "step": 134
813
+ },
814
+ {
815
+ "epoch": 1.73,
816
+ "learning_rate": 8.849557522123895e-06,
817
+ "loss": 0.3476,
818
+ "step": 135
819
+ },
820
+ {
821
+ "epoch": 1.74,
822
+ "learning_rate": 8.761061946902656e-06,
823
+ "loss": 0.3286,
824
+ "step": 136
825
+ },
826
+ {
827
+ "epoch": 1.76,
828
+ "learning_rate": 8.672566371681418e-06,
829
+ "loss": 0.3579,
830
+ "step": 137
831
+ },
832
+ {
833
+ "epoch": 1.77,
834
+ "learning_rate": 8.584070796460177e-06,
835
+ "loss": 0.3202,
836
+ "step": 138
837
+ },
838
+ {
839
+ "epoch": 1.78,
840
+ "learning_rate": 8.495575221238938e-06,
841
+ "loss": 0.3376,
842
+ "step": 139
843
+ },
844
+ {
845
+ "epoch": 1.79,
846
+ "learning_rate": 8.4070796460177e-06,
847
+ "loss": 0.3399,
848
+ "step": 140
849
+ },
850
+ {
851
+ "epoch": 1.81,
852
+ "learning_rate": 8.31858407079646e-06,
853
+ "loss": 0.3296,
854
+ "step": 141
855
+ },
856
+ {
857
+ "epoch": 1.82,
858
+ "learning_rate": 8.230088495575221e-06,
859
+ "loss": 0.3342,
860
+ "step": 142
861
+ },
862
+ {
863
+ "epoch": 1.83,
864
+ "learning_rate": 8.141592920353984e-06,
865
+ "loss": 0.3272,
866
+ "step": 143
867
+ },
868
+ {
869
+ "epoch": 1.84,
870
+ "learning_rate": 8.053097345132744e-06,
871
+ "loss": 0.3242,
872
+ "step": 144
873
+ },
874
+ {
875
+ "epoch": 1.86,
876
+ "learning_rate": 7.964601769911505e-06,
877
+ "loss": 0.3207,
878
+ "step": 145
879
+ },
880
+ {
881
+ "epoch": 1.87,
882
+ "learning_rate": 7.876106194690266e-06,
883
+ "loss": 0.3148,
884
+ "step": 146
885
+ },
886
+ {
887
+ "epoch": 1.88,
888
+ "learning_rate": 7.787610619469027e-06,
889
+ "loss": 0.3344,
890
+ "step": 147
891
+ },
892
+ {
893
+ "epoch": 1.9,
894
+ "learning_rate": 7.699115044247788e-06,
895
+ "loss": 0.3228,
896
+ "step": 148
897
+ },
898
+ {
899
+ "epoch": 1.91,
900
+ "learning_rate": 7.610619469026549e-06,
901
+ "loss": 0.3498,
902
+ "step": 149
903
+ },
904
+ {
905
+ "epoch": 1.92,
906
+ "learning_rate": 7.5221238938053095e-06,
907
+ "loss": 0.3427,
908
+ "step": 150
909
+ },
910
+ {
911
+ "epoch": 1.93,
912
+ "learning_rate": 7.4336283185840714e-06,
913
+ "loss": 0.346,
914
+ "step": 151
915
+ },
916
+ {
917
+ "epoch": 1.95,
918
+ "learning_rate": 7.3451327433628326e-06,
919
+ "loss": 0.3053,
920
+ "step": 152
921
+ },
922
+ {
923
+ "epoch": 1.96,
924
+ "learning_rate": 7.256637168141594e-06,
925
+ "loss": 0.3306,
926
+ "step": 153
927
+ },
928
+ {
929
+ "epoch": 1.97,
930
+ "learning_rate": 7.168141592920355e-06,
931
+ "loss": 0.3232,
932
+ "step": 154
933
+ },
934
+ {
935
+ "epoch": 1.99,
936
+ "learning_rate": 7.079646017699116e-06,
937
+ "loss": 0.3138,
938
+ "step": 155
939
+ },
940
+ {
941
+ "epoch": 2.0,
942
+ "learning_rate": 6.991150442477876e-06,
943
+ "loss": 0.3067,
944
+ "step": 156
945
+ },
946
+ {
947
+ "epoch": 2.01,
948
+ "learning_rate": 6.902654867256637e-06,
949
+ "loss": 0.2733,
950
+ "step": 157
951
+ },
952
+ {
953
+ "epoch": 2.03,
954
+ "learning_rate": 6.814159292035398e-06,
955
+ "loss": 0.2254,
956
+ "step": 158
957
+ },
958
+ {
959
+ "epoch": 2.04,
960
+ "learning_rate": 6.72566371681416e-06,
961
+ "loss": 0.2198,
962
+ "step": 159
963
+ },
964
+ {
965
+ "epoch": 2.05,
966
+ "learning_rate": 6.6371681415929215e-06,
967
+ "loss": 0.2098,
968
+ "step": 160
969
+ },
970
+ {
971
+ "epoch": 2.06,
972
+ "learning_rate": 6.548672566371682e-06,
973
+ "loss": 0.2004,
974
+ "step": 161
975
+ },
976
+ {
977
+ "epoch": 2.08,
978
+ "learning_rate": 6.460176991150443e-06,
979
+ "loss": 0.1913,
980
+ "step": 162
981
+ },
982
+ {
983
+ "epoch": 2.09,
984
+ "learning_rate": 6.371681415929204e-06,
985
+ "loss": 0.188,
986
+ "step": 163
987
+ },
988
+ {
989
+ "epoch": 2.1,
990
+ "learning_rate": 6.283185840707965e-06,
991
+ "loss": 0.1956,
992
+ "step": 164
993
+ },
994
+ {
995
+ "epoch": 2.12,
996
+ "learning_rate": 6.194690265486726e-06,
997
+ "loss": 0.1968,
998
+ "step": 165
999
+ },
1000
+ {
1001
+ "epoch": 2.13,
1002
+ "learning_rate": 6.1061946902654865e-06,
1003
+ "loss": 0.1919,
1004
+ "step": 166
1005
+ },
1006
+ {
1007
+ "epoch": 2.14,
1008
+ "learning_rate": 6.0176991150442484e-06,
1009
+ "loss": 0.1946,
1010
+ "step": 167
1011
+ },
1012
+ {
1013
+ "epoch": 2.15,
1014
+ "learning_rate": 5.9292035398230096e-06,
1015
+ "loss": 0.1955,
1016
+ "step": 168
1017
+ },
1018
+ {
1019
+ "epoch": 2.17,
1020
+ "learning_rate": 5.840707964601771e-06,
1021
+ "loss": 0.209,
1022
+ "step": 169
1023
+ },
1024
+ {
1025
+ "epoch": 2.18,
1026
+ "learning_rate": 5.752212389380532e-06,
1027
+ "loss": 0.199,
1028
+ "step": 170
1029
+ },
1030
+ {
1031
+ "epoch": 2.19,
1032
+ "learning_rate": 5.663716814159292e-06,
1033
+ "loss": 0.2018,
1034
+ "step": 171
1035
+ },
1036
+ {
1037
+ "epoch": 2.2,
1038
+ "learning_rate": 5.575221238938053e-06,
1039
+ "loss": 0.2105,
1040
+ "step": 172
1041
+ },
1042
+ {
1043
+ "epoch": 2.22,
1044
+ "learning_rate": 5.486725663716814e-06,
1045
+ "loss": 0.1831,
1046
+ "step": 173
1047
+ },
1048
+ {
1049
+ "epoch": 2.23,
1050
+ "learning_rate": 5.398230088495575e-06,
1051
+ "loss": 0.1989,
1052
+ "step": 174
1053
+ },
1054
+ {
1055
+ "epoch": 2.24,
1056
+ "learning_rate": 5.309734513274337e-06,
1057
+ "loss": 0.1882,
1058
+ "step": 175
1059
+ },
1060
+ {
1061
+ "epoch": 2.26,
1062
+ "learning_rate": 5.2212389380530985e-06,
1063
+ "loss": 0.1949,
1064
+ "step": 176
1065
+ },
1066
+ {
1067
+ "epoch": 2.27,
1068
+ "learning_rate": 5.132743362831859e-06,
1069
+ "loss": 0.1932,
1070
+ "step": 177
1071
+ },
1072
+ {
1073
+ "epoch": 2.28,
1074
+ "learning_rate": 5.04424778761062e-06,
1075
+ "loss": 0.1874,
1076
+ "step": 178
1077
+ },
1078
+ {
1079
+ "epoch": 2.29,
1080
+ "learning_rate": 4.955752212389381e-06,
1081
+ "loss": 0.1855,
1082
+ "step": 179
1083
+ },
1084
+ {
1085
+ "epoch": 2.31,
1086
+ "learning_rate": 4.867256637168142e-06,
1087
+ "loss": 0.1982,
1088
+ "step": 180
1089
+ },
1090
+ {
1091
+ "epoch": 2.32,
1092
+ "learning_rate": 4.778761061946903e-06,
1093
+ "loss": 0.1927,
1094
+ "step": 181
1095
+ },
1096
+ {
1097
+ "epoch": 2.33,
1098
+ "learning_rate": 4.690265486725664e-06,
1099
+ "loss": 0.2008,
1100
+ "step": 182
1101
+ },
1102
+ {
1103
+ "epoch": 2.35,
1104
+ "learning_rate": 4.6017699115044254e-06,
1105
+ "loss": 0.2016,
1106
+ "step": 183
1107
+ },
1108
+ {
1109
+ "epoch": 2.36,
1110
+ "learning_rate": 4.513274336283186e-06,
1111
+ "loss": 0.2026,
1112
+ "step": 184
1113
+ },
1114
+ {
1115
+ "epoch": 2.37,
1116
+ "learning_rate": 4.424778761061948e-06,
1117
+ "loss": 0.1817,
1118
+ "step": 185
1119
+ },
1120
+ {
1121
+ "epoch": 2.38,
1122
+ "learning_rate": 4.336283185840709e-06,
1123
+ "loss": 0.1809,
1124
+ "step": 186
1125
+ },
1126
+ {
1127
+ "epoch": 2.4,
1128
+ "learning_rate": 4.247787610619469e-06,
1129
+ "loss": 0.1942,
1130
+ "step": 187
1131
+ },
1132
+ {
1133
+ "epoch": 2.41,
1134
+ "learning_rate": 4.15929203539823e-06,
1135
+ "loss": 0.1849,
1136
+ "step": 188
1137
+ },
1138
+ {
1139
+ "epoch": 2.42,
1140
+ "learning_rate": 4.070796460176992e-06,
1141
+ "loss": 0.1933,
1142
+ "step": 189
1143
+ },
1144
+ {
1145
+ "epoch": 2.44,
1146
+ "learning_rate": 3.982300884955752e-06,
1147
+ "loss": 0.189,
1148
+ "step": 190
1149
+ },
1150
+ {
1151
+ "epoch": 2.45,
1152
+ "learning_rate": 3.8938053097345135e-06,
1153
+ "loss": 0.1914,
1154
+ "step": 191
1155
+ },
1156
+ {
1157
+ "epoch": 2.46,
1158
+ "learning_rate": 3.8053097345132746e-06,
1159
+ "loss": 0.2014,
1160
+ "step": 192
1161
+ },
1162
+ {
1163
+ "epoch": 2.47,
1164
+ "learning_rate": 3.7168141592920357e-06,
1165
+ "loss": 0.1784,
1166
+ "step": 193
1167
+ },
1168
+ {
1169
+ "epoch": 2.49,
1170
+ "learning_rate": 3.628318584070797e-06,
1171
+ "loss": 0.1835,
1172
+ "step": 194
1173
+ },
1174
+ {
1175
+ "epoch": 2.5,
1176
+ "learning_rate": 3.539823008849558e-06,
1177
+ "loss": 0.1961,
1178
+ "step": 195
1179
+ },
1180
+ {
1181
+ "epoch": 2.51,
1182
+ "learning_rate": 3.4513274336283186e-06,
1183
+ "loss": 0.1843,
1184
+ "step": 196
1185
+ },
1186
+ {
1187
+ "epoch": 2.52,
1188
+ "learning_rate": 3.36283185840708e-06,
1189
+ "loss": 0.1688,
1190
+ "step": 197
1191
+ },
1192
+ {
1193
+ "epoch": 2.54,
1194
+ "learning_rate": 3.274336283185841e-06,
1195
+ "loss": 0.1861,
1196
+ "step": 198
1197
+ },
1198
+ {
1199
+ "epoch": 2.55,
1200
+ "learning_rate": 3.185840707964602e-06,
1201
+ "loss": 0.1757,
1202
+ "step": 199
1203
+ },
1204
+ {
1205
+ "epoch": 2.56,
1206
+ "learning_rate": 3.097345132743363e-06,
1207
+ "loss": 0.1934,
1208
+ "step": 200
1209
+ },
1210
+ {
1211
+ "epoch": 2.58,
1212
+ "learning_rate": 3.0088495575221242e-06,
1213
+ "loss": 0.1946,
1214
+ "step": 201
1215
+ },
1216
+ {
1217
+ "epoch": 2.59,
1218
+ "learning_rate": 2.9203539823008853e-06,
1219
+ "loss": 0.1836,
1220
+ "step": 202
1221
+ },
1222
+ {
1223
+ "epoch": 2.6,
1224
+ "learning_rate": 2.831858407079646e-06,
1225
+ "loss": 0.1891,
1226
+ "step": 203
1227
+ },
1228
+ {
1229
+ "epoch": 2.61,
1230
+ "learning_rate": 2.743362831858407e-06,
1231
+ "loss": 0.1825,
1232
+ "step": 204
1233
+ },
1234
+ {
1235
+ "epoch": 2.63,
1236
+ "learning_rate": 2.6548672566371687e-06,
1237
+ "loss": 0.1862,
1238
+ "step": 205
1239
+ },
1240
+ {
1241
+ "epoch": 2.64,
1242
+ "learning_rate": 2.5663716814159294e-06,
1243
+ "loss": 0.1921,
1244
+ "step": 206
1245
+ },
1246
+ {
1247
+ "epoch": 2.65,
1248
+ "learning_rate": 2.4778761061946905e-06,
1249
+ "loss": 0.192,
1250
+ "step": 207
1251
+ },
1252
+ {
1253
+ "epoch": 2.67,
1254
+ "learning_rate": 2.3893805309734516e-06,
1255
+ "loss": 0.1883,
1256
+ "step": 208
1257
+ },
1258
+ {
1259
+ "epoch": 2.68,
1260
+ "learning_rate": 2.3008849557522127e-06,
1261
+ "loss": 0.1726,
1262
+ "step": 209
1263
+ },
1264
+ {
1265
+ "epoch": 2.69,
1266
+ "learning_rate": 2.212389380530974e-06,
1267
+ "loss": 0.189,
1268
+ "step": 210
1269
+ },
1270
+ {
1271
+ "epoch": 2.7,
1272
+ "learning_rate": 2.1238938053097345e-06,
1273
+ "loss": 0.1882,
1274
+ "step": 211
1275
+ },
1276
+ {
1277
+ "epoch": 2.72,
1278
+ "learning_rate": 2.035398230088496e-06,
1279
+ "loss": 0.1927,
1280
+ "step": 212
1281
+ },
1282
+ {
1283
+ "epoch": 2.73,
1284
+ "learning_rate": 1.9469026548672567e-06,
1285
+ "loss": 0.193,
1286
+ "step": 213
1287
+ },
1288
+ {
1289
+ "epoch": 2.74,
1290
+ "learning_rate": 1.8584070796460179e-06,
1291
+ "loss": 0.1785,
1292
+ "step": 214
1293
+ },
1294
+ {
1295
+ "epoch": 2.76,
1296
+ "learning_rate": 1.769911504424779e-06,
1297
+ "loss": 0.1867,
1298
+ "step": 215
1299
+ },
1300
+ {
1301
+ "epoch": 2.77,
1302
+ "learning_rate": 1.68141592920354e-06,
1303
+ "loss": 0.1893,
1304
+ "step": 216
1305
+ },
1306
+ {
1307
+ "epoch": 2.78,
1308
+ "learning_rate": 1.592920353982301e-06,
1309
+ "loss": 0.1937,
1310
+ "step": 217
1311
+ },
1312
+ {
1313
+ "epoch": 2.79,
1314
+ "learning_rate": 1.5044247787610621e-06,
1315
+ "loss": 0.1797,
1316
+ "step": 218
1317
+ },
1318
+ {
1319
+ "epoch": 2.81,
1320
+ "learning_rate": 1.415929203539823e-06,
1321
+ "loss": 0.187,
1322
+ "step": 219
1323
+ },
1324
+ {
1325
+ "epoch": 2.82,
1326
+ "learning_rate": 1.3274336283185843e-06,
1327
+ "loss": 0.1785,
1328
+ "step": 220
1329
+ },
1330
+ {
1331
+ "epoch": 2.83,
1332
+ "learning_rate": 1.2389380530973452e-06,
1333
+ "loss": 0.1759,
1334
+ "step": 221
1335
+ },
1336
+ {
1337
+ "epoch": 2.84,
1338
+ "learning_rate": 1.1504424778761064e-06,
1339
+ "loss": 0.1886,
1340
+ "step": 222
1341
+ },
1342
+ {
1343
+ "epoch": 2.86,
1344
+ "learning_rate": 1.0619469026548673e-06,
1345
+ "loss": 0.1737,
1346
+ "step": 223
1347
+ },
1348
+ {
1349
+ "epoch": 2.87,
1350
+ "learning_rate": 9.734513274336284e-07,
1351
+ "loss": 0.1817,
1352
+ "step": 224
1353
+ },
1354
+ {
1355
+ "epoch": 2.88,
1356
+ "learning_rate": 8.849557522123895e-07,
1357
+ "loss": 0.1955,
1358
+ "step": 225
1359
+ },
1360
+ {
1361
+ "epoch": 2.9,
1362
+ "learning_rate": 7.964601769911505e-07,
1363
+ "loss": 0.1836,
1364
+ "step": 226
1365
+ },
1366
+ {
1367
+ "epoch": 2.91,
1368
+ "learning_rate": 7.079646017699115e-07,
1369
+ "loss": 0.1815,
1370
+ "step": 227
1371
+ },
1372
+ {
1373
+ "epoch": 2.92,
1374
+ "learning_rate": 6.194690265486726e-07,
1375
+ "loss": 0.1889,
1376
+ "step": 228
1377
+ },
1378
+ {
1379
+ "epoch": 2.93,
1380
+ "learning_rate": 5.309734513274336e-07,
1381
+ "loss": 0.1777,
1382
+ "step": 229
1383
+ },
1384
+ {
1385
+ "epoch": 2.95,
1386
+ "learning_rate": 4.4247787610619474e-07,
1387
+ "loss": 0.1763,
1388
+ "step": 230
1389
+ },
1390
+ {
1391
+ "epoch": 2.96,
1392
+ "learning_rate": 3.5398230088495575e-07,
1393
+ "loss": 0.1764,
1394
+ "step": 231
1395
+ },
1396
+ {
1397
+ "epoch": 2.97,
1398
+ "learning_rate": 2.654867256637168e-07,
1399
+ "loss": 0.1984,
1400
+ "step": 232
1401
+ },
1402
+ {
1403
+ "epoch": 2.99,
1404
+ "learning_rate": 1.7699115044247788e-07,
1405
+ "loss": 0.1937,
1406
+ "step": 233
1407
+ },
1408
+ {
1409
+ "epoch": 3.0,
1410
+ "learning_rate": 8.849557522123894e-08,
1411
+ "loss": 0.1798,
1412
+ "step": 234
1413
+ },
1414
+ {
1415
+ "epoch": 3.0,
1416
+ "step": 234,
1417
+ "total_flos": 13371387494400.0,
1418
+ "train_loss": 0.3646234936184353,
1419
+ "train_runtime": 3952.8658,
1420
+ "train_samples_per_second": 7.589,
1421
+ "train_steps_per_second": 0.059
1422
+ }
1423
+ ],
1424
+ "max_steps": 234,
1425
+ "num_train_epochs": 3,
1426
+ "total_flos": 13371387494400.0,
1427
+ "trial_name": null,
1428
+ "trial_params": null
1429
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bfb5e3e1be86383d751db93e294c38999cb0a4be334fcf0d79e0af3c5a7de986
3
+ size 5051
zero_to_fp32.py ADDED
@@ -0,0 +1,483 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ '''Copyright The Microsoft DeepSpeed Team'''
3
+
4
+ # This script extracts fp32 consolidated weights from a zero 2 and 3 DeepSpeed checkpoints. It gets
5
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
6
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
7
+ # application.
8
+ #
9
+ # example: python zero_to_fp32.py . pytorch_model.bin
10
+
11
+ import argparse
12
+ import torch
13
+ import glob
14
+ import math
15
+ import os
16
+ import re
17
+ from collections import OrderedDict
18
+
19
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
20
+ # DeepSpeed data structures it has to be available in the current python environment.
21
+ from deepspeed.utils import logger
22
+ from deepspeed.checkpoint.constants import (DS_VERSION,
23
+ OPTIMIZER_STATE_DICT,
24
+ SINGLE_PARTITION_OF_FP32_GROUPS,
25
+ FP32_FLAT_GROUPS,
26
+ ZERO_STAGE,
27
+ PARTITION_COUNT,
28
+ PARAM_SHAPES,
29
+ BUFFER_NAMES)
30
+
31
+ debug = 0
32
+
33
+ # load to cpu
34
+ device = torch.device('cpu')
35
+
36
+
37
+ def atoi(text):
38
+ return int(text) if text.isdigit() else text
39
+
40
+
41
+ def natural_keys(text):
42
+ '''
43
+ alist.sort(key=natural_keys) sorts in human order
44
+ http://nedbatchelder.com/blog/200712/human_sorting.html
45
+ (See Toothy's implementation in the comments)
46
+ '''
47
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
48
+
49
+
50
+ def get_model_state_file(checkpoint_dir, zero_stage):
51
+ if not os.path.isdir(checkpoint_dir):
52
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
53
+
54
+ # there should be only one file
55
+ if zero_stage == 2:
56
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
57
+ elif zero_stage == 3:
58
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
59
+
60
+ if not os.path.exists(file):
61
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
62
+
63
+ return file
64
+
65
+
66
+ def get_optim_files(checkpoint_dir):
67
+ # XXX: need to test that this simple glob rule works for multi-node setup too
68
+ optim_files = sorted(glob.glob(os.path.join(checkpoint_dir,
69
+ "*_optim_states.pt")),
70
+ key=natural_keys)
71
+
72
+ if len(optim_files) == 0:
73
+ raise FileNotFoundError(
74
+ f"can't find '*_optim_states.pt' files in directory '{checkpoint_dir}'")
75
+
76
+ return optim_files
77
+
78
+
79
+ def parse_model_state(file):
80
+ state_dict = torch.load(file, map_location=device)
81
+
82
+ if BUFFER_NAMES not in state_dict:
83
+ raise ValueError(f"{file} is not a model state checkpoint")
84
+ buffer_names = state_dict[BUFFER_NAMES]
85
+ if debug:
86
+ print("Found buffers:", buffer_names)
87
+
88
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
89
+ buffers = {
90
+ k: v.float()
91
+ for k,
92
+ v in state_dict["module"].items() if k in buffer_names
93
+ }
94
+ param_shapes = state_dict[PARAM_SHAPES]
95
+
96
+ ds_version = state_dict.get(DS_VERSION, None)
97
+
98
+ return buffers, param_shapes, ds_version
99
+
100
+
101
+ def parse_optim_states(files, ds_checkpoint_dir):
102
+
103
+ total_files = len(files)
104
+ state_dicts = []
105
+ for f in files:
106
+ state_dicts.append(torch.load(f, map_location=device))
107
+
108
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
109
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
110
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
111
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
112
+
113
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
114
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
115
+ # use the max of the partition_count to get the dp world_size.
116
+
117
+ if type(world_size) is list:
118
+ world_size = max(world_size)
119
+
120
+ if world_size != total_files:
121
+ raise ValueError(
122
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
123
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
124
+ )
125
+
126
+ # the groups are named differently in each stage
127
+ if zero_stage == 2:
128
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
129
+ elif zero_stage == 3:
130
+ fp32_groups_key = FP32_FLAT_GROUPS
131
+ else:
132
+ raise ValueError(f"unknown zero stage {zero_stage}")
133
+
134
+ if zero_stage == 2:
135
+ fp32_flat_groups = [
136
+ state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key]
137
+ for i in range(len(state_dicts))
138
+ ]
139
+ elif zero_stage == 3:
140
+ # if there is more than one param group, there will be multiple flattened tensors - one
141
+ # flattened tensor per group - for simplicity merge them into a single tensor
142
+ #
143
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
144
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
145
+
146
+ fp32_flat_groups = [
147
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key],
148
+ 0) for i in range(len(state_dicts))
149
+ ]
150
+
151
+ return zero_stage, world_size, fp32_flat_groups
152
+
153
+
154
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir):
155
+ """
156
+ Returns fp32 state_dict reconstructed from ds checkpoint
157
+
158
+ Args:
159
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
160
+
161
+ """
162
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
163
+
164
+ optim_files = get_optim_files(ds_checkpoint_dir)
165
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
166
+ print(
167
+ f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
168
+
169
+ model_file = get_model_state_file(ds_checkpoint_dir, zero_stage)
170
+ buffers, param_shapes, ds_version = parse_model_state(model_file)
171
+ print(f'Parsing checkpoint created by deepspeed=={ds_version}')
172
+
173
+ if zero_stage == 2:
174
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size,
175
+ param_shapes,
176
+ fp32_flat_groups,
177
+ buffers)
178
+ elif zero_stage == 3:
179
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size,
180
+ param_shapes,
181
+ fp32_flat_groups,
182
+ buffers)
183
+
184
+
185
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size,
186
+ param_shapes,
187
+ fp32_flat_groups,
188
+ buffers):
189
+
190
+ # Reconstruction protocol:
191
+ #
192
+ # XXX: document this
193
+
194
+ if debug:
195
+ for i in range(world_size):
196
+ for j in range(len(fp32_flat_groups[0])):
197
+ print(
198
+ f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
199
+
200
+ # XXX: memory usage doubles here (zero2)
201
+ num_param_groups = len(fp32_flat_groups[0])
202
+ merged_single_partition_of_fp32_groups = []
203
+ for i in range(num_param_groups):
204
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
205
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
206
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
207
+ avail_numel = sum([
208
+ full_single_fp32_vector.numel()
209
+ for full_single_fp32_vector in merged_single_partition_of_fp32_groups
210
+ ])
211
+
212
+ if debug:
213
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
214
+ wanted_numel = sum(
215
+ [sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
216
+ # not asserting if there is a mismatch due to possible padding
217
+ print(f"Have {avail_numel} numels to process.")
218
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
219
+
220
+ state_dict = OrderedDict()
221
+
222
+ # buffers
223
+ state_dict.update(buffers)
224
+ if debug:
225
+ print(f"added {len(buffers)} buffers")
226
+
227
+ # params
228
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
229
+ # out-of-core computing solution
230
+ total_numel = 0
231
+ total_params = 0
232
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
233
+ offset = 0
234
+ avail_numel = full_single_fp32_vector.numel()
235
+ for name, shape in shapes.items():
236
+
237
+ unpartitioned_numel = shape.numel()
238
+ total_numel += unpartitioned_numel
239
+ total_params += 1
240
+
241
+ if debug:
242
+ print(
243
+ f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} "
244
+ )
245
+ state_dict[name] = full_single_fp32_vector.narrow(
246
+ 0,
247
+ offset,
248
+ unpartitioned_numel).view(shape)
249
+ offset += unpartitioned_numel
250
+
251
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
252
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
253
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
254
+ # live optimizer object, so we are checking that the numbers are within the right range
255
+ align_to = 2 * world_size
256
+
257
+ def zero2_align(x):
258
+ return align_to * math.ceil(x / align_to)
259
+
260
+ if debug:
261
+ print(f"original offset={offset}, avail_numel={avail_numel}")
262
+
263
+ offset = zero2_align(offset)
264
+ avail_numel = zero2_align(avail_numel)
265
+
266
+ if debug:
267
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
268
+
269
+ # Sanity check
270
+ if offset != avail_numel:
271
+ raise ValueError(
272
+ f"consumed {offset} numels out of {avail_numel} - something is wrong")
273
+
274
+ print(
275
+ f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements"
276
+ )
277
+
278
+ return state_dict
279
+
280
+
281
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
282
+ remainder = unpartitioned_numel % world_size
283
+ padding_numel = (world_size - remainder) if remainder else 0
284
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
285
+ return partitioned_numel, padding_numel
286
+
287
+
288
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size,
289
+ param_shapes,
290
+ fp32_flat_groups,
291
+ buffers):
292
+
293
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
294
+ # param, re-consolidating each param, while dealing with padding if any
295
+
296
+ avail_numel = fp32_flat_groups[0].numel() * world_size
297
+ # merge list of dicts, preserving order
298
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
299
+
300
+ if debug:
301
+ for i in range(world_size):
302
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
303
+
304
+ wanted_params = len(param_shapes)
305
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
306
+ # not asserting if there is a mismatch due to possible padding
307
+ print(f"Have {avail_numel} numels to process.")
308
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
309
+
310
+ state_dict = OrderedDict()
311
+
312
+ # buffers
313
+ state_dict.update(buffers)
314
+ if debug:
315
+ print(f"added {len(buffers)} buffers")
316
+
317
+ # params
318
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
319
+ # out-of-core computing solution
320
+ offset = 0
321
+ total_numel = 0
322
+ total_params = 0
323
+ for name, shape in param_shapes.items():
324
+
325
+ unpartitioned_numel = shape.numel()
326
+ total_numel += unpartitioned_numel
327
+ total_params += 1
328
+
329
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
330
+
331
+ if debug:
332
+ print(
333
+ f"{total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
334
+ )
335
+
336
+ # XXX: memory usage doubles here
337
+ state_dict[name] = torch.cat(
338
+ tuple(fp32_flat_groups[i].narrow(0,
339
+ offset,
340
+ partitioned_numel)
341
+ for i in range(world_size)),
342
+ 0).narrow(0,
343
+ 0,
344
+ unpartitioned_numel).view(shape)
345
+ offset += partitioned_numel
346
+
347
+ offset *= world_size
348
+
349
+ # Sanity check
350
+ if offset != avail_numel:
351
+ raise ValueError(
352
+ f"consumed {offset} numels out of {avail_numel} - something is wrong")
353
+
354
+ print(
355
+ f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements"
356
+ )
357
+
358
+ return state_dict
359
+
360
+
361
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None):
362
+ """
363
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
364
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
365
+ via a model hub.
366
+
367
+ Args:
368
+ - ``checkpoint_dir``: path to the desired checkpoint folder
369
+ - ``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``
370
+
371
+ Returns:
372
+ - pytorch ``state_dict``
373
+
374
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
375
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
376
+ the checkpoint.
377
+
378
+ A typical usage might be ::
379
+
380
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
381
+ # do the training and checkpoint saving
382
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
383
+ model = model.cpu() # move to cpu
384
+ model.load_state_dict(state_dict)
385
+ # submit to model hub or save the model to share with others
386
+
387
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
388
+ application. i.e. you will need to re-initialize the deepspeed engine, since
389
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
390
+
391
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
392
+
393
+ """
394
+ if tag is None:
395
+ latest_path = os.path.join(checkpoint_dir, 'latest')
396
+ if os.path.isfile(latest_path):
397
+ with open(latest_path, 'r') as fd:
398
+ tag = fd.read().strip()
399
+ else:
400
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
401
+
402
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
403
+
404
+ if not os.path.isdir(ds_checkpoint_dir):
405
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
406
+
407
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir)
408
+
409
+
410
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None):
411
+ """
412
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
413
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
414
+
415
+ Args:
416
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
417
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
418
+ - ``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``
419
+ """
420
+
421
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
422
+ print(f"Saving fp32 state dict to {output_file}")
423
+ torch.save(state_dict, output_file)
424
+
425
+
426
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
427
+ """
428
+ 1. Put the provided model to cpu
429
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
430
+ 3. Load it into the provided model
431
+
432
+ Args:
433
+ - ``model``: the model object to update
434
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
435
+ - ``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``
436
+
437
+ Returns:
438
+ - ``model`: modified model
439
+
440
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
441
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
442
+ conveniently placed for you in the checkpoint folder.
443
+
444
+ A typical usage might be ::
445
+
446
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
447
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
448
+ # submit to model hub or save the model to share with others
449
+
450
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
451
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
452
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
453
+
454
+ """
455
+ logger.info(f"Extracting fp32 weights")
456
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
457
+
458
+ logger.info(f"Overwriting model with fp32 weights")
459
+ model = model.cpu()
460
+ model.load_state_dict(state_dict, strict=False)
461
+
462
+ return model
463
+
464
+
465
+ if __name__ == "__main__":
466
+
467
+ parser = argparse.ArgumentParser()
468
+ parser.add_argument(
469
+ "checkpoint_dir",
470
+ type=str,
471
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
472
+ parser.add_argument(
473
+ "output_file",
474
+ type=str,
475
+ help=
476
+ "path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)"
477
+ )
478
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
479
+ args = parser.parse_args()
480
+
481
+ debug = args.debug
482
+
483
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir, args.output_file)