shuoxing commited on
Commit
27855f4
·
verified ·
1 Parent(s): ce59711

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,3 +1,202 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: llava-hf/LLaVA-NeXT-Video-7B-hf
3
+ library_name: peft
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.14.0
adapter_config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "/home/tzz/.cache/modelscope/hub/models/swift/LLaVA-NeXT-Video-7B-hf",
5
+ "bias": "none",
6
+ "eva_config": null,
7
+ "exclude_modules": null,
8
+ "fan_in_fan_out": false,
9
+ "inference_mode": true,
10
+ "init_lora_weights": true,
11
+ "layer_replication": null,
12
+ "layers_pattern": null,
13
+ "layers_to_transform": null,
14
+ "loftq_config": {},
15
+ "lora_alpha": 256,
16
+ "lora_bias": false,
17
+ "lora_dropout": 0.05,
18
+ "megatron_config": null,
19
+ "megatron_core": "megatron.core",
20
+ "modules_to_save": [],
21
+ "peft_type": "LORA",
22
+ "r": 128,
23
+ "rank_pattern": {},
24
+ "revision": null,
25
+ "target_modules": "(?!^(multi_modal_projector))^(language_model)(?!.*(lora_A|lora_B|base_layer|emb|wte|shared|lm_head|output|score|v_head|classifier)).*",
26
+ "task_type": "CAUSAL_LM",
27
+ "use_dora": false,
28
+ "use_rslora": false
29
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4402f2f8e389e6ae59c09a456ea4678952568fbff790eaba43ff1c6be7a97825
3
+ size 639699488
additional_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"lora_dtype": null, "lorap_lr_ratio": null, "lorap_emb_lr": 1e-06}
args.json ADDED
@@ -0,0 +1,356 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "swift/LLaVA-NeXT-Video-7B-hf",
3
+ "model_type": "llava_next_video_hf",
4
+ "model_revision": null,
5
+ "task_type": "causal_lm",
6
+ "torch_dtype": "bfloat16",
7
+ "attn_impl": null,
8
+ "num_labels": null,
9
+ "rope_scaling": null,
10
+ "device_map": null,
11
+ "max_memory": {},
12
+ "local_repo_path": null,
13
+ "template": "llava_next_video_hf",
14
+ "system": null,
15
+ "max_length": 4096,
16
+ "truncation_strategy": "delete",
17
+ "max_pixels": null,
18
+ "tools_prompt": "react_en",
19
+ "norm_bbox": null,
20
+ "padding_side": "right",
21
+ "loss_scale": "default",
22
+ "sequence_parallel_size": 1,
23
+ "use_chat_template": true,
24
+ "template_backend": "swift",
25
+ "dataset": [
26
+ "/data1/tzz/VQA/train_lsvq_swift_3000.json"
27
+ ],
28
+ "val_dataset": [],
29
+ "split_dataset_ratio": 0.01,
30
+ "data_seed": 42,
31
+ "dataset_num_proc": 1,
32
+ "streaming": false,
33
+ "enable_cache": false,
34
+ "download_mode": "reuse_dataset_if_exists",
35
+ "columns": {},
36
+ "strict": false,
37
+ "remove_unused_columns": true,
38
+ "model_name": [
39
+ null,
40
+ null
41
+ ],
42
+ "model_author": [
43
+ null,
44
+ null
45
+ ],
46
+ "custom_dataset_info": [],
47
+ "quant_method": null,
48
+ "quant_bits": null,
49
+ "hqq_axis": null,
50
+ "bnb_4bit_compute_dtype": "bfloat16",
51
+ "bnb_4bit_quant_type": "nf4",
52
+ "bnb_4bit_use_double_quant": true,
53
+ "bnb_4bit_quant_storage": null,
54
+ "max_new_tokens": 64,
55
+ "temperature": 0.0,
56
+ "top_k": null,
57
+ "top_p": null,
58
+ "repetition_penalty": null,
59
+ "num_beams": 1,
60
+ "stream": false,
61
+ "stop_words": [],
62
+ "logprobs": false,
63
+ "top_logprobs": null,
64
+ "ckpt_dir": null,
65
+ "load_dataset_config": null,
66
+ "lora_modules": [],
67
+ "tuner_backend": "peft",
68
+ "train_type": "lora",
69
+ "adapters": [],
70
+ "seed": 42,
71
+ "model_kwargs": {},
72
+ "load_args": false,
73
+ "load_data_args": false,
74
+ "use_hf": false,
75
+ "hub_token": null,
76
+ "custom_register_path": [],
77
+ "ignore_args_error": false,
78
+ "use_swift_lora": false,
79
+ "output_dir": "/data1/tzz/VQA/ckpt/llava_next_video/v2-20250226-080739",
80
+ "overwrite_output_dir": false,
81
+ "do_train": false,
82
+ "do_eval": false,
83
+ "do_predict": false,
84
+ "eval_strategy": "epoch",
85
+ "prediction_loss_only": false,
86
+ "per_device_train_batch_size": 1,
87
+ "per_device_eval_batch_size": 1,
88
+ "per_gpu_train_batch_size": null,
89
+ "per_gpu_eval_batch_size": null,
90
+ "gradient_accumulation_steps": 16,
91
+ "eval_accumulation_steps": null,
92
+ "eval_delay": 0,
93
+ "torch_empty_cache_steps": null,
94
+ "learning_rate": 1e-05,
95
+ "weight_decay": 0.1,
96
+ "adam_beta1": 0.9,
97
+ "adam_beta2": 0.999,
98
+ "adam_epsilon": 1e-08,
99
+ "max_grad_norm": 1.0,
100
+ "num_train_epochs": 1.0,
101
+ "max_steps": -1,
102
+ "lr_scheduler_type": "cosine",
103
+ "lr_scheduler_kwargs": null,
104
+ "warmup_ratio": 0.05,
105
+ "warmup_steps": 0,
106
+ "log_level": "passive",
107
+ "log_level_replica": "warning",
108
+ "log_on_each_node": true,
109
+ "logging_dir": "/data1/tzz/VQA/ckpt/llava_next_video/v2-20250226-080739/runs",
110
+ "logging_strategy": "steps",
111
+ "logging_first_step": true,
112
+ "logging_steps": 1,
113
+ "logging_nan_inf_filter": true,
114
+ "save_strategy": "epoch",
115
+ "save_steps": 500,
116
+ "save_total_limit": 1,
117
+ "save_safetensors": true,
118
+ "save_on_each_node": false,
119
+ "save_only_model": false,
120
+ "restore_callback_states_from_checkpoint": false,
121
+ "no_cuda": false,
122
+ "use_cpu": false,
123
+ "use_mps_device": false,
124
+ "jit_mode_eval": false,
125
+ "use_ipex": false,
126
+ "bf16": true,
127
+ "fp16": false,
128
+ "fp16_opt_level": "O1",
129
+ "half_precision_backend": "auto",
130
+ "bf16_full_eval": false,
131
+ "fp16_full_eval": false,
132
+ "tf32": null,
133
+ "local_rank": 0,
134
+ "ddp_backend": null,
135
+ "tpu_num_cores": null,
136
+ "tpu_metrics_debug": false,
137
+ "debug": null,
138
+ "dataloader_drop_last": false,
139
+ "eval_steps": null,
140
+ "dataloader_num_workers": 4,
141
+ "dataloader_prefetch_factor": null,
142
+ "past_index": -1,
143
+ "run_name": null,
144
+ "disable_tqdm": null,
145
+ "label_names": null,
146
+ "load_best_model_at_end": false,
147
+ "metric_for_best_model": "loss",
148
+ "greater_is_better": false,
149
+ "ignore_data_skip": false,
150
+ "fsdp": "",
151
+ "fsdp_min_num_params": 0,
152
+ "fsdp_config": null,
153
+ "fsdp_transformer_layer_cls_to_wrap": null,
154
+ "accelerator_config": {
155
+ "dispatch_batches": false
156
+ },
157
+ "deepspeed": {
158
+ "fp16": {
159
+ "enabled": "auto",
160
+ "loss_scale": 0,
161
+ "loss_scale_window": 1000,
162
+ "initial_scale_power": 16,
163
+ "hysteresis": 2,
164
+ "min_loss_scale": 1
165
+ },
166
+ "bf16": {
167
+ "enabled": "auto"
168
+ },
169
+ "zero_optimization": {
170
+ "stage": 3,
171
+ "offload_optimizer": {
172
+ "device": "none",
173
+ "pin_memory": true
174
+ },
175
+ "offload_param": {
176
+ "device": "none",
177
+ "pin_memory": true
178
+ },
179
+ "overlap_comm": true,
180
+ "contiguous_gradients": true,
181
+ "sub_group_size": 1000000000.0,
182
+ "reduce_bucket_size": "auto",
183
+ "stage3_prefetch_bucket_size": "auto",
184
+ "stage3_param_persistence_threshold": "auto",
185
+ "stage3_max_live_parameters": 1000000000.0,
186
+ "stage3_max_reuse_distance": 1000000000.0,
187
+ "stage3_gather_16bit_weights_on_model_save": true
188
+ },
189
+ "gradient_accumulation_steps": "auto",
190
+ "gradient_clipping": "auto",
191
+ "steps_per_print": 2000,
192
+ "train_batch_size": "auto",
193
+ "train_micro_batch_size_per_gpu": "auto",
194
+ "wall_clock_breakdown": false
195
+ },
196
+ "label_smoothing_factor": 0.0,
197
+ "optim": "adamw_torch",
198
+ "optim_args": null,
199
+ "adafactor": false,
200
+ "group_by_length": false,
201
+ "length_column_name": "length",
202
+ "report_to": [
203
+ "wandb"
204
+ ],
205
+ "ddp_find_unused_parameters": null,
206
+ "ddp_bucket_cap_mb": null,
207
+ "ddp_broadcast_buffers": null,
208
+ "dataloader_pin_memory": true,
209
+ "dataloader_persistent_workers": false,
210
+ "skip_memory_metrics": true,
211
+ "use_legacy_prediction_loop": false,
212
+ "push_to_hub": false,
213
+ "resume_from_checkpoint": null,
214
+ "hub_model_id": null,
215
+ "hub_strategy": "every_save",
216
+ "hub_private_repo": null,
217
+ "hub_always_push": false,
218
+ "gradient_checkpointing": true,
219
+ "gradient_checkpointing_kwargs": null,
220
+ "include_inputs_for_metrics": false,
221
+ "include_for_metrics": [],
222
+ "eval_do_concat_batches": true,
223
+ "fp16_backend": "auto",
224
+ "evaluation_strategy": "epoch",
225
+ "push_to_hub_model_id": null,
226
+ "push_to_hub_organization": null,
227
+ "push_to_hub_token": null,
228
+ "mp_parameters": "",
229
+ "auto_find_batch_size": false,
230
+ "full_determinism": false,
231
+ "torchdynamo": null,
232
+ "ray_scope": "last",
233
+ "ddp_timeout": 1800,
234
+ "torch_compile": false,
235
+ "torch_compile_backend": null,
236
+ "torch_compile_mode": null,
237
+ "dispatch_batches": null,
238
+ "split_batches": null,
239
+ "include_tokens_per_second": false,
240
+ "include_num_input_tokens_seen": false,
241
+ "neftune_noise_alpha": null,
242
+ "optim_target_modules": null,
243
+ "batch_eval_metrics": false,
244
+ "eval_on_start": false,
245
+ "use_liger_kernel": false,
246
+ "eval_use_gather_object": false,
247
+ "average_tokens_across_devices": false,
248
+ "sortish_sampler": false,
249
+ "predict_with_generate": false,
250
+ "generation_max_length": null,
251
+ "generation_num_beams": null,
252
+ "generation_config": null,
253
+ "freeze_parameters": [
254
+ "vision_tower",
255
+ "multi_modal_projector"
256
+ ],
257
+ "freeze_parameters_ratio": 0.0,
258
+ "trainable_parameters": [],
259
+ "freeze_llm": false,
260
+ "freeze_vit": true,
261
+ "freeze_aligner": true,
262
+ "target_modules": [
263
+ "all-linear"
264
+ ],
265
+ "target_regex": null,
266
+ "modules_to_save": [],
267
+ "lora_rank": 128,
268
+ "lora_alpha": 256,
269
+ "lora_dropout": 0.05,
270
+ "lora_bias": "none",
271
+ "lora_dtype": null,
272
+ "lorap_lr_ratio": null,
273
+ "use_rslora": false,
274
+ "use_dora": false,
275
+ "lora_ga_batch_size": 2,
276
+ "lora_ga_iters": 2,
277
+ "lora_ga_max_length": 1024,
278
+ "lora_ga_direction": "ArB2r",
279
+ "lora_ga_scale": "stable",
280
+ "lora_ga_stable_gamma": 16,
281
+ "init_weights": true,
282
+ "fourier_n_frequency": 2000,
283
+ "fourier_scaling": 300.0,
284
+ "boft_block_size": 4,
285
+ "boft_block_num": 0,
286
+ "boft_n_butterfly_factor": 1,
287
+ "boft_dropout": 0.0,
288
+ "vera_rank": 256,
289
+ "vera_projection_prng_key": 0,
290
+ "vera_dropout": 0.0,
291
+ "vera_d_initial": 0.1,
292
+ "adapter_act": "gelu",
293
+ "adapter_length": 128,
294
+ "use_galore": false,
295
+ "galore_target_modules": null,
296
+ "galore_rank": 128,
297
+ "galore_update_proj_gap": 50,
298
+ "galore_scale": 1.0,
299
+ "galore_proj_type": "std",
300
+ "galore_optim_per_parameter": false,
301
+ "galore_with_embedding": false,
302
+ "galore_quantization": false,
303
+ "galore_proj_quant": false,
304
+ "galore_proj_bits": 4,
305
+ "galore_proj_group_size": 256,
306
+ "galore_cos_threshold": 0.4,
307
+ "galore_gamma_proj": 2,
308
+ "galore_queue_size": 5,
309
+ "adalora_target_r": 8,
310
+ "adalora_init_r": 12,
311
+ "adalora_tinit": 0,
312
+ "adalora_tfinal": 0,
313
+ "adalora_deltaT": 1,
314
+ "adalora_beta1": 0.85,
315
+ "adalora_beta2": 0.85,
316
+ "adalora_orth_reg_weight": 0.5,
317
+ "llamapro_num_new_blocks": 4,
318
+ "llamapro_num_groups": null,
319
+ "lisa_activated_layers": 0,
320
+ "lisa_step_interval": 20,
321
+ "reft_layer_key": null,
322
+ "reft_layers": null,
323
+ "reft_rank": 4,
324
+ "reft_intervention_type": "LoreftIntervention",
325
+ "reft_args": null,
326
+ "use_liger": false,
327
+ "model_layer_cls_name": null,
328
+ "metric_warmup_step": 0,
329
+ "fsdp_num": 1,
330
+ "acc_steps": 1,
331
+ "swanlab_token": null,
332
+ "swanlab_project": null,
333
+ "swanlab_workspace": null,
334
+ "swanlab_exp_name": null,
335
+ "swanlab_mode": "cloud",
336
+ "add_version": true,
337
+ "resume_only_model": false,
338
+ "check_model": true,
339
+ "create_checkpoint_symlink": false,
340
+ "packing": false,
341
+ "lazy_tokenize": true,
342
+ "external_plugins": [],
343
+ "loss_type": null,
344
+ "optimizer": null,
345
+ "metric": null,
346
+ "acc_strategy": "token",
347
+ "rank": 0,
348
+ "global_world_size": 1,
349
+ "local_world_size": 1,
350
+ "model_suffix": "LLaVA-NeXT-Video-7B-hf",
351
+ "model_info": "ModelInfo(model_type='llava_next_video_hf', model_dir='/home/tzz/.cache/modelscope/hub/models/swift/LLaVA-NeXT-Video-7B-hf', torch_dtype=torch.bfloat16, max_model_len=4096, quant_method=None, quant_bits=None, rope_scaling={'factor': 2.5, 'type': 'linear'}, config=None, task_type='causal_lm', num_labels=None)",
352
+ "model_meta": "ModelMeta(model_type='llava_next_video_hf', model_groups=[ModelGroup(models=[Model(ms_model_id='swift/LLaVA-NeXT-Video-7B-DPO-hf', hf_model_id='llava-hf/LLaVA-NeXT-Video-7B-DPO-hf', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='swift/LLaVA-NeXT-Video-7B-32K-hf', hf_model_id='llava-hf/LLaVA-NeXT-Video-7B-32K-hf', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='swift/LLaVA-NeXT-Video-7B-hf', hf_model_id='llava-hf/LLaVA-NeXT-Video-7B-hf', model_path=None, ms_revision=None, hf_revision=None)], ignore_patterns=None, requires=None, tags=[])], template='llava_next_video_hf', get_function=<function get_model_tokenizer_llava_next_video at 0x7f31a2703880>, model_arch='llava_next_video_hf', architectures=['LlavaNextVideoForConditionalGeneration'], additional_saved_files=[], torch_dtype=None, is_multimodal=True, is_reward=False, task_type=None, ignore_patterns=['*.zip', '*.gguf', '*.pth', '*.pt', 'consolidated*', 'onnx/*', '*.safetensors.md', '*.msgpack', '*.onnx', '*.ot', '*.h5', '*.bin', '*.safetensors'], requires=['transformers>=4.42', 'av'], tags=[])",
353
+ "model_dir": "/home/tzz/.cache/modelscope/hub/models/swift/LLaVA-NeXT-Video-7B-hf",
354
+ "hub": "<class 'swift.hub.hub.MSHub'>",
355
+ "training_args": "Seq2SeqTrainingArguments(output_dir='/data1/tzz/VQA/ckpt/llava_next_video/v2-20250226-080739', overwrite_output_dir=False, do_train=False, do_eval=True, do_predict=False, eval_strategy=<IntervalStrategy.EPOCH: 'epoch'>, prediction_loss_only=False, per_device_train_batch_size=1, per_device_eval_batch_size=1, per_gpu_train_batch_size=None, per_gpu_eval_batch_size=None, gradient_accumulation_steps=16, eval_accumulation_steps=None, eval_delay=0, torch_empty_cache_steps=None, learning_rate=1e-05, weight_decay=0.1, adam_beta1=0.9, adam_beta2=0.999, adam_epsilon=1e-08, max_grad_norm=1.0, num_train_epochs=1.0, max_steps=-1, lr_scheduler_type=<SchedulerType.COSINE: 'cosine'>, lr_scheduler_kwargs=None, warmup_ratio=0.05, warmup_steps=0, log_level='passive', log_level_replica='warning', log_on_each_node=True, logging_dir='/data1/tzz/VQA/ckpt/llava_next_video/v2-20250226-080739/runs', logging_strategy=<IntervalStrategy.STEPS: 'steps'>, logging_first_step=True, logging_steps=1, logging_nan_inf_filter=True, save_strategy=<SaveStrategy.EPOCH: 'epoch'>, save_steps=500, save_total_limit=1, save_safetensors=True, save_on_each_node=False, save_only_model=False, restore_callback_states_from_checkpoint=False, no_cuda=False, use_cpu=False, use_mps_device=False, seed=42, data_seed=42, jit_mode_eval=False, use_ipex=False, bf16=True, fp16=False, fp16_opt_level='O1', half_precision_backend='auto', bf16_full_eval=False, fp16_full_eval=False, tf32=None, local_rank=0, ddp_backend=None, tpu_num_cores=None, tpu_metrics_debug=False, debug=[], dataloader_drop_last=False, eval_steps=None, dataloader_num_workers=4, dataloader_prefetch_factor=None, past_index=-1, run_name='/data1/tzz/VQA/ckpt/llava_next_video/v2-20250226-080739', disable_tqdm=False, remove_unused_columns=False, label_names=None, load_best_model_at_end=False, metric_for_best_model='loss', greater_is_better=False, ignore_data_skip=False, fsdp=[], fsdp_min_num_params=0, fsdp_config={'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}, fsdp_transformer_layer_cls_to_wrap=None, accelerator_config=AcceleratorConfig(split_batches=False, dispatch_batches=False, even_batches=True, use_seedable_sampler=True, non_blocking=False, gradient_accumulation_kwargs=None, use_configured_state=False), deepspeed={'fp16': {'enabled': 'auto', 'loss_scale': 0, 'loss_scale_window': 1000, 'initial_scale_power': 16, 'hysteresis': 2, 'min_loss_scale': 1}, 'bf16': {'enabled': 'auto'}, 'zero_optimization': {'stage': 3, 'offload_optimizer': {'device': 'none', 'pin_memory': True}, 'offload_param': {'device': 'none', 'pin_memory': True}, 'overlap_comm': True, 'contiguous_gradients': True, 'sub_group_size': 1000000000.0, 'reduce_bucket_size': 'auto', 'stage3_prefetch_bucket_size': 'auto', 'stage3_param_persistence_threshold': 'auto', 'stage3_max_live_parameters': 1000000000.0, 'stage3_max_reuse_distance': 1000000000.0, 'stage3_gather_16bit_weights_on_model_save': True}, 'gradient_accumulation_steps': 'auto', 'gradient_clipping': 'auto', 'steps_per_print': 2000, 'train_batch_size': 'auto', 'train_micro_batch_size_per_gpu': 'auto', 'wall_clock_breakdown': False}, label_smoothing_factor=0.0, optim=<OptimizerNames.ADAMW_TORCH: 'adamw_torch'>, optim_args=None, adafactor=False, group_by_length=False, length_column_name='length', report_to=['wandb'], ddp_find_unused_parameters=None, ddp_bucket_cap_mb=None, ddp_broadcast_buffers=None, dataloader_pin_memory=True, dataloader_persistent_workers=False, skip_memory_metrics=True, use_legacy_prediction_loop=False, push_to_hub=False, resume_from_checkpoint=None, hub_model_id=None, hub_strategy=<HubStrategy.EVERY_SAVE: 'every_save'>, hub_token=None, hub_private_repo=None, hub_always_push=False, gradient_checkpointing=True, gradient_checkpointing_kwargs=None, include_inputs_for_metrics=False, include_for_metrics=[], eval_do_concat_batches=True, fp16_backend='auto', evaluation_strategy='epoch', push_to_hub_model_id=None, push_to_hub_organization=None, push_to_hub_token=None, mp_parameters='', auto_find_batch_size=False, full_determinism=False, torchdynamo=None, ray_scope='last', ddp_timeout=1800, torch_compile=False, torch_compile_backend=None, torch_compile_mode=None, dispatch_batches=None, split_batches=None, include_tokens_per_second=None, include_num_input_tokens_seen=None, neftune_noise_alpha=None, optim_target_modules=None, batch_eval_metrics=False, eval_on_start=False, use_liger_kernel=False, eval_use_gather_object=False, average_tokens_across_devices=None, sortish_sampler=False, predict_with_generate=False, generation_max_length=None, generation_num_beams=None, generation_config=None, acc_strategy='token', sequence_parallel_size=1, check_model=True, train_sampler_random=True, is_encoder_decoder=False, metric_warmup_step=0, train_dataset_sample=-1, fsdp_num=1, acc_steps=1, train_type='lora', optimizer=None, local_repo_path=None, galore_config=None)"
356
+ }
global_step185/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb142298d09b7266f4b455468c7c704fb3afa56f2afdc8e0e2378594f054e37c
3
+ size 3837792176
global_step185/zero_pp_rank_0_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:991e9c2223ae1c3d7654420f5be184b06db39d4b78c74586bcda26d94db1c516
3
+ size 528622
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step185
rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:14b9c6bfdcac96caec5b34f932265a4ed33bc329eb6a8061c7a515c092f92e52
3
+ size 14244
scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3a2e1772b9728f7cdbde917d5843c9d3b3305888987ed6e39b76c36ce92fef7
3
+ size 1064
trainer_state.json ADDED
@@ -0,0 +1,1714 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": 0.12199707,
3
+ "best_model_checkpoint": "/data1/tzz/VQA/ckpt/llava_next_video/v2-20250226-080739/checkpoint-185",
4
+ "epoch": 0.9966329966329966,
5
+ "eval_steps": 500,
6
+ "global_step": 185,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.0053872053872053875,
13
+ "grad_norm": 14.159545000064247,
14
+ "learning_rate": 1.0000000000000002e-06,
15
+ "loss": 31.90625,
16
+ "memory(GiB)": 22.53,
17
+ "step": 1,
18
+ "train_speed(iter/s)": 0.022985
19
+ },
20
+ {
21
+ "epoch": 0.010774410774410775,
22
+ "grad_norm": 14.616283963493206,
23
+ "learning_rate": 2.0000000000000003e-06,
24
+ "loss": 31.5234375,
25
+ "memory(GiB)": 22.53,
26
+ "step": 2,
27
+ "train_speed(iter/s)": 0.028711
28
+ },
29
+ {
30
+ "epoch": 0.01616161616161616,
31
+ "grad_norm": 13.121864716464238,
32
+ "learning_rate": 3e-06,
33
+ "loss": 33.6796875,
34
+ "memory(GiB)": 22.53,
35
+ "step": 3,
36
+ "train_speed(iter/s)": 0.031289
37
+ },
38
+ {
39
+ "epoch": 0.02154882154882155,
40
+ "grad_norm": 11.258740067609244,
41
+ "learning_rate": 4.000000000000001e-06,
42
+ "loss": 31.8203125,
43
+ "memory(GiB)": 22.53,
44
+ "step": 4,
45
+ "train_speed(iter/s)": 0.032739
46
+ },
47
+ {
48
+ "epoch": 0.026936026936026935,
49
+ "grad_norm": 13.170936715126654,
50
+ "learning_rate": 5e-06,
51
+ "loss": 29.2109375,
52
+ "memory(GiB)": 22.55,
53
+ "step": 5,
54
+ "train_speed(iter/s)": 0.033213
55
+ },
56
+ {
57
+ "epoch": 0.03232323232323232,
58
+ "grad_norm": 14.330929445232412,
59
+ "learning_rate": 6e-06,
60
+ "loss": 28.078125,
61
+ "memory(GiB)": 22.55,
62
+ "step": 6,
63
+ "train_speed(iter/s)": 0.033152
64
+ },
65
+ {
66
+ "epoch": 0.03771043771043771,
67
+ "grad_norm": 13.548506738998086,
68
+ "learning_rate": 7e-06,
69
+ "loss": 27.5078125,
70
+ "memory(GiB)": 22.55,
71
+ "step": 7,
72
+ "train_speed(iter/s)": 0.033486
73
+ },
74
+ {
75
+ "epoch": 0.0430976430976431,
76
+ "grad_norm": 8.666929263748118,
77
+ "learning_rate": 8.000000000000001e-06,
78
+ "loss": 24.9609375,
79
+ "memory(GiB)": 22.56,
80
+ "step": 8,
81
+ "train_speed(iter/s)": 0.033686
82
+ },
83
+ {
84
+ "epoch": 0.048484848484848485,
85
+ "grad_norm": 11.066925048714,
86
+ "learning_rate": 9e-06,
87
+ "loss": 19.890625,
88
+ "memory(GiB)": 22.57,
89
+ "step": 9,
90
+ "train_speed(iter/s)": 0.0337
91
+ },
92
+ {
93
+ "epoch": 0.05387205387205387,
94
+ "grad_norm": 8.973276554829988,
95
+ "learning_rate": 1e-05,
96
+ "loss": 14.328125,
97
+ "memory(GiB)": 22.58,
98
+ "step": 10,
99
+ "train_speed(iter/s)": 0.03368
100
+ },
101
+ {
102
+ "epoch": 0.05925925925925926,
103
+ "grad_norm": 4.92025256078084,
104
+ "learning_rate": 9.999194339645292e-06,
105
+ "loss": 11.275390625,
106
+ "memory(GiB)": 22.58,
107
+ "step": 11,
108
+ "train_speed(iter/s)": 0.033773
109
+ },
110
+ {
111
+ "epoch": 0.06464646464646465,
112
+ "grad_norm": 2.5239985209180706,
113
+ "learning_rate": 9.996777618216608e-06,
114
+ "loss": 9.6875,
115
+ "memory(GiB)": 22.58,
116
+ "step": 12,
117
+ "train_speed(iter/s)": 0.034222
118
+ },
119
+ {
120
+ "epoch": 0.07003367003367003,
121
+ "grad_norm": 3.3965201854332046,
122
+ "learning_rate": 9.992750614536606e-06,
123
+ "loss": 7.869140625,
124
+ "memory(GiB)": 22.58,
125
+ "step": 13,
126
+ "train_speed(iter/s)": 0.034559
127
+ },
128
+ {
129
+ "epoch": 0.07542087542087542,
130
+ "grad_norm": 3.83999730322345,
131
+ "learning_rate": 9.987114626364172e-06,
132
+ "loss": 7.22265625,
133
+ "memory(GiB)": 22.58,
134
+ "step": 14,
135
+ "train_speed(iter/s)": 0.034521
136
+ },
137
+ {
138
+ "epoch": 0.08080808080808081,
139
+ "grad_norm": 4.824626769554233,
140
+ "learning_rate": 9.979871469976197e-06,
141
+ "loss": 7.0576171875,
142
+ "memory(GiB)": 22.58,
143
+ "step": 15,
144
+ "train_speed(iter/s)": 0.03441
145
+ },
146
+ {
147
+ "epoch": 0.0861952861952862,
148
+ "grad_norm": 3.043760096951554,
149
+ "learning_rate": 9.971023479582258e-06,
150
+ "loss": 5.4990234375,
151
+ "memory(GiB)": 22.58,
152
+ "step": 16,
153
+ "train_speed(iter/s)": 0.034356
154
+ },
155
+ {
156
+ "epoch": 0.09158249158249158,
157
+ "grad_norm": 1.3971212531371173,
158
+ "learning_rate": 9.960573506572391e-06,
159
+ "loss": 4.044921875,
160
+ "memory(GiB)": 22.58,
161
+ "step": 17,
162
+ "train_speed(iter/s)": 0.03432
163
+ },
164
+ {
165
+ "epoch": 0.09696969696969697,
166
+ "grad_norm": 1.5367962214559587,
167
+ "learning_rate": 9.948524918598175e-06,
168
+ "loss": 3.44189453125,
169
+ "memory(GiB)": 22.58,
170
+ "step": 18,
171
+ "train_speed(iter/s)": 0.034225
172
+ },
173
+ {
174
+ "epoch": 0.10235690235690235,
175
+ "grad_norm": 1.2329087385122603,
176
+ "learning_rate": 9.934881598487478e-06,
177
+ "loss": 3.4072265625,
178
+ "memory(GiB)": 22.58,
179
+ "step": 19,
180
+ "train_speed(iter/s)": 0.034123
181
+ },
182
+ {
183
+ "epoch": 0.10774410774410774,
184
+ "grad_norm": 0.8648810367159049,
185
+ "learning_rate": 9.91964794299315e-06,
186
+ "loss": 3.0048828125,
187
+ "memory(GiB)": 22.58,
188
+ "step": 20,
189
+ "train_speed(iter/s)": 0.03406
190
+ },
191
+ {
192
+ "epoch": 0.11313131313131314,
193
+ "grad_norm": 1.1333084548737522,
194
+ "learning_rate": 9.902828861376101e-06,
195
+ "loss": 2.973876953125,
196
+ "memory(GiB)": 22.58,
197
+ "step": 21,
198
+ "train_speed(iter/s)": 0.03407
199
+ },
200
+ {
201
+ "epoch": 0.11851851851851852,
202
+ "grad_norm": 1.67328747436259,
203
+ "learning_rate": 9.884429773823238e-06,
204
+ "loss": 2.460693359375,
205
+ "memory(GiB)": 22.58,
206
+ "step": 22,
207
+ "train_speed(iter/s)": 0.033985
208
+ },
209
+ {
210
+ "epoch": 0.12390572390572391,
211
+ "grad_norm": 0.8370283899907709,
212
+ "learning_rate": 9.864456609700726e-06,
213
+ "loss": 2.162109375,
214
+ "memory(GiB)": 22.58,
215
+ "step": 23,
216
+ "train_speed(iter/s)": 0.033817
217
+ },
218
+ {
219
+ "epoch": 0.1292929292929293,
220
+ "grad_norm": 0.7984037408374535,
221
+ "learning_rate": 9.842915805643156e-06,
222
+ "loss": 2.711669921875,
223
+ "memory(GiB)": 22.58,
224
+ "step": 24,
225
+ "train_speed(iter/s)": 0.033701
226
+ },
227
+ {
228
+ "epoch": 0.13468013468013468,
229
+ "grad_norm": 0.5877571918682093,
230
+ "learning_rate": 9.819814303479268e-06,
231
+ "loss": 1.707275390625,
232
+ "memory(GiB)": 22.58,
233
+ "step": 25,
234
+ "train_speed(iter/s)": 0.033872
235
+ },
236
+ {
237
+ "epoch": 0.14006734006734006,
238
+ "grad_norm": 1.4800629465642858,
239
+ "learning_rate": 9.79515954799483e-06,
240
+ "loss": 2.813720703125,
241
+ "memory(GiB)": 22.58,
242
+ "step": 26,
243
+ "train_speed(iter/s)": 0.034031
244
+ },
245
+ {
246
+ "epoch": 0.14545454545454545,
247
+ "grad_norm": 2.1222533390916443,
248
+ "learning_rate": 9.768959484533461e-06,
249
+ "loss": 3.59912109375,
250
+ "memory(GiB)": 22.58,
251
+ "step": 27,
252
+ "train_speed(iter/s)": 0.034169
253
+ },
254
+ {
255
+ "epoch": 0.15084175084175083,
256
+ "grad_norm": 0.8369490081884605,
257
+ "learning_rate": 9.741222556436132e-06,
258
+ "loss": 1.89404296875,
259
+ "memory(GiB)": 22.58,
260
+ "step": 28,
261
+ "train_speed(iter/s)": 0.034295
262
+ },
263
+ {
264
+ "epoch": 0.15622895622895622,
265
+ "grad_norm": 0.5854633514891076,
266
+ "learning_rate": 9.711957702320176e-06,
267
+ "loss": 1.986328125,
268
+ "memory(GiB)": 22.58,
269
+ "step": 29,
270
+ "train_speed(iter/s)": 0.034448
271
+ },
272
+ {
273
+ "epoch": 0.16161616161616163,
274
+ "grad_norm": 0.35782476089852655,
275
+ "learning_rate": 9.681174353198687e-06,
276
+ "loss": 2.087890625,
277
+ "memory(GiB)": 22.58,
278
+ "step": 30,
279
+ "train_speed(iter/s)": 0.034568
280
+ },
281
+ {
282
+ "epoch": 0.16700336700336701,
283
+ "grad_norm": 0.7861618699933016,
284
+ "learning_rate": 9.648882429441258e-06,
285
+ "loss": 2.669921875,
286
+ "memory(GiB)": 22.58,
287
+ "step": 31,
288
+ "train_speed(iter/s)": 0.034675
289
+ },
290
+ {
291
+ "epoch": 0.1723905723905724,
292
+ "grad_norm": 0.536791680824106,
293
+ "learning_rate": 9.615092337576987e-06,
294
+ "loss": 2.203125,
295
+ "memory(GiB)": 22.58,
296
+ "step": 32,
297
+ "train_speed(iter/s)": 0.034758
298
+ },
299
+ {
300
+ "epoch": 0.17777777777777778,
301
+ "grad_norm": 1.3726808261834198,
302
+ "learning_rate": 9.579814966940833e-06,
303
+ "loss": 2.114501953125,
304
+ "memory(GiB)": 22.58,
305
+ "step": 33,
306
+ "train_speed(iter/s)": 0.034839
307
+ },
308
+ {
309
+ "epoch": 0.18316498316498317,
310
+ "grad_norm": 0.8535138723050261,
311
+ "learning_rate": 9.543061686164374e-06,
312
+ "loss": 2.1591796875,
313
+ "memory(GiB)": 22.58,
314
+ "step": 34,
315
+ "train_speed(iter/s)": 0.034969
316
+ },
317
+ {
318
+ "epoch": 0.18855218855218855,
319
+ "grad_norm": 0.6726334477065563,
320
+ "learning_rate": 9.504844339512096e-06,
321
+ "loss": 2.35791015625,
322
+ "memory(GiB)": 22.58,
323
+ "step": 35,
324
+ "train_speed(iter/s)": 0.035076
325
+ },
326
+ {
327
+ "epoch": 0.19393939393939394,
328
+ "grad_norm": 0.7227226956981251,
329
+ "learning_rate": 9.465175243064428e-06,
330
+ "loss": 2.400390625,
331
+ "memory(GiB)": 22.58,
332
+ "step": 36,
333
+ "train_speed(iter/s)": 0.035195
334
+ },
335
+ {
336
+ "epoch": 0.19932659932659932,
337
+ "grad_norm": 0.7075241914063357,
338
+ "learning_rate": 9.424067180748692e-06,
339
+ "loss": 1.476318359375,
340
+ "memory(GiB)": 22.58,
341
+ "step": 37,
342
+ "train_speed(iter/s)": 0.035278
343
+ },
344
+ {
345
+ "epoch": 0.2047138047138047,
346
+ "grad_norm": 0.8285808812880359,
347
+ "learning_rate": 9.381533400219319e-06,
348
+ "loss": 2.50634765625,
349
+ "memory(GiB)": 22.58,
350
+ "step": 38,
351
+ "train_speed(iter/s)": 0.035354
352
+ },
353
+ {
354
+ "epoch": 0.2101010101010101,
355
+ "grad_norm": 0.747109858212397,
356
+ "learning_rate": 9.337587608588588e-06,
357
+ "loss": 2.397216796875,
358
+ "memory(GiB)": 22.58,
359
+ "step": 39,
360
+ "train_speed(iter/s)": 0.035434
361
+ },
362
+ {
363
+ "epoch": 0.21548821548821548,
364
+ "grad_norm": 0.8997236382866319,
365
+ "learning_rate": 9.292243968009332e-06,
366
+ "loss": 2.3466796875,
367
+ "memory(GiB)": 22.58,
368
+ "step": 40,
369
+ "train_speed(iter/s)": 0.035447
370
+ },
371
+ {
372
+ "epoch": 0.22087542087542086,
373
+ "grad_norm": 0.3854506877674985,
374
+ "learning_rate": 9.24551709111097e-06,
375
+ "loss": 1.607421875,
376
+ "memory(GiB)": 22.58,
377
+ "step": 41,
378
+ "train_speed(iter/s)": 0.035398
379
+ },
380
+ {
381
+ "epoch": 0.22626262626262628,
382
+ "grad_norm": 0.4259732475000951,
383
+ "learning_rate": 9.197422036290386e-06,
384
+ "loss": 1.921630859375,
385
+ "memory(GiB)": 22.58,
386
+ "step": 42,
387
+ "train_speed(iter/s)": 0.035349
388
+ },
389
+ {
390
+ "epoch": 0.23164983164983166,
391
+ "grad_norm": 0.46150408574103824,
392
+ "learning_rate": 9.147974302859158e-06,
393
+ "loss": 1.41650390625,
394
+ "memory(GiB)": 22.58,
395
+ "step": 43,
396
+ "train_speed(iter/s)": 0.035321
397
+ },
398
+ {
399
+ "epoch": 0.23703703703703705,
400
+ "grad_norm": 0.5918291232050616,
401
+ "learning_rate": 9.09718982604866e-06,
402
+ "loss": 1.58154296875,
403
+ "memory(GiB)": 22.58,
404
+ "step": 44,
405
+ "train_speed(iter/s)": 0.03529
406
+ },
407
+ {
408
+ "epoch": 0.24242424242424243,
409
+ "grad_norm": 1.1984794966626473,
410
+ "learning_rate": 9.045084971874738e-06,
411
+ "loss": 2.67236328125,
412
+ "memory(GiB)": 22.58,
413
+ "step": 45,
414
+ "train_speed(iter/s)": 0.035244
415
+ },
416
+ {
417
+ "epoch": 0.24781144781144782,
418
+ "grad_norm": 0.7304425352094286,
419
+ "learning_rate": 8.991676531863507e-06,
420
+ "loss": 1.993408203125,
421
+ "memory(GiB)": 22.58,
422
+ "step": 46,
423
+ "train_speed(iter/s)": 0.0352
424
+ },
425
+ {
426
+ "epoch": 0.2531986531986532,
427
+ "grad_norm": 0.8247667804924503,
428
+ "learning_rate": 8.936981717640061e-06,
429
+ "loss": 2.8740234375,
430
+ "memory(GiB)": 22.58,
431
+ "step": 47,
432
+ "train_speed(iter/s)": 0.035111
433
+ },
434
+ {
435
+ "epoch": 0.2585858585858586,
436
+ "grad_norm": 1.072788633508109,
437
+ "learning_rate": 8.881018155381766e-06,
438
+ "loss": 1.845458984375,
439
+ "memory(GiB)": 22.58,
440
+ "step": 48,
441
+ "train_speed(iter/s)": 0.035139
442
+ },
443
+ {
444
+ "epoch": 0.26397306397306397,
445
+ "grad_norm": 0.6949566674892941,
446
+ "learning_rate": 8.823803880137993e-06,
447
+ "loss": 2.345458984375,
448
+ "memory(GiB)": 22.58,
449
+ "step": 49,
450
+ "train_speed(iter/s)": 0.035224
451
+ },
452
+ {
453
+ "epoch": 0.26936026936026936,
454
+ "grad_norm": 0.3214051528089464,
455
+ "learning_rate": 8.765357330018056e-06,
456
+ "loss": 1.640869140625,
457
+ "memory(GiB)": 22.58,
458
+ "step": 50,
459
+ "train_speed(iter/s)": 0.035311
460
+ },
461
+ {
462
+ "epoch": 0.27474747474747474,
463
+ "grad_norm": 0.8127331172569063,
464
+ "learning_rate": 8.705697340249275e-06,
465
+ "loss": 2.334716796875,
466
+ "memory(GiB)": 22.58,
467
+ "step": 51,
468
+ "train_speed(iter/s)": 0.035368
469
+ },
470
+ {
471
+ "epoch": 0.2801346801346801,
472
+ "grad_norm": 0.6993353179443554,
473
+ "learning_rate": 8.644843137107058e-06,
474
+ "loss": 2.2666015625,
475
+ "memory(GiB)": 22.58,
476
+ "step": 52,
477
+ "train_speed(iter/s)": 0.03541
478
+ },
479
+ {
480
+ "epoch": 0.2855218855218855,
481
+ "grad_norm": 0.7930646229400613,
482
+ "learning_rate": 8.582814331718961e-06,
483
+ "loss": 1.73876953125,
484
+ "memory(GiB)": 22.58,
485
+ "step": 53,
486
+ "train_speed(iter/s)": 0.035443
487
+ },
488
+ {
489
+ "epoch": 0.2909090909090909,
490
+ "grad_norm": 0.47348696234661886,
491
+ "learning_rate": 8.519630913744726e-06,
492
+ "loss": 1.8544921875,
493
+ "memory(GiB)": 22.58,
494
+ "step": 54,
495
+ "train_speed(iter/s)": 0.035485
496
+ },
497
+ {
498
+ "epoch": 0.2962962962962963,
499
+ "grad_norm": 0.5105789152298116,
500
+ "learning_rate": 8.455313244934324e-06,
501
+ "loss": 2.10107421875,
502
+ "memory(GiB)": 22.58,
503
+ "step": 55,
504
+ "train_speed(iter/s)": 0.03552
505
+ },
506
+ {
507
+ "epoch": 0.30168350168350166,
508
+ "grad_norm": 0.48874730617457113,
509
+ "learning_rate": 8.389882052566106e-06,
510
+ "loss": 2.19189453125,
511
+ "memory(GiB)": 22.58,
512
+ "step": 56,
513
+ "train_speed(iter/s)": 0.035547
514
+ },
515
+ {
516
+ "epoch": 0.30707070707070705,
517
+ "grad_norm": 0.7017590448005361,
518
+ "learning_rate": 8.32335842276713e-06,
519
+ "loss": 1.605224609375,
520
+ "memory(GiB)": 22.58,
521
+ "step": 57,
522
+ "train_speed(iter/s)": 0.035484
523
+ },
524
+ {
525
+ "epoch": 0.31245791245791243,
526
+ "grad_norm": 0.7736924894631574,
527
+ "learning_rate": 8.255763793717868e-06,
528
+ "loss": 2.123779296875,
529
+ "memory(GiB)": 22.58,
530
+ "step": 58,
531
+ "train_speed(iter/s)": 0.035432
532
+ },
533
+ {
534
+ "epoch": 0.3178451178451178,
535
+ "grad_norm": 0.6091631207035194,
536
+ "learning_rate": 8.18711994874345e-06,
537
+ "loss": 1.8798828125,
538
+ "memory(GiB)": 22.58,
539
+ "step": 59,
540
+ "train_speed(iter/s)": 0.035351
541
+ },
542
+ {
543
+ "epoch": 0.32323232323232326,
544
+ "grad_norm": 0.6745360872937951,
545
+ "learning_rate": 8.117449009293668e-06,
546
+ "loss": 2.36767578125,
547
+ "memory(GiB)": 22.58,
548
+ "step": 60,
549
+ "train_speed(iter/s)": 0.035291
550
+ },
551
+ {
552
+ "epoch": 0.32861952861952864,
553
+ "grad_norm": 1.1170607516843722,
554
+ "learning_rate": 8.046773427814043e-06,
555
+ "loss": 2.153076171875,
556
+ "memory(GiB)": 22.58,
557
+ "step": 61,
558
+ "train_speed(iter/s)": 0.035255
559
+ },
560
+ {
561
+ "epoch": 0.33400673400673403,
562
+ "grad_norm": 0.42517306211931166,
563
+ "learning_rate": 7.975115980510187e-06,
564
+ "loss": 1.717041015625,
565
+ "memory(GiB)": 22.58,
566
+ "step": 62,
567
+ "train_speed(iter/s)": 0.035224
568
+ },
569
+ {
570
+ "epoch": 0.3393939393939394,
571
+ "grad_norm": 0.8043024113222557,
572
+ "learning_rate": 7.902499760007867e-06,
573
+ "loss": 1.85888671875,
574
+ "memory(GiB)": 22.58,
575
+ "step": 63,
576
+ "train_speed(iter/s)": 0.035142
577
+ },
578
+ {
579
+ "epoch": 0.3447811447811448,
580
+ "grad_norm": 0.9761638945939747,
581
+ "learning_rate": 7.828948167911073e-06,
582
+ "loss": 1.906005859375,
583
+ "memory(GiB)": 22.58,
584
+ "step": 64,
585
+ "train_speed(iter/s)": 0.035063
586
+ },
587
+ {
588
+ "epoch": 0.3501683501683502,
589
+ "grad_norm": 0.4137734068293326,
590
+ "learning_rate": 7.754484907260513e-06,
591
+ "loss": 2.05712890625,
592
+ "memory(GiB)": 22.58,
593
+ "step": 65,
594
+ "train_speed(iter/s)": 0.034992
595
+ },
596
+ {
597
+ "epoch": 0.35555555555555557,
598
+ "grad_norm": 0.6313489954771672,
599
+ "learning_rate": 7.679133974894984e-06,
600
+ "loss": 1.56591796875,
601
+ "memory(GiB)": 22.58,
602
+ "step": 66,
603
+ "train_speed(iter/s)": 0.035062
604
+ },
605
+ {
606
+ "epoch": 0.36094276094276095,
607
+ "grad_norm": 0.7916770866661113,
608
+ "learning_rate": 7.602919653718044e-06,
609
+ "loss": 1.32373046875,
610
+ "memory(GiB)": 22.58,
611
+ "step": 67,
612
+ "train_speed(iter/s)": 0.035123
613
+ },
614
+ {
615
+ "epoch": 0.36632996632996634,
616
+ "grad_norm": 0.7005145101509135,
617
+ "learning_rate": 7.5258665048725065e-06,
618
+ "loss": 1.677490234375,
619
+ "memory(GiB)": 22.58,
620
+ "step": 68,
621
+ "train_speed(iter/s)": 0.035192
622
+ },
623
+ {
624
+ "epoch": 0.3717171717171717,
625
+ "grad_norm": 0.5600472715983401,
626
+ "learning_rate": 7.447999359825263e-06,
627
+ "loss": 1.8934326171875,
628
+ "memory(GiB)": 22.58,
629
+ "step": 69,
630
+ "train_speed(iter/s)": 0.035242
631
+ },
632
+ {
633
+ "epoch": 0.3771043771043771,
634
+ "grad_norm": 0.7799156688047453,
635
+ "learning_rate": 7.369343312364994e-06,
636
+ "loss": 1.737060546875,
637
+ "memory(GiB)": 22.58,
638
+ "step": 70,
639
+ "train_speed(iter/s)": 0.035303
640
+ },
641
+ {
642
+ "epoch": 0.3824915824915825,
643
+ "grad_norm": 1.0088361337375438,
644
+ "learning_rate": 7.289923710515338e-06,
645
+ "loss": 2.55859375,
646
+ "memory(GiB)": 22.58,
647
+ "step": 71,
648
+ "train_speed(iter/s)": 0.035339
649
+ },
650
+ {
651
+ "epoch": 0.3878787878787879,
652
+ "grad_norm": 0.7778606766770365,
653
+ "learning_rate": 7.2097661483661355e-06,
654
+ "loss": 2.3927001953125,
655
+ "memory(GiB)": 22.58,
656
+ "step": 72,
657
+ "train_speed(iter/s)": 0.035398
658
+ },
659
+ {
660
+ "epoch": 0.39326599326599326,
661
+ "grad_norm": 0.7503526567701239,
662
+ "learning_rate": 7.128896457825364e-06,
663
+ "loss": 2.4095458984375,
664
+ "memory(GiB)": 22.58,
665
+ "step": 73,
666
+ "train_speed(iter/s)": 0.035435
667
+ },
668
+ {
669
+ "epoch": 0.39865319865319865,
670
+ "grad_norm": 0.9293852718192778,
671
+ "learning_rate": 7.047340700294454e-06,
672
+ "loss": 2.0943603515625,
673
+ "memory(GiB)": 22.58,
674
+ "step": 74,
675
+ "train_speed(iter/s)": 0.035473
676
+ },
677
+ {
678
+ "epoch": 0.40404040404040403,
679
+ "grad_norm": 1.2981158494810365,
680
+ "learning_rate": 6.965125158269619e-06,
681
+ "loss": 2.36279296875,
682
+ "memory(GiB)": 22.58,
683
+ "step": 75,
684
+ "train_speed(iter/s)": 0.035498
685
+ },
686
+ {
687
+ "epoch": 0.4094276094276094,
688
+ "grad_norm": 0.5915357318010657,
689
+ "learning_rate": 6.88227632687196e-06,
690
+ "loss": 1.13037109375,
691
+ "memory(GiB)": 22.58,
692
+ "step": 76,
693
+ "train_speed(iter/s)": 0.035521
694
+ },
695
+ {
696
+ "epoch": 0.4148148148148148,
697
+ "grad_norm": 0.8289109263502568,
698
+ "learning_rate": 6.798820905309036e-06,
699
+ "loss": 2.245849609375,
700
+ "memory(GiB)": 22.58,
701
+ "step": 77,
702
+ "train_speed(iter/s)": 0.035549
703
+ },
704
+ {
705
+ "epoch": 0.4202020202020202,
706
+ "grad_norm": 0.7332772758108902,
707
+ "learning_rate": 6.714785788270658e-06,
708
+ "loss": 1.794189453125,
709
+ "memory(GiB)": 22.58,
710
+ "step": 78,
711
+ "train_speed(iter/s)": 0.035574
712
+ },
713
+ {
714
+ "epoch": 0.4255892255892256,
715
+ "grad_norm": 0.8695389561000924,
716
+ "learning_rate": 6.63019805726171e-06,
717
+ "loss": 2.107177734375,
718
+ "memory(GiB)": 22.58,
719
+ "step": 79,
720
+ "train_speed(iter/s)": 0.035564
721
+ },
722
+ {
723
+ "epoch": 0.43097643097643096,
724
+ "grad_norm": 1.0578963540355828,
725
+ "learning_rate": 6.545084971874738e-06,
726
+ "loss": 2.2099609375,
727
+ "memory(GiB)": 22.58,
728
+ "step": 80,
729
+ "train_speed(iter/s)": 0.035518
730
+ },
731
+ {
732
+ "epoch": 0.43636363636363634,
733
+ "grad_norm": 0.5355473518839581,
734
+ "learning_rate": 6.459473961005168e-06,
735
+ "loss": 1.679931640625,
736
+ "memory(GiB)": 22.58,
737
+ "step": 81,
738
+ "train_speed(iter/s)": 0.035449
739
+ },
740
+ {
741
+ "epoch": 0.4417508417508417,
742
+ "grad_norm": 0.47562295475695077,
743
+ "learning_rate": 6.373392614011952e-06,
744
+ "loss": 1.548828125,
745
+ "memory(GiB)": 22.58,
746
+ "step": 82,
747
+ "train_speed(iter/s)": 0.03541
748
+ },
749
+ {
750
+ "epoch": 0.4471380471380471,
751
+ "grad_norm": 1.1873250939202482,
752
+ "learning_rate": 6.286868671826513e-06,
753
+ "loss": 2.3310546875,
754
+ "memory(GiB)": 22.58,
755
+ "step": 83,
756
+ "train_speed(iter/s)": 0.035383
757
+ },
758
+ {
759
+ "epoch": 0.45252525252525255,
760
+ "grad_norm": 0.6325848523967413,
761
+ "learning_rate": 6.19993001801283e-06,
762
+ "loss": 1.63232421875,
763
+ "memory(GiB)": 22.58,
764
+ "step": 84,
765
+ "train_speed(iter/s)": 0.035357
766
+ },
767
+ {
768
+ "epoch": 0.45791245791245794,
769
+ "grad_norm": 0.6180246232374331,
770
+ "learning_rate": 6.112604669781572e-06,
771
+ "loss": 2.5283203125,
772
+ "memory(GiB)": 22.58,
773
+ "step": 85,
774
+ "train_speed(iter/s)": 0.035328
775
+ },
776
+ {
777
+ "epoch": 0.4632996632996633,
778
+ "grad_norm": 0.9254342636136799,
779
+ "learning_rate": 6.024920768961153e-06,
780
+ "loss": 2.09814453125,
781
+ "memory(GiB)": 22.58,
782
+ "step": 86,
783
+ "train_speed(iter/s)": 0.03531
784
+ },
785
+ {
786
+ "epoch": 0.4686868686868687,
787
+ "grad_norm": 1.0220943585915119,
788
+ "learning_rate": 5.936906572928625e-06,
789
+ "loss": 1.8603515625,
790
+ "memory(GiB)": 22.58,
791
+ "step": 87,
792
+ "train_speed(iter/s)": 0.035243
793
+ },
794
+ {
795
+ "epoch": 0.4740740740740741,
796
+ "grad_norm": 0.547874150160307,
797
+ "learning_rate": 5.848590445503345e-06,
798
+ "loss": 2.2890625,
799
+ "memory(GiB)": 22.58,
800
+ "step": 88,
801
+ "train_speed(iter/s)": 0.03516
802
+ },
803
+ {
804
+ "epoch": 0.4794612794612795,
805
+ "grad_norm": 0.7203446700675221,
806
+ "learning_rate": 5.760000847806337e-06,
807
+ "loss": 1.68115234375,
808
+ "memory(GiB)": 22.58,
809
+ "step": 89,
810
+ "train_speed(iter/s)": 0.035117
811
+ },
812
+ {
813
+ "epoch": 0.48484848484848486,
814
+ "grad_norm": 0.7628245708662847,
815
+ "learning_rate": 5.671166329088278e-06,
816
+ "loss": 2.126953125,
817
+ "memory(GiB)": 22.58,
818
+ "step": 90,
819
+ "train_speed(iter/s)": 0.035147
820
+ },
821
+ {
822
+ "epoch": 0.49023569023569025,
823
+ "grad_norm": 0.8089999734614459,
824
+ "learning_rate": 5.582115517529114e-06,
825
+ "loss": 1.948486328125,
826
+ "memory(GiB)": 22.58,
827
+ "step": 91,
828
+ "train_speed(iter/s)": 0.035179
829
+ },
830
+ {
831
+ "epoch": 0.49562289562289563,
832
+ "grad_norm": 0.5039876551970663,
833
+ "learning_rate": 5.4928771110122185e-06,
834
+ "loss": 1.849853515625,
835
+ "memory(GiB)": 22.58,
836
+ "step": 92,
837
+ "train_speed(iter/s)": 0.035212
838
+ },
839
+ {
840
+ "epoch": 0.501010101010101,
841
+ "grad_norm": 0.9008917409254343,
842
+ "learning_rate": 5.403479867876087e-06,
843
+ "loss": 2.642578125,
844
+ "memory(GiB)": 22.58,
845
+ "step": 93,
846
+ "train_speed(iter/s)": 0.035235
847
+ },
848
+ {
849
+ "epoch": 0.5063973063973064,
850
+ "grad_norm": 1.1384096826151604,
851
+ "learning_rate": 5.3139525976465675e-06,
852
+ "loss": 2.49365234375,
853
+ "memory(GiB)": 22.58,
854
+ "step": 94,
855
+ "train_speed(iter/s)": 0.035265
856
+ },
857
+ {
858
+ "epoch": 0.5117845117845118,
859
+ "grad_norm": 0.7491826485818727,
860
+ "learning_rate": 5.224324151752575e-06,
861
+ "loss": 1.88037109375,
862
+ "memory(GiB)": 22.58,
863
+ "step": 95,
864
+ "train_speed(iter/s)": 0.035291
865
+ },
866
+ {
867
+ "epoch": 0.5171717171717172,
868
+ "grad_norm": 0.6169314437426718,
869
+ "learning_rate": 5.134623414228315e-06,
870
+ "loss": 1.485595703125,
871
+ "memory(GiB)": 22.58,
872
+ "step": 96,
873
+ "train_speed(iter/s)": 0.035322
874
+ },
875
+ {
876
+ "epoch": 0.5225589225589226,
877
+ "grad_norm": 0.7458411085328407,
878
+ "learning_rate": 5.04487929240499e-06,
879
+ "loss": 2.030517578125,
880
+ "memory(GiB)": 22.58,
881
+ "step": 97,
882
+ "train_speed(iter/s)": 0.035358
883
+ },
884
+ {
885
+ "epoch": 0.5279461279461279,
886
+ "grad_norm": 0.36969067992245414,
887
+ "learning_rate": 4.955120707595011e-06,
888
+ "loss": 1.82421875,
889
+ "memory(GiB)": 22.58,
890
+ "step": 98,
891
+ "train_speed(iter/s)": 0.03539
892
+ },
893
+ {
894
+ "epoch": 0.5333333333333333,
895
+ "grad_norm": 0.7184526746731991,
896
+ "learning_rate": 4.865376585771687e-06,
897
+ "loss": 2.1650390625,
898
+ "memory(GiB)": 22.58,
899
+ "step": 99,
900
+ "train_speed(iter/s)": 0.035417
901
+ },
902
+ {
903
+ "epoch": 0.5387205387205387,
904
+ "grad_norm": 0.5860047275017632,
905
+ "learning_rate": 4.775675848247427e-06,
906
+ "loss": 2.016845703125,
907
+ "memory(GiB)": 22.58,
908
+ "step": 100,
909
+ "train_speed(iter/s)": 0.035451
910
+ },
911
+ {
912
+ "epoch": 0.5441077441077441,
913
+ "grad_norm": 0.6740666234718802,
914
+ "learning_rate": 4.686047402353433e-06,
915
+ "loss": 1.481689453125,
916
+ "memory(GiB)": 22.58,
917
+ "step": 101,
918
+ "train_speed(iter/s)": 0.035484
919
+ },
920
+ {
921
+ "epoch": 0.5494949494949495,
922
+ "grad_norm": 0.5962985498733315,
923
+ "learning_rate": 4.596520132123915e-06,
924
+ "loss": 2.225341796875,
925
+ "memory(GiB)": 22.58,
926
+ "step": 102,
927
+ "train_speed(iter/s)": 0.035522
928
+ },
929
+ {
930
+ "epoch": 0.5548821548821549,
931
+ "grad_norm": 0.6185754487719404,
932
+ "learning_rate": 4.507122888987782e-06,
933
+ "loss": 2.630615234375,
934
+ "memory(GiB)": 22.58,
935
+ "step": 103,
936
+ "train_speed(iter/s)": 0.035566
937
+ },
938
+ {
939
+ "epoch": 0.5602693602693603,
940
+ "grad_norm": 0.8891703200104817,
941
+ "learning_rate": 4.417884482470887e-06,
942
+ "loss": 1.98291015625,
943
+ "memory(GiB)": 22.58,
944
+ "step": 104,
945
+ "train_speed(iter/s)": 0.03558
946
+ },
947
+ {
948
+ "epoch": 0.5656565656565656,
949
+ "grad_norm": 0.5620520767612842,
950
+ "learning_rate": 4.3288336709117246e-06,
951
+ "loss": 1.933349609375,
952
+ "memory(GiB)": 22.58,
953
+ "step": 105,
954
+ "train_speed(iter/s)": 0.035549
955
+ },
956
+ {
957
+ "epoch": 0.571043771043771,
958
+ "grad_norm": 1.3690550098042635,
959
+ "learning_rate": 4.239999152193664e-06,
960
+ "loss": 2.217529296875,
961
+ "memory(GiB)": 22.58,
962
+ "step": 106,
963
+ "train_speed(iter/s)": 0.035527
964
+ },
965
+ {
966
+ "epoch": 0.5764309764309764,
967
+ "grad_norm": 0.4160377433886458,
968
+ "learning_rate": 4.1514095544966556e-06,
969
+ "loss": 1.737060546875,
970
+ "memory(GiB)": 22.58,
971
+ "step": 107,
972
+ "train_speed(iter/s)": 0.03551
973
+ },
974
+ {
975
+ "epoch": 0.5818181818181818,
976
+ "grad_norm": 0.8209806760015574,
977
+ "learning_rate": 4.063093427071376e-06,
978
+ "loss": 2.782470703125,
979
+ "memory(GiB)": 22.58,
980
+ "step": 108,
981
+ "train_speed(iter/s)": 0.035486
982
+ },
983
+ {
984
+ "epoch": 0.5872053872053872,
985
+ "grad_norm": 0.726795857048424,
986
+ "learning_rate": 3.975079231038848e-06,
987
+ "loss": 2.009521484375,
988
+ "memory(GiB)": 22.58,
989
+ "step": 109,
990
+ "train_speed(iter/s)": 0.035449
991
+ },
992
+ {
993
+ "epoch": 0.5925925925925926,
994
+ "grad_norm": 1.2624010183388914,
995
+ "learning_rate": 3.887395330218429e-06,
996
+ "loss": 2.59814453125,
997
+ "memory(GiB)": 22.58,
998
+ "step": 110,
999
+ "train_speed(iter/s)": 0.035431
1000
+ },
1001
+ {
1002
+ "epoch": 0.597979797979798,
1003
+ "grad_norm": 0.7513165711048129,
1004
+ "learning_rate": 3.8000699819871704e-06,
1005
+ "loss": 1.6396484375,
1006
+ "memory(GiB)": 22.58,
1007
+ "step": 111,
1008
+ "train_speed(iter/s)": 0.035402
1009
+ },
1010
+ {
1011
+ "epoch": 0.6033670033670033,
1012
+ "grad_norm": 0.4587115862936887,
1013
+ "learning_rate": 3.7131313281734895e-06,
1014
+ "loss": 2.044189453125,
1015
+ "memory(GiB)": 22.58,
1016
+ "step": 112,
1017
+ "train_speed(iter/s)": 0.035373
1018
+ },
1019
+ {
1020
+ "epoch": 0.6087542087542087,
1021
+ "grad_norm": 0.41256540620865373,
1022
+ "learning_rate": 3.62660738598805e-06,
1023
+ "loss": 1.9287109375,
1024
+ "memory(GiB)": 22.58,
1025
+ "step": 113,
1026
+ "train_speed(iter/s)": 0.03534
1027
+ },
1028
+ {
1029
+ "epoch": 0.6141414141414141,
1030
+ "grad_norm": 0.4286929355926436,
1031
+ "learning_rate": 3.540526038994834e-06,
1032
+ "loss": 1.646728515625,
1033
+ "memory(GiB)": 22.58,
1034
+ "step": 114,
1035
+ "train_speed(iter/s)": 0.035359
1036
+ },
1037
+ {
1038
+ "epoch": 0.6195286195286195,
1039
+ "grad_norm": 0.8246295061207459,
1040
+ "learning_rate": 3.4549150281252635e-06,
1041
+ "loss": 1.7587890625,
1042
+ "memory(GiB)": 22.58,
1043
+ "step": 115,
1044
+ "train_speed(iter/s)": 0.035387
1045
+ },
1046
+ {
1047
+ "epoch": 0.6249158249158249,
1048
+ "grad_norm": 0.653674454928138,
1049
+ "learning_rate": 3.3698019427382912e-06,
1050
+ "loss": 1.9765625,
1051
+ "memory(GiB)": 22.58,
1052
+ "step": 116,
1053
+ "train_speed(iter/s)": 0.035417
1054
+ },
1055
+ {
1056
+ "epoch": 0.6303030303030303,
1057
+ "grad_norm": 0.6402748838297282,
1058
+ "learning_rate": 3.2852142117293435e-06,
1059
+ "loss": 1.94970703125,
1060
+ "memory(GiB)": 22.58,
1061
+ "step": 117,
1062
+ "train_speed(iter/s)": 0.035431
1063
+ },
1064
+ {
1065
+ "epoch": 0.6356902356902356,
1066
+ "grad_norm": 0.5582058394376362,
1067
+ "learning_rate": 3.2011790946909673e-06,
1068
+ "loss": 1.9755859375,
1069
+ "memory(GiB)": 22.58,
1070
+ "step": 118,
1071
+ "train_speed(iter/s)": 0.03546
1072
+ },
1073
+ {
1074
+ "epoch": 0.641077441077441,
1075
+ "grad_norm": 0.8447371297083311,
1076
+ "learning_rate": 3.11772367312804e-06,
1077
+ "loss": 1.784423828125,
1078
+ "memory(GiB)": 22.58,
1079
+ "step": 119,
1080
+ "train_speed(iter/s)": 0.035493
1081
+ },
1082
+ {
1083
+ "epoch": 0.6464646464646465,
1084
+ "grad_norm": 0.7640836687261319,
1085
+ "learning_rate": 3.0348748417303826e-06,
1086
+ "loss": 1.76171875,
1087
+ "memory(GiB)": 22.58,
1088
+ "step": 120,
1089
+ "train_speed(iter/s)": 0.035513
1090
+ },
1091
+ {
1092
+ "epoch": 0.6518518518518519,
1093
+ "grad_norm": 0.6689239585125656,
1094
+ "learning_rate": 2.9526592997055488e-06,
1095
+ "loss": 2.076904296875,
1096
+ "memory(GiB)": 22.58,
1097
+ "step": 121,
1098
+ "train_speed(iter/s)": 0.03554
1099
+ },
1100
+ {
1101
+ "epoch": 0.6572390572390573,
1102
+ "grad_norm": 0.8205443169011045,
1103
+ "learning_rate": 2.871103542174637e-06,
1104
+ "loss": 2.4423828125,
1105
+ "memory(GiB)": 22.58,
1106
+ "step": 122,
1107
+ "train_speed(iter/s)": 0.035564
1108
+ },
1109
+ {
1110
+ "epoch": 0.6626262626262627,
1111
+ "grad_norm": 0.3861380215034983,
1112
+ "learning_rate": 2.790233851633868e-06,
1113
+ "loss": 1.405517578125,
1114
+ "memory(GiB)": 22.58,
1115
+ "step": 123,
1116
+ "train_speed(iter/s)": 0.035589
1117
+ },
1118
+ {
1119
+ "epoch": 0.6680134680134681,
1120
+ "grad_norm": 0.9319720706049784,
1121
+ "learning_rate": 2.7100762894846633e-06,
1122
+ "loss": 1.884033203125,
1123
+ "memory(GiB)": 22.58,
1124
+ "step": 124,
1125
+ "train_speed(iter/s)": 0.035611
1126
+ },
1127
+ {
1128
+ "epoch": 0.6734006734006734,
1129
+ "grad_norm": 0.4894495365923113,
1130
+ "learning_rate": 2.6306566876350072e-06,
1131
+ "loss": 1.992431640625,
1132
+ "memory(GiB)": 22.58,
1133
+ "step": 125,
1134
+ "train_speed(iter/s)": 0.035618
1135
+ },
1136
+ {
1137
+ "epoch": 0.6787878787878788,
1138
+ "grad_norm": 0.5156966779296556,
1139
+ "learning_rate": 2.55200064017474e-06,
1140
+ "loss": 1.7987060546875,
1141
+ "memory(GiB)": 22.58,
1142
+ "step": 126,
1143
+ "train_speed(iter/s)": 0.035593
1144
+ },
1145
+ {
1146
+ "epoch": 0.6841750841750842,
1147
+ "grad_norm": 0.39627149470201456,
1148
+ "learning_rate": 2.4741334951274948e-06,
1149
+ "loss": 1.779541015625,
1150
+ "memory(GiB)": 22.58,
1151
+ "step": 127,
1152
+ "train_speed(iter/s)": 0.035563
1153
+ },
1154
+ {
1155
+ "epoch": 0.6895622895622896,
1156
+ "grad_norm": 0.7990132228587018,
1157
+ "learning_rate": 2.3970803462819586e-06,
1158
+ "loss": 2.385498046875,
1159
+ "memory(GiB)": 22.58,
1160
+ "step": 128,
1161
+ "train_speed(iter/s)": 0.035533
1162
+ },
1163
+ {
1164
+ "epoch": 0.694949494949495,
1165
+ "grad_norm": 0.542336867995926,
1166
+ "learning_rate": 2.320866025105016e-06,
1167
+ "loss": 1.775390625,
1168
+ "memory(GiB)": 22.58,
1169
+ "step": 129,
1170
+ "train_speed(iter/s)": 0.035487
1171
+ },
1172
+ {
1173
+ "epoch": 0.7003367003367004,
1174
+ "grad_norm": 0.40553603638944413,
1175
+ "learning_rate": 2.245515092739488e-06,
1176
+ "loss": 1.65771484375,
1177
+ "memory(GiB)": 22.58,
1178
+ "step": 130,
1179
+ "train_speed(iter/s)": 0.035457
1180
+ },
1181
+ {
1182
+ "epoch": 0.7057239057239058,
1183
+ "grad_norm": 0.5705311307759141,
1184
+ "learning_rate": 2.171051832088928e-06,
1185
+ "loss": 1.392578125,
1186
+ "memory(GiB)": 22.58,
1187
+ "step": 131,
1188
+ "train_speed(iter/s)": 0.035439
1189
+ },
1190
+ {
1191
+ "epoch": 0.7111111111111111,
1192
+ "grad_norm": 0.5637194621292295,
1193
+ "learning_rate": 2.097500239992132e-06,
1194
+ "loss": 1.808349609375,
1195
+ "memory(GiB)": 22.58,
1196
+ "step": 132,
1197
+ "train_speed(iter/s)": 0.035412
1198
+ },
1199
+ {
1200
+ "epoch": 0.7164983164983165,
1201
+ "grad_norm": 1.0166298249729564,
1202
+ "learning_rate": 2.0248840194898155e-06,
1203
+ "loss": 1.88232421875,
1204
+ "memory(GiB)": 22.58,
1205
+ "step": 133,
1206
+ "train_speed(iter/s)": 0.035367
1207
+ },
1208
+ {
1209
+ "epoch": 0.7218855218855219,
1210
+ "grad_norm": 0.365517442677317,
1211
+ "learning_rate": 1.95322657218596e-06,
1212
+ "loss": 1.8359375,
1213
+ "memory(GiB)": 22.58,
1214
+ "step": 134,
1215
+ "train_speed(iter/s)": 0.035304
1216
+ },
1217
+ {
1218
+ "epoch": 0.7272727272727273,
1219
+ "grad_norm": 0.5937921378630181,
1220
+ "learning_rate": 1.8825509907063328e-06,
1221
+ "loss": 2.16162109375,
1222
+ "memory(GiB)": 22.58,
1223
+ "step": 135,
1224
+ "train_speed(iter/s)": 0.035244
1225
+ },
1226
+ {
1227
+ "epoch": 0.7326599326599327,
1228
+ "grad_norm": 0.5630691840328598,
1229
+ "learning_rate": 1.8128800512565514e-06,
1230
+ "loss": 1.953369140625,
1231
+ "memory(GiB)": 22.58,
1232
+ "step": 136,
1233
+ "train_speed(iter/s)": 0.035272
1234
+ },
1235
+ {
1236
+ "epoch": 0.7380471380471381,
1237
+ "grad_norm": 0.9036946278139879,
1238
+ "learning_rate": 1.7442362062821323e-06,
1239
+ "loss": 3.1923828125,
1240
+ "memory(GiB)": 22.58,
1241
+ "step": 137,
1242
+ "train_speed(iter/s)": 0.035287
1243
+ },
1244
+ {
1245
+ "epoch": 0.7434343434343434,
1246
+ "grad_norm": 0.5335511498935785,
1247
+ "learning_rate": 1.6766415772328732e-06,
1248
+ "loss": 1.705322265625,
1249
+ "memory(GiB)": 22.58,
1250
+ "step": 138,
1251
+ "train_speed(iter/s)": 0.035295
1252
+ },
1253
+ {
1254
+ "epoch": 0.7488215488215488,
1255
+ "grad_norm": 0.8149099249815346,
1256
+ "learning_rate": 1.610117947433897e-06,
1257
+ "loss": 2.81689453125,
1258
+ "memory(GiB)": 22.58,
1259
+ "step": 139,
1260
+ "train_speed(iter/s)": 0.035308
1261
+ },
1262
+ {
1263
+ "epoch": 0.7542087542087542,
1264
+ "grad_norm": 0.5287002241309334,
1265
+ "learning_rate": 1.544686755065677e-06,
1266
+ "loss": 1.266357421875,
1267
+ "memory(GiB)": 22.58,
1268
+ "step": 140,
1269
+ "train_speed(iter/s)": 0.035318
1270
+ },
1271
+ {
1272
+ "epoch": 0.7595959595959596,
1273
+ "grad_norm": 0.6139302197140588,
1274
+ "learning_rate": 1.4803690862552755e-06,
1275
+ "loss": 1.817626953125,
1276
+ "memory(GiB)": 22.58,
1277
+ "step": 141,
1278
+ "train_speed(iter/s)": 0.035343
1279
+ },
1280
+ {
1281
+ "epoch": 0.764983164983165,
1282
+ "grad_norm": 0.6333656991964685,
1283
+ "learning_rate": 1.4171856682810386e-06,
1284
+ "loss": 2.101806640625,
1285
+ "memory(GiB)": 22.58,
1286
+ "step": 142,
1287
+ "train_speed(iter/s)": 0.035364
1288
+ },
1289
+ {
1290
+ "epoch": 0.7703703703703704,
1291
+ "grad_norm": 0.8829740683592863,
1292
+ "learning_rate": 1.3551568628929434e-06,
1293
+ "loss": 2.508056640625,
1294
+ "memory(GiB)": 22.58,
1295
+ "step": 143,
1296
+ "train_speed(iter/s)": 0.03539
1297
+ },
1298
+ {
1299
+ "epoch": 0.7757575757575758,
1300
+ "grad_norm": 0.5801508492146695,
1301
+ "learning_rate": 1.2943026597507268e-06,
1302
+ "loss": 1.6142578125,
1303
+ "memory(GiB)": 22.58,
1304
+ "step": 144,
1305
+ "train_speed(iter/s)": 0.035413
1306
+ },
1307
+ {
1308
+ "epoch": 0.7811447811447811,
1309
+ "grad_norm": 0.48056036748223746,
1310
+ "learning_rate": 1.234642669981946e-06,
1311
+ "loss": 1.942138671875,
1312
+ "memory(GiB)": 22.58,
1313
+ "step": 145,
1314
+ "train_speed(iter/s)": 0.035431
1315
+ },
1316
+ {
1317
+ "epoch": 0.7865319865319865,
1318
+ "grad_norm": 0.5473637984491948,
1319
+ "learning_rate": 1.1761961198620081e-06,
1320
+ "loss": 1.748779296875,
1321
+ "memory(GiB)": 22.58,
1322
+ "step": 146,
1323
+ "train_speed(iter/s)": 0.035455
1324
+ },
1325
+ {
1326
+ "epoch": 0.7919191919191919,
1327
+ "grad_norm": 0.7226102542834439,
1328
+ "learning_rate": 1.118981844618236e-06,
1329
+ "loss": 1.657470703125,
1330
+ "memory(GiB)": 22.58,
1331
+ "step": 147,
1332
+ "train_speed(iter/s)": 0.035472
1333
+ },
1334
+ {
1335
+ "epoch": 0.7973063973063973,
1336
+ "grad_norm": 0.677002948688539,
1337
+ "learning_rate": 1.06301828235994e-06,
1338
+ "loss": 1.730224609375,
1339
+ "memory(GiB)": 22.58,
1340
+ "step": 148,
1341
+ "train_speed(iter/s)": 0.035492
1342
+ },
1343
+ {
1344
+ "epoch": 0.8026936026936027,
1345
+ "grad_norm": 0.4690206204454014,
1346
+ "learning_rate": 1.0083234681364934e-06,
1347
+ "loss": 1.97509765625,
1348
+ "memory(GiB)": 22.58,
1349
+ "step": 149,
1350
+ "train_speed(iter/s)": 0.035513
1351
+ },
1352
+ {
1353
+ "epoch": 0.8080808080808081,
1354
+ "grad_norm": 0.38431237166068455,
1355
+ "learning_rate": 9.549150281252633e-07,
1356
+ "loss": 1.977783203125,
1357
+ "memory(GiB)": 22.58,
1358
+ "step": 150,
1359
+ "train_speed(iter/s)": 0.035533
1360
+ },
1361
+ {
1362
+ "epoch": 0.8134680134680135,
1363
+ "grad_norm": 1.4318443328161967,
1364
+ "learning_rate": 9.028101739513406e-07,
1365
+ "loss": 2.696533203125,
1366
+ "memory(GiB)": 22.58,
1367
+ "step": 151,
1368
+ "train_speed(iter/s)": 0.035549
1369
+ },
1370
+ {
1371
+ "epoch": 0.8188552188552188,
1372
+ "grad_norm": 0.39825000243591335,
1373
+ "learning_rate": 8.520256971408453e-07,
1374
+ "loss": 1.52294921875,
1375
+ "memory(GiB)": 22.58,
1376
+ "step": 152,
1377
+ "train_speed(iter/s)": 0.035566
1378
+ },
1379
+ {
1380
+ "epoch": 0.8242424242424242,
1381
+ "grad_norm": 0.403223921534723,
1382
+ "learning_rate": 8.025779637096138e-07,
1383
+ "loss": 2.0869140625,
1384
+ "memory(GiB)": 22.58,
1385
+ "step": 153,
1386
+ "train_speed(iter/s)": 0.035581
1387
+ },
1388
+ {
1389
+ "epoch": 0.8296296296296296,
1390
+ "grad_norm": 0.39408518518211616,
1391
+ "learning_rate": 7.544829088890326e-07,
1392
+ "loss": 2.085693359375,
1393
+ "memory(GiB)": 22.58,
1394
+ "step": 154,
1395
+ "train_speed(iter/s)": 0.035601
1396
+ },
1397
+ {
1398
+ "epoch": 0.835016835016835,
1399
+ "grad_norm": 0.6580639598152973,
1400
+ "learning_rate": 7.077560319906696e-07,
1401
+ "loss": 1.58740234375,
1402
+ "memory(GiB)": 22.58,
1403
+ "step": 155,
1404
+ "train_speed(iter/s)": 0.035601
1405
+ },
1406
+ {
1407
+ "epoch": 0.8404040404040404,
1408
+ "grad_norm": 0.5455643216936216,
1409
+ "learning_rate": 6.624123914114122e-07,
1410
+ "loss": 1.76953125,
1411
+ "memory(GiB)": 22.58,
1412
+ "step": 156,
1413
+ "train_speed(iter/s)": 0.035584
1414
+ },
1415
+ {
1416
+ "epoch": 0.8457912457912458,
1417
+ "grad_norm": 0.9580661740362665,
1418
+ "learning_rate": 6.184665997806832e-07,
1419
+ "loss": 2.3505859375,
1420
+ "memory(GiB)": 22.58,
1421
+ "step": 157,
1422
+ "train_speed(iter/s)": 0.035562
1423
+ },
1424
+ {
1425
+ "epoch": 0.8511784511784511,
1426
+ "grad_norm": 0.49273093322057226,
1427
+ "learning_rate": 5.759328192513075e-07,
1428
+ "loss": 1.632080078125,
1429
+ "memory(GiB)": 22.58,
1430
+ "step": 158,
1431
+ "train_speed(iter/s)": 0.035543
1432
+ },
1433
+ {
1434
+ "epoch": 0.8565656565656565,
1435
+ "grad_norm": 0.5074137587596991,
1436
+ "learning_rate": 5.348247569355736e-07,
1437
+ "loss": 1.71240234375,
1438
+ "memory(GiB)": 22.58,
1439
+ "step": 159,
1440
+ "train_speed(iter/s)": 0.03552
1441
+ },
1442
+ {
1443
+ "epoch": 0.8619528619528619,
1444
+ "grad_norm": 0.7185716029221749,
1445
+ "learning_rate": 4.951556604879049e-07,
1446
+ "loss": 2.36669921875,
1447
+ "memory(GiB)": 22.58,
1448
+ "step": 160,
1449
+ "train_speed(iter/s)": 0.035503
1450
+ },
1451
+ {
1452
+ "epoch": 0.8673400673400673,
1453
+ "grad_norm": 0.7811542866299452,
1454
+ "learning_rate": 4.569383138356276e-07,
1455
+ "loss": 1.678955078125,
1456
+ "memory(GiB)": 22.58,
1457
+ "step": 161,
1458
+ "train_speed(iter/s)": 0.035485
1459
+ },
1460
+ {
1461
+ "epoch": 0.8727272727272727,
1462
+ "grad_norm": 0.5128778192942757,
1463
+ "learning_rate": 4.201850330591678e-07,
1464
+ "loss": 2.072998046875,
1465
+ "memory(GiB)": 22.58,
1466
+ "step": 162,
1467
+ "train_speed(iter/s)": 0.035459
1468
+ },
1469
+ {
1470
+ "epoch": 0.8781144781144781,
1471
+ "grad_norm": 0.6851552480944826,
1472
+ "learning_rate": 3.8490766242301356e-07,
1473
+ "loss": 1.55322265625,
1474
+ "memory(GiB)": 22.58,
1475
+ "step": 163,
1476
+ "train_speed(iter/s)": 0.035422
1477
+ },
1478
+ {
1479
+ "epoch": 0.8835016835016835,
1480
+ "grad_norm": 1.0656634793505568,
1481
+ "learning_rate": 3.511175705587433e-07,
1482
+ "loss": 2.09228515625,
1483
+ "memory(GiB)": 22.58,
1484
+ "step": 164,
1485
+ "train_speed(iter/s)": 0.035412
1486
+ },
1487
+ {
1488
+ "epoch": 0.8888888888888888,
1489
+ "grad_norm": 0.4704867924767551,
1490
+ "learning_rate": 3.18825646801314e-07,
1491
+ "loss": 2.178955078125,
1492
+ "memory(GiB)": 22.58,
1493
+ "step": 165,
1494
+ "train_speed(iter/s)": 0.03542
1495
+ },
1496
+ {
1497
+ "epoch": 0.8942760942760942,
1498
+ "grad_norm": 0.3438531193817133,
1499
+ "learning_rate": 2.8804229767982637e-07,
1500
+ "loss": 1.828125,
1501
+ "memory(GiB)": 22.58,
1502
+ "step": 166,
1503
+ "train_speed(iter/s)": 0.035441
1504
+ },
1505
+ {
1506
+ "epoch": 0.8996632996632996,
1507
+ "grad_norm": 0.9072486327466182,
1508
+ "learning_rate": 2.587774435638679e-07,
1509
+ "loss": 1.902099609375,
1510
+ "memory(GiB)": 22.58,
1511
+ "step": 167,
1512
+ "train_speed(iter/s)": 0.035458
1513
+ },
1514
+ {
1515
+ "epoch": 0.9050505050505051,
1516
+ "grad_norm": 0.40209833194248146,
1517
+ "learning_rate": 2.3104051546654016e-07,
1518
+ "loss": 1.72314453125,
1519
+ "memory(GiB)": 22.58,
1520
+ "step": 168,
1521
+ "train_speed(iter/s)": 0.035472
1522
+ },
1523
+ {
1524
+ "epoch": 0.9104377104377105,
1525
+ "grad_norm": 0.6534758670706157,
1526
+ "learning_rate": 2.0484045200517222e-07,
1527
+ "loss": 1.73095703125,
1528
+ "memory(GiB)": 22.58,
1529
+ "step": 169,
1530
+ "train_speed(iter/s)": 0.03548
1531
+ },
1532
+ {
1533
+ "epoch": 0.9158249158249159,
1534
+ "grad_norm": 0.36229213242531244,
1535
+ "learning_rate": 1.801856965207338e-07,
1536
+ "loss": 1.954345703125,
1537
+ "memory(GiB)": 22.58,
1538
+ "step": 170,
1539
+ "train_speed(iter/s)": 0.035499
1540
+ },
1541
+ {
1542
+ "epoch": 0.9212121212121213,
1543
+ "grad_norm": 0.41462023840060064,
1544
+ "learning_rate": 1.5708419435684463e-07,
1545
+ "loss": 1.726318359375,
1546
+ "memory(GiB)": 22.58,
1547
+ "step": 171,
1548
+ "train_speed(iter/s)": 0.035512
1549
+ },
1550
+ {
1551
+ "epoch": 0.9265993265993266,
1552
+ "grad_norm": 0.793282464162017,
1553
+ "learning_rate": 1.3554339029927532e-07,
1554
+ "loss": 2.07861328125,
1555
+ "memory(GiB)": 22.58,
1556
+ "step": 172,
1557
+ "train_speed(iter/s)": 0.035526
1558
+ },
1559
+ {
1560
+ "epoch": 0.931986531986532,
1561
+ "grad_norm": 0.4924403822397691,
1562
+ "learning_rate": 1.1557022617676217e-07,
1563
+ "loss": 1.400634765625,
1564
+ "memory(GiB)": 22.58,
1565
+ "step": 173,
1566
+ "train_speed(iter/s)": 0.035541
1567
+ },
1568
+ {
1569
+ "epoch": 0.9373737373737374,
1570
+ "grad_norm": 0.41980069690346106,
1571
+ "learning_rate": 9.717113862389993e-08,
1572
+ "loss": 2.12158203125,
1573
+ "memory(GiB)": 22.58,
1574
+ "step": 174,
1575
+ "train_speed(iter/s)": 0.03556
1576
+ },
1577
+ {
1578
+ "epoch": 0.9427609427609428,
1579
+ "grad_norm": 0.8809220146060189,
1580
+ "learning_rate": 8.035205700685167e-08,
1581
+ "loss": 2.621826171875,
1582
+ "memory(GiB)": 22.58,
1583
+ "step": 175,
1584
+ "train_speed(iter/s)": 0.035577
1585
+ },
1586
+ {
1587
+ "epoch": 0.9481481481481482,
1588
+ "grad_norm": 0.6908254679787823,
1589
+ "learning_rate": 6.511840151252169e-08,
1590
+ "loss": 1.813232421875,
1591
+ "memory(GiB)": 22.58,
1592
+ "step": 176,
1593
+ "train_speed(iter/s)": 0.035597
1594
+ },
1595
+ {
1596
+ "epoch": 0.9535353535353536,
1597
+ "grad_norm": 0.49484208186969647,
1598
+ "learning_rate": 5.1475081401825553e-08,
1599
+ "loss": 1.9814453125,
1600
+ "memory(GiB)": 22.58,
1601
+ "step": 177,
1602
+ "train_speed(iter/s)": 0.035578
1603
+ },
1604
+ {
1605
+ "epoch": 0.958922558922559,
1606
+ "grad_norm": 0.6989450753180266,
1607
+ "learning_rate": 3.9426493427611177e-08,
1608
+ "loss": 1.78466796875,
1609
+ "memory(GiB)": 22.58,
1610
+ "step": 178,
1611
+ "train_speed(iter/s)": 0.035563
1612
+ },
1613
+ {
1614
+ "epoch": 0.9643097643097643,
1615
+ "grad_norm": 0.5543481036485521,
1616
+ "learning_rate": 2.8976520417742794e-08,
1617
+ "loss": 1.727783203125,
1618
+ "memory(GiB)": 22.58,
1619
+ "step": 179,
1620
+ "train_speed(iter/s)": 0.035552
1621
+ },
1622
+ {
1623
+ "epoch": 0.9696969696969697,
1624
+ "grad_norm": 0.5545843045026326,
1625
+ "learning_rate": 2.012853002380466e-08,
1626
+ "loss": 1.75634765625,
1627
+ "memory(GiB)": 22.58,
1628
+ "step": 180,
1629
+ "train_speed(iter/s)": 0.035543
1630
+ },
1631
+ {
1632
+ "epoch": 0.9750841750841751,
1633
+ "grad_norm": 0.3433152184276571,
1634
+ "learning_rate": 1.2885373635829756e-08,
1635
+ "loss": 1.64208984375,
1636
+ "memory(GiB)": 22.58,
1637
+ "step": 181,
1638
+ "train_speed(iter/s)": 0.035533
1639
+ },
1640
+ {
1641
+ "epoch": 0.9804713804713805,
1642
+ "grad_norm": 0.9002229182397717,
1643
+ "learning_rate": 7.249385463395375e-09,
1644
+ "loss": 2.177490234375,
1645
+ "memory(GiB)": 22.58,
1646
+ "step": 182,
1647
+ "train_speed(iter/s)": 0.035517
1648
+ },
1649
+ {
1650
+ "epoch": 0.9858585858585859,
1651
+ "grad_norm": 0.5840020558119475,
1652
+ "learning_rate": 3.2223817833931803e-09,
1653
+ "loss": 1.4775390625,
1654
+ "memory(GiB)": 22.58,
1655
+ "step": 183,
1656
+ "train_speed(iter/s)": 0.035499
1657
+ },
1658
+ {
1659
+ "epoch": 0.9912457912457913,
1660
+ "grad_norm": 0.31651969118225726,
1661
+ "learning_rate": 8.056603547090813e-10,
1662
+ "loss": 1.804931640625,
1663
+ "memory(GiB)": 22.58,
1664
+ "step": 184,
1665
+ "train_speed(iter/s)": 0.035513
1666
+ },
1667
+ {
1668
+ "epoch": 0.9966329966329966,
1669
+ "grad_norm": 0.5699524292753597,
1670
+ "learning_rate": 0.0,
1671
+ "loss": 1.653076171875,
1672
+ "memory(GiB)": 22.58,
1673
+ "step": 185,
1674
+ "train_speed(iter/s)": 0.035529
1675
+ },
1676
+ {
1677
+ "epoch": 0.9966329966329966,
1678
+ "eval_loss": 0.12199707329273224,
1679
+ "eval_runtime": 16.4404,
1680
+ "eval_samples_per_second": 1.825,
1681
+ "eval_steps_per_second": 1.825,
1682
+ "step": 185
1683
+ },
1684
+ {
1685
+ "epoch": 0.9966329966329966,
1686
+ "eval_loss": 0.12199707329273224,
1687
+ "eval_runtime": 18.3596,
1688
+ "eval_samples_per_second": 1.634,
1689
+ "eval_steps_per_second": 1.634,
1690
+ "step": 185
1691
+ }
1692
+ ],
1693
+ "logging_steps": 1,
1694
+ "max_steps": 185,
1695
+ "num_input_tokens_seen": 0,
1696
+ "num_train_epochs": 1,
1697
+ "save_steps": 500,
1698
+ "stateful_callbacks": {
1699
+ "TrainerControl": {
1700
+ "args": {
1701
+ "should_epoch_stop": false,
1702
+ "should_evaluate": false,
1703
+ "should_log": false,
1704
+ "should_save": true,
1705
+ "should_training_stop": true
1706
+ },
1707
+ "attributes": {}
1708
+ }
1709
+ },
1710
+ "total_flos": 664501364736.0,
1711
+ "train_batch_size": 1,
1712
+ "trial_name": null,
1713
+ "trial_params": null
1714
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:549e622b17a582e38ce2f4e01eadb3074fb9d02d89f1d257ec75ba841132e4e4
3
+ size 8120
zero_to_fp32.py ADDED
@@ -0,0 +1,760 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example:
14
+ # python zero_to_fp32.py . output_dir/
15
+ # or
16
+ # python zero_to_fp32.py . output_dir/ --safe_serialization
17
+
18
+ import argparse
19
+ import torch
20
+ import glob
21
+ import math
22
+ import os
23
+ import re
24
+ import gc
25
+ import json
26
+ import numpy as np
27
+ from tqdm import tqdm
28
+ from collections import OrderedDict
29
+ from dataclasses import dataclass
30
+
31
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
32
+ # DeepSpeed data structures it has to be available in the current python environment.
33
+ from deepspeed.utils import logger
34
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
35
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
36
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
37
+
38
+
39
+ @dataclass
40
+ class zero_model_state:
41
+ buffers: dict()
42
+ param_shapes: dict()
43
+ shared_params: list
44
+ ds_version: int
45
+ frozen_param_shapes: dict()
46
+ frozen_param_fragments: dict()
47
+
48
+
49
+ debug = 0
50
+
51
+ # load to cpu
52
+ device = torch.device('cpu')
53
+
54
+
55
+ def atoi(text):
56
+ return int(text) if text.isdigit() else text
57
+
58
+
59
+ def natural_keys(text):
60
+ '''
61
+ alist.sort(key=natural_keys) sorts in human order
62
+ http://nedbatchelder.com/blog/200712/human_sorting.html
63
+ (See Toothy's implementation in the comments)
64
+ '''
65
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
66
+
67
+
68
+ def get_model_state_file(checkpoint_dir, zero_stage):
69
+ if not os.path.isdir(checkpoint_dir):
70
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
71
+
72
+ # there should be only one file
73
+ if zero_stage <= 2:
74
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
75
+ elif zero_stage == 3:
76
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
77
+
78
+ if not os.path.exists(file):
79
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
80
+
81
+ return file
82
+
83
+
84
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
85
+ # XXX: need to test that this simple glob rule works for multi-node setup too
86
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
87
+
88
+ if len(ckpt_files) == 0:
89
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
90
+
91
+ return ckpt_files
92
+
93
+
94
+ def get_optim_files(checkpoint_dir):
95
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
96
+
97
+
98
+ def get_model_state_files(checkpoint_dir):
99
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
100
+
101
+
102
+ def parse_model_states(files):
103
+ zero_model_states = []
104
+ for file in files:
105
+ state_dict = torch.load(file, map_location=device, weights_only=False)
106
+
107
+ if BUFFER_NAMES not in state_dict:
108
+ raise ValueError(f"{file} is not a model state checkpoint")
109
+ buffer_names = state_dict[BUFFER_NAMES]
110
+ if debug:
111
+ print("Found buffers:", buffer_names)
112
+
113
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
114
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
115
+ param_shapes = state_dict[PARAM_SHAPES]
116
+
117
+ # collect parameters that are included in param_shapes
118
+ param_names = []
119
+ for s in param_shapes:
120
+ for name in s.keys():
121
+ param_names.append(name)
122
+
123
+ # update with frozen parameters
124
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
125
+ if frozen_param_shapes is not None:
126
+ if debug:
127
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
128
+ param_names += list(frozen_param_shapes.keys())
129
+
130
+ # handle shared params
131
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
132
+
133
+ ds_version = state_dict.get(DS_VERSION, None)
134
+
135
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
136
+
137
+ z_model_state = zero_model_state(buffers=buffers,
138
+ param_shapes=param_shapes,
139
+ shared_params=shared_params,
140
+ ds_version=ds_version,
141
+ frozen_param_shapes=frozen_param_shapes,
142
+ frozen_param_fragments=frozen_param_fragments)
143
+ zero_model_states.append(z_model_state)
144
+
145
+ return zero_model_states
146
+
147
+
148
+ def parse_optim_states(files, ds_checkpoint_dir):
149
+ total_files = len(files)
150
+ state_dicts = []
151
+ for f in tqdm(files, desc='Loading checkpoint shards'):
152
+ state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
153
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
154
+ # and also handle the case where it was already removed by another helper script
155
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
156
+ state_dicts.append(state_dict)
157
+
158
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
159
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
160
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
161
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
162
+
163
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
164
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
165
+ # use the max of the partition_count to get the dp world_size.
166
+
167
+ if type(world_size) is list:
168
+ world_size = max(world_size)
169
+
170
+ if world_size != total_files:
171
+ raise ValueError(
172
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
173
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
174
+ )
175
+
176
+ # the groups are named differently in each stage
177
+ if zero_stage <= 2:
178
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
179
+ elif zero_stage == 3:
180
+ fp32_groups_key = FP32_FLAT_GROUPS
181
+ else:
182
+ raise ValueError(f"unknown zero stage {zero_stage}")
183
+
184
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
185
+ return zero_stage, world_size, fp32_flat_groups
186
+
187
+
188
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
189
+ """
190
+ Returns fp32 state_dict reconstructed from ds checkpoint
191
+
192
+ Args:
193
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
194
+
195
+ """
196
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
197
+
198
+ optim_files = get_optim_files(ds_checkpoint_dir)
199
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
200
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
201
+
202
+ model_files = get_model_state_files(ds_checkpoint_dir)
203
+
204
+ zero_model_states = parse_model_states(model_files)
205
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
206
+
207
+ if zero_stage <= 2:
208
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
209
+ exclude_frozen_parameters)
210
+ elif zero_stage == 3:
211
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
212
+ exclude_frozen_parameters)
213
+
214
+
215
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
216
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
217
+ return
218
+
219
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
220
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
221
+
222
+ if debug:
223
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
224
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
225
+
226
+ wanted_params = len(frozen_param_shapes)
227
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
228
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
229
+ print(f'Frozen params: Have {avail_numel} numels to process.')
230
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
231
+
232
+ total_params = 0
233
+ total_numel = 0
234
+ for name, shape in frozen_param_shapes.items():
235
+ total_params += 1
236
+ unpartitioned_numel = shape.numel()
237
+ total_numel += unpartitioned_numel
238
+
239
+ state_dict[name] = frozen_param_fragments[name]
240
+
241
+ if debug:
242
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
243
+
244
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
245
+
246
+
247
+ def _has_callable(obj, fn):
248
+ attr = getattr(obj, fn, None)
249
+ return callable(attr)
250
+
251
+
252
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
253
+ param_shapes = zero_model_states[0].param_shapes
254
+
255
+ # Reconstruction protocol:
256
+ #
257
+ # XXX: document this
258
+
259
+ if debug:
260
+ for i in range(world_size):
261
+ for j in range(len(fp32_flat_groups[0])):
262
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
263
+
264
+ # XXX: memory usage doubles here (zero2)
265
+ num_param_groups = len(fp32_flat_groups[0])
266
+ merged_single_partition_of_fp32_groups = []
267
+ for i in range(num_param_groups):
268
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
269
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
270
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
271
+ avail_numel = sum(
272
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
273
+
274
+ if debug:
275
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
276
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
277
+ # not asserting if there is a mismatch due to possible padding
278
+ print(f"Have {avail_numel} numels to process.")
279
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
280
+
281
+ # params
282
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
283
+ # out-of-core computing solution
284
+ total_numel = 0
285
+ total_params = 0
286
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
287
+ offset = 0
288
+ avail_numel = full_single_fp32_vector.numel()
289
+ for name, shape in shapes.items():
290
+
291
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
292
+ total_numel += unpartitioned_numel
293
+ total_params += 1
294
+
295
+ if debug:
296
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
297
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
298
+ offset += unpartitioned_numel
299
+
300
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
301
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
302
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
303
+ # live optimizer object, so we are checking that the numbers are within the right range
304
+ align_to = 2 * world_size
305
+
306
+ def zero2_align(x):
307
+ return align_to * math.ceil(x / align_to)
308
+
309
+ if debug:
310
+ print(f"original offset={offset}, avail_numel={avail_numel}")
311
+
312
+ offset = zero2_align(offset)
313
+ avail_numel = zero2_align(avail_numel)
314
+
315
+ if debug:
316
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
317
+
318
+ # Sanity check
319
+ if offset != avail_numel:
320
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
321
+
322
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
323
+
324
+
325
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
326
+ exclude_frozen_parameters):
327
+ state_dict = OrderedDict()
328
+
329
+ # buffers
330
+ buffers = zero_model_states[0].buffers
331
+ state_dict.update(buffers)
332
+ if debug:
333
+ print(f"added {len(buffers)} buffers")
334
+
335
+ if not exclude_frozen_parameters:
336
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
337
+
338
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
339
+
340
+ # recover shared parameters
341
+ for pair in zero_model_states[0].shared_params:
342
+ if pair[1] in state_dict:
343
+ state_dict[pair[0]] = state_dict[pair[1]]
344
+
345
+ return state_dict
346
+
347
+
348
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
349
+ remainder = unpartitioned_numel % world_size
350
+ padding_numel = (world_size - remainder) if remainder else 0
351
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
352
+ return partitioned_numel, padding_numel
353
+
354
+
355
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
356
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
357
+ return
358
+
359
+ if debug:
360
+ for i in range(world_size):
361
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
362
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
363
+
364
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
365
+ wanted_params = len(frozen_param_shapes)
366
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
367
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
368
+ print(f'Frozen params: Have {avail_numel} numels to process.')
369
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
370
+
371
+ total_params = 0
372
+ total_numel = 0
373
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
374
+ total_params += 1
375
+ unpartitioned_numel = shape.numel()
376
+ total_numel += unpartitioned_numel
377
+
378
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
379
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
380
+
381
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
382
+
383
+ if debug:
384
+ print(
385
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
386
+ )
387
+
388
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
389
+
390
+
391
+ class GatheredTensor:
392
+ """
393
+ A pseudo tensor that collects partitioned weights.
394
+ It is more memory efficient when there are multiple groups.
395
+ """
396
+
397
+ def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
398
+ self.flat_groups = flat_groups
399
+ self.flat_groups_offset = flat_groups_offset
400
+ self.offset = offset
401
+ self.partitioned_numel = partitioned_numel
402
+ self.shape = shape
403
+ self.dtype = self.flat_groups[0][0].dtype
404
+
405
+ def contiguous(self):
406
+ """
407
+ Merge partitioned weights from flat_groups into a single tensor.
408
+ """
409
+ end_idx = self.offset + self.partitioned_numel
410
+ world_size = len(self.flat_groups)
411
+ pad_flat_param_chunks = []
412
+
413
+ for rank_i in range(world_size):
414
+ # for each rank, we need to collect weights from related group/groups
415
+ flat_groups_at_rank_i = self.flat_groups[rank_i]
416
+ start_group_id = None
417
+ end_group_id = None
418
+ for group_id in range(len(self.flat_groups_offset)):
419
+ if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
420
+ start_group_id = group_id
421
+ if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
422
+ end_group_id = group_id
423
+ break
424
+ # collect weights from related group/groups
425
+ for group_id in range(start_group_id, end_group_id + 1):
426
+ flat_tensor = flat_groups_at_rank_i[group_id]
427
+ start_offset = self.offset - self.flat_groups_offset[group_id]
428
+ end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
429
+ pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
430
+
431
+ # collect weights from all ranks
432
+ pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
433
+ param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
434
+ return param
435
+
436
+
437
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
438
+ param_shapes = zero_model_states[0].param_shapes
439
+ avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
440
+
441
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
442
+ # param, re-consolidating each param, while dealing with padding if any
443
+
444
+ # merge list of dicts, preserving order
445
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
446
+
447
+ if debug:
448
+ for i in range(world_size):
449
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
450
+
451
+ wanted_params = len(param_shapes)
452
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
453
+ # not asserting if there is a mismatch due to possible padding
454
+ avail_numel = fp32_flat_groups[0].numel() * world_size
455
+ print(f"Trainable params: Have {avail_numel} numels to process.")
456
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
457
+
458
+ # params
459
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
460
+ # out-of-core computing solution
461
+ offset = 0
462
+ total_numel = 0
463
+ total_params = 0
464
+ flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
465
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
466
+ unpartitioned_numel = shape.numel()
467
+ total_numel += unpartitioned_numel
468
+ total_params += 1
469
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
470
+
471
+ if debug:
472
+ print(
473
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
474
+ )
475
+
476
+ # memory efficient tensor
477
+ tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
478
+ state_dict[name] = tensor
479
+ offset += partitioned_numel
480
+
481
+ offset *= world_size
482
+
483
+ # Sanity check
484
+ if offset != avail_numel:
485
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
486
+
487
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
488
+
489
+
490
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
491
+ exclude_frozen_parameters):
492
+ state_dict = OrderedDict()
493
+
494
+ # buffers
495
+ buffers = zero_model_states[0].buffers
496
+ state_dict.update(buffers)
497
+ if debug:
498
+ print(f"added {len(buffers)} buffers")
499
+
500
+ if not exclude_frozen_parameters:
501
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
502
+
503
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
504
+
505
+ # recover shared parameters
506
+ for pair in zero_model_states[0].shared_params:
507
+ if pair[1] in state_dict:
508
+ state_dict[pair[0]] = state_dict[pair[1]]
509
+
510
+ return state_dict
511
+
512
+
513
+ def to_torch_tensor(state_dict, return_empty_tensor=False):
514
+ """
515
+ Convert state_dict of GatheredTensor to torch tensor
516
+ """
517
+ torch_state_dict = {}
518
+ converted_tensors = {}
519
+ for name, tensor in state_dict.items():
520
+ tensor_id = id(tensor)
521
+ if tensor_id in converted_tensors: # shared tensors
522
+ shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
523
+ torch_state_dict[name] = shared_tensor
524
+ else:
525
+ converted_tensors[tensor_id] = name
526
+ if return_empty_tensor:
527
+ torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
528
+ else:
529
+ torch_state_dict[name] = tensor.contiguous()
530
+ return torch_state_dict
531
+
532
+
533
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
534
+ tag=None,
535
+ exclude_frozen_parameters=False,
536
+ lazy_mode=False):
537
+ """
538
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
539
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
540
+ via a model hub.
541
+
542
+ Args:
543
+ - ``checkpoint_dir``: path to the desired checkpoint folder
544
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
545
+ - ``exclude_frozen_parameters``: exclude frozen parameters
546
+ - ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
547
+ Convert the pesduo tensor to torch tensor by ``.contiguous()``
548
+
549
+ Returns:
550
+ - pytorch ``state_dict``
551
+
552
+ A typical usage might be ::
553
+
554
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
555
+ # do the training and checkpoint saving
556
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
557
+ model = model.cpu() # move to cpu
558
+ model.load_state_dict(state_dict)
559
+ # submit to model hub or save the model to share with others
560
+
561
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
562
+ application. i.e. you will need to re-initialize the deepspeed engine, since
563
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
564
+
565
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
566
+
567
+ Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
568
+ You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
569
+ the checkpoint. Or you can load state_dict in lazy mode ::
570
+
571
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
572
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
573
+ for name, lazy_tensor in state_dict.item():
574
+ tensor = lazy_tensor.contiguous() # to cpu
575
+ print(name, tensor)
576
+ # del tensor to release memory if it no longer in use
577
+ """
578
+ if tag is None:
579
+ latest_path = os.path.join(checkpoint_dir, 'latest')
580
+ if os.path.isfile(latest_path):
581
+ with open(latest_path, 'r') as fd:
582
+ tag = fd.read().strip()
583
+ else:
584
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
585
+
586
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
587
+
588
+ if not os.path.isdir(ds_checkpoint_dir):
589
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
590
+
591
+ state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
592
+ if lazy_mode:
593
+ return state_dict
594
+ else:
595
+ return to_torch_tensor(state_dict)
596
+
597
+
598
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
599
+ output_dir,
600
+ max_shard_size="5GB",
601
+ safe_serialization=False,
602
+ tag=None,
603
+ exclude_frozen_parameters=False):
604
+ """
605
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
606
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
607
+
608
+ Args:
609
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
610
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
611
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
612
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
613
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
614
+ - ``exclude_frozen_parameters``: exclude frozen parameters
615
+ """
616
+
617
+ # Dependency pre-check
618
+ if safe_serialization:
619
+ try:
620
+ from safetensors.torch import save_file
621
+ except ImportError:
622
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
623
+ raise
624
+ if max_shard_size is not None:
625
+ try:
626
+ from huggingface_hub import split_torch_state_dict_into_shards
627
+ except ImportError:
628
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
629
+ raise
630
+
631
+ # Convert zero checkpoint to state_dict
632
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
633
+ tag,
634
+ exclude_frozen_parameters,
635
+ lazy_mode=True)
636
+
637
+ # Shard the model if it is too big.
638
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
639
+ if max_shard_size is not None:
640
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
641
+ # an memory-efficient approach for sharding
642
+ empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
643
+ state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
644
+ filename_pattern=filename_pattern,
645
+ max_shard_size=max_shard_size)
646
+ else:
647
+ from collections import namedtuple
648
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
649
+ state_dict_split = StateDictSplit(is_sharded=False,
650
+ filename_to_tensors={weights_name: list(state_dict.keys())})
651
+
652
+ # Save the model by shard
653
+ os.makedirs(output_dir, exist_ok=True)
654
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
655
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
656
+ shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
657
+ shard_state_dict = to_torch_tensor(shard_state_dict)
658
+ output_path = os.path.join(output_dir, shard_file)
659
+ if safe_serialization:
660
+ save_file(shard_state_dict, output_path, metadata={"format": "pt"})
661
+ else:
662
+ torch.save(shard_state_dict, output_path)
663
+ # release the memory of current shard
664
+ for tensor_name in list(shard_state_dict.keys()):
665
+ del state_dict[tensor_name]
666
+ del shard_state_dict[tensor_name]
667
+ del shard_state_dict
668
+ gc.collect()
669
+
670
+ # Save index if sharded
671
+ if state_dict_split.is_sharded:
672
+ index = {
673
+ "metadata": state_dict_split.metadata,
674
+ "weight_map": state_dict_split.tensor_to_filename,
675
+ }
676
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
677
+ save_index_file = os.path.join(output_dir, save_index_file)
678
+ with open(save_index_file, "w", encoding="utf-8") as f:
679
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
680
+ f.write(content)
681
+
682
+
683
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
684
+ """
685
+ 1. Put the provided model to cpu
686
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
687
+ 3. Load it into the provided model
688
+
689
+ Args:
690
+ - ``model``: the model object to update
691
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
692
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
693
+
694
+ Returns:
695
+ - ``model`: modified model
696
+
697
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
698
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
699
+ conveniently placed for you in the checkpoint folder.
700
+
701
+ A typical usage might be ::
702
+
703
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
704
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
705
+ # submit to model hub or save the model to share with others
706
+
707
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
708
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
709
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
710
+
711
+ """
712
+ logger.info(f"Extracting fp32 weights")
713
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
714
+
715
+ logger.info(f"Overwriting model with fp32 weights")
716
+ model = model.cpu()
717
+ model.load_state_dict(state_dict, strict=False)
718
+
719
+ return model
720
+
721
+
722
+ if __name__ == "__main__":
723
+ parser = argparse.ArgumentParser()
724
+ parser.add_argument("checkpoint_dir",
725
+ type=str,
726
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
727
+ parser.add_argument("output_dir",
728
+ type=str,
729
+ help="directory to the pytorch fp32 state_dict output files"
730
+ "(e.g. path/checkpoint-12-output/)")
731
+ parser.add_argument(
732
+ "--max_shard_size",
733
+ type=str,
734
+ default="5GB",
735
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
736
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
737
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
738
+ "without CPU OOM issues.")
739
+ parser.add_argument(
740
+ "--safe_serialization",
741
+ default=False,
742
+ action='store_true',
743
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
744
+ parser.add_argument("-t",
745
+ "--tag",
746
+ type=str,
747
+ default=None,
748
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
749
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
750
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
751
+ args = parser.parse_args()
752
+
753
+ debug = args.debug
754
+
755
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
756
+ args.output_dir,
757
+ max_shard_size=args.max_shard_size,
758
+ safe_serialization=args.safe_serialization,
759
+ tag=args.tag,
760
+ exclude_frozen_parameters=args.exclude_frozen_parameters)