pszemraj commited on
Commit
3c5a4f3
·
1 Parent(s): 4c72f60

load model from drive and convert

Browse files
Files changed (8) hide show
  1. .gitignore +1 -0
  2. config.json +34 -0
  3. latest +1 -0
  4. pytorch_model.bin +3 -0
  5. rng_state_0.pth +3 -0
  6. trainer_state.json +1498 -0
  7. training_args.bin +3 -0
  8. zero_to_fp32.py +484 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ checkpoint-*/
config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "pszemraj/mGPT-Peter-mwe",
3
+ "activation_function": "gelu_new",
4
+ "architectures": [
5
+ "GPT2LMHeadModel"
6
+ ],
7
+ "attn_pdrop": 0.1,
8
+ "bos_token_id": 50256,
9
+ "embd_pdrop": 0.1,
10
+ "eos_token_id": 50256,
11
+ "gradient_checkpointing": false,
12
+ "initializer_range": 0.02,
13
+ "layer_norm_epsilon": 1e-05,
14
+ "model_type": "gpt2",
15
+ "n_ctx": 2048,
16
+ "n_embd": 2048,
17
+ "n_head": 16,
18
+ "n_inner": null,
19
+ "n_layer": 24,
20
+ "n_positions": 2048,
21
+ "reorder_and_upcast_attn": false,
22
+ "resid_pdrop": 0.1,
23
+ "scale_attn_by_inverse_layer_idx": false,
24
+ "scale_attn_weights": true,
25
+ "summary_activation": null,
26
+ "summary_first_dropout": 0.1,
27
+ "summary_proj_to_labels": true,
28
+ "summary_type": "cls_index",
29
+ "summary_use_proj": true,
30
+ "torch_dtype": "float32",
31
+ "transformers_version": "4.18.0",
32
+ "use_cache": false,
33
+ "vocab_size": 100000
34
+ }
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step1235
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f00f7d1d6f23d45d69168a4cfe11d10ed0fa62feb2d9e86438edec9a982fe870
3
+ size 6073088630
rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:492c774094be36f42d831fd3f641aea7ce6f60f0a7c71492c1b79d5d5cf9f21b
3
+ size 14503
trainer_state.json ADDED
@@ -0,0 +1,1498 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.9993425378040762,
5
+ "global_step": 1235,
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.0,
12
+ "learning_rate": 2e-05,
13
+ "loss": 2.5625,
14
+ "step": 5
15
+ },
16
+ {
17
+ "epoch": 0.01,
18
+ "learning_rate": 2e-05,
19
+ "loss": 2.5563,
20
+ "step": 10
21
+ },
22
+ {
23
+ "epoch": 0.01,
24
+ "learning_rate": 2e-05,
25
+ "loss": 2.4244,
26
+ "step": 15
27
+ },
28
+ {
29
+ "epoch": 0.02,
30
+ "learning_rate": 2e-05,
31
+ "loss": 2.4346,
32
+ "step": 20
33
+ },
34
+ {
35
+ "epoch": 0.02,
36
+ "learning_rate": 2e-05,
37
+ "loss": 2.3772,
38
+ "step": 25
39
+ },
40
+ {
41
+ "epoch": 0.02,
42
+ "learning_rate": 2e-05,
43
+ "loss": 2.3381,
44
+ "step": 30
45
+ },
46
+ {
47
+ "epoch": 0.03,
48
+ "learning_rate": 2e-05,
49
+ "loss": 2.3317,
50
+ "step": 35
51
+ },
52
+ {
53
+ "epoch": 0.03,
54
+ "learning_rate": 2e-05,
55
+ "loss": 2.3854,
56
+ "step": 40
57
+ },
58
+ {
59
+ "epoch": 0.04,
60
+ "learning_rate": 2e-05,
61
+ "loss": 2.1806,
62
+ "step": 45
63
+ },
64
+ {
65
+ "epoch": 0.04,
66
+ "learning_rate": 2e-05,
67
+ "loss": 2.2056,
68
+ "step": 50
69
+ },
70
+ {
71
+ "epoch": 0.04,
72
+ "learning_rate": 2e-05,
73
+ "loss": 2.314,
74
+ "step": 55
75
+ },
76
+ {
77
+ "epoch": 0.05,
78
+ "learning_rate": 2e-05,
79
+ "loss": 2.1725,
80
+ "step": 60
81
+ },
82
+ {
83
+ "epoch": 0.05,
84
+ "learning_rate": 2e-05,
85
+ "loss": 2.2587,
86
+ "step": 65
87
+ },
88
+ {
89
+ "epoch": 0.06,
90
+ "learning_rate": 2e-05,
91
+ "loss": 2.2467,
92
+ "step": 70
93
+ },
94
+ {
95
+ "epoch": 0.06,
96
+ "learning_rate": 2e-05,
97
+ "loss": 2.2023,
98
+ "step": 75
99
+ },
100
+ {
101
+ "epoch": 0.06,
102
+ "learning_rate": 2e-05,
103
+ "loss": 2.2455,
104
+ "step": 80
105
+ },
106
+ {
107
+ "epoch": 0.07,
108
+ "learning_rate": 2e-05,
109
+ "loss": 2.1647,
110
+ "step": 85
111
+ },
112
+ {
113
+ "epoch": 0.07,
114
+ "learning_rate": 2e-05,
115
+ "loss": 2.2335,
116
+ "step": 90
117
+ },
118
+ {
119
+ "epoch": 0.08,
120
+ "learning_rate": 2e-05,
121
+ "loss": 2.1529,
122
+ "step": 95
123
+ },
124
+ {
125
+ "epoch": 0.08,
126
+ "learning_rate": 2e-05,
127
+ "loss": 2.1256,
128
+ "step": 100
129
+ },
130
+ {
131
+ "epoch": 0.08,
132
+ "learning_rate": 2e-05,
133
+ "loss": 2.1475,
134
+ "step": 105
135
+ },
136
+ {
137
+ "epoch": 0.09,
138
+ "learning_rate": 2e-05,
139
+ "loss": 2.0954,
140
+ "step": 110
141
+ },
142
+ {
143
+ "epoch": 0.09,
144
+ "learning_rate": 2e-05,
145
+ "loss": 2.1259,
146
+ "step": 115
147
+ },
148
+ {
149
+ "epoch": 0.1,
150
+ "learning_rate": 2e-05,
151
+ "loss": 2.0918,
152
+ "step": 120
153
+ },
154
+ {
155
+ "epoch": 0.1,
156
+ "learning_rate": 2e-05,
157
+ "loss": 2.1516,
158
+ "step": 125
159
+ },
160
+ {
161
+ "epoch": 0.11,
162
+ "learning_rate": 2e-05,
163
+ "loss": 2.117,
164
+ "step": 130
165
+ },
166
+ {
167
+ "epoch": 0.11,
168
+ "learning_rate": 2e-05,
169
+ "loss": 2.0805,
170
+ "step": 135
171
+ },
172
+ {
173
+ "epoch": 0.11,
174
+ "learning_rate": 2e-05,
175
+ "loss": 2.1526,
176
+ "step": 140
177
+ },
178
+ {
179
+ "epoch": 0.12,
180
+ "learning_rate": 2e-05,
181
+ "loss": 2.1309,
182
+ "step": 145
183
+ },
184
+ {
185
+ "epoch": 0.12,
186
+ "learning_rate": 2e-05,
187
+ "loss": 2.0483,
188
+ "step": 150
189
+ },
190
+ {
191
+ "epoch": 0.13,
192
+ "learning_rate": 2e-05,
193
+ "loss": 2.0181,
194
+ "step": 155
195
+ },
196
+ {
197
+ "epoch": 0.13,
198
+ "learning_rate": 2e-05,
199
+ "loss": 2.1135,
200
+ "step": 160
201
+ },
202
+ {
203
+ "epoch": 0.13,
204
+ "learning_rate": 2e-05,
205
+ "loss": 2.1093,
206
+ "step": 165
207
+ },
208
+ {
209
+ "epoch": 0.14,
210
+ "learning_rate": 2e-05,
211
+ "loss": 2.2676,
212
+ "step": 170
213
+ },
214
+ {
215
+ "epoch": 0.14,
216
+ "learning_rate": 2e-05,
217
+ "loss": 1.938,
218
+ "step": 175
219
+ },
220
+ {
221
+ "epoch": 0.15,
222
+ "learning_rate": 2e-05,
223
+ "loss": 2.039,
224
+ "step": 180
225
+ },
226
+ {
227
+ "epoch": 0.15,
228
+ "learning_rate": 2e-05,
229
+ "loss": 2.048,
230
+ "step": 185
231
+ },
232
+ {
233
+ "epoch": 0.15,
234
+ "learning_rate": 2e-05,
235
+ "loss": 2.082,
236
+ "step": 190
237
+ },
238
+ {
239
+ "epoch": 0.16,
240
+ "learning_rate": 2e-05,
241
+ "loss": 2.0175,
242
+ "step": 195
243
+ },
244
+ {
245
+ "epoch": 0.16,
246
+ "learning_rate": 2e-05,
247
+ "loss": 2.1113,
248
+ "step": 200
249
+ },
250
+ {
251
+ "epoch": 0.17,
252
+ "learning_rate": 2e-05,
253
+ "loss": 2.0146,
254
+ "step": 205
255
+ },
256
+ {
257
+ "epoch": 0.17,
258
+ "learning_rate": 2e-05,
259
+ "loss": 2.0577,
260
+ "step": 210
261
+ },
262
+ {
263
+ "epoch": 0.17,
264
+ "learning_rate": 2e-05,
265
+ "loss": 1.954,
266
+ "step": 215
267
+ },
268
+ {
269
+ "epoch": 0.18,
270
+ "learning_rate": 2e-05,
271
+ "loss": 1.9996,
272
+ "step": 220
273
+ },
274
+ {
275
+ "epoch": 0.18,
276
+ "learning_rate": 2e-05,
277
+ "loss": 1.9537,
278
+ "step": 225
279
+ },
280
+ {
281
+ "epoch": 0.19,
282
+ "learning_rate": 2e-05,
283
+ "loss": 1.9284,
284
+ "step": 230
285
+ },
286
+ {
287
+ "epoch": 0.19,
288
+ "learning_rate": 2e-05,
289
+ "loss": 2.1234,
290
+ "step": 235
291
+ },
292
+ {
293
+ "epoch": 0.19,
294
+ "learning_rate": 2e-05,
295
+ "loss": 2.0763,
296
+ "step": 240
297
+ },
298
+ {
299
+ "epoch": 0.2,
300
+ "learning_rate": 2e-05,
301
+ "loss": 2.1654,
302
+ "step": 245
303
+ },
304
+ {
305
+ "epoch": 0.2,
306
+ "learning_rate": 2e-05,
307
+ "loss": 1.9704,
308
+ "step": 250
309
+ },
310
+ {
311
+ "epoch": 0.21,
312
+ "learning_rate": 2e-05,
313
+ "loss": 1.9391,
314
+ "step": 255
315
+ },
316
+ {
317
+ "epoch": 0.21,
318
+ "learning_rate": 2e-05,
319
+ "loss": 1.9187,
320
+ "step": 260
321
+ },
322
+ {
323
+ "epoch": 0.21,
324
+ "learning_rate": 2e-05,
325
+ "loss": 1.9767,
326
+ "step": 265
327
+ },
328
+ {
329
+ "epoch": 0.22,
330
+ "learning_rate": 2e-05,
331
+ "loss": 1.9845,
332
+ "step": 270
333
+ },
334
+ {
335
+ "epoch": 0.22,
336
+ "learning_rate": 2e-05,
337
+ "loss": 1.9118,
338
+ "step": 275
339
+ },
340
+ {
341
+ "epoch": 0.23,
342
+ "learning_rate": 2e-05,
343
+ "loss": 1.9757,
344
+ "step": 280
345
+ },
346
+ {
347
+ "epoch": 0.23,
348
+ "learning_rate": 2e-05,
349
+ "loss": 2.0186,
350
+ "step": 285
351
+ },
352
+ {
353
+ "epoch": 0.23,
354
+ "learning_rate": 2e-05,
355
+ "loss": 1.9451,
356
+ "step": 290
357
+ },
358
+ {
359
+ "epoch": 0.24,
360
+ "learning_rate": 2e-05,
361
+ "loss": 1.9661,
362
+ "step": 295
363
+ },
364
+ {
365
+ "epoch": 0.24,
366
+ "learning_rate": 2e-05,
367
+ "loss": 1.9473,
368
+ "step": 300
369
+ },
370
+ {
371
+ "epoch": 0.25,
372
+ "learning_rate": 2e-05,
373
+ "loss": 1.9502,
374
+ "step": 305
375
+ },
376
+ {
377
+ "epoch": 0.25,
378
+ "learning_rate": 2e-05,
379
+ "loss": 1.9148,
380
+ "step": 310
381
+ },
382
+ {
383
+ "epoch": 0.25,
384
+ "learning_rate": 2e-05,
385
+ "loss": 1.9381,
386
+ "step": 315
387
+ },
388
+ {
389
+ "epoch": 0.26,
390
+ "learning_rate": 2e-05,
391
+ "loss": 1.9283,
392
+ "step": 320
393
+ },
394
+ {
395
+ "epoch": 0.26,
396
+ "learning_rate": 2e-05,
397
+ "loss": 1.888,
398
+ "step": 325
399
+ },
400
+ {
401
+ "epoch": 0.27,
402
+ "learning_rate": 2e-05,
403
+ "loss": 1.9899,
404
+ "step": 330
405
+ },
406
+ {
407
+ "epoch": 0.27,
408
+ "learning_rate": 2e-05,
409
+ "loss": 1.8954,
410
+ "step": 335
411
+ },
412
+ {
413
+ "epoch": 0.28,
414
+ "learning_rate": 2e-05,
415
+ "loss": 1.8963,
416
+ "step": 340
417
+ },
418
+ {
419
+ "epoch": 0.28,
420
+ "learning_rate": 2e-05,
421
+ "loss": 1.9435,
422
+ "step": 345
423
+ },
424
+ {
425
+ "epoch": 0.28,
426
+ "learning_rate": 2e-05,
427
+ "loss": 1.8642,
428
+ "step": 350
429
+ },
430
+ {
431
+ "epoch": 0.29,
432
+ "learning_rate": 2e-05,
433
+ "loss": 1.8577,
434
+ "step": 355
435
+ },
436
+ {
437
+ "epoch": 0.29,
438
+ "learning_rate": 2e-05,
439
+ "loss": 1.8103,
440
+ "step": 360
441
+ },
442
+ {
443
+ "epoch": 0.3,
444
+ "learning_rate": 2e-05,
445
+ "loss": 1.8264,
446
+ "step": 365
447
+ },
448
+ {
449
+ "epoch": 0.3,
450
+ "learning_rate": 2e-05,
451
+ "loss": 1.9099,
452
+ "step": 370
453
+ },
454
+ {
455
+ "epoch": 0.3,
456
+ "learning_rate": 2e-05,
457
+ "loss": 1.8475,
458
+ "step": 375
459
+ },
460
+ {
461
+ "epoch": 0.31,
462
+ "learning_rate": 2e-05,
463
+ "loss": 1.8834,
464
+ "step": 380
465
+ },
466
+ {
467
+ "epoch": 0.31,
468
+ "learning_rate": 2e-05,
469
+ "loss": 1.8622,
470
+ "step": 385
471
+ },
472
+ {
473
+ "epoch": 0.32,
474
+ "learning_rate": 2e-05,
475
+ "loss": 1.9847,
476
+ "step": 390
477
+ },
478
+ {
479
+ "epoch": 0.32,
480
+ "learning_rate": 2e-05,
481
+ "loss": 1.9528,
482
+ "step": 395
483
+ },
484
+ {
485
+ "epoch": 0.32,
486
+ "learning_rate": 2e-05,
487
+ "loss": 1.8633,
488
+ "step": 400
489
+ },
490
+ {
491
+ "epoch": 0.33,
492
+ "learning_rate": 2e-05,
493
+ "loss": 1.9114,
494
+ "step": 405
495
+ },
496
+ {
497
+ "epoch": 0.33,
498
+ "learning_rate": 2e-05,
499
+ "loss": 1.8894,
500
+ "step": 410
501
+ },
502
+ {
503
+ "epoch": 0.34,
504
+ "learning_rate": 2e-05,
505
+ "loss": 1.8457,
506
+ "step": 415
507
+ },
508
+ {
509
+ "epoch": 0.34,
510
+ "learning_rate": 2e-05,
511
+ "loss": 1.8714,
512
+ "step": 420
513
+ },
514
+ {
515
+ "epoch": 0.34,
516
+ "learning_rate": 2e-05,
517
+ "loss": 1.826,
518
+ "step": 425
519
+ },
520
+ {
521
+ "epoch": 0.35,
522
+ "learning_rate": 2e-05,
523
+ "loss": 2.0078,
524
+ "step": 430
525
+ },
526
+ {
527
+ "epoch": 0.35,
528
+ "learning_rate": 2e-05,
529
+ "loss": 1.8291,
530
+ "step": 435
531
+ },
532
+ {
533
+ "epoch": 0.36,
534
+ "learning_rate": 2e-05,
535
+ "loss": 1.74,
536
+ "step": 440
537
+ },
538
+ {
539
+ "epoch": 0.36,
540
+ "learning_rate": 2e-05,
541
+ "loss": 1.9296,
542
+ "step": 445
543
+ },
544
+ {
545
+ "epoch": 0.36,
546
+ "learning_rate": 2e-05,
547
+ "loss": 1.9473,
548
+ "step": 450
549
+ },
550
+ {
551
+ "epoch": 0.37,
552
+ "learning_rate": 2e-05,
553
+ "loss": 1.8385,
554
+ "step": 455
555
+ },
556
+ {
557
+ "epoch": 0.37,
558
+ "learning_rate": 2e-05,
559
+ "loss": 1.791,
560
+ "step": 460
561
+ },
562
+ {
563
+ "epoch": 0.38,
564
+ "learning_rate": 2e-05,
565
+ "loss": 1.8647,
566
+ "step": 465
567
+ },
568
+ {
569
+ "epoch": 0.38,
570
+ "learning_rate": 2e-05,
571
+ "loss": 1.9116,
572
+ "step": 470
573
+ },
574
+ {
575
+ "epoch": 0.38,
576
+ "learning_rate": 2e-05,
577
+ "loss": 1.7981,
578
+ "step": 475
579
+ },
580
+ {
581
+ "epoch": 0.39,
582
+ "learning_rate": 2e-05,
583
+ "loss": 1.8359,
584
+ "step": 480
585
+ },
586
+ {
587
+ "epoch": 0.39,
588
+ "learning_rate": 2e-05,
589
+ "loss": 1.9179,
590
+ "step": 485
591
+ },
592
+ {
593
+ "epoch": 0.4,
594
+ "learning_rate": 2e-05,
595
+ "loss": 1.701,
596
+ "step": 490
597
+ },
598
+ {
599
+ "epoch": 0.4,
600
+ "learning_rate": 2e-05,
601
+ "loss": 1.7887,
602
+ "step": 495
603
+ },
604
+ {
605
+ "epoch": 0.4,
606
+ "learning_rate": 2e-05,
607
+ "loss": 1.8896,
608
+ "step": 500
609
+ },
610
+ {
611
+ "epoch": 0.41,
612
+ "learning_rate": 2e-05,
613
+ "loss": 1.7814,
614
+ "step": 505
615
+ },
616
+ {
617
+ "epoch": 0.41,
618
+ "learning_rate": 2e-05,
619
+ "loss": 1.8209,
620
+ "step": 510
621
+ },
622
+ {
623
+ "epoch": 0.42,
624
+ "learning_rate": 2e-05,
625
+ "loss": 1.8416,
626
+ "step": 515
627
+ },
628
+ {
629
+ "epoch": 0.42,
630
+ "learning_rate": 2e-05,
631
+ "loss": 1.8407,
632
+ "step": 520
633
+ },
634
+ {
635
+ "epoch": 0.42,
636
+ "learning_rate": 2e-05,
637
+ "loss": 1.7528,
638
+ "step": 525
639
+ },
640
+ {
641
+ "epoch": 0.43,
642
+ "learning_rate": 2e-05,
643
+ "loss": 1.7344,
644
+ "step": 530
645
+ },
646
+ {
647
+ "epoch": 0.43,
648
+ "learning_rate": 2e-05,
649
+ "loss": 1.7534,
650
+ "step": 535
651
+ },
652
+ {
653
+ "epoch": 0.44,
654
+ "learning_rate": 2e-05,
655
+ "loss": 1.7573,
656
+ "step": 540
657
+ },
658
+ {
659
+ "epoch": 0.44,
660
+ "learning_rate": 2e-05,
661
+ "loss": 1.7634,
662
+ "step": 545
663
+ },
664
+ {
665
+ "epoch": 0.45,
666
+ "learning_rate": 2e-05,
667
+ "loss": 1.8272,
668
+ "step": 550
669
+ },
670
+ {
671
+ "epoch": 0.45,
672
+ "learning_rate": 2e-05,
673
+ "loss": 1.7401,
674
+ "step": 555
675
+ },
676
+ {
677
+ "epoch": 0.45,
678
+ "learning_rate": 2e-05,
679
+ "loss": 1.6877,
680
+ "step": 560
681
+ },
682
+ {
683
+ "epoch": 0.46,
684
+ "learning_rate": 2e-05,
685
+ "loss": 1.7539,
686
+ "step": 565
687
+ },
688
+ {
689
+ "epoch": 0.46,
690
+ "learning_rate": 2e-05,
691
+ "loss": 1.7215,
692
+ "step": 570
693
+ },
694
+ {
695
+ "epoch": 0.47,
696
+ "learning_rate": 2e-05,
697
+ "loss": 1.7627,
698
+ "step": 575
699
+ },
700
+ {
701
+ "epoch": 0.47,
702
+ "learning_rate": 2e-05,
703
+ "loss": 1.6985,
704
+ "step": 580
705
+ },
706
+ {
707
+ "epoch": 0.47,
708
+ "learning_rate": 2e-05,
709
+ "loss": 1.7537,
710
+ "step": 585
711
+ },
712
+ {
713
+ "epoch": 0.48,
714
+ "learning_rate": 2e-05,
715
+ "loss": 1.8617,
716
+ "step": 590
717
+ },
718
+ {
719
+ "epoch": 0.48,
720
+ "learning_rate": 2e-05,
721
+ "loss": 1.6984,
722
+ "step": 595
723
+ },
724
+ {
725
+ "epoch": 0.49,
726
+ "learning_rate": 2e-05,
727
+ "loss": 1.8526,
728
+ "step": 600
729
+ },
730
+ {
731
+ "epoch": 0.49,
732
+ "learning_rate": 2e-05,
733
+ "loss": 1.6908,
734
+ "step": 605
735
+ },
736
+ {
737
+ "epoch": 0.49,
738
+ "learning_rate": 2e-05,
739
+ "loss": 1.5731,
740
+ "step": 610
741
+ },
742
+ {
743
+ "epoch": 0.5,
744
+ "learning_rate": 2e-05,
745
+ "loss": 1.7283,
746
+ "step": 615
747
+ },
748
+ {
749
+ "epoch": 0.5,
750
+ "learning_rate": 2e-05,
751
+ "loss": 1.7848,
752
+ "step": 620
753
+ },
754
+ {
755
+ "epoch": 0.51,
756
+ "learning_rate": 2e-05,
757
+ "loss": 1.6737,
758
+ "step": 625
759
+ },
760
+ {
761
+ "epoch": 0.51,
762
+ "learning_rate": 2e-05,
763
+ "loss": 1.7305,
764
+ "step": 630
765
+ },
766
+ {
767
+ "epoch": 0.51,
768
+ "learning_rate": 2e-05,
769
+ "loss": 1.7056,
770
+ "step": 635
771
+ },
772
+ {
773
+ "epoch": 0.52,
774
+ "learning_rate": 2e-05,
775
+ "loss": 1.6571,
776
+ "step": 640
777
+ },
778
+ {
779
+ "epoch": 0.52,
780
+ "learning_rate": 2e-05,
781
+ "loss": 1.8254,
782
+ "step": 645
783
+ },
784
+ {
785
+ "epoch": 0.53,
786
+ "learning_rate": 2e-05,
787
+ "loss": 1.7202,
788
+ "step": 650
789
+ },
790
+ {
791
+ "epoch": 0.53,
792
+ "learning_rate": 2e-05,
793
+ "loss": 1.6718,
794
+ "step": 655
795
+ },
796
+ {
797
+ "epoch": 0.53,
798
+ "learning_rate": 2e-05,
799
+ "loss": 1.7311,
800
+ "step": 660
801
+ },
802
+ {
803
+ "epoch": 0.54,
804
+ "learning_rate": 2e-05,
805
+ "loss": 1.7288,
806
+ "step": 665
807
+ },
808
+ {
809
+ "epoch": 0.54,
810
+ "learning_rate": 2e-05,
811
+ "loss": 1.7409,
812
+ "step": 670
813
+ },
814
+ {
815
+ "epoch": 0.55,
816
+ "learning_rate": 2e-05,
817
+ "loss": 1.7236,
818
+ "step": 675
819
+ },
820
+ {
821
+ "epoch": 0.55,
822
+ "learning_rate": 2e-05,
823
+ "loss": 1.6565,
824
+ "step": 680
825
+ },
826
+ {
827
+ "epoch": 0.55,
828
+ "learning_rate": 2e-05,
829
+ "loss": 1.66,
830
+ "step": 685
831
+ },
832
+ {
833
+ "epoch": 0.56,
834
+ "learning_rate": 2e-05,
835
+ "loss": 1.6991,
836
+ "step": 690
837
+ },
838
+ {
839
+ "epoch": 0.56,
840
+ "learning_rate": 2e-05,
841
+ "loss": 1.7188,
842
+ "step": 695
843
+ },
844
+ {
845
+ "epoch": 0.57,
846
+ "learning_rate": 2e-05,
847
+ "loss": 1.5943,
848
+ "step": 700
849
+ },
850
+ {
851
+ "epoch": 0.57,
852
+ "learning_rate": 2e-05,
853
+ "loss": 1.7805,
854
+ "step": 705
855
+ },
856
+ {
857
+ "epoch": 0.57,
858
+ "learning_rate": 2e-05,
859
+ "loss": 1.7366,
860
+ "step": 710
861
+ },
862
+ {
863
+ "epoch": 0.58,
864
+ "learning_rate": 2e-05,
865
+ "loss": 1.6402,
866
+ "step": 715
867
+ },
868
+ {
869
+ "epoch": 0.58,
870
+ "learning_rate": 2e-05,
871
+ "loss": 1.6981,
872
+ "step": 720
873
+ },
874
+ {
875
+ "epoch": 0.59,
876
+ "learning_rate": 2e-05,
877
+ "loss": 1.6954,
878
+ "step": 725
879
+ },
880
+ {
881
+ "epoch": 0.59,
882
+ "learning_rate": 2e-05,
883
+ "loss": 1.7004,
884
+ "step": 730
885
+ },
886
+ {
887
+ "epoch": 0.59,
888
+ "learning_rate": 2e-05,
889
+ "loss": 1.776,
890
+ "step": 735
891
+ },
892
+ {
893
+ "epoch": 0.6,
894
+ "learning_rate": 2e-05,
895
+ "loss": 1.5995,
896
+ "step": 740
897
+ },
898
+ {
899
+ "epoch": 0.6,
900
+ "learning_rate": 2e-05,
901
+ "loss": 1.6109,
902
+ "step": 745
903
+ },
904
+ {
905
+ "epoch": 0.61,
906
+ "learning_rate": 2e-05,
907
+ "loss": 1.7467,
908
+ "step": 750
909
+ },
910
+ {
911
+ "epoch": 0.61,
912
+ "learning_rate": 2e-05,
913
+ "loss": 1.7777,
914
+ "step": 755
915
+ },
916
+ {
917
+ "epoch": 0.61,
918
+ "learning_rate": 2e-05,
919
+ "loss": 1.6837,
920
+ "step": 760
921
+ },
922
+ {
923
+ "epoch": 0.62,
924
+ "learning_rate": 2e-05,
925
+ "loss": 1.5458,
926
+ "step": 765
927
+ },
928
+ {
929
+ "epoch": 0.62,
930
+ "learning_rate": 2e-05,
931
+ "loss": 1.5676,
932
+ "step": 770
933
+ },
934
+ {
935
+ "epoch": 0.63,
936
+ "learning_rate": 2e-05,
937
+ "loss": 1.7139,
938
+ "step": 775
939
+ },
940
+ {
941
+ "epoch": 0.63,
942
+ "learning_rate": 2e-05,
943
+ "loss": 1.6222,
944
+ "step": 780
945
+ },
946
+ {
947
+ "epoch": 0.64,
948
+ "learning_rate": 2e-05,
949
+ "loss": 1.6769,
950
+ "step": 785
951
+ },
952
+ {
953
+ "epoch": 0.64,
954
+ "learning_rate": 2e-05,
955
+ "loss": 1.6037,
956
+ "step": 790
957
+ },
958
+ {
959
+ "epoch": 0.64,
960
+ "learning_rate": 2e-05,
961
+ "loss": 1.5756,
962
+ "step": 795
963
+ },
964
+ {
965
+ "epoch": 0.65,
966
+ "learning_rate": 2e-05,
967
+ "loss": 1.6477,
968
+ "step": 800
969
+ },
970
+ {
971
+ "epoch": 0.65,
972
+ "learning_rate": 2e-05,
973
+ "loss": 1.6211,
974
+ "step": 805
975
+ },
976
+ {
977
+ "epoch": 0.66,
978
+ "learning_rate": 2e-05,
979
+ "loss": 1.5294,
980
+ "step": 810
981
+ },
982
+ {
983
+ "epoch": 0.66,
984
+ "learning_rate": 2e-05,
985
+ "loss": 1.5906,
986
+ "step": 815
987
+ },
988
+ {
989
+ "epoch": 0.66,
990
+ "learning_rate": 2e-05,
991
+ "loss": 1.6337,
992
+ "step": 820
993
+ },
994
+ {
995
+ "epoch": 0.67,
996
+ "learning_rate": 2e-05,
997
+ "loss": 1.6612,
998
+ "step": 825
999
+ },
1000
+ {
1001
+ "epoch": 0.67,
1002
+ "learning_rate": 2e-05,
1003
+ "loss": 1.6442,
1004
+ "step": 830
1005
+ },
1006
+ {
1007
+ "epoch": 0.68,
1008
+ "learning_rate": 2e-05,
1009
+ "loss": 1.5258,
1010
+ "step": 835
1011
+ },
1012
+ {
1013
+ "epoch": 0.68,
1014
+ "learning_rate": 2e-05,
1015
+ "loss": 1.6587,
1016
+ "step": 840
1017
+ },
1018
+ {
1019
+ "epoch": 0.68,
1020
+ "learning_rate": 2e-05,
1021
+ "loss": 1.6412,
1022
+ "step": 845
1023
+ },
1024
+ {
1025
+ "epoch": 0.69,
1026
+ "learning_rate": 2e-05,
1027
+ "loss": 1.6121,
1028
+ "step": 850
1029
+ },
1030
+ {
1031
+ "epoch": 0.69,
1032
+ "learning_rate": 2e-05,
1033
+ "loss": 1.6697,
1034
+ "step": 855
1035
+ },
1036
+ {
1037
+ "epoch": 0.7,
1038
+ "learning_rate": 2e-05,
1039
+ "loss": 1.7363,
1040
+ "step": 860
1041
+ },
1042
+ {
1043
+ "epoch": 0.7,
1044
+ "learning_rate": 2e-05,
1045
+ "loss": 1.5942,
1046
+ "step": 865
1047
+ },
1048
+ {
1049
+ "epoch": 0.7,
1050
+ "learning_rate": 2e-05,
1051
+ "loss": 1.5956,
1052
+ "step": 870
1053
+ },
1054
+ {
1055
+ "epoch": 0.71,
1056
+ "learning_rate": 2e-05,
1057
+ "loss": 1.6143,
1058
+ "step": 875
1059
+ },
1060
+ {
1061
+ "epoch": 0.71,
1062
+ "learning_rate": 2e-05,
1063
+ "loss": 1.6825,
1064
+ "step": 880
1065
+ },
1066
+ {
1067
+ "epoch": 0.72,
1068
+ "learning_rate": 2e-05,
1069
+ "loss": 1.5519,
1070
+ "step": 885
1071
+ },
1072
+ {
1073
+ "epoch": 0.72,
1074
+ "learning_rate": 2e-05,
1075
+ "loss": 1.5407,
1076
+ "step": 890
1077
+ },
1078
+ {
1079
+ "epoch": 0.72,
1080
+ "learning_rate": 2e-05,
1081
+ "loss": 1.64,
1082
+ "step": 895
1083
+ },
1084
+ {
1085
+ "epoch": 0.73,
1086
+ "learning_rate": 2e-05,
1087
+ "loss": 1.6164,
1088
+ "step": 900
1089
+ },
1090
+ {
1091
+ "epoch": 0.73,
1092
+ "learning_rate": 2e-05,
1093
+ "loss": 1.5794,
1094
+ "step": 905
1095
+ },
1096
+ {
1097
+ "epoch": 0.74,
1098
+ "learning_rate": 2e-05,
1099
+ "loss": 1.599,
1100
+ "step": 910
1101
+ },
1102
+ {
1103
+ "epoch": 0.74,
1104
+ "learning_rate": 2e-05,
1105
+ "loss": 1.6298,
1106
+ "step": 915
1107
+ },
1108
+ {
1109
+ "epoch": 0.74,
1110
+ "learning_rate": 2e-05,
1111
+ "loss": 1.5314,
1112
+ "step": 920
1113
+ },
1114
+ {
1115
+ "epoch": 0.75,
1116
+ "learning_rate": 2e-05,
1117
+ "loss": 1.5408,
1118
+ "step": 925
1119
+ },
1120
+ {
1121
+ "epoch": 0.75,
1122
+ "learning_rate": 2e-05,
1123
+ "loss": 1.5463,
1124
+ "step": 930
1125
+ },
1126
+ {
1127
+ "epoch": 0.76,
1128
+ "learning_rate": 2e-05,
1129
+ "loss": 1.6333,
1130
+ "step": 935
1131
+ },
1132
+ {
1133
+ "epoch": 0.76,
1134
+ "learning_rate": 2e-05,
1135
+ "loss": 1.587,
1136
+ "step": 940
1137
+ },
1138
+ {
1139
+ "epoch": 0.76,
1140
+ "learning_rate": 2e-05,
1141
+ "loss": 1.5648,
1142
+ "step": 945
1143
+ },
1144
+ {
1145
+ "epoch": 0.77,
1146
+ "learning_rate": 2e-05,
1147
+ "loss": 1.555,
1148
+ "step": 950
1149
+ },
1150
+ {
1151
+ "epoch": 0.77,
1152
+ "learning_rate": 2e-05,
1153
+ "loss": 1.5351,
1154
+ "step": 955
1155
+ },
1156
+ {
1157
+ "epoch": 0.78,
1158
+ "learning_rate": 2e-05,
1159
+ "loss": 1.4786,
1160
+ "step": 960
1161
+ },
1162
+ {
1163
+ "epoch": 0.78,
1164
+ "learning_rate": 2e-05,
1165
+ "loss": 1.5897,
1166
+ "step": 965
1167
+ },
1168
+ {
1169
+ "epoch": 0.78,
1170
+ "learning_rate": 2e-05,
1171
+ "loss": 1.5618,
1172
+ "step": 970
1173
+ },
1174
+ {
1175
+ "epoch": 0.79,
1176
+ "learning_rate": 2e-05,
1177
+ "loss": 1.5788,
1178
+ "step": 975
1179
+ },
1180
+ {
1181
+ "epoch": 0.79,
1182
+ "learning_rate": 2e-05,
1183
+ "loss": 1.5145,
1184
+ "step": 980
1185
+ },
1186
+ {
1187
+ "epoch": 0.8,
1188
+ "learning_rate": 2e-05,
1189
+ "loss": 1.5698,
1190
+ "step": 985
1191
+ },
1192
+ {
1193
+ "epoch": 0.8,
1194
+ "learning_rate": 2e-05,
1195
+ "loss": 1.5379,
1196
+ "step": 990
1197
+ },
1198
+ {
1199
+ "epoch": 0.81,
1200
+ "learning_rate": 2e-05,
1201
+ "loss": 1.5551,
1202
+ "step": 995
1203
+ },
1204
+ {
1205
+ "epoch": 0.81,
1206
+ "learning_rate": 2e-05,
1207
+ "loss": 1.6016,
1208
+ "step": 1000
1209
+ },
1210
+ {
1211
+ "epoch": 0.81,
1212
+ "learning_rate": 2e-05,
1213
+ "loss": 1.5892,
1214
+ "step": 1005
1215
+ },
1216
+ {
1217
+ "epoch": 0.82,
1218
+ "learning_rate": 2e-05,
1219
+ "loss": 1.498,
1220
+ "step": 1010
1221
+ },
1222
+ {
1223
+ "epoch": 0.82,
1224
+ "learning_rate": 2e-05,
1225
+ "loss": 1.5073,
1226
+ "step": 1015
1227
+ },
1228
+ {
1229
+ "epoch": 0.83,
1230
+ "learning_rate": 2e-05,
1231
+ "loss": 1.5505,
1232
+ "step": 1020
1233
+ },
1234
+ {
1235
+ "epoch": 0.83,
1236
+ "learning_rate": 2e-05,
1237
+ "loss": 1.5326,
1238
+ "step": 1025
1239
+ },
1240
+ {
1241
+ "epoch": 0.83,
1242
+ "learning_rate": 2e-05,
1243
+ "loss": 1.5299,
1244
+ "step": 1030
1245
+ },
1246
+ {
1247
+ "epoch": 0.84,
1248
+ "learning_rate": 2e-05,
1249
+ "loss": 1.5437,
1250
+ "step": 1035
1251
+ },
1252
+ {
1253
+ "epoch": 0.84,
1254
+ "learning_rate": 2e-05,
1255
+ "loss": 1.5517,
1256
+ "step": 1040
1257
+ },
1258
+ {
1259
+ "epoch": 0.85,
1260
+ "learning_rate": 2e-05,
1261
+ "loss": 1.6051,
1262
+ "step": 1045
1263
+ },
1264
+ {
1265
+ "epoch": 0.85,
1266
+ "learning_rate": 2e-05,
1267
+ "loss": 1.4787,
1268
+ "step": 1050
1269
+ },
1270
+ {
1271
+ "epoch": 0.85,
1272
+ "learning_rate": 2e-05,
1273
+ "loss": 1.5765,
1274
+ "step": 1055
1275
+ },
1276
+ {
1277
+ "epoch": 0.86,
1278
+ "learning_rate": 2e-05,
1279
+ "loss": 1.4983,
1280
+ "step": 1060
1281
+ },
1282
+ {
1283
+ "epoch": 0.86,
1284
+ "learning_rate": 2e-05,
1285
+ "loss": 1.5846,
1286
+ "step": 1065
1287
+ },
1288
+ {
1289
+ "epoch": 0.87,
1290
+ "learning_rate": 2e-05,
1291
+ "loss": 1.4963,
1292
+ "step": 1070
1293
+ },
1294
+ {
1295
+ "epoch": 0.87,
1296
+ "learning_rate": 2e-05,
1297
+ "loss": 1.5376,
1298
+ "step": 1075
1299
+ },
1300
+ {
1301
+ "epoch": 0.87,
1302
+ "learning_rate": 2e-05,
1303
+ "loss": 1.4862,
1304
+ "step": 1080
1305
+ },
1306
+ {
1307
+ "epoch": 0.88,
1308
+ "learning_rate": 2e-05,
1309
+ "loss": 1.4577,
1310
+ "step": 1085
1311
+ },
1312
+ {
1313
+ "epoch": 0.88,
1314
+ "learning_rate": 2e-05,
1315
+ "loss": 1.4354,
1316
+ "step": 1090
1317
+ },
1318
+ {
1319
+ "epoch": 0.89,
1320
+ "learning_rate": 2e-05,
1321
+ "loss": 1.4426,
1322
+ "step": 1095
1323
+ },
1324
+ {
1325
+ "epoch": 0.89,
1326
+ "learning_rate": 2e-05,
1327
+ "loss": 1.5383,
1328
+ "step": 1100
1329
+ },
1330
+ {
1331
+ "epoch": 0.89,
1332
+ "learning_rate": 2e-05,
1333
+ "loss": 1.5622,
1334
+ "step": 1105
1335
+ },
1336
+ {
1337
+ "epoch": 0.9,
1338
+ "learning_rate": 2e-05,
1339
+ "loss": 1.4842,
1340
+ "step": 1110
1341
+ },
1342
+ {
1343
+ "epoch": 0.9,
1344
+ "learning_rate": 2e-05,
1345
+ "loss": 1.5048,
1346
+ "step": 1115
1347
+ },
1348
+ {
1349
+ "epoch": 0.91,
1350
+ "learning_rate": 2e-05,
1351
+ "loss": 1.4932,
1352
+ "step": 1120
1353
+ },
1354
+ {
1355
+ "epoch": 0.91,
1356
+ "learning_rate": 2e-05,
1357
+ "loss": 1.4942,
1358
+ "step": 1125
1359
+ },
1360
+ {
1361
+ "epoch": 0.91,
1362
+ "learning_rate": 2e-05,
1363
+ "loss": 1.5909,
1364
+ "step": 1130
1365
+ },
1366
+ {
1367
+ "epoch": 0.92,
1368
+ "learning_rate": 2e-05,
1369
+ "loss": 1.452,
1370
+ "step": 1135
1371
+ },
1372
+ {
1373
+ "epoch": 0.92,
1374
+ "learning_rate": 2e-05,
1375
+ "loss": 1.4005,
1376
+ "step": 1140
1377
+ },
1378
+ {
1379
+ "epoch": 0.93,
1380
+ "learning_rate": 2e-05,
1381
+ "loss": 1.4827,
1382
+ "step": 1145
1383
+ },
1384
+ {
1385
+ "epoch": 0.93,
1386
+ "learning_rate": 2e-05,
1387
+ "loss": 1.4196,
1388
+ "step": 1150
1389
+ },
1390
+ {
1391
+ "epoch": 0.93,
1392
+ "learning_rate": 2e-05,
1393
+ "loss": 1.4841,
1394
+ "step": 1155
1395
+ },
1396
+ {
1397
+ "epoch": 0.94,
1398
+ "learning_rate": 2e-05,
1399
+ "loss": 1.389,
1400
+ "step": 1160
1401
+ },
1402
+ {
1403
+ "epoch": 0.94,
1404
+ "learning_rate": 2e-05,
1405
+ "loss": 1.5696,
1406
+ "step": 1165
1407
+ },
1408
+ {
1409
+ "epoch": 0.95,
1410
+ "learning_rate": 2e-05,
1411
+ "loss": 1.4462,
1412
+ "step": 1170
1413
+ },
1414
+ {
1415
+ "epoch": 0.95,
1416
+ "learning_rate": 2e-05,
1417
+ "loss": 1.4554,
1418
+ "step": 1175
1419
+ },
1420
+ {
1421
+ "epoch": 0.95,
1422
+ "learning_rate": 2e-05,
1423
+ "loss": 1.4258,
1424
+ "step": 1180
1425
+ },
1426
+ {
1427
+ "epoch": 0.96,
1428
+ "learning_rate": 2e-05,
1429
+ "loss": 1.3619,
1430
+ "step": 1185
1431
+ },
1432
+ {
1433
+ "epoch": 0.96,
1434
+ "learning_rate": 2e-05,
1435
+ "loss": 1.3859,
1436
+ "step": 1190
1437
+ },
1438
+ {
1439
+ "epoch": 0.97,
1440
+ "learning_rate": 2e-05,
1441
+ "loss": 1.5367,
1442
+ "step": 1195
1443
+ },
1444
+ {
1445
+ "epoch": 0.97,
1446
+ "learning_rate": 2e-05,
1447
+ "loss": 1.564,
1448
+ "step": 1200
1449
+ },
1450
+ {
1451
+ "epoch": 0.98,
1452
+ "learning_rate": 2e-05,
1453
+ "loss": 1.4659,
1454
+ "step": 1205
1455
+ },
1456
+ {
1457
+ "epoch": 0.98,
1458
+ "learning_rate": 2e-05,
1459
+ "loss": 1.5207,
1460
+ "step": 1210
1461
+ },
1462
+ {
1463
+ "epoch": 0.98,
1464
+ "learning_rate": 2e-05,
1465
+ "loss": 1.3289,
1466
+ "step": 1215
1467
+ },
1468
+ {
1469
+ "epoch": 0.99,
1470
+ "learning_rate": 2e-05,
1471
+ "loss": 1.3327,
1472
+ "step": 1220
1473
+ },
1474
+ {
1475
+ "epoch": 0.99,
1476
+ "learning_rate": 2e-05,
1477
+ "loss": 1.4587,
1478
+ "step": 1225
1479
+ },
1480
+ {
1481
+ "epoch": 1.0,
1482
+ "learning_rate": 2e-05,
1483
+ "loss": 1.5185,
1484
+ "step": 1230
1485
+ },
1486
+ {
1487
+ "epoch": 1.0,
1488
+ "learning_rate": 2e-05,
1489
+ "loss": 1.8666,
1490
+ "step": 1235
1491
+ }
1492
+ ],
1493
+ "max_steps": 2470,
1494
+ "num_train_epochs": 2,
1495
+ "total_flos": 2.936549337213174e+17,
1496
+ "trial_name": null,
1497
+ "trial_params": null
1498
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1478bd66c59324660d419c4dbf66ae0913f61e46b4ae461c1dfb2b742fba3ea8
3
+ size 4271
zero_to_fp32.py ADDED
@@ -0,0 +1,484 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # This script extracts fp32 consolidated weights from a zero 2 and 3 DeepSpeed checkpoints. It gets
4
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
5
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
6
+ # application.
7
+ #
8
+ # example: python zero_to_fp32.py . pytorch_model.bin
9
+
10
+ import argparse
11
+ import torch
12
+ import glob
13
+ import math
14
+ import os
15
+ import re
16
+ from collections import OrderedDict
17
+
18
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
19
+ # DeepSpeed data structures it has to be available in the current python environment.
20
+ import deepspeed
21
+ from deepspeed.utils import logger
22
+ from deepspeed.checkpoint.constants import (DS_VERSION,
23
+ OPTIMIZER_STATE_DICT,
24
+ PARAM_SHAPES,
25
+ SINGLE_PARTITION_OF_FP32_GROUPS,
26
+ FP32_FLAT_GROUPS,
27
+ ZERO_STAGE,
28
+ PARTITION_COUNT,
29
+ PARAM_SHAPES,
30
+ BUFFER_NAMES)
31
+
32
+ debug = 0
33
+
34
+ # load to cpu
35
+ device = torch.device('cpu')
36
+
37
+
38
+ def atoi(text):
39
+ return int(text) if text.isdigit() else text
40
+
41
+
42
+ def natural_keys(text):
43
+ '''
44
+ alist.sort(key=natural_keys) sorts in human order
45
+ http://nedbatchelder.com/blog/200712/human_sorting.html
46
+ (See Toothy's implementation in the comments)
47
+ '''
48
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
49
+
50
+
51
+ def get_model_state_file(checkpoint_dir, zero_stage):
52
+ if not os.path.isdir(checkpoint_dir):
53
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
54
+
55
+ # there should be only one file
56
+ if zero_stage == 2:
57
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
58
+ elif zero_stage == 3:
59
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
60
+
61
+ if not os.path.exists(file):
62
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
63
+
64
+ return file
65
+
66
+
67
+ def get_optim_files(checkpoint_dir):
68
+ # XXX: need to test that this simple glob rule works for multi-node setup too
69
+ optim_files = sorted(glob.glob(os.path.join(checkpoint_dir,
70
+ "*_optim_states.pt")),
71
+ key=natural_keys)
72
+
73
+ if len(optim_files) == 0:
74
+ raise FileNotFoundError(
75
+ f"can't find '*_optim_states.pt' files in directory '{checkpoint_dir}'")
76
+
77
+ return optim_files
78
+
79
+
80
+ def parse_model_state(file):
81
+ state_dict = torch.load(file, map_location=device)
82
+
83
+ if BUFFER_NAMES not in state_dict:
84
+ raise ValueError(f"{file} is not a model state checkpoint")
85
+ buffer_names = state_dict[BUFFER_NAMES]
86
+ if debug:
87
+ print("Found buffers:", buffer_names)
88
+
89
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
90
+ buffers = {
91
+ k: v.float()
92
+ for k,
93
+ v in state_dict["module"].items() if k in buffer_names
94
+ }
95
+ param_shapes = state_dict[PARAM_SHAPES]
96
+
97
+ ds_version = state_dict.get(DS_VERSION, None)
98
+
99
+ return buffers, param_shapes, ds_version
100
+
101
+
102
+ def parse_optim_states(files, ds_checkpoint_dir):
103
+
104
+ total_files = len(files)
105
+ state_dicts = []
106
+ for f in files:
107
+ state_dicts.append(torch.load(f, map_location=device))
108
+
109
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
110
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
111
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
112
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
113
+
114
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
115
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
116
+ # use the max of the partition_count to get the dp world_size.
117
+
118
+ if type(world_size) is list:
119
+ world_size = max(world_size)
120
+
121
+ if world_size != total_files:
122
+ raise ValueError(
123
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
124
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
125
+ )
126
+
127
+ # the groups are named differently in each stage
128
+ if zero_stage == 2:
129
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
130
+ elif zero_stage == 3:
131
+ fp32_groups_key = FP32_FLAT_GROUPS
132
+ else:
133
+ raise ValueError(f"unknown zero stage {zero_stage}")
134
+
135
+ if zero_stage == 2:
136
+ fp32_flat_groups = [
137
+ state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key]
138
+ for i in range(len(state_dicts))
139
+ ]
140
+ elif zero_stage == 3:
141
+ # if there is more than one param group, there will be multiple flattened tensors - one
142
+ # flattened tensor per group - for simplicity merge them into a single tensor
143
+ #
144
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
145
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
146
+
147
+ fp32_flat_groups = [
148
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key],
149
+ 0) for i in range(len(state_dicts))
150
+ ]
151
+
152
+ return zero_stage, world_size, fp32_flat_groups
153
+
154
+
155
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir):
156
+ """
157
+ Returns fp32 state_dict reconstructed from ds checkpoint
158
+
159
+ Args:
160
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
161
+
162
+ """
163
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
164
+
165
+ optim_files = get_optim_files(ds_checkpoint_dir)
166
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
167
+ print(
168
+ f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
169
+
170
+ model_file = get_model_state_file(ds_checkpoint_dir, zero_stage)
171
+ buffers, param_shapes, ds_version = parse_model_state(model_file)
172
+ print(f'Parsing checkpoint created by deepspeed=={ds_version}')
173
+
174
+ if zero_stage == 2:
175
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size,
176
+ param_shapes,
177
+ fp32_flat_groups,
178
+ buffers)
179
+ elif zero_stage == 3:
180
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size,
181
+ param_shapes,
182
+ fp32_flat_groups,
183
+ buffers)
184
+
185
+
186
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size,
187
+ param_shapes,
188
+ fp32_flat_groups,
189
+ buffers):
190
+
191
+ # Reconstruction protocol:
192
+ #
193
+ # XXX: document this
194
+
195
+ if debug:
196
+ for i in range(world_size):
197
+ for j in range(len(fp32_flat_groups[0])):
198
+ print(
199
+ f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
200
+
201
+ # XXX: memory usage doubles here (zero2)
202
+ num_param_groups = len(fp32_flat_groups[0])
203
+ merged_single_partition_of_fp32_groups = []
204
+ for i in range(num_param_groups):
205
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
206
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
207
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
208
+ avail_numel = sum([
209
+ full_single_fp32_vector.numel()
210
+ for full_single_fp32_vector in merged_single_partition_of_fp32_groups
211
+ ])
212
+
213
+ if debug:
214
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
215
+ wanted_numel = sum(
216
+ [sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
217
+ # not asserting if there is a mismatch due to possible padding
218
+ print(f"Have {avail_numel} numels to process.")
219
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
220
+
221
+ state_dict = OrderedDict()
222
+
223
+ # buffers
224
+ state_dict.update(buffers)
225
+ if debug:
226
+ print(f"added {len(buffers)} buffers")
227
+
228
+ # params
229
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
230
+ # out-of-core computing solution
231
+ total_numel = 0
232
+ total_params = 0
233
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
234
+ offset = 0
235
+ avail_numel = full_single_fp32_vector.numel()
236
+ for name, shape in shapes.items():
237
+
238
+ unpartitioned_numel = shape.numel()
239
+ total_numel += unpartitioned_numel
240
+ total_params += 1
241
+
242
+ if debug:
243
+ print(
244
+ f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} "
245
+ )
246
+ state_dict[name] = full_single_fp32_vector.narrow(
247
+ 0,
248
+ offset,
249
+ unpartitioned_numel).view(shape)
250
+ offset += unpartitioned_numel
251
+
252
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
253
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
254
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
255
+ # live optimizer object, so we are checking that the numbers are within the right range
256
+ align_to = 2 * world_size
257
+
258
+ def zero2_align(x):
259
+ return align_to * math.ceil(x / align_to)
260
+
261
+ if debug:
262
+ print(f"original offset={offset}, avail_numel={avail_numel}")
263
+
264
+ offset = zero2_align(offset)
265
+ avail_numel = zero2_align(avail_numel)
266
+
267
+ if debug:
268
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
269
+
270
+ # Sanity check
271
+ if offset != avail_numel:
272
+ raise ValueError(
273
+ f"consumed {offset} numels out of {avail_numel} - something is wrong")
274
+
275
+ print(
276
+ f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements"
277
+ )
278
+
279
+ return state_dict
280
+
281
+
282
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
283
+ remainder = unpartitioned_numel % world_size
284
+ padding_numel = (world_size - remainder) if remainder else 0
285
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
286
+ return partitioned_numel, padding_numel
287
+
288
+
289
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size,
290
+ param_shapes,
291
+ fp32_flat_groups,
292
+ buffers):
293
+
294
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
295
+ # param, re-consolidating each param, while dealing with padding if any
296
+
297
+ avail_numel = fp32_flat_groups[0].numel() * world_size
298
+ # merge list of dicts, preserving order
299
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
300
+
301
+ if debug:
302
+ for i in range(world_size):
303
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
304
+
305
+ wanted_params = len(param_shapes)
306
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
307
+ # not asserting if there is a mismatch due to possible padding
308
+ print(f"Have {avail_numel} numels to process.")
309
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
310
+
311
+ state_dict = OrderedDict()
312
+
313
+ # buffers
314
+ state_dict.update(buffers)
315
+ if debug:
316
+ print(f"added {len(buffers)} buffers")
317
+
318
+ # params
319
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
320
+ # out-of-core computing solution
321
+ offset = 0
322
+ total_numel = 0
323
+ total_params = 0
324
+ for name, shape in param_shapes.items():
325
+
326
+ unpartitioned_numel = shape.numel()
327
+ total_numel += unpartitioned_numel
328
+ total_params += 1
329
+
330
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
331
+
332
+ if debug:
333
+ print(
334
+ f"{total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
335
+ )
336
+
337
+ # XXX: memory usage doubles here
338
+ state_dict[name] = torch.cat(
339
+ tuple(fp32_flat_groups[i].narrow(0,
340
+ offset,
341
+ partitioned_numel)
342
+ for i in range(world_size)),
343
+ 0).narrow(0,
344
+ 0,
345
+ unpartitioned_numel).view(shape)
346
+ offset += partitioned_numel
347
+
348
+ offset *= world_size
349
+
350
+ # Sanity check
351
+ if offset != avail_numel:
352
+ raise ValueError(
353
+ f"consumed {offset} numels out of {avail_numel} - something is wrong")
354
+
355
+ print(
356
+ f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements"
357
+ )
358
+
359
+ return state_dict
360
+
361
+
362
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None):
363
+ """
364
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
365
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
366
+ via a model hub.
367
+
368
+ Args:
369
+ - ``checkpoint_dir``: path to the desired checkpoint folder
370
+ - ``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``
371
+
372
+ Returns:
373
+ - pytorch ``state_dict``
374
+
375
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
376
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
377
+ the checkpoint.
378
+
379
+ A typical usage might be ::
380
+
381
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
382
+ # do the training and checkpoint saving
383
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
384
+ model = model.cpu() # move to cpu
385
+ model.load_state_dict(state_dict)
386
+ # submit to model hub or save the model to share with others
387
+
388
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
389
+ application. i.e. you will need to re-initialize the deepspeed engine, since
390
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
391
+
392
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
393
+
394
+ """
395
+ if tag is None:
396
+ latest_path = os.path.join(checkpoint_dir, 'latest')
397
+ if os.path.isfile(latest_path):
398
+ with open(latest_path, 'r') as fd:
399
+ tag = fd.read().strip()
400
+ else:
401
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
402
+
403
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
404
+
405
+ if not os.path.isdir(ds_checkpoint_dir):
406
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
407
+
408
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir)
409
+
410
+
411
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None):
412
+ """
413
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
414
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
415
+
416
+ Args:
417
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
418
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
419
+ - ``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``
420
+ """
421
+
422
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
423
+ print(f"Saving fp32 state dict to {output_file}")
424
+ torch.save(state_dict, output_file)
425
+
426
+
427
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
428
+ """
429
+ 1. Put the provided model to cpu
430
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
431
+ 3. Load it into the provided model
432
+
433
+ Args:
434
+ - ``model``: the model object to update
435
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
436
+ - ``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``
437
+
438
+ Returns:
439
+ - ``model`: modified model
440
+
441
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
442
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
443
+ conveniently placed for you in the checkpoint folder.
444
+
445
+ A typical usage might be ::
446
+
447
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
448
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
449
+ # submit to model hub or save the model to share with others
450
+
451
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
452
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
453
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
454
+
455
+ """
456
+ logger.info(f"Extracting fp32 weights")
457
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
458
+
459
+ logger.info(f"Overwriting model with fp32 weights")
460
+ model = model.cpu()
461
+ model.load_state_dict(state_dict, strict=False)
462
+
463
+ return model
464
+
465
+
466
+ if __name__ == "__main__":
467
+
468
+ parser = argparse.ArgumentParser()
469
+ parser.add_argument(
470
+ "checkpoint_dir",
471
+ type=str,
472
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
473
+ parser.add_argument(
474
+ "output_file",
475
+ type=str,
476
+ help=
477
+ "path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)"
478
+ )
479
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
480
+ args = parser.parse_args()
481
+
482
+ debug = args.debug
483
+
484
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir, args.output_file)