BleachNick commited on
Commit
e69bb69
1 Parent(s): db9ef4d

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ pytorch_model.bin filter=lfs diff=lfs merge=lfs -text
config.json ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_commit_hash": "fa9c7486149855fffd7f495aed428f2b025f4fd5",
3
+ "_name_or_path": "Salesforce/instructblip-flan-t5-xl",
4
+ "architectures": [
5
+ "InstructBlipForConditionalGeneration"
6
+ ],
7
+ "initializer_factor": 1.0,
8
+ "initializer_range": 0.02,
9
+ "is_encoder_decoder": true,
10
+ "model_type": "instructblip",
11
+ "num_query_tokens": 32,
12
+ "qformer_config": {
13
+ "_name_or_path": "",
14
+ "add_cross_attention": false,
15
+ "architectures": null,
16
+ "attention_probs_dropout_prob": 0.1,
17
+ "bad_words_ids": null,
18
+ "begin_suppress_tokens": null,
19
+ "bos_token_id": null,
20
+ "chunk_size_feed_forward": 0,
21
+ "classifier_dropout": null,
22
+ "cross_attention_frequency": 2,
23
+ "cross_attention_hidden_size": null,
24
+ "decoder_start_token_id": null,
25
+ "diversity_penalty": 0.0,
26
+ "do_sample": false,
27
+ "early_stopping": false,
28
+ "encoder_hidden_size": 1408,
29
+ "encoder_no_repeat_ngram_size": 0,
30
+ "eos_token_id": null,
31
+ "exponential_decay_length_penalty": null,
32
+ "finetuning_task": null,
33
+ "forced_bos_token_id": null,
34
+ "forced_eos_token_id": null,
35
+ "hidden_act": "gelu",
36
+ "hidden_dropout_prob": 0.1,
37
+ "hidden_size": 768,
38
+ "id2label": {
39
+ "0": "LABEL_0",
40
+ "1": "LABEL_1"
41
+ },
42
+ "initializer_range": 0.02,
43
+ "intermediate_size": 3072,
44
+ "is_decoder": false,
45
+ "is_encoder_decoder": false,
46
+ "label2id": {
47
+ "LABEL_0": 0,
48
+ "LABEL_1": 1
49
+ },
50
+ "layer_norm_eps": 1e-12,
51
+ "length_penalty": 1.0,
52
+ "max_length": 20,
53
+ "max_position_embeddings": 512,
54
+ "min_length": 0,
55
+ "model_type": "instructblip_qformer",
56
+ "no_repeat_ngram_size": 0,
57
+ "num_attention_heads": 12,
58
+ "num_beam_groups": 1,
59
+ "num_beams": 1,
60
+ "num_hidden_layers": 12,
61
+ "num_return_sequences": 1,
62
+ "output_attentions": false,
63
+ "output_hidden_states": false,
64
+ "output_scores": false,
65
+ "pad_token_id": 0,
66
+ "position_embedding_type": "absolute",
67
+ "prefix": null,
68
+ "problem_type": null,
69
+ "pruned_heads": {},
70
+ "remove_invalid_values": false,
71
+ "repetition_penalty": 1.0,
72
+ "return_dict": true,
73
+ "return_dict_in_generate": false,
74
+ "sep_token_id": null,
75
+ "suppress_tokens": null,
76
+ "task_specific_params": null,
77
+ "temperature": 1.0,
78
+ "tf_legacy_loss": false,
79
+ "tie_encoder_decoder": false,
80
+ "tie_word_embeddings": true,
81
+ "tokenizer_class": null,
82
+ "top_k": 50,
83
+ "top_p": 1.0,
84
+ "torch_dtype": null,
85
+ "torchscript": false,
86
+ "transformers_version": "4.29.2",
87
+ "typical_p": 1.0,
88
+ "use_bfloat16": false,
89
+ "vocab_size": 30623
90
+ },
91
+ "text_config": {
92
+ "_from_model_config": false,
93
+ "_name_or_path": "",
94
+ "add_cross_attention": false,
95
+ "architectures": [
96
+ "T5ForConditionalGeneration"
97
+ ],
98
+ "bad_words_ids": null,
99
+ "begin_suppress_tokens": null,
100
+ "bos_token_id": 1,
101
+ "chunk_size_feed_forward": 0,
102
+ "cross_attention_hidden_size": null,
103
+ "d_ff": 5120,
104
+ "d_kv": 64,
105
+ "d_model": 2048,
106
+ "decoder_start_token_id": 0,
107
+ "dense_act_fn": "gelu",
108
+ "diversity_penalty": 0.0,
109
+ "do_sample": false,
110
+ "dropout_rate": 0.1,
111
+ "early_stopping": false,
112
+ "encoder_no_repeat_ngram_size": 0,
113
+ "eos_token_id": 1,
114
+ "exponential_decay_length_penalty": null,
115
+ "feed_forward_proj": "gated-gelu",
116
+ "finetuning_task": null,
117
+ "forced_bos_token_id": null,
118
+ "forced_eos_token_id": null,
119
+ "id2label": {
120
+ "0": "LABEL_0",
121
+ "1": "LABEL_1"
122
+ },
123
+ "initializer_factor": 1.0,
124
+ "is_decoder": false,
125
+ "is_encoder_decoder": true,
126
+ "is_gated_act": true,
127
+ "label2id": {
128
+ "LABEL_0": 0,
129
+ "LABEL_1": 1
130
+ },
131
+ "layer_norm_epsilon": 1e-06,
132
+ "length_penalty": 1.0,
133
+ "max_length": 20,
134
+ "min_length": 0,
135
+ "model_type": "t5",
136
+ "n_positions": 512,
137
+ "no_repeat_ngram_size": 0,
138
+ "num_beam_groups": 1,
139
+ "num_beams": 1,
140
+ "num_decoder_layers": 24,
141
+ "num_heads": 32,
142
+ "num_layers": 24,
143
+ "num_return_sequences": 1,
144
+ "output_attentions": false,
145
+ "output_hidden_states": false,
146
+ "output_past": true,
147
+ "output_scores": false,
148
+ "pad_token_id": 0,
149
+ "prefix": null,
150
+ "problem_type": null,
151
+ "pruned_heads": {},
152
+ "relative_attention_max_distance": 128,
153
+ "relative_attention_num_buckets": 32,
154
+ "remove_invalid_values": false,
155
+ "repetition_penalty": 1.0,
156
+ "return_dict": true,
157
+ "return_dict_in_generate": false,
158
+ "sep_token_id": null,
159
+ "suppress_tokens": null,
160
+ "task_specific_params": {
161
+ "summarization": {
162
+ "early_stopping": true,
163
+ "length_penalty": 2.0,
164
+ "max_length": 200,
165
+ "min_length": 30,
166
+ "no_repeat_ngram_size": 3,
167
+ "num_beams": 4,
168
+ "prefix": "summarize: "
169
+ },
170
+ "translation_en_to_de": {
171
+ "early_stopping": true,
172
+ "max_length": 300,
173
+ "num_beams": 4,
174
+ "prefix": "translate English to German: "
175
+ },
176
+ "translation_en_to_fr": {
177
+ "early_stopping": true,
178
+ "max_length": 300,
179
+ "num_beams": 4,
180
+ "prefix": "translate English to French: "
181
+ },
182
+ "translation_en_to_ro": {
183
+ "early_stopping": true,
184
+ "max_length": 300,
185
+ "num_beams": 4,
186
+ "prefix": "translate English to Romanian: "
187
+ }
188
+ },
189
+ "temperature": 1.0,
190
+ "tf_legacy_loss": false,
191
+ "tie_encoder_decoder": false,
192
+ "tie_word_embeddings": false,
193
+ "tokenizer_class": null,
194
+ "top_k": 50,
195
+ "top_p": 1.0,
196
+ "torch_dtype": "float32",
197
+ "torchscript": false,
198
+ "transformers_version": "4.29.2",
199
+ "typical_p": 1.0,
200
+ "use_bfloat16": false,
201
+ "use_cache": true,
202
+ "vocab_size": 32128
203
+ },
204
+ "tie_word_embeddings": false,
205
+ "torch_dtype": "bfloat16",
206
+ "transformers_version": null,
207
+ "use_decoder_only_language_model": false,
208
+ "vision_config": {
209
+ "_name_or_path": "",
210
+ "add_cross_attention": false,
211
+ "architectures": null,
212
+ "attention_dropout": 0.0,
213
+ "bad_words_ids": null,
214
+ "begin_suppress_tokens": null,
215
+ "bos_token_id": null,
216
+ "chunk_size_feed_forward": 0,
217
+ "cross_attention_hidden_size": null,
218
+ "decoder_start_token_id": null,
219
+ "diversity_penalty": 0.0,
220
+ "do_sample": false,
221
+ "dropout": 0.0,
222
+ "early_stopping": false,
223
+ "encoder_no_repeat_ngram_size": 0,
224
+ "eos_token_id": null,
225
+ "exponential_decay_length_penalty": null,
226
+ "finetuning_task": null,
227
+ "forced_bos_token_id": null,
228
+ "forced_eos_token_id": null,
229
+ "hidden_act": "gelu",
230
+ "hidden_size": 1408,
231
+ "id2label": {
232
+ "0": "LABEL_0",
233
+ "1": "LABEL_1"
234
+ },
235
+ "image_size": 224,
236
+ "initializer_factor": 1.0,
237
+ "initializer_range": 1e-10,
238
+ "intermediate_size": 6144,
239
+ "is_decoder": false,
240
+ "is_encoder_decoder": false,
241
+ "label2id": {
242
+ "LABEL_0": 0,
243
+ "LABEL_1": 1
244
+ },
245
+ "layer_norm_eps": 1e-05,
246
+ "length_penalty": 1.0,
247
+ "max_length": 20,
248
+ "min_length": 0,
249
+ "model_type": "instructblip_vision_model",
250
+ "no_repeat_ngram_size": 0,
251
+ "num_attention_heads": 16,
252
+ "num_beam_groups": 1,
253
+ "num_beams": 1,
254
+ "num_channels": 3,
255
+ "num_hidden_layers": 39,
256
+ "num_return_sequences": 1,
257
+ "output_attentions": false,
258
+ "output_hidden_states": false,
259
+ "output_scores": false,
260
+ "pad_token_id": null,
261
+ "patch_size": 14,
262
+ "prefix": null,
263
+ "problem_type": null,
264
+ "projection_dim": 512,
265
+ "pruned_heads": {},
266
+ "qkv_bias": true,
267
+ "remove_invalid_values": false,
268
+ "repetition_penalty": 1.0,
269
+ "return_dict": true,
270
+ "return_dict_in_generate": false,
271
+ "sep_token_id": null,
272
+ "suppress_tokens": null,
273
+ "task_specific_params": null,
274
+ "temperature": 1.0,
275
+ "tf_legacy_loss": false,
276
+ "tie_encoder_decoder": false,
277
+ "tie_word_embeddings": true,
278
+ "tokenizer_class": null,
279
+ "top_k": 50,
280
+ "top_p": 1.0,
281
+ "torch_dtype": null,
282
+ "torchscript": false,
283
+ "transformers_version": "4.29.2",
284
+ "typical_p": 1.0,
285
+ "use_bfloat16": false
286
+ }
287
+ }
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step1500
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f6d48d314bcb8a19ada769dc9af8fcfcfc9be42d221b50f4f55235f7fd1896b
3
+ size 8046567875
rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c68a25d37b0b194d5f39d5814c524d4177edcc93c7db7a776c49cac6f44b2613
3
+ size 19539
rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53b883a036b069efa1e59a3729009e30533185b026ee03a684d4d765323f4314
3
+ size 19539
rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b1376b9b767573d999b4d567a1c07f8456006c2b071a5b322801e3ed02dfdf8
3
+ size 19539
rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f539f195bfec0ddcb112938aaa247d81e7cb19dd57d0680d12b71ed2261fde0d
3
+ size 19539
rng_state_4.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d11c9946f779d146f0ff48b5d0ea3ed57eb631a5ef63ee95eff09fe85a0965ed
3
+ size 19539
rng_state_5.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a94e70f86a5e40d54d6d12a1a47f30d0dbc1c94f37160060be4979a2da03cef
3
+ size 19539
trainer_state.json ADDED
@@ -0,0 +1,874 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": 0.11633333333333333,
3
+ "best_model_checkpoint": "checkpoints/instruct_BLIP2_deepSpeed_t5xl_unfreeze_Qformer_Projection_Encoder_DecoderLLM_QV_weight_no_instructqformer/checkpoint-1200",
4
+ "epoch": 1.271994912020352,
5
+ "global_step": 1500,
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.04,
12
+ "eval_accuracy": 0.10066666666666667,
13
+ "eval_avg_bleuScore": 0.028052001625299455,
14
+ "eval_loss": 1.821718692779541,
15
+ "eval_rouge1_fmeasure": 0.39566364884376526,
16
+ "eval_rouge1_precision": 0.40851742029190063,
17
+ "eval_rouge1_recall": 0.40402013063430786,
18
+ "eval_rouge2_fmeasure": 0.11902458965778351,
19
+ "eval_rouge2_precision": 0.12462873011827469,
20
+ "eval_rouge2_recall": 0.12082352489233017,
21
+ "eval_rougeL_fmeasure": 0.3664987087249756,
22
+ "eval_rougeL_precision": 0.37793973088264465,
23
+ "eval_rougeL_recall": 0.374777227640152,
24
+ "eval_rougeLsum_fmeasure": 0.36648938059806824,
25
+ "eval_rougeLsum_precision": 0.3779275715351105,
26
+ "eval_rougeLsum_recall": 0.3747769892215729,
27
+ "eval_runtime": 497.9069,
28
+ "eval_samples_per_second": 6.025,
29
+ "eval_steps_per_second": 0.084,
30
+ "step": 50
31
+ },
32
+ {
33
+ "best_epoch": 0,
34
+ "best_eval_accuracy": 0.10066666666666667,
35
+ "epoch": 0.04,
36
+ "step": 50
37
+ },
38
+ {
39
+ "epoch": 0.08,
40
+ "eval_accuracy": 0.10766666666666666,
41
+ "eval_avg_bleuScore": 0.027600931445757548,
42
+ "eval_loss": 1.7757344245910645,
43
+ "eval_rouge1_fmeasure": 0.4066351652145386,
44
+ "eval_rouge1_precision": 0.42435961961746216,
45
+ "eval_rouge1_recall": 0.4121783375740051,
46
+ "eval_rouge2_fmeasure": 0.1213102638721466,
47
+ "eval_rouge2_precision": 0.12911927700042725,
48
+ "eval_rouge2_recall": 0.12066558748483658,
49
+ "eval_rougeL_fmeasure": 0.375918984413147,
50
+ "eval_rougeL_precision": 0.3917166292667389,
51
+ "eval_rougeL_recall": 0.3817567229270935,
52
+ "eval_rougeLsum_fmeasure": 0.37593305110931396,
53
+ "eval_rougeLsum_precision": 0.3917284309864044,
54
+ "eval_rougeLsum_recall": 0.38177403807640076,
55
+ "eval_runtime": 665.5797,
56
+ "eval_samples_per_second": 4.507,
57
+ "eval_steps_per_second": 0.063,
58
+ "step": 100
59
+ },
60
+ {
61
+ "best_epoch": 0,
62
+ "best_eval_accuracy": 0.10766666666666666,
63
+ "epoch": 0.08,
64
+ "step": 100
65
+ },
66
+ {
67
+ "epoch": 0.13,
68
+ "eval_accuracy": 0.10366666666666667,
69
+ "eval_avg_bleuScore": 0.027236416570842265,
70
+ "eval_loss": 1.761132836341858,
71
+ "eval_rouge1_fmeasure": 0.4095948040485382,
72
+ "eval_rouge1_precision": 0.4314381182193756,
73
+ "eval_rouge1_recall": 0.4098112881183624,
74
+ "eval_rouge2_fmeasure": 0.12273810803890228,
75
+ "eval_rouge2_precision": 0.13252894580364227,
76
+ "eval_rouge2_recall": 0.12072920054197311,
77
+ "eval_rougeL_fmeasure": 0.3781542181968689,
78
+ "eval_rougeL_precision": 0.3977195620536804,
79
+ "eval_rougeL_recall": 0.37909412384033203,
80
+ "eval_rougeLsum_fmeasure": 0.3781542181968689,
81
+ "eval_rougeLsum_precision": 0.3977195620536804,
82
+ "eval_rougeLsum_recall": 0.37909412384033203,
83
+ "eval_runtime": 682.2715,
84
+ "eval_samples_per_second": 4.397,
85
+ "eval_steps_per_second": 0.062,
86
+ "step": 150
87
+ },
88
+ {
89
+ "best_epoch": 0,
90
+ "best_eval_accuracy": 0.10766666666666666,
91
+ "epoch": 0.13,
92
+ "step": 150
93
+ },
94
+ {
95
+ "epoch": 0.17,
96
+ "eval_accuracy": 0.111,
97
+ "eval_avg_bleuScore": 0.02802771261582772,
98
+ "eval_loss": 1.752191424369812,
99
+ "eval_rouge1_fmeasure": 0.4127008020877838,
100
+ "eval_rouge1_precision": 0.43622446060180664,
101
+ "eval_rouge1_recall": 0.4123985171318054,
102
+ "eval_rouge2_fmeasure": 0.12286161631345749,
103
+ "eval_rouge2_precision": 0.13331134617328644,
104
+ "eval_rouge2_recall": 0.11954713612794876,
105
+ "eval_rougeL_fmeasure": 0.38183602690696716,
106
+ "eval_rougeL_precision": 0.4026814103126526,
107
+ "eval_rougeL_recall": 0.38258570432662964,
108
+ "eval_rougeLsum_fmeasure": 0.38183602690696716,
109
+ "eval_rougeLsum_precision": 0.4026814103126526,
110
+ "eval_rougeLsum_recall": 0.38258570432662964,
111
+ "eval_runtime": 651.8851,
112
+ "eval_samples_per_second": 4.602,
113
+ "eval_steps_per_second": 0.064,
114
+ "step": 200
115
+ },
116
+ {
117
+ "best_epoch": 0,
118
+ "best_eval_accuracy": 0.111,
119
+ "epoch": 0.17,
120
+ "step": 200
121
+ },
122
+ {
123
+ "epoch": 0.21,
124
+ "eval_accuracy": 0.105,
125
+ "eval_avg_bleuScore": 0.027756770220274726,
126
+ "eval_loss": 1.7442187070846558,
127
+ "eval_rouge1_fmeasure": 0.4091792702674866,
128
+ "eval_rouge1_precision": 0.4254671335220337,
129
+ "eval_rouge1_recall": 0.4135805368423462,
130
+ "eval_rouge2_fmeasure": 0.12273108959197998,
131
+ "eval_rouge2_precision": 0.13018882274627686,
132
+ "eval_rouge2_recall": 0.1215042695403099,
133
+ "eval_rougeL_fmeasure": 0.3773505389690399,
134
+ "eval_rougeL_precision": 0.3915799856185913,
135
+ "eval_rougeL_recall": 0.38237836956977844,
136
+ "eval_rougeLsum_fmeasure": 0.3773505389690399,
137
+ "eval_rougeLsum_precision": 0.3915799856185913,
138
+ "eval_rougeLsum_recall": 0.38237836956977844,
139
+ "eval_runtime": 537.4239,
140
+ "eval_samples_per_second": 5.582,
141
+ "eval_steps_per_second": 0.078,
142
+ "step": 250
143
+ },
144
+ {
145
+ "best_epoch": 0,
146
+ "best_eval_accuracy": 0.111,
147
+ "epoch": 0.21,
148
+ "step": 250
149
+ },
150
+ {
151
+ "epoch": 0.25,
152
+ "eval_accuracy": 0.10933333333333334,
153
+ "eval_avg_bleuScore": 0.029238753189643224,
154
+ "eval_loss": 1.7391133308410645,
155
+ "eval_rouge1_fmeasure": 0.4145018756389618,
156
+ "eval_rouge1_precision": 0.4305371046066284,
157
+ "eval_rouge1_recall": 0.418173223733902,
158
+ "eval_rouge2_fmeasure": 0.12484551221132278,
159
+ "eval_rouge2_precision": 0.13209865987300873,
160
+ "eval_rouge2_recall": 0.123726025223732,
161
+ "eval_rougeL_fmeasure": 0.3840600848197937,
162
+ "eval_rougeL_precision": 0.39804303646087646,
163
+ "eval_rougeL_recall": 0.388366162776947,
164
+ "eval_rougeLsum_fmeasure": 0.38407862186431885,
165
+ "eval_rougeLsum_precision": 0.3980652689933777,
166
+ "eval_rougeLsum_recall": 0.38838204741477966,
167
+ "eval_runtime": 636.8392,
168
+ "eval_samples_per_second": 4.711,
169
+ "eval_steps_per_second": 0.066,
170
+ "step": 300
171
+ },
172
+ {
173
+ "best_epoch": 0,
174
+ "best_eval_accuracy": 0.111,
175
+ "epoch": 0.25,
176
+ "step": 300
177
+ },
178
+ {
179
+ "epoch": 0.3,
180
+ "eval_accuracy": 0.10833333333333334,
181
+ "eval_avg_bleuScore": 0.02794275293002526,
182
+ "eval_loss": 1.7383359670639038,
183
+ "eval_rouge1_fmeasure": 0.4148719012737274,
184
+ "eval_rouge1_precision": 0.4366380274295807,
185
+ "eval_rouge1_recall": 0.41247957944869995,
186
+ "eval_rouge2_fmeasure": 0.12334803491830826,
187
+ "eval_rouge2_precision": 0.13329564034938812,
188
+ "eval_rouge2_recall": 0.11994606256484985,
189
+ "eval_rougeL_fmeasure": 0.3842999339103699,
190
+ "eval_rougeL_precision": 0.403416246175766,
191
+ "eval_rougeL_recall": 0.3831061124801636,
192
+ "eval_rougeLsum_fmeasure": 0.38431844115257263,
193
+ "eval_rougeLsum_precision": 0.4034384787082672,
194
+ "eval_rougeLsum_recall": 0.3831219971179962,
195
+ "eval_runtime": 613.4876,
196
+ "eval_samples_per_second": 4.89,
197
+ "eval_steps_per_second": 0.068,
198
+ "step": 350
199
+ },
200
+ {
201
+ "best_epoch": 0,
202
+ "best_eval_accuracy": 0.111,
203
+ "epoch": 0.3,
204
+ "step": 350
205
+ },
206
+ {
207
+ "epoch": 0.34,
208
+ "eval_accuracy": 0.11166666666666666,
209
+ "eval_avg_bleuScore": 0.027422180160880088,
210
+ "eval_loss": 1.7323437929153442,
211
+ "eval_rouge1_fmeasure": 0.41112449765205383,
212
+ "eval_rouge1_precision": 0.42366519570350647,
213
+ "eval_rouge1_recall": 0.42089518904685974,
214
+ "eval_rouge2_fmeasure": 0.12152101844549179,
215
+ "eval_rouge2_precision": 0.1277269721031189,
216
+ "eval_rouge2_recall": 0.1217166930437088,
217
+ "eval_rougeL_fmeasure": 0.38071784377098083,
218
+ "eval_rougeL_precision": 0.39161595702171326,
219
+ "eval_rougeL_recall": 0.3908142149448395,
220
+ "eval_rougeLsum_fmeasure": 0.380736380815506,
221
+ "eval_rougeLsum_precision": 0.3916381895542145,
222
+ "eval_rougeLsum_recall": 0.39083006978034973,
223
+ "eval_runtime": 832.3704,
224
+ "eval_samples_per_second": 3.604,
225
+ "eval_steps_per_second": 0.05,
226
+ "step": 400
227
+ },
228
+ {
229
+ "best_epoch": 0,
230
+ "best_eval_accuracy": 0.11166666666666666,
231
+ "epoch": 0.34,
232
+ "step": 400
233
+ },
234
+ {
235
+ "epoch": 0.38,
236
+ "eval_accuracy": 0.113,
237
+ "eval_avg_bleuScore": 0.02941073496143023,
238
+ "eval_loss": 1.7295702695846558,
239
+ "eval_rouge1_fmeasure": 0.4182838201522827,
240
+ "eval_rouge1_precision": 0.4307253062725067,
241
+ "eval_rouge1_recall": 0.42410746216773987,
242
+ "eval_rouge2_fmeasure": 0.12393321841955185,
243
+ "eval_rouge2_precision": 0.1300639659166336,
244
+ "eval_rouge2_recall": 0.1235329881310463,
245
+ "eval_rougeL_fmeasure": 0.38701331615448,
246
+ "eval_rougeL_precision": 0.3976545035839081,
247
+ "eval_rougeL_recall": 0.3932779133319855,
248
+ "eval_rougeLsum_fmeasure": 0.38703182339668274,
249
+ "eval_rougeLsum_precision": 0.3976767063140869,
250
+ "eval_rougeLsum_recall": 0.3932937681674957,
251
+ "eval_runtime": 644.9911,
252
+ "eval_samples_per_second": 4.651,
253
+ "eval_steps_per_second": 0.065,
254
+ "step": 450
255
+ },
256
+ {
257
+ "best_epoch": 0,
258
+ "best_eval_accuracy": 0.113,
259
+ "epoch": 0.38,
260
+ "step": 450
261
+ },
262
+ {
263
+ "epoch": 0.42,
264
+ "learning_rate": 9.07225348510492e-05,
265
+ "loss": 1.4583,
266
+ "step": 500
267
+ },
268
+ {
269
+ "epoch": 0.42,
270
+ "eval_accuracy": 0.112,
271
+ "eval_avg_bleuScore": 0.028446144399543603,
272
+ "eval_loss": 1.7309530973434448,
273
+ "eval_rouge1_fmeasure": 0.41481727361679077,
274
+ "eval_rouge1_precision": 0.4275760352611542,
275
+ "eval_rouge1_recall": 0.4214574098587036,
276
+ "eval_rouge2_fmeasure": 0.12195532023906708,
277
+ "eval_rouge2_precision": 0.1282820999622345,
278
+ "eval_rouge2_recall": 0.12207218259572983,
279
+ "eval_rougeL_fmeasure": 0.38423991203308105,
280
+ "eval_rougeL_precision": 0.39524608850479126,
281
+ "eval_rougeL_recall": 0.39129284024238586,
282
+ "eval_rougeLsum_fmeasure": 0.38425952196121216,
283
+ "eval_rougeLsum_precision": 0.3952717185020447,
284
+ "eval_rougeLsum_recall": 0.3913087248802185,
285
+ "eval_runtime": 753.8166,
286
+ "eval_samples_per_second": 3.98,
287
+ "eval_steps_per_second": 0.056,
288
+ "step": 500
289
+ },
290
+ {
291
+ "best_epoch": 0,
292
+ "best_eval_accuracy": 0.113,
293
+ "epoch": 0.42,
294
+ "step": 500
295
+ },
296
+ {
297
+ "epoch": 0.47,
298
+ "eval_accuracy": 0.109,
299
+ "eval_avg_bleuScore": 0.02862334846953551,
300
+ "eval_loss": 1.7262461185455322,
301
+ "eval_rouge1_fmeasure": 0.41011935472488403,
302
+ "eval_rouge1_precision": 0.4244203269481659,
303
+ "eval_rouge1_recall": 0.4158960282802582,
304
+ "eval_rouge2_fmeasure": 0.12124613672494888,
305
+ "eval_rouge2_precision": 0.12845604121685028,
306
+ "eval_rouge2_recall": 0.1203385517001152,
307
+ "eval_rougeL_fmeasure": 0.37967798113822937,
308
+ "eval_rougeL_precision": 0.3920755982398987,
309
+ "eval_rougeL_recall": 0.3858604431152344,
310
+ "eval_rougeLsum_fmeasure": 0.3796946704387665,
311
+ "eval_rougeLsum_precision": 0.39209315180778503,
312
+ "eval_rougeLsum_recall": 0.38587629795074463,
313
+ "eval_runtime": 521.071,
314
+ "eval_samples_per_second": 5.757,
315
+ "eval_steps_per_second": 0.081,
316
+ "step": 550
317
+ },
318
+ {
319
+ "best_epoch": 0,
320
+ "best_eval_accuracy": 0.113,
321
+ "epoch": 0.47,
322
+ "step": 550
323
+ },
324
+ {
325
+ "epoch": 0.51,
326
+ "eval_accuracy": 0.11133333333333334,
327
+ "eval_avg_bleuScore": 0.028583366366724174,
328
+ "eval_loss": 1.7252265214920044,
329
+ "eval_rouge1_fmeasure": 0.4135696589946747,
330
+ "eval_rouge1_precision": 0.42282983660697937,
331
+ "eval_rouge1_recall": 0.42099812626838684,
332
+ "eval_rouge2_fmeasure": 0.12228861451148987,
333
+ "eval_rouge2_precision": 0.1273748129606247,
334
+ "eval_rouge2_recall": 0.12293525040149689,
335
+ "eval_rougeL_fmeasure": 0.3833465278148651,
336
+ "eval_rougeL_precision": 0.391093373298645,
337
+ "eval_rougeL_recall": 0.39074525237083435,
338
+ "eval_rougeLsum_fmeasure": 0.38336315751075745,
339
+ "eval_rougeLsum_precision": 0.39111092686653137,
340
+ "eval_rougeLsum_recall": 0.3907611072063446,
341
+ "eval_runtime": 444.5441,
342
+ "eval_samples_per_second": 6.748,
343
+ "eval_steps_per_second": 0.094,
344
+ "step": 600
345
+ },
346
+ {
347
+ "best_epoch": 0,
348
+ "best_eval_accuracy": 0.113,
349
+ "epoch": 0.51,
350
+ "step": 600
351
+ },
352
+ {
353
+ "epoch": 0.55,
354
+ "eval_accuracy": 0.11166666666666666,
355
+ "eval_avg_bleuScore": 0.0276417871316274,
356
+ "eval_loss": 1.7287226915359497,
357
+ "eval_rouge1_fmeasure": 0.41999372839927673,
358
+ "eval_rouge1_precision": 0.4347474277019501,
359
+ "eval_rouge1_recall": 0.41890957951545715,
360
+ "eval_rouge2_fmeasure": 0.1226092204451561,
361
+ "eval_rouge2_precision": 0.12977544963359833,
362
+ "eval_rouge2_recall": 0.12063863128423691,
363
+ "eval_rougeL_fmeasure": 0.38852831721305847,
364
+ "eval_rougeL_precision": 0.401227742433548,
365
+ "eval_rougeL_recall": 0.3881692588329315,
366
+ "eval_rougeLsum_fmeasure": 0.3885473608970642,
367
+ "eval_rougeLsum_precision": 0.40125155448913574,
368
+ "eval_rougeLsum_recall": 0.38818514347076416,
369
+ "eval_runtime": 416.9212,
370
+ "eval_samples_per_second": 7.196,
371
+ "eval_steps_per_second": 0.101,
372
+ "step": 650
373
+ },
374
+ {
375
+ "best_epoch": 0,
376
+ "best_eval_accuracy": 0.113,
377
+ "epoch": 0.55,
378
+ "step": 650
379
+ },
380
+ {
381
+ "epoch": 0.59,
382
+ "eval_accuracy": 0.11166666666666666,
383
+ "eval_avg_bleuScore": 0.028842177291711173,
384
+ "eval_loss": 1.7268632650375366,
385
+ "eval_rouge1_fmeasure": 0.4184536039829254,
386
+ "eval_rouge1_precision": 0.4310172498226166,
387
+ "eval_rouge1_recall": 0.4187770485877991,
388
+ "eval_rouge2_fmeasure": 0.12251175940036774,
389
+ "eval_rouge2_precision": 0.12893937528133392,
390
+ "eval_rouge2_recall": 0.12104275822639465,
391
+ "eval_rougeL_fmeasure": 0.38783329725265503,
392
+ "eval_rougeL_precision": 0.398539274930954,
393
+ "eval_rougeL_recall": 0.3887461721897125,
394
+ "eval_rougeLsum_fmeasure": 0.38785290718078613,
395
+ "eval_rougeLsum_precision": 0.3985649049282074,
396
+ "eval_rougeLsum_recall": 0.38876205682754517,
397
+ "eval_runtime": 417.6826,
398
+ "eval_samples_per_second": 7.182,
399
+ "eval_steps_per_second": 0.101,
400
+ "step": 700
401
+ },
402
+ {
403
+ "best_epoch": 0,
404
+ "best_eval_accuracy": 0.113,
405
+ "epoch": 0.59,
406
+ "step": 700
407
+ },
408
+ {
409
+ "epoch": 0.64,
410
+ "eval_accuracy": 0.115,
411
+ "eval_avg_bleuScore": 0.0290608666613698,
412
+ "eval_loss": 1.721261739730835,
413
+ "eval_rouge1_fmeasure": 0.4215930998325348,
414
+ "eval_rouge1_precision": 0.43335336446762085,
415
+ "eval_rouge1_recall": 0.4254607856273651,
416
+ "eval_rouge2_fmeasure": 0.12333113700151443,
417
+ "eval_rouge2_precision": 0.1291794627904892,
418
+ "eval_rouge2_recall": 0.123162180185318,
419
+ "eval_rougeL_fmeasure": 0.39064252376556396,
420
+ "eval_rougeL_precision": 0.40073809027671814,
421
+ "eval_rougeL_recall": 0.39462339878082275,
422
+ "eval_rougeLsum_fmeasure": 0.39064013957977295,
423
+ "eval_rougeLsum_precision": 0.4007423222064972,
424
+ "eval_rougeLsum_recall": 0.39460596442222595,
425
+ "eval_runtime": 448.6827,
426
+ "eval_samples_per_second": 6.686,
427
+ "eval_steps_per_second": 0.094,
428
+ "step": 750
429
+ },
430
+ {
431
+ "best_epoch": 0,
432
+ "best_eval_accuracy": 0.115,
433
+ "epoch": 0.64,
434
+ "step": 750
435
+ },
436
+ {
437
+ "epoch": 0.68,
438
+ "eval_accuracy": 0.11366666666666667,
439
+ "eval_avg_bleuScore": 0.02823698183397452,
440
+ "eval_loss": 1.719179630279541,
441
+ "eval_rouge1_fmeasure": 0.4255302846431732,
442
+ "eval_rouge1_precision": 0.44179973006248474,
443
+ "eval_rouge1_recall": 0.4235004186630249,
444
+ "eval_rouge2_fmeasure": 0.12516146898269653,
445
+ "eval_rouge2_precision": 0.13273605704307556,
446
+ "eval_rouge2_recall": 0.12307706475257874,
447
+ "eval_rougeL_fmeasure": 0.3939012885093689,
448
+ "eval_rougeL_precision": 0.4078863561153412,
449
+ "eval_rougeL_recall": 0.39276742935180664,
450
+ "eval_rougeLsum_fmeasure": 0.3939012885093689,
451
+ "eval_rougeLsum_precision": 0.4078863561153412,
452
+ "eval_rougeLsum_recall": 0.39276742935180664,
453
+ "eval_runtime": 428.3483,
454
+ "eval_samples_per_second": 7.004,
455
+ "eval_steps_per_second": 0.098,
456
+ "step": 800
457
+ },
458
+ {
459
+ "best_epoch": 0,
460
+ "best_eval_accuracy": 0.115,
461
+ "epoch": 0.68,
462
+ "step": 800
463
+ },
464
+ {
465
+ "epoch": 0.72,
466
+ "eval_accuracy": 0.11433333333333333,
467
+ "eval_avg_bleuScore": 0.030075389464696248,
468
+ "eval_loss": 1.716699242591858,
469
+ "eval_rouge1_fmeasure": 0.42475032806396484,
470
+ "eval_rouge1_precision": 0.4392147660255432,
471
+ "eval_rouge1_recall": 0.4252479374408722,
472
+ "eval_rouge2_fmeasure": 0.12556101381778717,
473
+ "eval_rouge2_precision": 0.13259626924991608,
474
+ "eval_rouge2_recall": 0.12433860450983047,
475
+ "eval_rougeL_fmeasure": 0.39261123538017273,
476
+ "eval_rougeL_precision": 0.40510380268096924,
477
+ "eval_rougeL_recall": 0.3936094641685486,
478
+ "eval_rougeLsum_fmeasure": 0.3926297128200531,
479
+ "eval_rougeLsum_precision": 0.40512600541114807,
480
+ "eval_rougeLsum_recall": 0.39362531900405884,
481
+ "eval_runtime": 416.1761,
482
+ "eval_samples_per_second": 7.208,
483
+ "eval_steps_per_second": 0.101,
484
+ "step": 850
485
+ },
486
+ {
487
+ "best_epoch": 0,
488
+ "best_eval_accuracy": 0.115,
489
+ "epoch": 0.72,
490
+ "step": 850
491
+ },
492
+ {
493
+ "epoch": 0.76,
494
+ "eval_accuracy": 0.11333333333333333,
495
+ "eval_avg_bleuScore": 0.02911172941327095,
496
+ "eval_loss": 1.7144726514816284,
497
+ "eval_rouge1_fmeasure": 0.4232616424560547,
498
+ "eval_rouge1_precision": 0.43622541427612305,
499
+ "eval_rouge1_recall": 0.4255277216434479,
500
+ "eval_rouge2_fmeasure": 0.12597259879112244,
501
+ "eval_rouge2_precision": 0.1326662003993988,
502
+ "eval_rouge2_recall": 0.12559087574481964,
503
+ "eval_rougeL_fmeasure": 0.3917687237262726,
504
+ "eval_rougeL_precision": 0.4028547704219818,
505
+ "eval_rougeL_recall": 0.39450860023498535,
506
+ "eval_rougeLsum_fmeasure": 0.39178499579429626,
507
+ "eval_rougeLsum_precision": 0.40287142992019653,
508
+ "eval_rougeLsum_recall": 0.3945244550704956,
509
+ "eval_runtime": 418.7629,
510
+ "eval_samples_per_second": 7.164,
511
+ "eval_steps_per_second": 0.1,
512
+ "step": 900
513
+ },
514
+ {
515
+ "best_epoch": 0,
516
+ "best_eval_accuracy": 0.115,
517
+ "epoch": 0.76,
518
+ "step": 900
519
+ },
520
+ {
521
+ "epoch": 0.81,
522
+ "eval_accuracy": 0.11366666666666667,
523
+ "eval_avg_bleuScore": 0.02877427616963784,
524
+ "eval_loss": 1.7141094207763672,
525
+ "eval_rouge1_fmeasure": 0.42343342304229736,
526
+ "eval_rouge1_precision": 0.4381575882434845,
527
+ "eval_rouge1_recall": 0.4245162308216095,
528
+ "eval_rouge2_fmeasure": 0.12420167028903961,
529
+ "eval_rouge2_precision": 0.13117600977420807,
530
+ "eval_rouge2_recall": 0.12346965819597244,
531
+ "eval_rougeL_fmeasure": 0.3917766809463501,
532
+ "eval_rougeL_precision": 0.4044066071510315,
533
+ "eval_rougeL_recall": 0.39342838525772095,
534
+ "eval_rougeLsum_fmeasure": 0.39179524779319763,
535
+ "eval_rougeLsum_precision": 0.4044288396835327,
536
+ "eval_rougeLsum_recall": 0.3934442400932312,
537
+ "eval_runtime": 412.8924,
538
+ "eval_samples_per_second": 7.266,
539
+ "eval_steps_per_second": 0.102,
540
+ "step": 950
541
+ },
542
+ {
543
+ "best_epoch": 0,
544
+ "best_eval_accuracy": 0.115,
545
+ "epoch": 0.81,
546
+ "step": 950
547
+ },
548
+ {
549
+ "epoch": 0.85,
550
+ "learning_rate": 0.0001,
551
+ "loss": 1.3251,
552
+ "step": 1000
553
+ },
554
+ {
555
+ "epoch": 0.85,
556
+ "eval_accuracy": 0.114,
557
+ "eval_avg_bleuScore": 0.028698996223509313,
558
+ "eval_loss": 1.7141406536102295,
559
+ "eval_rouge1_fmeasure": 0.4231337010860443,
560
+ "eval_rouge1_precision": 0.43527066707611084,
561
+ "eval_rouge1_recall": 0.42574357986450195,
562
+ "eval_rouge2_fmeasure": 0.12320207059383392,
563
+ "eval_rouge2_precision": 0.12941864132881165,
564
+ "eval_rouge2_recall": 0.12254573404788971,
565
+ "eval_rougeL_fmeasure": 0.3913033902645111,
566
+ "eval_rougeL_precision": 0.40169021487236023,
567
+ "eval_rougeL_recall": 0.39426353573799133,
568
+ "eval_rougeLsum_fmeasure": 0.3913209140300751,
569
+ "eval_rougeLsum_precision": 0.40170982480049133,
570
+ "eval_rougeLsum_recall": 0.39427945017814636,
571
+ "eval_runtime": 411.3837,
572
+ "eval_samples_per_second": 7.292,
573
+ "eval_steps_per_second": 0.102,
574
+ "step": 1000
575
+ },
576
+ {
577
+ "best_epoch": 0,
578
+ "best_eval_accuracy": 0.115,
579
+ "epoch": 0.85,
580
+ "step": 1000
581
+ },
582
+ {
583
+ "epoch": 0.89,
584
+ "eval_accuracy": 0.115,
585
+ "eval_avg_bleuScore": 0.028069007659951847,
586
+ "eval_loss": 1.7145625352859497,
587
+ "eval_rouge1_fmeasure": 0.4248062074184418,
588
+ "eval_rouge1_precision": 0.4398679733276367,
589
+ "eval_rouge1_recall": 0.423473060131073,
590
+ "eval_rouge2_fmeasure": 0.12515196204185486,
591
+ "eval_rouge2_precision": 0.13223549723625183,
592
+ "eval_rouge2_recall": 0.12349213659763336,
593
+ "eval_rougeL_fmeasure": 0.39318299293518066,
594
+ "eval_rougeL_precision": 0.405906617641449,
595
+ "eval_rougeL_recall": 0.39283618330955505,
596
+ "eval_rougeLsum_fmeasure": 0.39318299293518066,
597
+ "eval_rougeLsum_precision": 0.405906617641449,
598
+ "eval_rougeLsum_recall": 0.39283618330955505,
599
+ "eval_runtime": 423.8761,
600
+ "eval_samples_per_second": 7.078,
601
+ "eval_steps_per_second": 0.099,
602
+ "step": 1050
603
+ },
604
+ {
605
+ "best_epoch": 0,
606
+ "best_eval_accuracy": 0.115,
607
+ "epoch": 0.89,
608
+ "step": 1050
609
+ },
610
+ {
611
+ "epoch": 0.93,
612
+ "eval_accuracy": 0.112,
613
+ "eval_avg_bleuScore": 0.027762405360738436,
614
+ "eval_loss": 1.7136757373809814,
615
+ "eval_rouge1_fmeasure": 0.42095834016799927,
616
+ "eval_rouge1_precision": 0.43534284830093384,
617
+ "eval_rouge1_recall": 0.42047563195228577,
618
+ "eval_rouge2_fmeasure": 0.12339958548545837,
619
+ "eval_rouge2_precision": 0.13038772344589233,
620
+ "eval_rouge2_recall": 0.12185768783092499,
621
+ "eval_rougeL_fmeasure": 0.3895176649093628,
622
+ "eval_rougeL_precision": 0.4018775522708893,
623
+ "eval_rougeL_recall": 0.3896372616291046,
624
+ "eval_rougeLsum_fmeasure": 0.3895343542098999,
625
+ "eval_rougeLsum_precision": 0.40189510583877563,
626
+ "eval_rougeLsum_recall": 0.38965311646461487,
627
+ "eval_runtime": 412.9847,
628
+ "eval_samples_per_second": 7.264,
629
+ "eval_steps_per_second": 0.102,
630
+ "step": 1100
631
+ },
632
+ {
633
+ "best_epoch": 0,
634
+ "best_eval_accuracy": 0.115,
635
+ "epoch": 0.93,
636
+ "step": 1100
637
+ },
638
+ {
639
+ "epoch": 0.98,
640
+ "eval_accuracy": 0.11233333333333333,
641
+ "eval_avg_bleuScore": 0.029023348152637483,
642
+ "eval_loss": 1.7126835584640503,
643
+ "eval_rouge1_fmeasure": 0.42007914185523987,
644
+ "eval_rouge1_precision": 0.4302547574043274,
645
+ "eval_rouge1_recall": 0.42434659600257874,
646
+ "eval_rouge2_fmeasure": 0.12373975664377213,
647
+ "eval_rouge2_precision": 0.12897014617919922,
648
+ "eval_rouge2_recall": 0.1240621954202652,
649
+ "eval_rougeL_fmeasure": 0.38924336433410645,
650
+ "eval_rougeL_precision": 0.39777547121047974,
651
+ "eval_rougeL_recall": 0.39375001192092896,
652
+ "eval_rougeLsum_fmeasure": 0.389260470867157,
653
+ "eval_rougeLsum_precision": 0.3977939784526825,
654
+ "eval_rougeLsum_recall": 0.39376595616340637,
655
+ "eval_runtime": 416.6217,
656
+ "eval_samples_per_second": 7.201,
657
+ "eval_steps_per_second": 0.101,
658
+ "step": 1150
659
+ },
660
+ {
661
+ "best_epoch": 0,
662
+ "best_eval_accuracy": 0.115,
663
+ "epoch": 0.98,
664
+ "step": 1150
665
+ },
666
+ {
667
+ "epoch": 1.02,
668
+ "eval_accuracy": 0.11633333333333333,
669
+ "eval_avg_bleuScore": 0.0286271261125803,
670
+ "eval_loss": 1.7119219303131104,
671
+ "eval_rouge1_fmeasure": 0.4223006069660187,
672
+ "eval_rouge1_precision": 0.43355467915534973,
673
+ "eval_rouge1_recall": 0.42424923181533813,
674
+ "eval_rouge2_fmeasure": 0.12183848023414612,
675
+ "eval_rouge2_precision": 0.12746664881706238,
676
+ "eval_rouge2_recall": 0.12144064158201218,
677
+ "eval_rougeL_fmeasure": 0.39173752069473267,
678
+ "eval_rougeL_precision": 0.4012112319469452,
679
+ "eval_rougeL_recall": 0.3941992223262787,
680
+ "eval_rougeLsum_fmeasure": 0.39173752069473267,
681
+ "eval_rougeLsum_precision": 0.4012112319469452,
682
+ "eval_rougeLsum_recall": 0.3941992223262787,
683
+ "eval_runtime": 414.7589,
684
+ "eval_samples_per_second": 7.233,
685
+ "eval_steps_per_second": 0.101,
686
+ "step": 1200
687
+ },
688
+ {
689
+ "best_epoch": 1,
690
+ "best_eval_accuracy": 0.11633333333333333,
691
+ "epoch": 1.02,
692
+ "step": 1200
693
+ },
694
+ {
695
+ "epoch": 1.06,
696
+ "eval_accuracy": 0.11333333333333333,
697
+ "eval_avg_bleuScore": 0.027211002017060917,
698
+ "eval_loss": 1.714453101158142,
699
+ "eval_rouge1_fmeasure": 0.41994115710258484,
700
+ "eval_rouge1_precision": 0.43688705563545227,
701
+ "eval_rouge1_recall": 0.41850513219833374,
702
+ "eval_rouge2_fmeasure": 0.12223239243030548,
703
+ "eval_rouge2_precision": 0.13026195764541626,
704
+ "eval_rouge2_recall": 0.12033700197935104,
705
+ "eval_rougeL_fmeasure": 0.3890978693962097,
706
+ "eval_rougeL_precision": 0.4037608504295349,
707
+ "eval_rougeL_recall": 0.3884038031101227,
708
+ "eval_rougeLsum_fmeasure": 0.38911449909210205,
709
+ "eval_rougeLsum_precision": 0.40377840399742126,
710
+ "eval_rougeLsum_recall": 0.3884196877479553,
711
+ "eval_runtime": 435.9324,
712
+ "eval_samples_per_second": 6.882,
713
+ "eval_steps_per_second": 0.096,
714
+ "step": 1250
715
+ },
716
+ {
717
+ "best_epoch": 1,
718
+ "best_eval_accuracy": 0.11633333333333333,
719
+ "epoch": 1.06,
720
+ "step": 1250
721
+ },
722
+ {
723
+ "epoch": 1.1,
724
+ "eval_accuracy": 0.11233333333333333,
725
+ "eval_avg_bleuScore": 0.02936673008153836,
726
+ "eval_loss": 1.7116132974624634,
727
+ "eval_rouge1_fmeasure": 0.4216597378253937,
728
+ "eval_rouge1_precision": 0.4335962235927582,
729
+ "eval_rouge1_recall": 0.42250940203666687,
730
+ "eval_rouge2_fmeasure": 0.12213711440563202,
731
+ "eval_rouge2_precision": 0.12782621383666992,
732
+ "eval_rouge2_recall": 0.12156455218791962,
733
+ "eval_rougeL_fmeasure": 0.3895263671875,
734
+ "eval_rougeL_precision": 0.39964497089385986,
735
+ "eval_rougeL_recall": 0.39094799757003784,
736
+ "eval_rougeLsum_fmeasure": 0.38954439759254456,
737
+ "eval_rougeLsum_precision": 0.39966580271720886,
738
+ "eval_rougeLsum_recall": 0.3909638524055481,
739
+ "eval_runtime": 442.558,
740
+ "eval_samples_per_second": 6.779,
741
+ "eval_steps_per_second": 0.095,
742
+ "step": 1300
743
+ },
744
+ {
745
+ "best_epoch": 1,
746
+ "best_eval_accuracy": 0.11633333333333333,
747
+ "epoch": 1.1,
748
+ "step": 1300
749
+ },
750
+ {
751
+ "epoch": 1.14,
752
+ "eval_accuracy": 0.11633333333333333,
753
+ "eval_avg_bleuScore": 0.027918557037909825,
754
+ "eval_loss": 1.7098476886749268,
755
+ "eval_rouge1_fmeasure": 0.4242185950279236,
756
+ "eval_rouge1_precision": 0.4375033378601074,
757
+ "eval_rouge1_recall": 0.42478516697883606,
758
+ "eval_rouge2_fmeasure": 0.12248878926038742,
759
+ "eval_rouge2_precision": 0.12885503470897675,
760
+ "eval_rouge2_recall": 0.12164236605167389,
761
+ "eval_rougeL_fmeasure": 0.39410412311553955,
762
+ "eval_rougeL_precision": 0.40549689531326294,
763
+ "eval_rougeL_recall": 0.39526131749153137,
764
+ "eval_rougeLsum_fmeasure": 0.3941212296485901,
765
+ "eval_rougeLsum_precision": 0.4055154621601105,
766
+ "eval_rougeLsum_recall": 0.3952771723270416,
767
+ "eval_runtime": 422.7031,
768
+ "eval_samples_per_second": 7.097,
769
+ "eval_steps_per_second": 0.099,
770
+ "step": 1350
771
+ },
772
+ {
773
+ "best_epoch": 1,
774
+ "best_eval_accuracy": 0.11633333333333333,
775
+ "epoch": 1.14,
776
+ "step": 1350
777
+ },
778
+ {
779
+ "epoch": 1.19,
780
+ "eval_accuracy": 0.11266666666666666,
781
+ "eval_avg_bleuScore": 0.027800548608104388,
782
+ "eval_loss": 1.7062265872955322,
783
+ "eval_rouge1_fmeasure": 0.42027780413627625,
784
+ "eval_rouge1_precision": 0.435363233089447,
785
+ "eval_rouge1_recall": 0.4199471175670624,
786
+ "eval_rouge2_fmeasure": 0.12210887670516968,
787
+ "eval_rouge2_precision": 0.12934038043022156,
788
+ "eval_rouge2_recall": 0.12082366645336151,
789
+ "eval_rougeL_fmeasure": 0.38862261176109314,
790
+ "eval_rougeL_precision": 0.40165209770202637,
791
+ "eval_rougeL_recall": 0.388929158449173,
792
+ "eval_rougeLsum_fmeasure": 0.3886396884918213,
793
+ "eval_rougeLsum_precision": 0.4016706645488739,
794
+ "eval_rougeLsum_recall": 0.3889450132846832,
795
+ "eval_runtime": 421.8991,
796
+ "eval_samples_per_second": 7.111,
797
+ "eval_steps_per_second": 0.1,
798
+ "step": 1400
799
+ },
800
+ {
801
+ "best_epoch": 1,
802
+ "best_eval_accuracy": 0.11633333333333333,
803
+ "epoch": 1.19,
804
+ "step": 1400
805
+ },
806
+ {
807
+ "epoch": 1.23,
808
+ "eval_accuracy": 0.113,
809
+ "eval_avg_bleuScore": 0.026157520641883213,
810
+ "eval_loss": 1.7059766054153442,
811
+ "eval_rouge1_fmeasure": 0.4198099374771118,
812
+ "eval_rouge1_precision": 0.43453213572502136,
813
+ "eval_rouge1_recall": 0.4178878962993622,
814
+ "eval_rouge2_fmeasure": 0.1191374883055687,
815
+ "eval_rouge2_precision": 0.12592871487140656,
816
+ "eval_rouge2_recall": 0.11757373064756393,
817
+ "eval_rougeL_fmeasure": 0.3882248103618622,
818
+ "eval_rougeL_precision": 0.40069010853767395,
819
+ "eval_rougeL_recall": 0.3872298300266266,
820
+ "eval_rougeLsum_fmeasure": 0.3882444202899933,
821
+ "eval_rougeLsum_precision": 0.40071573853492737,
822
+ "eval_rougeLsum_recall": 0.38724568486213684,
823
+ "eval_runtime": 425.7259,
824
+ "eval_samples_per_second": 7.047,
825
+ "eval_steps_per_second": 0.099,
826
+ "step": 1450
827
+ },
828
+ {
829
+ "best_epoch": 1,
830
+ "best_eval_accuracy": 0.11633333333333333,
831
+ "epoch": 1.23,
832
+ "step": 1450
833
+ },
834
+ {
835
+ "epoch": 1.27,
836
+ "learning_rate": 0.0001,
837
+ "loss": 1.2797,
838
+ "step": 1500
839
+ },
840
+ {
841
+ "epoch": 1.27,
842
+ "eval_accuracy": 0.114,
843
+ "eval_avg_bleuScore": 0.026971253817280133,
844
+ "eval_loss": 1.7088124752044678,
845
+ "eval_rouge1_fmeasure": 0.42218562960624695,
846
+ "eval_rouge1_precision": 0.43385228514671326,
847
+ "eval_rouge1_recall": 0.42346033453941345,
848
+ "eval_rouge2_fmeasure": 0.12264084815979004,
849
+ "eval_rouge2_precision": 0.1281544268131256,
850
+ "eval_rouge2_recall": 0.12249463051557541,
851
+ "eval_rougeL_fmeasure": 0.3912815749645233,
852
+ "eval_rougeL_precision": 0.4010494649410248,
853
+ "eval_rougeL_recall": 0.39323461055755615,
854
+ "eval_rougeLsum_fmeasure": 0.39129638671875,
855
+ "eval_rougeLsum_precision": 0.40106332302093506,
856
+ "eval_rougeLsum_recall": 0.3932504951953888,
857
+ "eval_runtime": 429.3226,
858
+ "eval_samples_per_second": 6.988,
859
+ "eval_steps_per_second": 0.098,
860
+ "step": 1500
861
+ },
862
+ {
863
+ "best_epoch": 1,
864
+ "best_eval_accuracy": 0.11633333333333333,
865
+ "epoch": 1.27,
866
+ "step": 1500
867
+ }
868
+ ],
869
+ "max_steps": 4716,
870
+ "num_train_epochs": 4,
871
+ "total_flos": 2.130248764531802e+22,
872
+ "trial_name": null,
873
+ "trial_params": null
874
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb2690f93601f3894e4e2f7f511834e110a8dbd35cdc3d13e655df1773103c4d
3
+ size 5551
zero_to_fp32.py ADDED
@@ -0,0 +1,584 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 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
+ # record shared parameters so that they can be recovered based on partners
124
+ # this is because such parameters holding reference only are not saved by optimizer
125
+ shared_params = []
126
+ for param in state_dict["module"]:
127
+ if param not in [*param_names, *buffer_names]:
128
+ for share_param in state_dict["module"]:
129
+ if (state_dict["module"][share_param].data_ptr() == state_dict["module"][param].data_ptr()
130
+ and share_param != param):
131
+ shared_params.append([param, share_param])
132
+ break
133
+
134
+ ds_version = state_dict.get(DS_VERSION, None)
135
+
136
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
137
+
138
+ z_model_state = zero_model_state(buffers=buffers,
139
+ param_shapes=param_shapes,
140
+ shared_params=shared_params,
141
+ ds_version=ds_version,
142
+ frozen_param_shapes=frozen_param_shapes,
143
+ frozen_param_fragments=frozen_param_fragments)
144
+ zero_model_states.append(z_model_state)
145
+
146
+ return zero_model_states
147
+
148
+
149
+ def parse_optim_states(files, ds_checkpoint_dir):
150
+
151
+ total_files = len(files)
152
+ state_dicts = []
153
+ for f in files:
154
+ state_dicts.append(torch.load(f, map_location=device))
155
+
156
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
157
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
158
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
159
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
160
+
161
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
162
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
163
+ # use the max of the partition_count to get the dp world_size.
164
+
165
+ if type(world_size) is list:
166
+ world_size = max(world_size)
167
+
168
+ if world_size != total_files:
169
+ raise ValueError(
170
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
171
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
172
+ )
173
+
174
+ # the groups are named differently in each stage
175
+ if zero_stage == 2:
176
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
177
+ elif zero_stage == 3:
178
+ fp32_groups_key = FP32_FLAT_GROUPS
179
+ else:
180
+ raise ValueError(f"unknown zero stage {zero_stage}")
181
+
182
+ if zero_stage == 2:
183
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
184
+ elif zero_stage == 3:
185
+ # if there is more than one param group, there will be multiple flattened tensors - one
186
+ # flattened tensor per group - for simplicity merge them into a single tensor
187
+ #
188
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
189
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
190
+
191
+ fp32_flat_groups = [
192
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
193
+ ]
194
+
195
+ return zero_stage, world_size, fp32_flat_groups
196
+
197
+
198
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir):
199
+ """
200
+ Returns fp32 state_dict reconstructed from ds checkpoint
201
+
202
+ Args:
203
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
204
+
205
+ """
206
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
207
+
208
+ optim_files = get_optim_files(ds_checkpoint_dir)
209
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
210
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
211
+
212
+ model_files = get_model_state_files(ds_checkpoint_dir)
213
+
214
+ zero_model_states = parse_model_states(model_files)
215
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
216
+
217
+ if zero_stage == 2:
218
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states)
219
+ elif zero_stage == 3:
220
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states)
221
+
222
+
223
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
224
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
225
+ return
226
+
227
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
228
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
229
+
230
+ if debug:
231
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
232
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
233
+
234
+ wanted_params = len(frozen_param_shapes)
235
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
236
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
237
+ print(f'Frozen params: Have {avail_numel} numels to process.')
238
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
239
+
240
+ total_params = 0
241
+ total_numel = 0
242
+ for name, shape in frozen_param_shapes.items():
243
+ total_params += 1
244
+ unpartitioned_numel = shape.numel()
245
+ total_numel += unpartitioned_numel
246
+
247
+ state_dict[name] = frozen_param_fragments[name]
248
+
249
+ if debug:
250
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
251
+
252
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
253
+
254
+
255
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
256
+ param_shapes = zero_model_states[0].param_shapes
257
+
258
+ # Reconstruction protocol:
259
+ #
260
+ # XXX: document this
261
+
262
+ if debug:
263
+ for i in range(world_size):
264
+ for j in range(len(fp32_flat_groups[0])):
265
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
266
+
267
+ # XXX: memory usage doubles here (zero2)
268
+ num_param_groups = len(fp32_flat_groups[0])
269
+ merged_single_partition_of_fp32_groups = []
270
+ for i in range(num_param_groups):
271
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
272
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
273
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
274
+ avail_numel = sum(
275
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
276
+
277
+ if debug:
278
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
279
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
280
+ # not asserting if there is a mismatch due to possible padding
281
+ print(f"Have {avail_numel} numels to process.")
282
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
283
+
284
+ # params
285
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
286
+ # out-of-core computing solution
287
+ total_numel = 0
288
+ total_params = 0
289
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
290
+ offset = 0
291
+ avail_numel = full_single_fp32_vector.numel()
292
+ for name, shape in shapes.items():
293
+
294
+ unpartitioned_numel = shape.numel()
295
+ total_numel += unpartitioned_numel
296
+ total_params += 1
297
+
298
+ if debug:
299
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
300
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
301
+ offset += unpartitioned_numel
302
+
303
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
304
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
305
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
306
+ # live optimizer object, so we are checking that the numbers are within the right range
307
+ align_to = 2 * world_size
308
+
309
+ def zero2_align(x):
310
+ return align_to * math.ceil(x / align_to)
311
+
312
+ if debug:
313
+ print(f"original offset={offset}, avail_numel={avail_numel}")
314
+
315
+ offset = zero2_align(offset)
316
+ avail_numel = zero2_align(avail_numel)
317
+
318
+ if debug:
319
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
320
+
321
+ # Sanity check
322
+ if offset != avail_numel:
323
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
324
+
325
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
326
+
327
+
328
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states):
329
+ state_dict = OrderedDict()
330
+
331
+ # buffers
332
+ buffers = zero_model_states[0].buffers
333
+ state_dict.update(buffers)
334
+ if debug:
335
+ print(f"added {len(buffers)} buffers")
336
+
337
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
338
+
339
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
340
+
341
+ # recover shared parameters
342
+ for pair in zero_model_states[0].shared_params:
343
+ state_dict[pair[0]] = state_dict[pair[1]]
344
+
345
+ return state_dict
346
+
347
+
348
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
349
+ remainder = unpartitioned_numel % world_size
350
+ padding_numel = (world_size - remainder) if remainder else 0
351
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
352
+ return partitioned_numel, padding_numel
353
+
354
+
355
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
356
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
357
+ return
358
+
359
+ if debug:
360
+ for i in range(world_size):
361
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
362
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
363
+
364
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
365
+ wanted_params = len(frozen_param_shapes)
366
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
367
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
368
+ print(f'Frozen params: Have {avail_numel} numels to process.')
369
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
370
+
371
+ total_params = 0
372
+ total_numel = 0
373
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
374
+ total_params += 1
375
+ unpartitioned_numel = shape.numel()
376
+ total_numel += unpartitioned_numel
377
+
378
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
379
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
380
+
381
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
382
+
383
+ if debug:
384
+ print(
385
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
386
+ )
387
+
388
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
389
+
390
+
391
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
392
+ param_shapes = zero_model_states[0].param_shapes
393
+ avail_numel = fp32_flat_groups[0].numel() * world_size
394
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
395
+ # param, re-consolidating each param, while dealing with padding if any
396
+
397
+ # merge list of dicts, preserving order
398
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
399
+
400
+ if debug:
401
+ for i in range(world_size):
402
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
403
+
404
+ wanted_params = len(param_shapes)
405
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
406
+ # not asserting if there is a mismatch due to possible padding
407
+ avail_numel = fp32_flat_groups[0].numel() * world_size
408
+ print(f"Trainable params: Have {avail_numel} numels to process.")
409
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
410
+
411
+ # params
412
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
413
+ # out-of-core computing solution
414
+ offset = 0
415
+ total_numel = 0
416
+ total_params = 0
417
+ for name, shape in param_shapes.items():
418
+
419
+ unpartitioned_numel = shape.numel()
420
+ total_numel += unpartitioned_numel
421
+ total_params += 1
422
+
423
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
424
+
425
+ if debug:
426
+ print(
427
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
428
+ )
429
+
430
+ # XXX: memory usage doubles here
431
+ state_dict[name] = torch.cat(
432
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
433
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
434
+ offset += partitioned_numel
435
+
436
+ offset *= world_size
437
+
438
+ # Sanity check
439
+ if offset != avail_numel:
440
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
441
+
442
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
443
+
444
+
445
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states):
446
+ state_dict = OrderedDict()
447
+
448
+ # buffers
449
+ buffers = zero_model_states[0].buffers
450
+ state_dict.update(buffers)
451
+ if debug:
452
+ print(f"added {len(buffers)} buffers")
453
+
454
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
455
+
456
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
457
+
458
+ # recover shared parameters
459
+ for pair in zero_model_states[0].shared_params:
460
+ state_dict[pair[0]] = state_dict[pair[1]]
461
+
462
+ return state_dict
463
+
464
+
465
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None):
466
+ """
467
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
468
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
469
+ via a model hub.
470
+
471
+ Args:
472
+ - ``checkpoint_dir``: path to the desired checkpoint folder
473
+ - ``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``
474
+
475
+ Returns:
476
+ - pytorch ``state_dict``
477
+
478
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
479
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
480
+ the checkpoint.
481
+
482
+ A typical usage might be ::
483
+
484
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
485
+ # do the training and checkpoint saving
486
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
487
+ model = model.cpu() # move to cpu
488
+ model.load_state_dict(state_dict)
489
+ # submit to model hub or save the model to share with others
490
+
491
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
492
+ application. i.e. you will need to re-initialize the deepspeed engine, since
493
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
494
+
495
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
496
+
497
+ """
498
+ if tag is None:
499
+ latest_path = os.path.join(checkpoint_dir, 'latest')
500
+ if os.path.isfile(latest_path):
501
+ with open(latest_path, 'r') as fd:
502
+ tag = fd.read().strip()
503
+ else:
504
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
505
+
506
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
507
+
508
+ if not os.path.isdir(ds_checkpoint_dir):
509
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
510
+
511
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir)
512
+
513
+
514
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None):
515
+ """
516
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
517
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
518
+
519
+ Args:
520
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
521
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
522
+ - ``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``
523
+ """
524
+
525
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
526
+ print(f"Saving fp32 state dict to {output_file}")
527
+ torch.save(state_dict, output_file)
528
+
529
+
530
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
531
+ """
532
+ 1. Put the provided model to cpu
533
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
534
+ 3. Load it into the provided model
535
+
536
+ Args:
537
+ - ``model``: the model object to update
538
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
539
+ - ``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``
540
+
541
+ Returns:
542
+ - ``model`: modified model
543
+
544
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
545
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
546
+ conveniently placed for you in the checkpoint folder.
547
+
548
+ A typical usage might be ::
549
+
550
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
551
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
552
+ # submit to model hub or save the model to share with others
553
+
554
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
555
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
556
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
557
+
558
+ """
559
+ logger.info(f"Extracting fp32 weights")
560
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
561
+
562
+ logger.info(f"Overwriting model with fp32 weights")
563
+ model = model.cpu()
564
+ model.load_state_dict(state_dict, strict=False)
565
+
566
+ return model
567
+
568
+
569
+ if __name__ == "__main__":
570
+
571
+ parser = argparse.ArgumentParser()
572
+ parser.add_argument("checkpoint_dir",
573
+ type=str,
574
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
575
+ parser.add_argument(
576
+ "output_file",
577
+ type=str,
578
+ help="path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)")
579
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
580
+ args = parser.parse_args()
581
+
582
+ debug = args.debug
583
+
584
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir, args.output_file)