64bits commited on
Commit
4cfba6c
1 Parent(s): 1611cb9

initial commit: LexPodLM-13B

Browse files
.gitattributes CHANGED
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ *.psd filter=lfs diff=lfs merge=lfs -text
config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/workspace/datasets/llama-13b",
3
+ "architectures": [
4
+ "LlamaForCausalLM"
5
+ ],
6
+ "bos_token_id": 1,
7
+ "eos_token_id": 2,
8
+ "hidden_act": "silu",
9
+ "hidden_size": 5120,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 13824,
12
+ "max_position_embeddings": 2048,
13
+ "max_sequence_length": 2048,
14
+ "model_type": "llama",
15
+ "num_attention_heads": 40,
16
+ "num_hidden_layers": 40,
17
+ "pad_token_id": 0,
18
+ "rms_norm_eps": 1e-06,
19
+ "tie_word_embeddings": false,
20
+ "torch_dtype": "bfloat16",
21
+ "transformers_version": "4.28.1",
22
+ "use_cache": false,
23
+ "vocab_size": 32000
24
+ }
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.28.1"
7
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:316aa63bdb5b58c77dff5490f62fad85304252fa6c653cf389e13245ec4d7595
3
+ size 26031865519
special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "<unk>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": true,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
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,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "bos_token": {
5
+ "__type": "AddedToken",
6
+ "content": "<s>",
7
+ "lstrip": false,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "clean_up_tokenization_spaces": false,
13
+ "eos_token": {
14
+ "__type": "AddedToken",
15
+ "content": "</s>",
16
+ "lstrip": false,
17
+ "normalized": true,
18
+ "rstrip": false,
19
+ "single_word": false
20
+ },
21
+ "model_max_length": 2048,
22
+ "pad_token": null,
23
+ "padding_side": "right",
24
+ "sp_model_kwargs": {},
25
+ "tokenizer_class": "LlamaTokenizer",
26
+ "unk_token": {
27
+ "__type": "AddedToken",
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false
33
+ }
34
+ }
trainer_state.json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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 1.9941747572815534,
5
+ "global_step": 256,
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": 1.8181818181818183e-06,
13
+ "loss": 2.6279,
14
+ "step": 1
15
+ },
16
+ {
17
+ "epoch": 0.02,
18
+ "learning_rate": 3.6363636363636366e-06,
19
+ "loss": 2.6631,
20
+ "step": 2
21
+ },
22
+ {
23
+ "epoch": 0.02,
24
+ "learning_rate": 5.4545454545454545e-06,
25
+ "loss": 2.6104,
26
+ "step": 3
27
+ },
28
+ {
29
+ "epoch": 0.03,
30
+ "learning_rate": 7.272727272727273e-06,
31
+ "loss": 2.6699,
32
+ "step": 4
33
+ },
34
+ {
35
+ "epoch": 0.04,
36
+ "learning_rate": 9.090909090909091e-06,
37
+ "loss": 2.5469,
38
+ "step": 5
39
+ },
40
+ {
41
+ "epoch": 0.05,
42
+ "learning_rate": 1.0909090909090909e-05,
43
+ "loss": 2.499,
44
+ "step": 6
45
+ },
46
+ {
47
+ "epoch": 0.05,
48
+ "learning_rate": 1.2727272727272728e-05,
49
+ "loss": 2.5264,
50
+ "step": 7
51
+ },
52
+ {
53
+ "epoch": 0.06,
54
+ "learning_rate": 1.4545454545454546e-05,
55
+ "loss": 2.5,
56
+ "step": 8
57
+ },
58
+ {
59
+ "epoch": 0.07,
60
+ "learning_rate": 1.6363636363636366e-05,
61
+ "loss": 2.5107,
62
+ "step": 9
63
+ },
64
+ {
65
+ "epoch": 0.08,
66
+ "learning_rate": 1.8181818181818182e-05,
67
+ "loss": 2.541,
68
+ "step": 10
69
+ },
70
+ {
71
+ "epoch": 0.09,
72
+ "learning_rate": 2e-05,
73
+ "loss": 2.5381,
74
+ "step": 11
75
+ },
76
+ {
77
+ "epoch": 0.09,
78
+ "learning_rate": 1.9999177886783194e-05,
79
+ "loss": 2.5234,
80
+ "step": 12
81
+ },
82
+ {
83
+ "epoch": 0.1,
84
+ "learning_rate": 1.99967116823068e-05,
85
+ "loss": 2.5303,
86
+ "step": 13
87
+ },
88
+ {
89
+ "epoch": 0.11,
90
+ "learning_rate": 1.999260179207068e-05,
91
+ "loss": 2.5117,
92
+ "step": 14
93
+ },
94
+ {
95
+ "epoch": 0.12,
96
+ "learning_rate": 1.9986848891833846e-05,
97
+ "loss": 2.4707,
98
+ "step": 15
99
+ },
100
+ {
101
+ "epoch": 0.12,
102
+ "learning_rate": 1.9979453927503366e-05,
103
+ "loss": 2.5107,
104
+ "step": 16
105
+ },
106
+ {
107
+ "epoch": 0.13,
108
+ "learning_rate": 1.997041811497882e-05,
109
+ "loss": 2.5078,
110
+ "step": 17
111
+ },
112
+ {
113
+ "epoch": 0.14,
114
+ "learning_rate": 1.9959742939952393e-05,
115
+ "loss": 2.4258,
116
+ "step": 18
117
+ },
118
+ {
119
+ "epoch": 0.15,
120
+ "learning_rate": 1.9947430157664575e-05,
121
+ "loss": 2.4717,
122
+ "step": 19
123
+ },
124
+ {
125
+ "epoch": 0.16,
126
+ "learning_rate": 1.9933481792615583e-05,
127
+ "loss": 2.5234,
128
+ "step": 20
129
+ },
130
+ {
131
+ "epoch": 0.16,
132
+ "learning_rate": 1.991790013823246e-05,
133
+ "loss": 2.4385,
134
+ "step": 21
135
+ },
136
+ {
137
+ "epoch": 0.17,
138
+ "learning_rate": 1.9900687756492022e-05,
139
+ "loss": 2.4541,
140
+ "step": 22
141
+ },
142
+ {
143
+ "epoch": 0.18,
144
+ "learning_rate": 1.988184747749956e-05,
145
+ "loss": 2.4629,
146
+ "step": 23
147
+ },
148
+ {
149
+ "epoch": 0.19,
150
+ "learning_rate": 1.986138239902355e-05,
151
+ "loss": 2.5381,
152
+ "step": 24
153
+ },
154
+ {
155
+ "epoch": 0.19,
156
+ "learning_rate": 1.98392958859863e-05,
157
+ "loss": 2.4775,
158
+ "step": 25
159
+ },
160
+ {
161
+ "epoch": 0.2,
162
+ "learning_rate": 1.9815591569910654e-05,
163
+ "loss": 2.4717,
164
+ "step": 26
165
+ },
166
+ {
167
+ "epoch": 0.21,
168
+ "learning_rate": 1.979027334832293e-05,
169
+ "loss": 2.4678,
170
+ "step": 27
171
+ },
172
+ {
173
+ "epoch": 0.22,
174
+ "learning_rate": 1.9763345384112044e-05,
175
+ "loss": 2.4863,
176
+ "step": 28
177
+ },
178
+ {
179
+ "epoch": 0.23,
180
+ "learning_rate": 1.973481210484505e-05,
181
+ "loss": 2.5049,
182
+ "step": 29
183
+ },
184
+ {
185
+ "epoch": 0.23,
186
+ "learning_rate": 1.9704678202039148e-05,
187
+ "loss": 2.5186,
188
+ "step": 30
189
+ },
190
+ {
191
+ "epoch": 0.24,
192
+ "learning_rate": 1.9672948630390296e-05,
193
+ "loss": 2.3848,
194
+ "step": 31
195
+ },
196
+ {
197
+ "epoch": 0.25,
198
+ "learning_rate": 1.9639628606958535e-05,
199
+ "loss": 2.5127,
200
+ "step": 32
201
+ },
202
+ {
203
+ "epoch": 0.26,
204
+ "learning_rate": 1.9604723610310195e-05,
205
+ "loss": 2.4727,
206
+ "step": 33
207
+ },
208
+ {
209
+ "epoch": 0.26,
210
+ "learning_rate": 1.956823937961709e-05,
211
+ "loss": 2.4502,
212
+ "step": 34
213
+ },
214
+ {
215
+ "epoch": 0.27,
216
+ "learning_rate": 1.9530181913712875e-05,
217
+ "loss": 2.5029,
218
+ "step": 35
219
+ },
220
+ {
221
+ "epoch": 0.28,
222
+ "learning_rate": 1.949055747010669e-05,
223
+ "loss": 2.5,
224
+ "step": 36
225
+ },
226
+ {
227
+ "epoch": 0.29,
228
+ "learning_rate": 1.9449372563954293e-05,
229
+ "loss": 2.4551,
230
+ "step": 37
231
+ },
232
+ {
233
+ "epoch": 0.3,
234
+ "learning_rate": 1.9406633966986828e-05,
235
+ "loss": 2.458,
236
+ "step": 38
237
+ },
238
+ {
239
+ "epoch": 0.3,
240
+ "learning_rate": 1.9362348706397374e-05,
241
+ "loss": 2.4453,
242
+ "step": 39
243
+ },
244
+ {
245
+ "epoch": 0.31,
246
+ "learning_rate": 1.9316524063685544e-05,
247
+ "loss": 2.3975,
248
+ "step": 40
249
+ },
250
+ {
251
+ "epoch": 0.32,
252
+ "learning_rate": 1.926916757346022e-05,
253
+ "loss": 2.4785,
254
+ "step": 41
255
+ },
256
+ {
257
+ "epoch": 0.33,
258
+ "learning_rate": 1.9220287022200707e-05,
259
+ "loss": 2.416,
260
+ "step": 42
261
+ },
262
+ {
263
+ "epoch": 0.33,
264
+ "learning_rate": 1.9169890446976454e-05,
265
+ "loss": 2.5166,
266
+ "step": 43
267
+ },
268
+ {
269
+ "epoch": 0.34,
270
+ "learning_rate": 1.911798613412557e-05,
271
+ "loss": 2.4268,
272
+ "step": 44
273
+ },
274
+ {
275
+ "epoch": 0.35,
276
+ "learning_rate": 1.9064582617892383e-05,
277
+ "loss": 2.4736,
278
+ "step": 45
279
+ },
280
+ {
281
+ "epoch": 0.36,
282
+ "learning_rate": 1.900968867902419e-05,
283
+ "loss": 2.4531,
284
+ "step": 46
285
+ },
286
+ {
287
+ "epoch": 0.37,
288
+ "learning_rate": 1.895331334332753e-05,
289
+ "loss": 2.4199,
290
+ "step": 47
291
+ },
292
+ {
293
+ "epoch": 0.37,
294
+ "learning_rate": 1.889546588018412e-05,
295
+ "loss": 2.4893,
296
+ "step": 48
297
+ },
298
+ {
299
+ "epoch": 0.38,
300
+ "learning_rate": 1.8836155801026754e-05,
301
+ "loss": 2.4785,
302
+ "step": 49
303
+ },
304
+ {
305
+ "epoch": 0.39,
306
+ "learning_rate": 1.877539285777543e-05,
307
+ "loss": 2.4346,
308
+ "step": 50
309
+ },
310
+ {
311
+ "epoch": 0.39,
312
+ "eval_loss": 2.4345414638519287,
313
+ "eval_runtime": 50.8104,
314
+ "eval_samples_per_second": 3.326,
315
+ "eval_steps_per_second": 0.039,
316
+ "step": 50
317
+ },
318
+ {
319
+ "epoch": 0.4,
320
+ "learning_rate": 1.8713187041233896e-05,
321
+ "loss": 2.4541,
322
+ "step": 51
323
+ },
324
+ {
325
+ "epoch": 0.4,
326
+ "learning_rate": 1.8649548579446938e-05,
327
+ "loss": 2.4746,
328
+ "step": 52
329
+ },
330
+ {
331
+ "epoch": 0.41,
332
+ "learning_rate": 1.8584487936018663e-05,
333
+ "loss": 2.4355,
334
+ "step": 53
335
+ },
336
+ {
337
+ "epoch": 0.42,
338
+ "learning_rate": 1.8518015808392045e-05,
339
+ "loss": 2.4268,
340
+ "step": 54
341
+ },
342
+ {
343
+ "epoch": 0.43,
344
+ "learning_rate": 1.8450143126090015e-05,
345
+ "loss": 2.4092,
346
+ "step": 55
347
+ },
348
+ {
349
+ "epoch": 0.43,
350
+ "learning_rate": 1.8380881048918406e-05,
351
+ "loss": 2.5039,
352
+ "step": 56
353
+ },
354
+ {
355
+ "epoch": 0.44,
356
+ "learning_rate": 1.831024096513104e-05,
357
+ "loss": 2.4609,
358
+ "step": 57
359
+ },
360
+ {
361
+ "epoch": 0.45,
362
+ "learning_rate": 1.8238234489557217e-05,
363
+ "loss": 2.5352,
364
+ "step": 58
365
+ },
366
+ {
367
+ "epoch": 0.46,
368
+ "learning_rate": 1.8164873461691987e-05,
369
+ "loss": 2.4775,
370
+ "step": 59
371
+ },
372
+ {
373
+ "epoch": 0.47,
374
+ "learning_rate": 1.8090169943749477e-05,
375
+ "loss": 2.4678,
376
+ "step": 60
377
+ },
378
+ {
379
+ "epoch": 0.47,
380
+ "learning_rate": 1.8014136218679566e-05,
381
+ "loss": 2.4814,
382
+ "step": 61
383
+ },
384
+ {
385
+ "epoch": 0.48,
386
+ "learning_rate": 1.793678478814833e-05,
387
+ "loss": 2.4473,
388
+ "step": 62
389
+ },
390
+ {
391
+ "epoch": 0.49,
392
+ "learning_rate": 1.7858128370482427e-05,
393
+ "loss": 2.4346,
394
+ "step": 63
395
+ },
396
+ {
397
+ "epoch": 0.5,
398
+ "learning_rate": 1.7778179898577973e-05,
399
+ "loss": 2.4561,
400
+ "step": 64
401
+ },
402
+ {
403
+ "epoch": 0.5,
404
+ "learning_rate": 1.769695251777406e-05,
405
+ "loss": 2.5137,
406
+ "step": 65
407
+ },
408
+ {
409
+ "epoch": 0.51,
410
+ "learning_rate": 1.7614459583691346e-05,
411
+ "loss": 2.4717,
412
+ "step": 66
413
+ },
414
+ {
415
+ "epoch": 0.52,
416
+ "learning_rate": 1.7530714660036112e-05,
417
+ "loss": 2.4561,
418
+ "step": 67
419
+ },
420
+ {
421
+ "epoch": 0.53,
422
+ "learning_rate": 1.744573151637007e-05,
423
+ "loss": 2.5293,
424
+ "step": 68
425
+ },
426
+ {
427
+ "epoch": 0.54,
428
+ "learning_rate": 1.7359524125846353e-05,
429
+ "loss": 2.4531,
430
+ "step": 69
431
+ },
432
+ {
433
+ "epoch": 0.54,
434
+ "learning_rate": 1.7272106662911972e-05,
435
+ "loss": 2.4854,
436
+ "step": 70
437
+ },
438
+ {
439
+ "epoch": 0.55,
440
+ "learning_rate": 1.7183493500977277e-05,
441
+ "loss": 2.4414,
442
+ "step": 71
443
+ },
444
+ {
445
+ "epoch": 0.56,
446
+ "learning_rate": 1.709369921005258e-05,
447
+ "loss": 2.4619,
448
+ "step": 72
449
+ },
450
+ {
451
+ "epoch": 0.57,
452
+ "learning_rate": 1.700273855435255e-05,
453
+ "loss": 2.4424,
454
+ "step": 73
455
+ },
456
+ {
457
+ "epoch": 0.57,
458
+ "learning_rate": 1.691062648986865e-05,
459
+ "loss": 2.4336,
460
+ "step": 74
461
+ },
462
+ {
463
+ "epoch": 0.58,
464
+ "learning_rate": 1.6817378161909995e-05,
465
+ "loss": 2.4795,
466
+ "step": 75
467
+ },
468
+ {
469
+ "epoch": 0.59,
470
+ "learning_rate": 1.672300890261317e-05,
471
+ "loss": 2.4756,
472
+ "step": 76
473
+ },
474
+ {
475
+ "epoch": 0.6,
476
+ "learning_rate": 1.662753422842123e-05,
477
+ "loss": 2.4492,
478
+ "step": 77
479
+ },
480
+ {
481
+ "epoch": 0.61,
482
+ "learning_rate": 1.6530969837532487e-05,
483
+ "loss": 2.4141,
484
+ "step": 78
485
+ },
486
+ {
487
+ "epoch": 0.61,
488
+ "learning_rate": 1.6433331607319342e-05,
489
+ "loss": 2.459,
490
+ "step": 79
491
+ },
492
+ {
493
+ "epoch": 0.62,
494
+ "learning_rate": 1.63346355917177e-05,
495
+ "loss": 2.4434,
496
+ "step": 80
497
+ },
498
+ {
499
+ "epoch": 0.63,
500
+ "learning_rate": 1.6234898018587336e-05,
501
+ "loss": 2.4854,
502
+ "step": 81
503
+ },
504
+ {
505
+ "epoch": 0.64,
506
+ "learning_rate": 1.6134135287043668e-05,
507
+ "loss": 2.3984,
508
+ "step": 82
509
+ },
510
+ {
511
+ "epoch": 0.64,
512
+ "learning_rate": 1.6032363964761363e-05,
513
+ "loss": 2.4277,
514
+ "step": 83
515
+ },
516
+ {
517
+ "epoch": 0.65,
518
+ "learning_rate": 1.592960078525026e-05,
519
+ "loss": 2.415,
520
+ "step": 84
521
+ },
522
+ {
523
+ "epoch": 0.66,
524
+ "learning_rate": 1.5825862645103962e-05,
525
+ "loss": 2.3994,
526
+ "step": 85
527
+ },
528
+ {
529
+ "epoch": 0.67,
530
+ "learning_rate": 1.5721166601221697e-05,
531
+ "loss": 2.4014,
532
+ "step": 86
533
+ },
534
+ {
535
+ "epoch": 0.68,
536
+ "learning_rate": 1.561552986800375e-05,
537
+ "loss": 2.4766,
538
+ "step": 87
539
+ },
540
+ {
541
+ "epoch": 0.68,
542
+ "learning_rate": 1.5508969814521026e-05,
543
+ "loss": 2.4268,
544
+ "step": 88
545
+ },
546
+ {
547
+ "epoch": 0.69,
548
+ "learning_rate": 1.5401503961659202e-05,
549
+ "loss": 2.4688,
550
+ "step": 89
551
+ },
552
+ {
553
+ "epoch": 0.7,
554
+ "learning_rate": 1.5293149979237875e-05,
555
+ "loss": 2.4619,
556
+ "step": 90
557
+ },
558
+ {
559
+ "epoch": 0.71,
560
+ "learning_rate": 1.5183925683105254e-05,
561
+ "loss": 2.4678,
562
+ "step": 91
563
+ },
564
+ {
565
+ "epoch": 0.71,
566
+ "learning_rate": 1.5073849032208823e-05,
567
+ "loss": 2.4551,
568
+ "step": 92
569
+ },
570
+ {
571
+ "epoch": 0.72,
572
+ "learning_rate": 1.4962938125642504e-05,
573
+ "loss": 2.4502,
574
+ "step": 93
575
+ },
576
+ {
577
+ "epoch": 0.73,
578
+ "learning_rate": 1.485121119967072e-05,
579
+ "loss": 2.4707,
580
+ "step": 94
581
+ },
582
+ {
583
+ "epoch": 0.74,
584
+ "learning_rate": 1.4738686624729987e-05,
585
+ "loss": 2.4453,
586
+ "step": 95
587
+ },
588
+ {
589
+ "epoch": 0.75,
590
+ "learning_rate": 1.4625382902408356e-05,
591
+ "loss": 2.4443,
592
+ "step": 96
593
+ },
594
+ {
595
+ "epoch": 0.75,
596
+ "learning_rate": 1.4511318662403347e-05,
597
+ "loss": 2.4424,
598
+ "step": 97
599
+ },
600
+ {
601
+ "epoch": 0.76,
602
+ "learning_rate": 1.4396512659458824e-05,
603
+ "loss": 2.4375,
604
+ "step": 98
605
+ },
606
+ {
607
+ "epoch": 0.77,
608
+ "learning_rate": 1.4280983770281258e-05,
609
+ "loss": 2.4492,
610
+ "step": 99
611
+ },
612
+ {
613
+ "epoch": 0.78,
614
+ "learning_rate": 1.4164750990435991e-05,
615
+ "loss": 2.3975,
616
+ "step": 100
617
+ },
618
+ {
619
+ "epoch": 0.78,
620
+ "eval_loss": 2.415125846862793,
621
+ "eval_runtime": 46.8913,
622
+ "eval_samples_per_second": 3.604,
623
+ "eval_steps_per_second": 0.043,
624
+ "step": 100
625
+ },
626
+ {
627
+ "epoch": 0.78,
628
+ "learning_rate": 1.4047833431223938e-05,
629
+ "loss": 2.4238,
630
+ "step": 101
631
+ },
632
+ {
633
+ "epoch": 0.79,
634
+ "learning_rate": 1.3930250316539237e-05,
635
+ "loss": 2.4658,
636
+ "step": 102
637
+ },
638
+ {
639
+ "epoch": 0.8,
640
+ "learning_rate": 1.3812020979708418e-05,
641
+ "loss": 2.4521,
642
+ "step": 103
643
+ },
644
+ {
645
+ "epoch": 0.81,
646
+ "learning_rate": 1.3693164860311565e-05,
647
+ "loss": 2.4619,
648
+ "step": 104
649
+ },
650
+ {
651
+ "epoch": 0.82,
652
+ "learning_rate": 1.3573701500986012e-05,
653
+ "loss": 2.3975,
654
+ "step": 105
655
+ },
656
+ {
657
+ "epoch": 0.82,
658
+ "learning_rate": 1.3453650544213078e-05,
659
+ "loss": 2.4551,
660
+ "step": 106
661
+ },
662
+ {
663
+ "epoch": 0.83,
664
+ "learning_rate": 1.333303172908842e-05,
665
+ "loss": 2.4492,
666
+ "step": 107
667
+ },
668
+ {
669
+ "epoch": 0.84,
670
+ "learning_rate": 1.3211864888076458e-05,
671
+ "loss": 2.4092,
672
+ "step": 108
673
+ },
674
+ {
675
+ "epoch": 0.85,
676
+ "learning_rate": 1.3090169943749475e-05,
677
+ "loss": 2.4395,
678
+ "step": 109
679
+ },
680
+ {
681
+ "epoch": 0.85,
682
+ "learning_rate": 1.2967966905511906e-05,
683
+ "loss": 2.3906,
684
+ "step": 110
685
+ },
686
+ {
687
+ "epoch": 0.86,
688
+ "learning_rate": 1.2845275866310325e-05,
689
+ "loss": 2.4619,
690
+ "step": 111
691
+ },
692
+ {
693
+ "epoch": 0.87,
694
+ "learning_rate": 1.2722116999329712e-05,
695
+ "loss": 2.4443,
696
+ "step": 112
697
+ },
698
+ {
699
+ "epoch": 0.88,
700
+ "learning_rate": 1.259851055467653e-05,
701
+ "loss": 2.4629,
702
+ "step": 113
703
+ },
704
+ {
705
+ "epoch": 0.89,
706
+ "learning_rate": 1.2474476856049145e-05,
707
+ "loss": 2.4502,
708
+ "step": 114
709
+ },
710
+ {
711
+ "epoch": 0.89,
712
+ "learning_rate": 1.2350036297396153e-05,
713
+ "loss": 2.4736,
714
+ "step": 115
715
+ },
716
+ {
717
+ "epoch": 0.9,
718
+ "learning_rate": 1.2225209339563144e-05,
719
+ "loss": 2.4521,
720
+ "step": 116
721
+ },
722
+ {
723
+ "epoch": 0.91,
724
+ "learning_rate": 1.2100016506928494e-05,
725
+ "loss": 2.4775,
726
+ "step": 117
727
+ },
728
+ {
729
+ "epoch": 0.92,
730
+ "learning_rate": 1.1974478384028672e-05,
731
+ "loss": 2.3906,
732
+ "step": 118
733
+ },
734
+ {
735
+ "epoch": 0.92,
736
+ "learning_rate": 1.1848615612173689e-05,
737
+ "loss": 2.4521,
738
+ "step": 119
739
+ },
740
+ {
741
+ "epoch": 0.93,
742
+ "learning_rate": 1.172244888605319e-05,
743
+ "loss": 2.4844,
744
+ "step": 120
745
+ },
746
+ {
747
+ "epoch": 0.94,
748
+ "learning_rate": 1.1595998950333794e-05,
749
+ "loss": 2.4258,
750
+ "step": 121
751
+ },
752
+ {
753
+ "epoch": 0.95,
754
+ "learning_rate": 1.1469286596248181e-05,
755
+ "loss": 2.3906,
756
+ "step": 122
757
+ },
758
+ {
759
+ "epoch": 0.96,
760
+ "learning_rate": 1.1342332658176556e-05,
761
+ "loss": 2.4238,
762
+ "step": 123
763
+ },
764
+ {
765
+ "epoch": 0.96,
766
+ "learning_rate": 1.1215158010221005e-05,
767
+ "loss": 2.458,
768
+ "step": 124
769
+ },
770
+ {
771
+ "epoch": 0.97,
772
+ "learning_rate": 1.108778356277331e-05,
773
+ "loss": 2.4736,
774
+ "step": 125
775
+ },
776
+ {
777
+ "epoch": 0.98,
778
+ "learning_rate": 1.0960230259076819e-05,
779
+ "loss": 2.4062,
780
+ "step": 126
781
+ },
782
+ {
783
+ "epoch": 0.99,
784
+ "learning_rate": 1.0832519071782895e-05,
785
+ "loss": 2.4004,
786
+ "step": 127
787
+ },
788
+ {
789
+ "epoch": 0.99,
790
+ "learning_rate": 1.070467099950254e-05,
791
+ "loss": 2.4473,
792
+ "step": 128
793
+ },
794
+ {
795
+ "epoch": 1.0,
796
+ "learning_rate": 1.0576707063353745e-05,
797
+ "loss": 2.3799,
798
+ "step": 129
799
+ },
800
+ {
801
+ "epoch": 1.01,
802
+ "learning_rate": 1.044864830350515e-05,
803
+ "loss": 2.2168,
804
+ "step": 130
805
+ },
806
+ {
807
+ "epoch": 1.02,
808
+ "learning_rate": 1.0320515775716556e-05,
809
+ "loss": 2.1523,
810
+ "step": 131
811
+ },
812
+ {
813
+ "epoch": 1.03,
814
+ "learning_rate": 1.0192330547876871e-05,
815
+ "loss": 2.1826,
816
+ "step": 132
817
+ },
818
+ {
819
+ "epoch": 1.03,
820
+ "learning_rate": 1.0064113696540112e-05,
821
+ "loss": 2.1543,
822
+ "step": 133
823
+ },
824
+ {
825
+ "epoch": 1.04,
826
+ "learning_rate": 9.93588630345989e-06,
827
+ "loss": 2.1992,
828
+ "step": 134
829
+ },
830
+ {
831
+ "epoch": 1.05,
832
+ "learning_rate": 9.80766945212313e-06,
833
+ "loss": 2.1069,
834
+ "step": 135
835
+ },
836
+ {
837
+ "epoch": 1.06,
838
+ "learning_rate": 9.67948422428345e-06,
839
+ "loss": 2.1523,
840
+ "step": 136
841
+ },
842
+ {
843
+ "epoch": 1.06,
844
+ "learning_rate": 9.551351696494854e-06,
845
+ "loss": 2.1797,
846
+ "step": 137
847
+ },
848
+ {
849
+ "epoch": 1.07,
850
+ "learning_rate": 9.423292936646258e-06,
851
+ "loss": 2.1787,
852
+ "step": 138
853
+ },
854
+ {
855
+ "epoch": 1.08,
856
+ "learning_rate": 9.29532900049746e-06,
857
+ "loss": 2.2017,
858
+ "step": 139
859
+ },
860
+ {
861
+ "epoch": 1.09,
862
+ "learning_rate": 9.167480928217108e-06,
863
+ "loss": 2.1636,
864
+ "step": 140
865
+ },
866
+ {
867
+ "epoch": 1.1,
868
+ "learning_rate": 9.039769740923183e-06,
869
+ "loss": 2.1738,
870
+ "step": 141
871
+ },
872
+ {
873
+ "epoch": 1.1,
874
+ "learning_rate": 8.912216437226692e-06,
875
+ "loss": 2.1904,
876
+ "step": 142
877
+ },
878
+ {
879
+ "epoch": 1.11,
880
+ "learning_rate": 8.784841989778997e-06,
881
+ "loss": 2.1855,
882
+ "step": 143
883
+ },
884
+ {
885
+ "epoch": 1.12,
886
+ "learning_rate": 8.657667341823449e-06,
887
+ "loss": 2.1182,
888
+ "step": 144
889
+ },
890
+ {
891
+ "epoch": 1.13,
892
+ "learning_rate": 8.530713403751822e-06,
893
+ "loss": 2.1924,
894
+ "step": 145
895
+ },
896
+ {
897
+ "epoch": 1.13,
898
+ "learning_rate": 8.404001049666211e-06,
899
+ "loss": 2.1953,
900
+ "step": 146
901
+ },
902
+ {
903
+ "epoch": 1.14,
904
+ "learning_rate": 8.277551113946812e-06,
905
+ "loss": 2.1802,
906
+ "step": 147
907
+ },
908
+ {
909
+ "epoch": 1.15,
910
+ "learning_rate": 8.151384387826313e-06,
911
+ "loss": 2.1299,
912
+ "step": 148
913
+ },
914
+ {
915
+ "epoch": 1.16,
916
+ "learning_rate": 8.02552161597133e-06,
917
+ "loss": 2.166,
918
+ "step": 149
919
+ },
920
+ {
921
+ "epoch": 1.17,
922
+ "learning_rate": 7.899983493071506e-06,
923
+ "loss": 2.1167,
924
+ "step": 150
925
+ },
926
+ {
927
+ "epoch": 1.17,
928
+ "eval_loss": 2.4375,
929
+ "eval_runtime": 44.0835,
930
+ "eval_samples_per_second": 3.834,
931
+ "eval_steps_per_second": 0.045,
932
+ "step": 150
933
+ },
934
+ {
935
+ "epoch": 1.17,
936
+ "learning_rate": 7.774790660436857e-06,
937
+ "loss": 2.1729,
938
+ "step": 151
939
+ },
940
+ {
941
+ "epoch": 1.18,
942
+ "learning_rate": 7.649963702603848e-06,
943
+ "loss": 2.1719,
944
+ "step": 152
945
+ },
946
+ {
947
+ "epoch": 1.19,
948
+ "learning_rate": 7.525523143950859e-06,
949
+ "loss": 2.2061,
950
+ "step": 153
951
+ },
952
+ {
953
+ "epoch": 1.2,
954
+ "learning_rate": 7.401489445323473e-06,
955
+ "loss": 2.1426,
956
+ "step": 154
957
+ },
958
+ {
959
+ "epoch": 1.2,
960
+ "learning_rate": 7.27788300067029e-06,
961
+ "loss": 2.1987,
962
+ "step": 155
963
+ },
964
+ {
965
+ "epoch": 1.21,
966
+ "learning_rate": 7.154724133689677e-06,
967
+ "loss": 2.1572,
968
+ "step": 156
969
+ },
970
+ {
971
+ "epoch": 1.22,
972
+ "learning_rate": 7.032033094488094e-06,
973
+ "loss": 2.1465,
974
+ "step": 157
975
+ },
976
+ {
977
+ "epoch": 1.23,
978
+ "learning_rate": 6.909830056250527e-06,
979
+ "loss": 2.1411,
980
+ "step": 158
981
+ },
982
+ {
983
+ "epoch": 1.23,
984
+ "learning_rate": 6.788135111923545e-06,
985
+ "loss": 2.1548,
986
+ "step": 159
987
+ },
988
+ {
989
+ "epoch": 1.24,
990
+ "learning_rate": 6.666968270911585e-06,
991
+ "loss": 2.1138,
992
+ "step": 160
993
+ },
994
+ {
995
+ "epoch": 1.25,
996
+ "learning_rate": 6.546349455786926e-06,
997
+ "loss": 2.1548,
998
+ "step": 161
999
+ },
1000
+ {
1001
+ "epoch": 1.26,
1002
+ "learning_rate": 6.426298499013994e-06,
1003
+ "loss": 2.1782,
1004
+ "step": 162
1005
+ },
1006
+ {
1007
+ "epoch": 1.27,
1008
+ "learning_rate": 6.306835139688439e-06,
1009
+ "loss": 2.1621,
1010
+ "step": 163
1011
+ },
1012
+ {
1013
+ "epoch": 1.27,
1014
+ "learning_rate": 6.187979020291584e-06,
1015
+ "loss": 2.1738,
1016
+ "step": 164
1017
+ },
1018
+ {
1019
+ "epoch": 1.28,
1020
+ "learning_rate": 6.069749683460765e-06,
1021
+ "loss": 2.1221,
1022
+ "step": 165
1023
+ },
1024
+ {
1025
+ "epoch": 1.29,
1026
+ "learning_rate": 5.952166568776062e-06,
1027
+ "loss": 2.1304,
1028
+ "step": 166
1029
+ },
1030
+ {
1031
+ "epoch": 1.3,
1032
+ "learning_rate": 5.835249009564013e-06,
1033
+ "loss": 2.1885,
1034
+ "step": 167
1035
+ },
1036
+ {
1037
+ "epoch": 1.3,
1038
+ "learning_rate": 5.719016229718748e-06,
1039
+ "loss": 2.1777,
1040
+ "step": 168
1041
+ },
1042
+ {
1043
+ "epoch": 1.31,
1044
+ "learning_rate": 5.60348734054118e-06,
1045
+ "loss": 2.1304,
1046
+ "step": 169
1047
+ },
1048
+ {
1049
+ "epoch": 1.32,
1050
+ "learning_rate": 5.488681337596653e-06,
1051
+ "loss": 2.1294,
1052
+ "step": 170
1053
+ },
1054
+ {
1055
+ "epoch": 1.33,
1056
+ "learning_rate": 5.37461709759165e-06,
1057
+ "loss": 2.1592,
1058
+ "step": 171
1059
+ },
1060
+ {
1061
+ "epoch": 1.34,
1062
+ "learning_rate": 5.2613133752700145e-06,
1063
+ "loss": 2.1367,
1064
+ "step": 172
1065
+ },
1066
+ {
1067
+ "epoch": 1.34,
1068
+ "learning_rate": 5.148788800329279e-06,
1069
+ "loss": 2.124,
1070
+ "step": 173
1071
+ },
1072
+ {
1073
+ "epoch": 1.35,
1074
+ "learning_rate": 5.037061874357503e-06,
1075
+ "loss": 2.1538,
1076
+ "step": 174
1077
+ },
1078
+ {
1079
+ "epoch": 1.36,
1080
+ "learning_rate": 4.92615096779118e-06,
1081
+ "loss": 2.1382,
1082
+ "step": 175
1083
+ },
1084
+ {
1085
+ "epoch": 1.37,
1086
+ "learning_rate": 4.81607431689475e-06,
1087
+ "loss": 2.1826,
1088
+ "step": 176
1089
+ },
1090
+ {
1091
+ "epoch": 1.37,
1092
+ "learning_rate": 4.706850020762126e-06,
1093
+ "loss": 2.167,
1094
+ "step": 177
1095
+ },
1096
+ {
1097
+ "epoch": 1.38,
1098
+ "learning_rate": 4.598496038340801e-06,
1099
+ "loss": 2.1699,
1100
+ "step": 178
1101
+ },
1102
+ {
1103
+ "epoch": 1.39,
1104
+ "learning_rate": 4.491030185478976e-06,
1105
+ "loss": 2.1533,
1106
+ "step": 179
1107
+ },
1108
+ {
1109
+ "epoch": 1.4,
1110
+ "learning_rate": 4.3844701319962525e-06,
1111
+ "loss": 2.1255,
1112
+ "step": 180
1113
+ },
1114
+ {
1115
+ "epoch": 1.41,
1116
+ "learning_rate": 4.278833398778306e-06,
1117
+ "loss": 2.1577,
1118
+ "step": 181
1119
+ },
1120
+ {
1121
+ "epoch": 1.41,
1122
+ "learning_rate": 4.17413735489604e-06,
1123
+ "loss": 2.1519,
1124
+ "step": 182
1125
+ },
1126
+ {
1127
+ "epoch": 1.42,
1128
+ "learning_rate": 4.070399214749743e-06,
1129
+ "loss": 2.1636,
1130
+ "step": 183
1131
+ },
1132
+ {
1133
+ "epoch": 1.43,
1134
+ "learning_rate": 3.967636035238636e-06,
1135
+ "loss": 2.1699,
1136
+ "step": 184
1137
+ },
1138
+ {
1139
+ "epoch": 1.44,
1140
+ "learning_rate": 3.865864712956336e-06,
1141
+ "loss": 2.1719,
1142
+ "step": 185
1143
+ },
1144
+ {
1145
+ "epoch": 1.44,
1146
+ "learning_rate": 3.7651019814126656e-06,
1147
+ "loss": 2.1538,
1148
+ "step": 186
1149
+ },
1150
+ {
1151
+ "epoch": 1.45,
1152
+ "learning_rate": 3.665364408282305e-06,
1153
+ "loss": 2.2119,
1154
+ "step": 187
1155
+ },
1156
+ {
1157
+ "epoch": 1.46,
1158
+ "learning_rate": 3.5666683926806623e-06,
1159
+ "loss": 2.1455,
1160
+ "step": 188
1161
+ },
1162
+ {
1163
+ "epoch": 1.47,
1164
+ "learning_rate": 3.4690301624675127e-06,
1165
+ "loss": 2.1162,
1166
+ "step": 189
1167
+ },
1168
+ {
1169
+ "epoch": 1.48,
1170
+ "learning_rate": 3.372465771578771e-06,
1171
+ "loss": 2.0981,
1172
+ "step": 190
1173
+ },
1174
+ {
1175
+ "epoch": 1.48,
1176
+ "learning_rate": 3.2769910973868314e-06,
1177
+ "loss": 2.1162,
1178
+ "step": 191
1179
+ },
1180
+ {
1181
+ "epoch": 1.49,
1182
+ "learning_rate": 3.1826218380900066e-06,
1183
+ "loss": 2.1655,
1184
+ "step": 192
1185
+ },
1186
+ {
1187
+ "epoch": 1.5,
1188
+ "learning_rate": 3.089373510131354e-06,
1189
+ "loss": 2.1724,
1190
+ "step": 193
1191
+ },
1192
+ {
1193
+ "epoch": 1.51,
1194
+ "learning_rate": 2.9972614456474537e-06,
1195
+ "loss": 2.0962,
1196
+ "step": 194
1197
+ },
1198
+ {
1199
+ "epoch": 1.51,
1200
+ "learning_rate": 2.9063007899474214e-06,
1201
+ "loss": 2.1387,
1202
+ "step": 195
1203
+ },
1204
+ {
1205
+ "epoch": 1.52,
1206
+ "learning_rate": 2.8165064990227255e-06,
1207
+ "loss": 2.1211,
1208
+ "step": 196
1209
+ },
1210
+ {
1211
+ "epoch": 1.53,
1212
+ "learning_rate": 2.7278933370880267e-06,
1213
+ "loss": 2.1543,
1214
+ "step": 197
1215
+ },
1216
+ {
1217
+ "epoch": 1.54,
1218
+ "learning_rate": 2.640475874153651e-06,
1219
+ "loss": 2.1494,
1220
+ "step": 198
1221
+ },
1222
+ {
1223
+ "epoch": 1.55,
1224
+ "learning_rate": 2.5542684836299316e-06,
1225
+ "loss": 2.208,
1226
+ "step": 199
1227
+ },
1228
+ {
1229
+ "epoch": 1.55,
1230
+ "learning_rate": 2.469285339963892e-06,
1231
+ "loss": 2.1606,
1232
+ "step": 200
1233
+ },
1234
+ {
1235
+ "epoch": 1.55,
1236
+ "eval_loss": 2.4366679191589355,
1237
+ "eval_runtime": 44.9926,
1238
+ "eval_samples_per_second": 3.756,
1239
+ "eval_steps_per_second": 0.044,
1240
+ "step": 200
1241
+ },
1242
+ {
1243
+ "epoch": 1.56,
1244
+ "learning_rate": 2.3855404163086558e-06,
1245
+ "loss": 2.1528,
1246
+ "step": 201
1247
+ },
1248
+ {
1249
+ "epoch": 1.57,
1250
+ "learning_rate": 2.3030474822259396e-06,
1251
+ "loss": 2.1606,
1252
+ "step": 202
1253
+ },
1254
+ {
1255
+ "epoch": 1.58,
1256
+ "learning_rate": 2.2218201014220266e-06,
1257
+ "loss": 2.1572,
1258
+ "step": 203
1259
+ },
1260
+ {
1261
+ "epoch": 1.58,
1262
+ "learning_rate": 2.1418716295175766e-06,
1263
+ "loss": 2.1582,
1264
+ "step": 204
1265
+ },
1266
+ {
1267
+ "epoch": 1.59,
1268
+ "learning_rate": 2.063215211851678e-06,
1269
+ "loss": 2.1406,
1270
+ "step": 205
1271
+ },
1272
+ {
1273
+ "epoch": 1.6,
1274
+ "learning_rate": 1.9858637813204352e-06,
1275
+ "loss": 2.1709,
1276
+ "step": 206
1277
+ },
1278
+ {
1279
+ "epoch": 1.61,
1280
+ "learning_rate": 1.9098300562505266e-06,
1281
+ "loss": 2.1826,
1282
+ "step": 207
1283
+ },
1284
+ {
1285
+ "epoch": 1.62,
1286
+ "learning_rate": 1.835126538308013e-06,
1287
+ "loss": 2.1416,
1288
+ "step": 208
1289
+ },
1290
+ {
1291
+ "epoch": 1.62,
1292
+ "learning_rate": 1.7617655104427833e-06,
1293
+ "loss": 2.1665,
1294
+ "step": 209
1295
+ },
1296
+ {
1297
+ "epoch": 1.63,
1298
+ "learning_rate": 1.6897590348689607e-06,
1299
+ "loss": 2.1582,
1300
+ "step": 210
1301
+ },
1302
+ {
1303
+ "epoch": 1.64,
1304
+ "learning_rate": 1.6191189510815942e-06,
1305
+ "loss": 2.144,
1306
+ "step": 211
1307
+ },
1308
+ {
1309
+ "epoch": 1.65,
1310
+ "learning_rate": 1.5498568739099907e-06,
1311
+ "loss": 2.1685,
1312
+ "step": 212
1313
+ },
1314
+ {
1315
+ "epoch": 1.65,
1316
+ "learning_rate": 1.481984191607959e-06,
1317
+ "loss": 2.1343,
1318
+ "step": 213
1319
+ },
1320
+ {
1321
+ "epoch": 1.66,
1322
+ "learning_rate": 1.4155120639813392e-06,
1323
+ "loss": 2.1528,
1324
+ "step": 214
1325
+ },
1326
+ {
1327
+ "epoch": 1.67,
1328
+ "learning_rate": 1.350451420553065e-06,
1329
+ "loss": 2.1411,
1330
+ "step": 215
1331
+ },
1332
+ {
1333
+ "epoch": 1.68,
1334
+ "learning_rate": 1.286812958766106e-06,
1335
+ "loss": 2.1289,
1336
+ "step": 216
1337
+ },
1338
+ {
1339
+ "epoch": 1.69,
1340
+ "learning_rate": 1.224607142224572e-06,
1341
+ "loss": 2.127,
1342
+ "step": 217
1343
+ },
1344
+ {
1345
+ "epoch": 1.69,
1346
+ "learning_rate": 1.1638441989732474e-06,
1347
+ "loss": 2.1367,
1348
+ "step": 218
1349
+ },
1350
+ {
1351
+ "epoch": 1.7,
1352
+ "learning_rate": 1.1045341198158833e-06,
1353
+ "loss": 2.1021,
1354
+ "step": 219
1355
+ },
1356
+ {
1357
+ "epoch": 1.71,
1358
+ "learning_rate": 1.0466866566724698e-06,
1359
+ "loss": 2.1436,
1360
+ "step": 220
1361
+ },
1362
+ {
1363
+ "epoch": 1.72,
1364
+ "learning_rate": 9.903113209758098e-07,
1365
+ "loss": 2.1509,
1366
+ "step": 221
1367
+ },
1368
+ {
1369
+ "epoch": 1.72,
1370
+ "learning_rate": 9.354173821076184e-07,
1371
+ "loss": 2.1665,
1372
+ "step": 222
1373
+ },
1374
+ {
1375
+ "epoch": 1.73,
1376
+ "learning_rate": 8.820138658744304e-07,
1377
+ "loss": 2.1162,
1378
+ "step": 223
1379
+ },
1380
+ {
1381
+ "epoch": 1.74,
1382
+ "learning_rate": 8.301095530235492e-07,
1383
+ "loss": 2.1104,
1384
+ "step": 224
1385
+ },
1386
+ {
1387
+ "epoch": 1.75,
1388
+ "learning_rate": 7.797129777992951e-07,
1389
+ "loss": 2.1348,
1390
+ "step": 225
1391
+ },
1392
+ {
1393
+ "epoch": 1.76,
1394
+ "learning_rate": 7.308324265397837e-07,
1395
+ "loss": 2.1562,
1396
+ "step": 226
1397
+ },
1398
+ {
1399
+ "epoch": 1.76,
1400
+ "learning_rate": 6.834759363144595e-07,
1401
+ "loss": 2.1543,
1402
+ "step": 227
1403
+ },
1404
+ {
1405
+ "epoch": 1.77,
1406
+ "learning_rate": 6.37651293602628e-07,
1407
+ "loss": 2.1357,
1408
+ "step": 228
1409
+ },
1410
+ {
1411
+ "epoch": 1.78,
1412
+ "learning_rate": 5.933660330131752e-07,
1413
+ "loss": 2.1392,
1414
+ "step": 229
1415
+ },
1416
+ {
1417
+ "epoch": 1.79,
1418
+ "learning_rate": 5.506274360457087e-07,
1419
+ "loss": 2.123,
1420
+ "step": 230
1421
+ },
1422
+ {
1423
+ "epoch": 1.79,
1424
+ "learning_rate": 5.094425298933136e-07,
1425
+ "loss": 2.1606,
1426
+ "step": 231
1427
+ },
1428
+ {
1429
+ "epoch": 1.8,
1430
+ "learning_rate": 4.6981808628712823e-07,
1431
+ "loss": 2.0991,
1432
+ "step": 232
1433
+ },
1434
+ {
1435
+ "epoch": 1.81,
1436
+ "learning_rate": 4.3176062038291275e-07,
1437
+ "loss": 2.1582,
1438
+ "step": 233
1439
+ },
1440
+ {
1441
+ "epoch": 1.82,
1442
+ "learning_rate": 3.9527638968980707e-07,
1443
+ "loss": 2.1929,
1444
+ "step": 234
1445
+ },
1446
+ {
1447
+ "epoch": 1.83,
1448
+ "learning_rate": 3.603713930414676e-07,
1449
+ "loss": 2.0874,
1450
+ "step": 235
1451
+ },
1452
+ {
1453
+ "epoch": 1.83,
1454
+ "learning_rate": 3.2705136960970554e-07,
1455
+ "loss": 2.1299,
1456
+ "step": 236
1457
+ },
1458
+ {
1459
+ "epoch": 1.84,
1460
+ "learning_rate": 2.9532179796085356e-07,
1461
+ "loss": 2.1704,
1462
+ "step": 237
1463
+ },
1464
+ {
1465
+ "epoch": 1.85,
1466
+ "learning_rate": 2.6518789515495356e-07,
1467
+ "loss": 2.1382,
1468
+ "step": 238
1469
+ },
1470
+ {
1471
+ "epoch": 1.86,
1472
+ "learning_rate": 2.3665461588795902e-07,
1473
+ "loss": 2.1689,
1474
+ "step": 239
1475
+ },
1476
+ {
1477
+ "epoch": 1.86,
1478
+ "learning_rate": 2.097266516770713e-07,
1479
+ "loss": 2.1436,
1480
+ "step": 240
1481
+ },
1482
+ {
1483
+ "epoch": 1.87,
1484
+ "learning_rate": 1.844084300893456e-07,
1485
+ "loss": 2.1108,
1486
+ "step": 241
1487
+ },
1488
+ {
1489
+ "epoch": 1.88,
1490
+ "learning_rate": 1.6070411401370335e-07,
1491
+ "loss": 2.1206,
1492
+ "step": 242
1493
+ },
1494
+ {
1495
+ "epoch": 1.89,
1496
+ "learning_rate": 1.3861760097645062e-07,
1497
+ "loss": 2.1118,
1498
+ "step": 243
1499
+ },
1500
+ {
1501
+ "epoch": 1.9,
1502
+ "learning_rate": 1.1815252250044318e-07,
1503
+ "loss": 2.1738,
1504
+ "step": 244
1505
+ },
1506
+ {
1507
+ "epoch": 1.9,
1508
+ "learning_rate": 9.931224350798185e-08,
1509
+ "loss": 2.1328,
1510
+ "step": 245
1511
+ },
1512
+ {
1513
+ "epoch": 1.91,
1514
+ "learning_rate": 8.209986176753947e-08,
1515
+ "loss": 2.1538,
1516
+ "step": 246
1517
+ },
1518
+ {
1519
+ "epoch": 1.92,
1520
+ "learning_rate": 6.65182073844195e-08,
1521
+ "loss": 2.1338,
1522
+ "step": 247
1523
+ },
1524
+ {
1525
+ "epoch": 1.93,
1526
+ "learning_rate": 5.256984233542595e-08,
1527
+ "loss": 2.1455,
1528
+ "step": 248
1529
+ },
1530
+ {
1531
+ "epoch": 1.93,
1532
+ "learning_rate": 4.025706004760932e-08,
1533
+ "loss": 2.1831,
1534
+ "step": 249
1535
+ },
1536
+ {
1537
+ "epoch": 1.94,
1538
+ "learning_rate": 2.9581885021181534e-08,
1539
+ "loss": 2.1304,
1540
+ "step": 250
1541
+ },
1542
+ {
1543
+ "epoch": 1.94,
1544
+ "eval_loss": 2.4366679191589355,
1545
+ "eval_runtime": 40.7598,
1546
+ "eval_samples_per_second": 4.146,
1547
+ "eval_steps_per_second": 0.049,
1548
+ "step": 250
1549
+ },
1550
+ {
1551
+ "epoch": 1.96,
1552
+ "learning_rate": 2.054607249663665e-08,
1553
+ "loss": 2.1387,
1554
+ "step": 251
1555
+ },
1556
+ {
1557
+ "epoch": 1.96,
1558
+ "learning_rate": 1.3151108166156168e-08,
1559
+ "loss": 2.1406,
1560
+ "step": 252
1561
+ },
1562
+ {
1563
+ "epoch": 1.97,
1564
+ "learning_rate": 7.3982079293233314e-09,
1565
+ "loss": 2.1309,
1566
+ "step": 253
1567
+ },
1568
+ {
1569
+ "epoch": 1.98,
1570
+ "learning_rate": 3.2883176932019255e-09,
1571
+ "loss": 2.1133,
1572
+ "step": 254
1573
+ },
1574
+ {
1575
+ "epoch": 1.99,
1576
+ "learning_rate": 8.221132168073631e-10,
1577
+ "loss": 2.1543,
1578
+ "step": 255
1579
+ },
1580
+ {
1581
+ "epoch": 1.99,
1582
+ "learning_rate": 0.0,
1583
+ "loss": 2.1475,
1584
+ "step": 256
1585
+ }
1586
+ ],
1587
+ "max_steps": 256,
1588
+ "num_train_epochs": 2,
1589
+ "total_flos": 83249552424960.0,
1590
+ "trial_name": null,
1591
+ "trial_params": null
1592
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a95bb91ac445ca680f147f9c52cedc230507eaf729b4551416a08d2430966a5
3
+ size 4591
zero_to_fp32.py ADDED
@@ -0,0 +1,578 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example: python zero_to_fp32.py . pytorch_model.bin
14
+
15
+ import argparse
16
+ import torch
17
+ import glob
18
+ import math
19
+ import os
20
+ import re
21
+ from collections import OrderedDict
22
+ from dataclasses import dataclass
23
+
24
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
25
+ # DeepSpeed data structures it has to be available in the current python environment.
26
+ from deepspeed.utils import logger
27
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
28
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
29
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
30
+
31
+
32
+ @dataclass
33
+ class zero_model_state:
34
+ buffers: dict()
35
+ param_shapes: dict()
36
+ shared_params: list
37
+ ds_version: int
38
+ frozen_param_shapes: dict()
39
+ frozen_param_fragments: dict()
40
+
41
+
42
+ debug = 0
43
+
44
+ # load to cpu
45
+ device = torch.device('cpu')
46
+
47
+
48
+ def atoi(text):
49
+ return int(text) if text.isdigit() else text
50
+
51
+
52
+ def natural_keys(text):
53
+ '''
54
+ alist.sort(key=natural_keys) sorts in human order
55
+ http://nedbatchelder.com/blog/200712/human_sorting.html
56
+ (See Toothy's implementation in the comments)
57
+ '''
58
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
59
+
60
+
61
+ def get_model_state_file(checkpoint_dir, zero_stage):
62
+ if not os.path.isdir(checkpoint_dir):
63
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
64
+
65
+ # there should be only one file
66
+ if zero_stage == 2:
67
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
68
+ elif zero_stage == 3:
69
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
70
+
71
+ if not os.path.exists(file):
72
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
73
+
74
+ return file
75
+
76
+
77
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
78
+ # XXX: need to test that this simple glob rule works for multi-node setup too
79
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
80
+
81
+ if len(ckpt_files) == 0:
82
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
83
+
84
+ return ckpt_files
85
+
86
+
87
+ def get_optim_files(checkpoint_dir):
88
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
89
+
90
+
91
+ def get_model_state_files(checkpoint_dir):
92
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
93
+
94
+
95
+ def parse_model_states(files):
96
+ zero_model_states = []
97
+ for file in files:
98
+ state_dict = torch.load(file, map_location=device)
99
+
100
+ if BUFFER_NAMES not in state_dict:
101
+ raise ValueError(f"{file} is not a model state checkpoint")
102
+ buffer_names = state_dict[BUFFER_NAMES]
103
+ if debug:
104
+ print("Found buffers:", buffer_names)
105
+
106
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
107
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
108
+ param_shapes = state_dict[PARAM_SHAPES]
109
+
110
+ # collect parameters that are included in param_shapes
111
+ param_names = []
112
+ for s in param_shapes:
113
+ for name in s.keys():
114
+ param_names.append(name)
115
+
116
+ # update with frozen parameters
117
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
118
+ if frozen_param_shapes is not None:
119
+ if debug:
120
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
121
+ param_names += list(frozen_param_shapes.keys())
122
+
123
+ # handle shared params
124
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
125
+
126
+ ds_version = state_dict.get(DS_VERSION, None)
127
+
128
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
129
+
130
+ z_model_state = zero_model_state(buffers=buffers,
131
+ param_shapes=param_shapes,
132
+ shared_params=shared_params,
133
+ ds_version=ds_version,
134
+ frozen_param_shapes=frozen_param_shapes,
135
+ frozen_param_fragments=frozen_param_fragments)
136
+ zero_model_states.append(z_model_state)
137
+
138
+ return zero_model_states
139
+
140
+
141
+ def parse_optim_states(files, ds_checkpoint_dir):
142
+
143
+ total_files = len(files)
144
+ state_dicts = []
145
+ for f in files:
146
+ state_dicts.append(torch.load(f, map_location=device))
147
+
148
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
149
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
150
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
151
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
152
+
153
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
154
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
155
+ # use the max of the partition_count to get the dp world_size.
156
+
157
+ if type(world_size) is list:
158
+ world_size = max(world_size)
159
+
160
+ if world_size != total_files:
161
+ raise ValueError(
162
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
163
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
164
+ )
165
+
166
+ # the groups are named differently in each stage
167
+ if zero_stage == 2:
168
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
169
+ elif zero_stage == 3:
170
+ fp32_groups_key = FP32_FLAT_GROUPS
171
+ else:
172
+ raise ValueError(f"unknown zero stage {zero_stage}")
173
+
174
+ if zero_stage == 2:
175
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
176
+ elif zero_stage == 3:
177
+ # if there is more than one param group, there will be multiple flattened tensors - one
178
+ # flattened tensor per group - for simplicity merge them into a single tensor
179
+ #
180
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
181
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
182
+
183
+ fp32_flat_groups = [
184
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
185
+ ]
186
+
187
+ return zero_stage, world_size, fp32_flat_groups
188
+
189
+
190
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir):
191
+ """
192
+ Returns fp32 state_dict reconstructed from ds checkpoint
193
+
194
+ Args:
195
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
196
+
197
+ """
198
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
199
+
200
+ optim_files = get_optim_files(ds_checkpoint_dir)
201
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
202
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
203
+
204
+ model_files = get_model_state_files(ds_checkpoint_dir)
205
+
206
+ zero_model_states = parse_model_states(model_files)
207
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
208
+
209
+ if zero_stage == 2:
210
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states)
211
+ elif zero_stage == 3:
212
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states)
213
+
214
+
215
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
216
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
217
+ return
218
+
219
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
220
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
221
+
222
+ if debug:
223
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
224
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
225
+
226
+ wanted_params = len(frozen_param_shapes)
227
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
228
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
229
+ print(f'Frozen params: Have {avail_numel} numels to process.')
230
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
231
+
232
+ total_params = 0
233
+ total_numel = 0
234
+ for name, shape in frozen_param_shapes.items():
235
+ total_params += 1
236
+ unpartitioned_numel = shape.numel()
237
+ total_numel += unpartitioned_numel
238
+
239
+ state_dict[name] = frozen_param_fragments[name]
240
+
241
+ if debug:
242
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
243
+
244
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
245
+
246
+
247
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
248
+ param_shapes = zero_model_states[0].param_shapes
249
+
250
+ # Reconstruction protocol:
251
+ #
252
+ # XXX: document this
253
+
254
+ if debug:
255
+ for i in range(world_size):
256
+ for j in range(len(fp32_flat_groups[0])):
257
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
258
+
259
+ # XXX: memory usage doubles here (zero2)
260
+ num_param_groups = len(fp32_flat_groups[0])
261
+ merged_single_partition_of_fp32_groups = []
262
+ for i in range(num_param_groups):
263
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
264
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
265
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
266
+ avail_numel = sum(
267
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
268
+
269
+ if debug:
270
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
271
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
272
+ # not asserting if there is a mismatch due to possible padding
273
+ print(f"Have {avail_numel} numels to process.")
274
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
275
+
276
+ # params
277
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
278
+ # out-of-core computing solution
279
+ total_numel = 0
280
+ total_params = 0
281
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
282
+ offset = 0
283
+ avail_numel = full_single_fp32_vector.numel()
284
+ for name, shape in shapes.items():
285
+
286
+ unpartitioned_numel = shape.numel()
287
+ total_numel += unpartitioned_numel
288
+ total_params += 1
289
+
290
+ if debug:
291
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
292
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
293
+ offset += unpartitioned_numel
294
+
295
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
296
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
297
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
298
+ # live optimizer object, so we are checking that the numbers are within the right range
299
+ align_to = 2 * world_size
300
+
301
+ def zero2_align(x):
302
+ return align_to * math.ceil(x / align_to)
303
+
304
+ if debug:
305
+ print(f"original offset={offset}, avail_numel={avail_numel}")
306
+
307
+ offset = zero2_align(offset)
308
+ avail_numel = zero2_align(avail_numel)
309
+
310
+ if debug:
311
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
312
+
313
+ # Sanity check
314
+ if offset != avail_numel:
315
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
316
+
317
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
318
+
319
+
320
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states):
321
+ state_dict = OrderedDict()
322
+
323
+ # buffers
324
+ buffers = zero_model_states[0].buffers
325
+ state_dict.update(buffers)
326
+ if debug:
327
+ print(f"added {len(buffers)} buffers")
328
+
329
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
330
+
331
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
332
+
333
+ # recover shared parameters
334
+ for pair in zero_model_states[0].shared_params:
335
+ if pair[1] in state_dict:
336
+ state_dict[pair[0]] = state_dict[pair[1]]
337
+
338
+ return state_dict
339
+
340
+
341
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
342
+ remainder = unpartitioned_numel % world_size
343
+ padding_numel = (world_size - remainder) if remainder else 0
344
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
345
+ return partitioned_numel, padding_numel
346
+
347
+
348
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
349
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
350
+ return
351
+
352
+ if debug:
353
+ for i in range(world_size):
354
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
355
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
356
+
357
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
358
+ wanted_params = len(frozen_param_shapes)
359
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
360
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
361
+ print(f'Frozen params: Have {avail_numel} numels to process.')
362
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
363
+
364
+ total_params = 0
365
+ total_numel = 0
366
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
367
+ total_params += 1
368
+ unpartitioned_numel = shape.numel()
369
+ total_numel += unpartitioned_numel
370
+
371
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
372
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
373
+
374
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
375
+
376
+ if debug:
377
+ print(
378
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
379
+ )
380
+
381
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
382
+
383
+
384
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
385
+ param_shapes = zero_model_states[0].param_shapes
386
+ avail_numel = fp32_flat_groups[0].numel() * world_size
387
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
388
+ # param, re-consolidating each param, while dealing with padding if any
389
+
390
+ # merge list of dicts, preserving order
391
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
392
+
393
+ if debug:
394
+ for i in range(world_size):
395
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
396
+
397
+ wanted_params = len(param_shapes)
398
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
399
+ # not asserting if there is a mismatch due to possible padding
400
+ avail_numel = fp32_flat_groups[0].numel() * world_size
401
+ print(f"Trainable params: Have {avail_numel} numels to process.")
402
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
403
+
404
+ # params
405
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
406
+ # out-of-core computing solution
407
+ offset = 0
408
+ total_numel = 0
409
+ total_params = 0
410
+ for name, shape in param_shapes.items():
411
+
412
+ unpartitioned_numel = shape.numel()
413
+ total_numel += unpartitioned_numel
414
+ total_params += 1
415
+
416
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
417
+
418
+ if debug:
419
+ print(
420
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
421
+ )
422
+
423
+ # XXX: memory usage doubles here
424
+ state_dict[name] = torch.cat(
425
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
426
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
427
+ offset += partitioned_numel
428
+
429
+ offset *= world_size
430
+
431
+ # Sanity check
432
+ if offset != avail_numel:
433
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
434
+
435
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
436
+
437
+
438
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states):
439
+ state_dict = OrderedDict()
440
+
441
+ # buffers
442
+ buffers = zero_model_states[0].buffers
443
+ state_dict.update(buffers)
444
+ if debug:
445
+ print(f"added {len(buffers)} buffers")
446
+
447
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
448
+
449
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
450
+
451
+ # recover shared parameters
452
+ for pair in zero_model_states[0].shared_params:
453
+ if pair[1] in state_dict:
454
+ state_dict[pair[0]] = state_dict[pair[1]]
455
+
456
+ return state_dict
457
+
458
+
459
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None):
460
+ """
461
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
462
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
463
+ via a model hub.
464
+
465
+ Args:
466
+ - ``checkpoint_dir``: path to the desired checkpoint folder
467
+ - ``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``
468
+
469
+ Returns:
470
+ - pytorch ``state_dict``
471
+
472
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
473
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
474
+ the checkpoint.
475
+
476
+ A typical usage might be ::
477
+
478
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
479
+ # do the training and checkpoint saving
480
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
481
+ model = model.cpu() # move to cpu
482
+ model.load_state_dict(state_dict)
483
+ # submit to model hub or save the model to share with others
484
+
485
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
486
+ application. i.e. you will need to re-initialize the deepspeed engine, since
487
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
488
+
489
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
490
+
491
+ """
492
+ if tag is None:
493
+ latest_path = os.path.join(checkpoint_dir, 'latest')
494
+ if os.path.isfile(latest_path):
495
+ with open(latest_path, 'r') as fd:
496
+ tag = fd.read().strip()
497
+ else:
498
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
499
+
500
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
501
+
502
+ if not os.path.isdir(ds_checkpoint_dir):
503
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
504
+
505
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir)
506
+
507
+
508
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None):
509
+ """
510
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
511
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
512
+
513
+ Args:
514
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
515
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
516
+ - ``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``
517
+ """
518
+
519
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
520
+ print(f"Saving fp32 state dict to {output_file}")
521
+ torch.save(state_dict, output_file)
522
+
523
+
524
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
525
+ """
526
+ 1. Put the provided model to cpu
527
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
528
+ 3. Load it into the provided model
529
+
530
+ Args:
531
+ - ``model``: the model object to update
532
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
533
+ - ``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``
534
+
535
+ Returns:
536
+ - ``model`: modified model
537
+
538
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
539
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
540
+ conveniently placed for you in the checkpoint folder.
541
+
542
+ A typical usage might be ::
543
+
544
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
545
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
546
+ # submit to model hub or save the model to share with others
547
+
548
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
549
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
550
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
551
+
552
+ """
553
+ logger.info(f"Extracting fp32 weights")
554
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
555
+
556
+ logger.info(f"Overwriting model with fp32 weights")
557
+ model = model.cpu()
558
+ model.load_state_dict(state_dict, strict=False)
559
+
560
+ return model
561
+
562
+
563
+ if __name__ == "__main__":
564
+
565
+ parser = argparse.ArgumentParser()
566
+ parser.add_argument("checkpoint_dir",
567
+ type=str,
568
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
569
+ parser.add_argument(
570
+ "output_file",
571
+ type=str,
572
+ help="path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)")
573
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
574
+ args = parser.parse_args()
575
+
576
+ debug = args.debug
577
+
578
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir, args.output_file)