Upload folder using huggingface_hub
Browse files- added_tokens.json +24 -0
- chat_template.jinja +7 -0
- config.json +103 -0
- generation_config.json +4 -0
- global_step1000/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt +3 -0
- global_step1000/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt +3 -0
- global_step1000/bf16_zero_pp_rank_2_mp_rank_00_optim_states.pt +3 -0
- global_step1000/bf16_zero_pp_rank_3_mp_rank_00_optim_states.pt +3 -0
- global_step1000/bf16_zero_pp_rank_4_mp_rank_00_optim_states.pt +3 -0
- global_step1000/bf16_zero_pp_rank_5_mp_rank_00_optim_states.pt +3 -0
- global_step1000/bf16_zero_pp_rank_6_mp_rank_00_optim_states.pt +3 -0
- global_step1000/bf16_zero_pp_rank_7_mp_rank_00_optim_states.pt +3 -0
- global_step1000/zero_pp_rank_0_mp_rank_00_model_states.pt +3 -0
- global_step1000/zero_pp_rank_1_mp_rank_00_model_states.pt +3 -0
- global_step1000/zero_pp_rank_2_mp_rank_00_model_states.pt +3 -0
- global_step1000/zero_pp_rank_3_mp_rank_00_model_states.pt +3 -0
- global_step1000/zero_pp_rank_4_mp_rank_00_model_states.pt +3 -0
- global_step1000/zero_pp_rank_5_mp_rank_00_model_states.pt +3 -0
- global_step1000/zero_pp_rank_6_mp_rank_00_model_states.pt +3 -0
- global_step1000/zero_pp_rank_7_mp_rank_00_model_states.pt +3 -0
- latest +1 -0
- merges.txt +0 -0
- model-00001-of-00002.safetensors +3 -0
- model-00002-of-00002.safetensors +3 -0
- model.safetensors.index.json +0 -0
- rng_state_0.pth +3 -0
- rng_state_1.pth +3 -0
- rng_state_2.pth +3 -0
- rng_state_3.pth +3 -0
- rng_state_4.pth +3 -0
- rng_state_5.pth +3 -0
- rng_state_6.pth +3 -0
- rng_state_7.pth +3 -0
- special_tokens_map.json +38 -0
- tokenizer_config.json +223 -0
- trainer_state.json +894 -0
- training_args.bin +3 -0
- vocab.json +0 -0
- zero_to_fp32.py +760 -0
added_tokens.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"</tool_call>": 151658,
|
| 3 |
+
"<tool_call>": 151657,
|
| 4 |
+
"<|AUDIO|>": 151646,
|
| 5 |
+
"<|IMAGE|>": 151655,
|
| 6 |
+
"<|VIDEO|>": 151656,
|
| 7 |
+
"<|audio_bos|>": 151647,
|
| 8 |
+
"<|audio_eos|>": 151648,
|
| 9 |
+
"<|box_end|>": 151649,
|
| 10 |
+
"<|endoftext|>": 151643,
|
| 11 |
+
"<|file_sep|>": 151664,
|
| 12 |
+
"<|fim_middle|>": 151660,
|
| 13 |
+
"<|fim_pad|>": 151662,
|
| 14 |
+
"<|fim_prefix|>": 151659,
|
| 15 |
+
"<|fim_suffix|>": 151661,
|
| 16 |
+
"<|im_end|>": 151645,
|
| 17 |
+
"<|im_start|>": 151644,
|
| 18 |
+
"<|quad_end|>": 151651,
|
| 19 |
+
"<|quad_start|>": 151650,
|
| 20 |
+
"<|repo_name|>": 151663,
|
| 21 |
+
"<|vision_bos|>": 151652,
|
| 22 |
+
"<|vision_eos|>": 151653,
|
| 23 |
+
"<|vision_pad|>": 151654
|
| 24 |
+
}
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% set audio_count = namespace(value=0) %}{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system
|
| 2 |
+
You are a helpful assistant.<|im_end|>
|
| 3 |
+
{% endif %}<|im_start|>{{ message['role'] }}
|
| 4 |
+
{% if message['content'] is string %}{{ message['content'] }}<|im_end|>
|
| 5 |
+
{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_bos|><|IMAGE|><|vision_eos|>{% elif content['type'] == 'audio' or 'audio' in content or 'audio_url' in content %}{% set audio_count.value = audio_count.value + 1 %}{% if add_audio_id %}Audio {{ audio_count.value }}: {% endif %}<|audio_bos|><|AUDIO|><|audio_eos|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_bos|><|VIDEO|><|vision_eos|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>
|
| 6 |
+
{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
|
| 7 |
+
{% endif %}
|
config.json
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"AccustomThinker"
|
| 4 |
+
],
|
| 5 |
+
"audio_config": {
|
| 6 |
+
"activation_dropout": 0.0,
|
| 7 |
+
"activation_function": "gelu",
|
| 8 |
+
"attention_dropout": 0.0,
|
| 9 |
+
"d_model": 1280,
|
| 10 |
+
"dropout": 0.0,
|
| 11 |
+
"encoder_attention_heads": 20,
|
| 12 |
+
"encoder_ffn_dim": 5120,
|
| 13 |
+
"encoder_layerdrop": 0.0,
|
| 14 |
+
"encoder_layers": 32,
|
| 15 |
+
"init_std": 0.02,
|
| 16 |
+
"initializer_range": 0.02,
|
| 17 |
+
"max_source_positions": 1500,
|
| 18 |
+
"model_type": "qwen2_5_omni_audio_encoder",
|
| 19 |
+
"n_window": 100,
|
| 20 |
+
"num_hidden_layers": 32,
|
| 21 |
+
"num_mel_bins": 128,
|
| 22 |
+
"output_dim": 2048,
|
| 23 |
+
"scale_embedding": false,
|
| 24 |
+
"torch_dtype": "float32"
|
| 25 |
+
},
|
| 26 |
+
"audio_end_token_id": 151648,
|
| 27 |
+
"audio_start_token_id": 151647,
|
| 28 |
+
"audio_token_index": 151646,
|
| 29 |
+
"bos_token_id": 151644,
|
| 30 |
+
"eos_token_id": 151645,
|
| 31 |
+
"ignore_index": -100,
|
| 32 |
+
"image_token_index": 151655,
|
| 33 |
+
"init_std": 0.02,
|
| 34 |
+
"initializer_range": 0.02,
|
| 35 |
+
"model_type": "qwen2_5_omni_thinker",
|
| 36 |
+
"pad_token_id": 151643,
|
| 37 |
+
"position_id_per_seconds": 25,
|
| 38 |
+
"seconds_per_chunk": 2,
|
| 39 |
+
"text_config": {
|
| 40 |
+
"attention_dropout": 0.0,
|
| 41 |
+
"hidden_act": "silu",
|
| 42 |
+
"hidden_size": 2048,
|
| 43 |
+
"init_std": 0.02,
|
| 44 |
+
"initializer_range": 0.02,
|
| 45 |
+
"intermediate_size": 11008,
|
| 46 |
+
"max_position_embeddings": 32768,
|
| 47 |
+
"max_window_layers": 70,
|
| 48 |
+
"model_type": "qwen2_5_omni_text",
|
| 49 |
+
"num_attention_heads": 16,
|
| 50 |
+
"num_hidden_layers": 36,
|
| 51 |
+
"num_key_value_heads": 2,
|
| 52 |
+
"rms_norm_eps": 1e-06,
|
| 53 |
+
"rope_scaling": {
|
| 54 |
+
"mrope_section": [
|
| 55 |
+
16,
|
| 56 |
+
24,
|
| 57 |
+
24
|
| 58 |
+
],
|
| 59 |
+
"rope_type": "default",
|
| 60 |
+
"type": "default"
|
| 61 |
+
},
|
| 62 |
+
"rope_theta": 1000000.0,
|
| 63 |
+
"sliding_window": 32768,
|
| 64 |
+
"torch_dtype": "float32",
|
| 65 |
+
"use_cache": true,
|
| 66 |
+
"use_sliding_window": false,
|
| 67 |
+
"vocab_size": 151936
|
| 68 |
+
},
|
| 69 |
+
"torch_dtype": "bfloat16",
|
| 70 |
+
"transformers_version": "4.52.3",
|
| 71 |
+
"user_token_id": 872,
|
| 72 |
+
"video_token_index": 151656,
|
| 73 |
+
"vision_config": {
|
| 74 |
+
"depth": 32,
|
| 75 |
+
"embed_dim": 1280,
|
| 76 |
+
"fullatt_block_indexes": [
|
| 77 |
+
7,
|
| 78 |
+
15,
|
| 79 |
+
23,
|
| 80 |
+
31
|
| 81 |
+
],
|
| 82 |
+
"hidden_act": "silu",
|
| 83 |
+
"hidden_size": 1280,
|
| 84 |
+
"in_channels": 3,
|
| 85 |
+
"in_chans": 3,
|
| 86 |
+
"init_std": 0.02,
|
| 87 |
+
"initializer_range": 0.02,
|
| 88 |
+
"intermediate_size": 3420,
|
| 89 |
+
"model_type": "qwen2_5_omni_vision_encoder",
|
| 90 |
+
"num_heads": 16,
|
| 91 |
+
"out_hidden_size": 2048,
|
| 92 |
+
"patch_size": 14,
|
| 93 |
+
"spatial_merge_size": 2,
|
| 94 |
+
"spatial_patch_size": 14,
|
| 95 |
+
"temporal_patch_size": 2,
|
| 96 |
+
"tokens_per_second": 25,
|
| 97 |
+
"torch_dtype": "float32",
|
| 98 |
+
"window_size": 112
|
| 99 |
+
},
|
| 100 |
+
"vision_end_token_id": 151653,
|
| 101 |
+
"vision_start_token_id": 151652,
|
| 102 |
+
"vision_token_id": 151654
|
| 103 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"transformers_version": "4.52.3"
|
| 4 |
+
}
|
global_step1000/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:c705ff181d09603e0134317870903f91b9cdc4b6cca29cc39c817aac63506339
|
| 3 |
+
size 5095659845
|
global_step1000/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f4a2f6706f2df846522b385308134ab14aa6397eb90d66b15ec108fd9738343c
|
| 3 |
+
size 5095659845
|
global_step1000/bf16_zero_pp_rank_2_mp_rank_00_optim_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7ef19352a7047d93bc93485add87af6d2bc305428a892183858d34554c7174f9
|
| 3 |
+
size 5095659845
|
global_step1000/bf16_zero_pp_rank_3_mp_rank_00_optim_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:856541a373c1d9d1c11fd47d1d82d53e31bfa098251f6e60b1f06077b231d91a
|
| 3 |
+
size 5095659845
|
global_step1000/bf16_zero_pp_rank_4_mp_rank_00_optim_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5f8ea18c9ee7f3d0c170ba8e56d5def108028cc2c57dff5fb9cc5334f41185c5
|
| 3 |
+
size 5095659845
|
global_step1000/bf16_zero_pp_rank_5_mp_rank_00_optim_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9649bd1a81daaf22b8df363b900dcbf584316768a352bdf079d70671af5fd9a7
|
| 3 |
+
size 5095659845
|
global_step1000/bf16_zero_pp_rank_6_mp_rank_00_optim_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:43cae29c6db462b3a48364fed529adbfdfc61dfd2b9105ad976163d934c75fb5
|
| 3 |
+
size 5095659845
|
global_step1000/bf16_zero_pp_rank_7_mp_rank_00_optim_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bad43e8ee6a97a04dc3823a65f0066de10e860b16fd4d5d13aa670c721805cb7
|
| 3 |
+
size 5095659845
|
global_step1000/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:abbdcb92f3cf5b1b92742748c6f0ad224744a90892577ed42e1ef48cb6b0b470
|
| 3 |
+
size 327584207
|
global_step1000/zero_pp_rank_1_mp_rank_00_model_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4867cef3522762acebfdea1f7eff16c807737c5d53bc46d09ebda7d71e21784d
|
| 3 |
+
size 327584207
|
global_step1000/zero_pp_rank_2_mp_rank_00_model_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:19e2636e9db75f2670d1801cdb4334250fbd233c4099801b9a8390a7b15fded2
|
| 3 |
+
size 327584207
|
global_step1000/zero_pp_rank_3_mp_rank_00_model_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3636749f4cc2bc86c6039405f692fce4e2b26af5951ba9a50dd7125146971b0a
|
| 3 |
+
size 327584207
|
global_step1000/zero_pp_rank_4_mp_rank_00_model_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ed61f12ce1e432ab91507198bc6667b9c4c0c9672abee7ebc8d3e98a01566724
|
| 3 |
+
size 327584207
|
global_step1000/zero_pp_rank_5_mp_rank_00_model_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ce744d1b83005ccb4715deff6dcbf249de7d927d1c127cb911d555a1de908d46
|
| 3 |
+
size 327584207
|
global_step1000/zero_pp_rank_6_mp_rank_00_model_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8b0fd3695f964c9768c3cdb9c1d0748fbe47c84ead554c8beb44bb9959d184d5
|
| 3 |
+
size 327584207
|
global_step1000/zero_pp_rank_7_mp_rank_00_model_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:391a48aee32c72a1813ff7435e25510858c6d7e9af0a612e7fa17ae3db5506f2
|
| 3 |
+
size 327584207
|
latest
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
global_step1000
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model-00001-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:14d9216c9eabf00decf0b69a3670b99fa32771fe4fa0b96ae98e8e624b1031ba
|
| 3 |
+
size 4994841696
|
model-00002-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:22b05e23b5345f976d408e55fe9fccb2c44a4574ed3f199e980bcf9c2a51046b
|
| 3 |
+
size 4412249056
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
rng_state_0.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:48710b9a70599805c18daba6558fae4bd505ad20153bc960c075808b568dc199
|
| 3 |
+
size 16389
|
rng_state_1.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:64057913c08cbc5a331da1b86f8c9959116d1b8f57da5d46b01964018f9b33bc
|
| 3 |
+
size 16389
|
rng_state_2.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2fdddd79ebffd22cce641a1f9d877f8f71ee0a1f4d5456b324f1502c24a0afc8
|
| 3 |
+
size 16389
|
rng_state_3.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:55f7ffc5f5ef755ee6f41899cbc1c851dd4b531d5a434b37e2a9a173f5681278
|
| 3 |
+
size 16389
|
rng_state_4.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4eb86677c9c42301e10d06e3d7d7a13feb36bdc968538c0b45a918e0892865d0
|
| 3 |
+
size 16389
|
rng_state_5.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9eaf133ee591f519dfd4b31f8e16cd3ce86423781ac46677c03ec2d24b095e13
|
| 3 |
+
size 16389
|
rng_state_6.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6e0113a7a68d6c2907c60343a63f5b2c8e10a1b9e9f0733803097fe1bc2e8e5c
|
| 3 |
+
size 16389
|
rng_state_7.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cd16c04f5d95db2915d47583857e72337cae993ae34dfd477f05516135f973b2
|
| 3 |
+
size 16389
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<|im_start|>",
|
| 4 |
+
"<|im_end|>",
|
| 5 |
+
"<|AUDIO|>",
|
| 6 |
+
"<|audio_bos|>",
|
| 7 |
+
"<|audio_eos|>",
|
| 8 |
+
"<|box_end|>",
|
| 9 |
+
"<|quad_start|>",
|
| 10 |
+
"<|quad_end|>",
|
| 11 |
+
"<|vision_bos|>",
|
| 12 |
+
"<|vision_eos|>",
|
| 13 |
+
"<|vision_pad|>",
|
| 14 |
+
"<|IMAGE|>",
|
| 15 |
+
"<|VIDEO|>"
|
| 16 |
+
],
|
| 17 |
+
"audio_bos_token": "<|audio_bos|>",
|
| 18 |
+
"audio_eos_token": "<|audio_eos|>",
|
| 19 |
+
"audio_token": "<|AUDIO|>",
|
| 20 |
+
"eos_token": {
|
| 21 |
+
"content": "<|im_end|>",
|
| 22 |
+
"lstrip": false,
|
| 23 |
+
"normalized": false,
|
| 24 |
+
"rstrip": false,
|
| 25 |
+
"single_word": false
|
| 26 |
+
},
|
| 27 |
+
"image_token": "<|IMAGE|>",
|
| 28 |
+
"pad_token": {
|
| 29 |
+
"content": "<|endoftext|>",
|
| 30 |
+
"lstrip": false,
|
| 31 |
+
"normalized": false,
|
| 32 |
+
"rstrip": false,
|
| 33 |
+
"single_word": false
|
| 34 |
+
},
|
| 35 |
+
"video_token": "<|VIDEO|>",
|
| 36 |
+
"vision_bos_token": "<|vision_bos|>",
|
| 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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"added_tokens_decoder": {
|
| 4 |
+
"151643": {
|
| 5 |
+
"content": "<|endoftext|>",
|
| 6 |
+
"lstrip": false,
|
| 7 |
+
"normalized": false,
|
| 8 |
+
"rstrip": false,
|
| 9 |
+
"single_word": false,
|
| 10 |
+
"special": true
|
| 11 |
+
},
|
| 12 |
+
"151644": {
|
| 13 |
+
"content": "<|im_start|>",
|
| 14 |
+
"lstrip": false,
|
| 15 |
+
"normalized": false,
|
| 16 |
+
"rstrip": false,
|
| 17 |
+
"single_word": false,
|
| 18 |
+
"special": true
|
| 19 |
+
},
|
| 20 |
+
"151645": {
|
| 21 |
+
"content": "<|im_end|>",
|
| 22 |
+
"lstrip": false,
|
| 23 |
+
"normalized": false,
|
| 24 |
+
"rstrip": false,
|
| 25 |
+
"single_word": false,
|
| 26 |
+
"special": true
|
| 27 |
+
},
|
| 28 |
+
"151646": {
|
| 29 |
+
"content": "<|AUDIO|>",
|
| 30 |
+
"lstrip": false,
|
| 31 |
+
"normalized": false,
|
| 32 |
+
"rstrip": false,
|
| 33 |
+
"single_word": false,
|
| 34 |
+
"special": true
|
| 35 |
+
},
|
| 36 |
+
"151647": {
|
| 37 |
+
"content": "<|audio_bos|>",
|
| 38 |
+
"lstrip": false,
|
| 39 |
+
"normalized": false,
|
| 40 |
+
"rstrip": false,
|
| 41 |
+
"single_word": false,
|
| 42 |
+
"special": true
|
| 43 |
+
},
|
| 44 |
+
"151648": {
|
| 45 |
+
"content": "<|audio_eos|>",
|
| 46 |
+
"lstrip": false,
|
| 47 |
+
"normalized": false,
|
| 48 |
+
"rstrip": false,
|
| 49 |
+
"single_word": false,
|
| 50 |
+
"special": true
|
| 51 |
+
},
|
| 52 |
+
"151649": {
|
| 53 |
+
"content": "<|box_end|>",
|
| 54 |
+
"lstrip": false,
|
| 55 |
+
"normalized": false,
|
| 56 |
+
"rstrip": false,
|
| 57 |
+
"single_word": false,
|
| 58 |
+
"special": true
|
| 59 |
+
},
|
| 60 |
+
"151650": {
|
| 61 |
+
"content": "<|quad_start|>",
|
| 62 |
+
"lstrip": false,
|
| 63 |
+
"normalized": false,
|
| 64 |
+
"rstrip": false,
|
| 65 |
+
"single_word": false,
|
| 66 |
+
"special": true
|
| 67 |
+
},
|
| 68 |
+
"151651": {
|
| 69 |
+
"content": "<|quad_end|>",
|
| 70 |
+
"lstrip": false,
|
| 71 |
+
"normalized": false,
|
| 72 |
+
"rstrip": false,
|
| 73 |
+
"single_word": false,
|
| 74 |
+
"special": true
|
| 75 |
+
},
|
| 76 |
+
"151652": {
|
| 77 |
+
"content": "<|vision_bos|>",
|
| 78 |
+
"lstrip": false,
|
| 79 |
+
"normalized": false,
|
| 80 |
+
"rstrip": false,
|
| 81 |
+
"single_word": false,
|
| 82 |
+
"special": true
|
| 83 |
+
},
|
| 84 |
+
"151653": {
|
| 85 |
+
"content": "<|vision_eos|>",
|
| 86 |
+
"lstrip": false,
|
| 87 |
+
"normalized": false,
|
| 88 |
+
"rstrip": false,
|
| 89 |
+
"single_word": false,
|
| 90 |
+
"special": true
|
| 91 |
+
},
|
| 92 |
+
"151654": {
|
| 93 |
+
"content": "<|vision_pad|>",
|
| 94 |
+
"lstrip": false,
|
| 95 |
+
"normalized": false,
|
| 96 |
+
"rstrip": false,
|
| 97 |
+
"single_word": false,
|
| 98 |
+
"special": true
|
| 99 |
+
},
|
| 100 |
+
"151655": {
|
| 101 |
+
"content": "<|IMAGE|>",
|
| 102 |
+
"lstrip": false,
|
| 103 |
+
"normalized": false,
|
| 104 |
+
"rstrip": false,
|
| 105 |
+
"single_word": false,
|
| 106 |
+
"special": true
|
| 107 |
+
},
|
| 108 |
+
"151656": {
|
| 109 |
+
"content": "<|VIDEO|>",
|
| 110 |
+
"lstrip": false,
|
| 111 |
+
"normalized": false,
|
| 112 |
+
"rstrip": false,
|
| 113 |
+
"single_word": false,
|
| 114 |
+
"special": true
|
| 115 |
+
},
|
| 116 |
+
"151657": {
|
| 117 |
+
"content": "<tool_call>",
|
| 118 |
+
"lstrip": false,
|
| 119 |
+
"normalized": false,
|
| 120 |
+
"rstrip": false,
|
| 121 |
+
"single_word": false,
|
| 122 |
+
"special": false
|
| 123 |
+
},
|
| 124 |
+
"151658": {
|
| 125 |
+
"content": "</tool_call>",
|
| 126 |
+
"lstrip": false,
|
| 127 |
+
"normalized": false,
|
| 128 |
+
"rstrip": false,
|
| 129 |
+
"single_word": false,
|
| 130 |
+
"special": false
|
| 131 |
+
},
|
| 132 |
+
"151659": {
|
| 133 |
+
"content": "<|fim_prefix|>",
|
| 134 |
+
"lstrip": false,
|
| 135 |
+
"normalized": false,
|
| 136 |
+
"rstrip": false,
|
| 137 |
+
"single_word": false,
|
| 138 |
+
"special": false
|
| 139 |
+
},
|
| 140 |
+
"151660": {
|
| 141 |
+
"content": "<|fim_middle|>",
|
| 142 |
+
"lstrip": false,
|
| 143 |
+
"normalized": false,
|
| 144 |
+
"rstrip": false,
|
| 145 |
+
"single_word": false,
|
| 146 |
+
"special": false
|
| 147 |
+
},
|
| 148 |
+
"151661": {
|
| 149 |
+
"content": "<|fim_suffix|>",
|
| 150 |
+
"lstrip": false,
|
| 151 |
+
"normalized": false,
|
| 152 |
+
"rstrip": false,
|
| 153 |
+
"single_word": false,
|
| 154 |
+
"special": false
|
| 155 |
+
},
|
| 156 |
+
"151662": {
|
| 157 |
+
"content": "<|fim_pad|>",
|
| 158 |
+
"lstrip": false,
|
| 159 |
+
"normalized": false,
|
| 160 |
+
"rstrip": false,
|
| 161 |
+
"single_word": false,
|
| 162 |
+
"special": false
|
| 163 |
+
},
|
| 164 |
+
"151663": {
|
| 165 |
+
"content": "<|repo_name|>",
|
| 166 |
+
"lstrip": false,
|
| 167 |
+
"normalized": false,
|
| 168 |
+
"rstrip": false,
|
| 169 |
+
"single_word": false,
|
| 170 |
+
"special": false
|
| 171 |
+
},
|
| 172 |
+
"151664": {
|
| 173 |
+
"content": "<|file_sep|>",
|
| 174 |
+
"lstrip": false,
|
| 175 |
+
"normalized": false,
|
| 176 |
+
"rstrip": false,
|
| 177 |
+
"single_word": false,
|
| 178 |
+
"special": false
|
| 179 |
+
}
|
| 180 |
+
},
|
| 181 |
+
"additional_special_tokens": [
|
| 182 |
+
"<|im_start|>",
|
| 183 |
+
"<|im_end|>",
|
| 184 |
+
"<|AUDIO|>",
|
| 185 |
+
"<|audio_bos|>",
|
| 186 |
+
"<|audio_eos|>",
|
| 187 |
+
"<|box_end|>",
|
| 188 |
+
"<|quad_start|>",
|
| 189 |
+
"<|quad_end|>",
|
| 190 |
+
"<|vision_bos|>",
|
| 191 |
+
"<|vision_eos|>",
|
| 192 |
+
"<|vision_pad|>",
|
| 193 |
+
"<|IMAGE|>",
|
| 194 |
+
"<|VIDEO|>"
|
| 195 |
+
],
|
| 196 |
+
"audio_bos_token": "<|audio_bos|>",
|
| 197 |
+
"audio_eos_token": "<|audio_eos|>",
|
| 198 |
+
"audio_token": "<|AUDIO|>",
|
| 199 |
+
"bos_token": null,
|
| 200 |
+
"clean_up_tokenization_spaces": false,
|
| 201 |
+
"eos_token": "<|im_end|>",
|
| 202 |
+
"errors": "replace",
|
| 203 |
+
"extra_special_tokens": {
|
| 204 |
+
"audio_bos_token": "<|audio_bos|>",
|
| 205 |
+
"audio_eos_token": "<|audio_eos|>",
|
| 206 |
+
"audio_token": "<|AUDIO|>",
|
| 207 |
+
"image_token": "<|IMAGE|>",
|
| 208 |
+
"video_token": "<|VIDEO|>",
|
| 209 |
+
"vision_bos_token": "<|vision_bos|>",
|
| 210 |
+
"vision_eos_token": "<|vision_eos|>"
|
| 211 |
+
},
|
| 212 |
+
"image_token": "<|IMAGE|>",
|
| 213 |
+
"model_max_length": 32768,
|
| 214 |
+
"pad_token": "<|endoftext|>",
|
| 215 |
+
"processor_class": "Qwen2_5OmniProcessor",
|
| 216 |
+
"split_special_tokens": false,
|
| 217 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 218 |
+
"unk_token": null,
|
| 219 |
+
"use_fast": false,
|
| 220 |
+
"video_token": "<|VIDEO|>",
|
| 221 |
+
"vision_bos_token": "<|vision_bos|>",
|
| 222 |
+
"vision_eos_token": "<|vision_eos|>"
|
| 223 |
+
}
|
trainer_state.json
ADDED
|
@@ -0,0 +1,894 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"best_global_step": 700,
|
| 3 |
+
"best_metric": 0.7593940496444702,
|
| 4 |
+
"best_model_checkpoint": "./thinker_output/07-08_multi_audio/checkpoint-700",
|
| 5 |
+
"epoch": 2.692489053553385,
|
| 6 |
+
"eval_steps": 50,
|
| 7 |
+
"global_step": 1000,
|
| 8 |
+
"is_hyper_param_search": false,
|
| 9 |
+
"is_local_process_zero": true,
|
| 10 |
+
"is_world_process_zero": true,
|
| 11 |
+
"log_history": [
|
| 12 |
+
{
|
| 13 |
+
"epoch": 0.02694509936005389,
|
| 14 |
+
"grad_norm": 7.9127708678466355,
|
| 15 |
+
"learning_rate": 5e-05,
|
| 16 |
+
"loss": 2.2253,
|
| 17 |
+
"step": 10
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"epoch": 0.05389019872010778,
|
| 21 |
+
"grad_norm": 2.129170820552183,
|
| 22 |
+
"learning_rate": 4.954792043399639e-05,
|
| 23 |
+
"loss": 1.4156,
|
| 24 |
+
"step": 20
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"epoch": 0.08083529808016167,
|
| 28 |
+
"grad_norm": 2.213231596266166,
|
| 29 |
+
"learning_rate": 4.909584086799277e-05,
|
| 30 |
+
"loss": 1.2292,
|
| 31 |
+
"step": 30
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"epoch": 0.10778039744021556,
|
| 35 |
+
"grad_norm": 1.9446166933638902,
|
| 36 |
+
"learning_rate": 4.864376130198916e-05,
|
| 37 |
+
"loss": 1.1526,
|
| 38 |
+
"step": 40
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"epoch": 0.13472549680026946,
|
| 42 |
+
"grad_norm": 1.8624996582053734,
|
| 43 |
+
"learning_rate": 4.8191681735985535e-05,
|
| 44 |
+
"loss": 1.1116,
|
| 45 |
+
"step": 50
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"epoch": 0.13472549680026946,
|
| 49 |
+
"eval_loss": 1.0801820755004883,
|
| 50 |
+
"eval_runtime": 116.0,
|
| 51 |
+
"eval_samples_per_second": 43.103,
|
| 52 |
+
"eval_steps_per_second": 0.681,
|
| 53 |
+
"step": 50
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"epoch": 0.16167059616032334,
|
| 57 |
+
"grad_norm": 1.644929460056369,
|
| 58 |
+
"learning_rate": 4.773960216998192e-05,
|
| 59 |
+
"loss": 1.0736,
|
| 60 |
+
"step": 60
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"epoch": 0.18861569552037724,
|
| 64 |
+
"grad_norm": 1.9154194240377669,
|
| 65 |
+
"learning_rate": 4.7287522603978304e-05,
|
| 66 |
+
"loss": 1.0532,
|
| 67 |
+
"step": 70
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"epoch": 0.21556079488043112,
|
| 71 |
+
"grad_norm": 1.5827665298198546,
|
| 72 |
+
"learning_rate": 4.683544303797468e-05,
|
| 73 |
+
"loss": 1.0312,
|
| 74 |
+
"step": 80
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"epoch": 0.24250589424048502,
|
| 78 |
+
"grad_norm": 1.429127675663522,
|
| 79 |
+
"learning_rate": 4.638336347197107e-05,
|
| 80 |
+
"loss": 1.0133,
|
| 81 |
+
"step": 90
|
| 82 |
+
},
|
| 83 |
+
{
|
| 84 |
+
"epoch": 0.2694509936005389,
|
| 85 |
+
"grad_norm": 1.4187637596535974,
|
| 86 |
+
"learning_rate": 4.593128390596745e-05,
|
| 87 |
+
"loss": 0.9944,
|
| 88 |
+
"step": 100
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"epoch": 0.2694509936005389,
|
| 92 |
+
"eval_loss": 0.987108588218689,
|
| 93 |
+
"eval_runtime": 113.3326,
|
| 94 |
+
"eval_samples_per_second": 44.118,
|
| 95 |
+
"eval_steps_per_second": 0.697,
|
| 96 |
+
"step": 100
|
| 97 |
+
},
|
| 98 |
+
{
|
| 99 |
+
"epoch": 0.29639609296059277,
|
| 100 |
+
"grad_norm": 1.6143534620181745,
|
| 101 |
+
"learning_rate": 4.547920433996384e-05,
|
| 102 |
+
"loss": 0.9861,
|
| 103 |
+
"step": 110
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
"epoch": 0.3233411923206467,
|
| 107 |
+
"grad_norm": 1.470799422498714,
|
| 108 |
+
"learning_rate": 4.5027124773960215e-05,
|
| 109 |
+
"loss": 0.9813,
|
| 110 |
+
"step": 120
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"epoch": 0.3502862916807006,
|
| 114 |
+
"grad_norm": 1.5329678036861214,
|
| 115 |
+
"learning_rate": 4.45750452079566e-05,
|
| 116 |
+
"loss": 0.9725,
|
| 117 |
+
"step": 130
|
| 118 |
+
},
|
| 119 |
+
{
|
| 120 |
+
"epoch": 0.3772313910407545,
|
| 121 |
+
"grad_norm": 1.5683570099493096,
|
| 122 |
+
"learning_rate": 4.4122965641952984e-05,
|
| 123 |
+
"loss": 0.9604,
|
| 124 |
+
"step": 140
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"epoch": 0.40417649040080833,
|
| 128 |
+
"grad_norm": 1.4886000727881106,
|
| 129 |
+
"learning_rate": 4.367088607594937e-05,
|
| 130 |
+
"loss": 0.9494,
|
| 131 |
+
"step": 150
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"epoch": 0.40417649040080833,
|
| 135 |
+
"eval_loss": 0.9371287226676941,
|
| 136 |
+
"eval_runtime": 147.0071,
|
| 137 |
+
"eval_samples_per_second": 34.012,
|
| 138 |
+
"eval_steps_per_second": 0.537,
|
| 139 |
+
"step": 150
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"epoch": 0.43112158976086223,
|
| 143 |
+
"grad_norm": 1.7059179320901345,
|
| 144 |
+
"learning_rate": 4.3218806509945754e-05,
|
| 145 |
+
"loss": 0.9409,
|
| 146 |
+
"step": 160
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"epoch": 0.45806668912091614,
|
| 150 |
+
"grad_norm": 1.3194635069630314,
|
| 151 |
+
"learning_rate": 4.276672694394214e-05,
|
| 152 |
+
"loss": 0.9244,
|
| 153 |
+
"step": 170
|
| 154 |
+
},
|
| 155 |
+
{
|
| 156 |
+
"epoch": 0.48501178848097004,
|
| 157 |
+
"grad_norm": 1.3060771848163875,
|
| 158 |
+
"learning_rate": 4.2314647377938523e-05,
|
| 159 |
+
"loss": 0.9157,
|
| 160 |
+
"step": 180
|
| 161 |
+
},
|
| 162 |
+
{
|
| 163 |
+
"epoch": 0.5119568878410239,
|
| 164 |
+
"grad_norm": 1.4749915311735549,
|
| 165 |
+
"learning_rate": 4.186256781193491e-05,
|
| 166 |
+
"loss": 0.9119,
|
| 167 |
+
"step": 190
|
| 168 |
+
},
|
| 169 |
+
{
|
| 170 |
+
"epoch": 0.5389019872010778,
|
| 171 |
+
"grad_norm": 1.4869922949493382,
|
| 172 |
+
"learning_rate": 4.1410488245931286e-05,
|
| 173 |
+
"loss": 0.913,
|
| 174 |
+
"step": 200
|
| 175 |
+
},
|
| 176 |
+
{
|
| 177 |
+
"epoch": 0.5389019872010778,
|
| 178 |
+
"eval_loss": 0.907091498374939,
|
| 179 |
+
"eval_runtime": 111.8122,
|
| 180 |
+
"eval_samples_per_second": 44.718,
|
| 181 |
+
"eval_steps_per_second": 0.707,
|
| 182 |
+
"step": 200
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"epoch": 0.5658470865611317,
|
| 186 |
+
"grad_norm": 1.4160894102096444,
|
| 187 |
+
"learning_rate": 4.095840867992767e-05,
|
| 188 |
+
"loss": 0.901,
|
| 189 |
+
"step": 210
|
| 190 |
+
},
|
| 191 |
+
{
|
| 192 |
+
"epoch": 0.5927921859211855,
|
| 193 |
+
"grad_norm": 1.5792102697843888,
|
| 194 |
+
"learning_rate": 4.050632911392405e-05,
|
| 195 |
+
"loss": 0.89,
|
| 196 |
+
"step": 220
|
| 197 |
+
},
|
| 198 |
+
{
|
| 199 |
+
"epoch": 0.6197372852812395,
|
| 200 |
+
"grad_norm": 1.2974993115890197,
|
| 201 |
+
"learning_rate": 4.0054249547920434e-05,
|
| 202 |
+
"loss": 0.8863,
|
| 203 |
+
"step": 230
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
"epoch": 0.6466823846412934,
|
| 207 |
+
"grad_norm": 1.3514939321309911,
|
| 208 |
+
"learning_rate": 3.960216998191682e-05,
|
| 209 |
+
"loss": 0.8854,
|
| 210 |
+
"step": 240
|
| 211 |
+
},
|
| 212 |
+
{
|
| 213 |
+
"epoch": 0.6736274840013473,
|
| 214 |
+
"grad_norm": 1.266918300985221,
|
| 215 |
+
"learning_rate": 3.9150090415913203e-05,
|
| 216 |
+
"loss": 0.8845,
|
| 217 |
+
"step": 250
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"epoch": 0.6736274840013473,
|
| 221 |
+
"eval_loss": 0.8746693134307861,
|
| 222 |
+
"eval_runtime": 144.3762,
|
| 223 |
+
"eval_samples_per_second": 34.632,
|
| 224 |
+
"eval_steps_per_second": 0.547,
|
| 225 |
+
"step": 250
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
"epoch": 0.7005725833614012,
|
| 229 |
+
"grad_norm": 1.3519572583606572,
|
| 230 |
+
"learning_rate": 3.869801084990959e-05,
|
| 231 |
+
"loss": 0.8721,
|
| 232 |
+
"step": 260
|
| 233 |
+
},
|
| 234 |
+
{
|
| 235 |
+
"epoch": 0.727517682721455,
|
| 236 |
+
"grad_norm": 1.2840451675298208,
|
| 237 |
+
"learning_rate": 3.8245931283905966e-05,
|
| 238 |
+
"loss": 0.8736,
|
| 239 |
+
"step": 270
|
| 240 |
+
},
|
| 241 |
+
{
|
| 242 |
+
"epoch": 0.754462782081509,
|
| 243 |
+
"grad_norm": 1.2178137913182443,
|
| 244 |
+
"learning_rate": 3.779385171790235e-05,
|
| 245 |
+
"loss": 0.8664,
|
| 246 |
+
"step": 280
|
| 247 |
+
},
|
| 248 |
+
{
|
| 249 |
+
"epoch": 0.7814078814415628,
|
| 250 |
+
"grad_norm": 1.371387951800443,
|
| 251 |
+
"learning_rate": 3.7341772151898736e-05,
|
| 252 |
+
"loss": 0.8554,
|
| 253 |
+
"step": 290
|
| 254 |
+
},
|
| 255 |
+
{
|
| 256 |
+
"epoch": 0.8083529808016167,
|
| 257 |
+
"grad_norm": 1.344734634165615,
|
| 258 |
+
"learning_rate": 3.688969258589512e-05,
|
| 259 |
+
"loss": 0.8638,
|
| 260 |
+
"step": 300
|
| 261 |
+
},
|
| 262 |
+
{
|
| 263 |
+
"epoch": 0.8083529808016167,
|
| 264 |
+
"eval_loss": 0.8491566181182861,
|
| 265 |
+
"eval_runtime": 146.4614,
|
| 266 |
+
"eval_samples_per_second": 34.139,
|
| 267 |
+
"eval_steps_per_second": 0.539,
|
| 268 |
+
"step": 300
|
| 269 |
+
},
|
| 270 |
+
{
|
| 271 |
+
"epoch": 0.8352980801616706,
|
| 272 |
+
"grad_norm": 1.272788750854563,
|
| 273 |
+
"learning_rate": 3.6437613019891505e-05,
|
| 274 |
+
"loss": 0.8541,
|
| 275 |
+
"step": 310
|
| 276 |
+
},
|
| 277 |
+
{
|
| 278 |
+
"epoch": 0.8622431795217245,
|
| 279 |
+
"grad_norm": 1.3792910383877415,
|
| 280 |
+
"learning_rate": 3.598553345388789e-05,
|
| 281 |
+
"loss": 0.8481,
|
| 282 |
+
"step": 320
|
| 283 |
+
},
|
| 284 |
+
{
|
| 285 |
+
"epoch": 0.8891882788817784,
|
| 286 |
+
"grad_norm": 1.203782825434394,
|
| 287 |
+
"learning_rate": 3.553345388788427e-05,
|
| 288 |
+
"loss": 0.8376,
|
| 289 |
+
"step": 330
|
| 290 |
+
},
|
| 291 |
+
{
|
| 292 |
+
"epoch": 0.9161333782418323,
|
| 293 |
+
"grad_norm": 1.2646961187289552,
|
| 294 |
+
"learning_rate": 3.508137432188065e-05,
|
| 295 |
+
"loss": 0.839,
|
| 296 |
+
"step": 340
|
| 297 |
+
},
|
| 298 |
+
{
|
| 299 |
+
"epoch": 0.9430784776018861,
|
| 300 |
+
"grad_norm": 1.24393119289486,
|
| 301 |
+
"learning_rate": 3.462929475587703e-05,
|
| 302 |
+
"loss": 0.8381,
|
| 303 |
+
"step": 350
|
| 304 |
+
},
|
| 305 |
+
{
|
| 306 |
+
"epoch": 0.9430784776018861,
|
| 307 |
+
"eval_loss": 0.8305084109306335,
|
| 308 |
+
"eval_runtime": 135.5403,
|
| 309 |
+
"eval_samples_per_second": 36.889,
|
| 310 |
+
"eval_steps_per_second": 0.583,
|
| 311 |
+
"step": 350
|
| 312 |
+
},
|
| 313 |
+
{
|
| 314 |
+
"epoch": 0.9700235769619401,
|
| 315 |
+
"grad_norm": 1.2087402616528558,
|
| 316 |
+
"learning_rate": 3.4177215189873416e-05,
|
| 317 |
+
"loss": 0.8264,
|
| 318 |
+
"step": 360
|
| 319 |
+
},
|
| 320 |
+
{
|
| 321 |
+
"epoch": 0.9969686763219939,
|
| 322 |
+
"grad_norm": 1.2771110484442496,
|
| 323 |
+
"learning_rate": 3.37251356238698e-05,
|
| 324 |
+
"loss": 0.8242,
|
| 325 |
+
"step": 370
|
| 326 |
+
},
|
| 327 |
+
{
|
| 328 |
+
"epoch": 1.0215560794880432,
|
| 329 |
+
"grad_norm": 1.332831610585688,
|
| 330 |
+
"learning_rate": 3.3273056057866185e-05,
|
| 331 |
+
"loss": 0.6297,
|
| 332 |
+
"step": 380
|
| 333 |
+
},
|
| 334 |
+
{
|
| 335 |
+
"epoch": 1.048501178848097,
|
| 336 |
+
"grad_norm": 1.2917409109187712,
|
| 337 |
+
"learning_rate": 3.282097649186257e-05,
|
| 338 |
+
"loss": 0.6539,
|
| 339 |
+
"step": 390
|
| 340 |
+
},
|
| 341 |
+
{
|
| 342 |
+
"epoch": 1.0754462782081509,
|
| 343 |
+
"grad_norm": 1.3245733128879162,
|
| 344 |
+
"learning_rate": 3.2368896925858955e-05,
|
| 345 |
+
"loss": 0.6544,
|
| 346 |
+
"step": 400
|
| 347 |
+
},
|
| 348 |
+
{
|
| 349 |
+
"epoch": 1.0754462782081509,
|
| 350 |
+
"eval_loss": 0.8334468007087708,
|
| 351 |
+
"eval_runtime": 148.2965,
|
| 352 |
+
"eval_samples_per_second": 33.716,
|
| 353 |
+
"eval_steps_per_second": 0.533,
|
| 354 |
+
"step": 400
|
| 355 |
+
},
|
| 356 |
+
{
|
| 357 |
+
"epoch": 1.1023913775682048,
|
| 358 |
+
"grad_norm": 1.1724140281525666,
|
| 359 |
+
"learning_rate": 3.191681735985534e-05,
|
| 360 |
+
"loss": 0.6473,
|
| 361 |
+
"step": 410
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"epoch": 1.1293364769282586,
|
| 365 |
+
"grad_norm": 1.2278740780504742,
|
| 366 |
+
"learning_rate": 3.146473779385172e-05,
|
| 367 |
+
"loss": 0.6459,
|
| 368 |
+
"step": 420
|
| 369 |
+
},
|
| 370 |
+
{
|
| 371 |
+
"epoch": 1.1562815762883125,
|
| 372 |
+
"grad_norm": 1.1783670358458123,
|
| 373 |
+
"learning_rate": 3.10126582278481e-05,
|
| 374 |
+
"loss": 0.6573,
|
| 375 |
+
"step": 430
|
| 376 |
+
},
|
| 377 |
+
{
|
| 378 |
+
"epoch": 1.1832266756483665,
|
| 379 |
+
"grad_norm": 1.29897205539554,
|
| 380 |
+
"learning_rate": 3.056057866184449e-05,
|
| 381 |
+
"loss": 0.6548,
|
| 382 |
+
"step": 440
|
| 383 |
+
},
|
| 384 |
+
{
|
| 385 |
+
"epoch": 1.2101717750084204,
|
| 386 |
+
"grad_norm": 1.1568119957121505,
|
| 387 |
+
"learning_rate": 3.010849909584087e-05,
|
| 388 |
+
"loss": 0.65,
|
| 389 |
+
"step": 450
|
| 390 |
+
},
|
| 391 |
+
{
|
| 392 |
+
"epoch": 1.2101717750084204,
|
| 393 |
+
"eval_loss": 0.8229044675827026,
|
| 394 |
+
"eval_runtime": 113.6433,
|
| 395 |
+
"eval_samples_per_second": 43.997,
|
| 396 |
+
"eval_steps_per_second": 0.695,
|
| 397 |
+
"step": 450
|
| 398 |
+
},
|
| 399 |
+
{
|
| 400 |
+
"epoch": 1.2371168743684742,
|
| 401 |
+
"grad_norm": 1.3004916817149637,
|
| 402 |
+
"learning_rate": 2.9656419529837253e-05,
|
| 403 |
+
"loss": 0.6474,
|
| 404 |
+
"step": 460
|
| 405 |
+
},
|
| 406 |
+
{
|
| 407 |
+
"epoch": 1.2640619737285281,
|
| 408 |
+
"grad_norm": 1.212521588358061,
|
| 409 |
+
"learning_rate": 2.9204339963833638e-05,
|
| 410 |
+
"loss": 0.6518,
|
| 411 |
+
"step": 470
|
| 412 |
+
},
|
| 413 |
+
{
|
| 414 |
+
"epoch": 1.291007073088582,
|
| 415 |
+
"grad_norm": 1.2553077221366877,
|
| 416 |
+
"learning_rate": 2.8752260397830023e-05,
|
| 417 |
+
"loss": 0.6456,
|
| 418 |
+
"step": 480
|
| 419 |
+
},
|
| 420 |
+
{
|
| 421 |
+
"epoch": 1.3179521724486358,
|
| 422 |
+
"grad_norm": 1.184218802614123,
|
| 423 |
+
"learning_rate": 2.83001808318264e-05,
|
| 424 |
+
"loss": 0.6546,
|
| 425 |
+
"step": 490
|
| 426 |
+
},
|
| 427 |
+
{
|
| 428 |
+
"epoch": 1.3448972718086898,
|
| 429 |
+
"grad_norm": 1.136986753079325,
|
| 430 |
+
"learning_rate": 2.7848101265822786e-05,
|
| 431 |
+
"loss": 0.6415,
|
| 432 |
+
"step": 500
|
| 433 |
+
},
|
| 434 |
+
{
|
| 435 |
+
"epoch": 1.3448972718086898,
|
| 436 |
+
"eval_loss": 0.8110851049423218,
|
| 437 |
+
"eval_runtime": 137.5711,
|
| 438 |
+
"eval_samples_per_second": 36.345,
|
| 439 |
+
"eval_steps_per_second": 0.574,
|
| 440 |
+
"step": 500
|
| 441 |
+
},
|
| 442 |
+
{
|
| 443 |
+
"epoch": 1.3718423711687437,
|
| 444 |
+
"grad_norm": 1.2143646330707367,
|
| 445 |
+
"learning_rate": 2.7396021699819167e-05,
|
| 446 |
+
"loss": 0.6558,
|
| 447 |
+
"step": 510
|
| 448 |
+
},
|
| 449 |
+
{
|
| 450 |
+
"epoch": 1.3987874705287977,
|
| 451 |
+
"grad_norm": 1.265789637913618,
|
| 452 |
+
"learning_rate": 2.6943942133815552e-05,
|
| 453 |
+
"loss": 0.6505,
|
| 454 |
+
"step": 520
|
| 455 |
+
},
|
| 456 |
+
{
|
| 457 |
+
"epoch": 1.4257325698888514,
|
| 458 |
+
"grad_norm": 1.2191031554639078,
|
| 459 |
+
"learning_rate": 2.6491862567811937e-05,
|
| 460 |
+
"loss": 0.6426,
|
| 461 |
+
"step": 530
|
| 462 |
+
},
|
| 463 |
+
{
|
| 464 |
+
"epoch": 1.4526776692489054,
|
| 465 |
+
"grad_norm": 1.222440942937553,
|
| 466 |
+
"learning_rate": 2.603978300180832e-05,
|
| 467 |
+
"loss": 0.644,
|
| 468 |
+
"step": 540
|
| 469 |
+
},
|
| 470 |
+
{
|
| 471 |
+
"epoch": 1.4796227686089591,
|
| 472 |
+
"grad_norm": 1.1495752286958087,
|
| 473 |
+
"learning_rate": 2.5587703435804706e-05,
|
| 474 |
+
"loss": 0.6415,
|
| 475 |
+
"step": 550
|
| 476 |
+
},
|
| 477 |
+
{
|
| 478 |
+
"epoch": 1.4796227686089591,
|
| 479 |
+
"eval_loss": 0.7958658337593079,
|
| 480 |
+
"eval_runtime": 142.3592,
|
| 481 |
+
"eval_samples_per_second": 35.122,
|
| 482 |
+
"eval_steps_per_second": 0.555,
|
| 483 |
+
"step": 550
|
| 484 |
+
},
|
| 485 |
+
{
|
| 486 |
+
"epoch": 1.506567867969013,
|
| 487 |
+
"grad_norm": 1.2049482092443289,
|
| 488 |
+
"learning_rate": 2.5135623869801084e-05,
|
| 489 |
+
"loss": 0.6395,
|
| 490 |
+
"step": 560
|
| 491 |
+
},
|
| 492 |
+
{
|
| 493 |
+
"epoch": 1.533512967329067,
|
| 494 |
+
"grad_norm": 1.1839061997290048,
|
| 495 |
+
"learning_rate": 2.468354430379747e-05,
|
| 496 |
+
"loss": 0.6441,
|
| 497 |
+
"step": 570
|
| 498 |
+
},
|
| 499 |
+
{
|
| 500 |
+
"epoch": 1.560458066689121,
|
| 501 |
+
"grad_norm": 1.2057965805365276,
|
| 502 |
+
"learning_rate": 2.423146473779385e-05,
|
| 503 |
+
"loss": 0.6335,
|
| 504 |
+
"step": 580
|
| 505 |
+
},
|
| 506 |
+
{
|
| 507 |
+
"epoch": 1.5874031660491748,
|
| 508 |
+
"grad_norm": 1.1650282316989717,
|
| 509 |
+
"learning_rate": 2.3779385171790235e-05,
|
| 510 |
+
"loss": 0.6339,
|
| 511 |
+
"step": 590
|
| 512 |
+
},
|
| 513 |
+
{
|
| 514 |
+
"epoch": 1.6143482654092287,
|
| 515 |
+
"grad_norm": 1.153394411032144,
|
| 516 |
+
"learning_rate": 2.332730560578662e-05,
|
| 517 |
+
"loss": 0.6311,
|
| 518 |
+
"step": 600
|
| 519 |
+
},
|
| 520 |
+
{
|
| 521 |
+
"epoch": 1.6143482654092287,
|
| 522 |
+
"eval_loss": 0.784841775894165,
|
| 523 |
+
"eval_runtime": 153.2005,
|
| 524 |
+
"eval_samples_per_second": 32.637,
|
| 525 |
+
"eval_steps_per_second": 0.516,
|
| 526 |
+
"step": 600
|
| 527 |
+
},
|
| 528 |
+
{
|
| 529 |
+
"epoch": 1.6412933647692824,
|
| 530 |
+
"grad_norm": 1.1963943501637924,
|
| 531 |
+
"learning_rate": 2.2875226039783005e-05,
|
| 532 |
+
"loss": 0.6267,
|
| 533 |
+
"step": 610
|
| 534 |
+
},
|
| 535 |
+
{
|
| 536 |
+
"epoch": 1.6682384641293364,
|
| 537 |
+
"grad_norm": 1.093066884488607,
|
| 538 |
+
"learning_rate": 2.2423146473779386e-05,
|
| 539 |
+
"loss": 0.6289,
|
| 540 |
+
"step": 620
|
| 541 |
+
},
|
| 542 |
+
{
|
| 543 |
+
"epoch": 1.6951835634893904,
|
| 544 |
+
"grad_norm": 1.115011570991967,
|
| 545 |
+
"learning_rate": 2.197106690777577e-05,
|
| 546 |
+
"loss": 0.6299,
|
| 547 |
+
"step": 630
|
| 548 |
+
},
|
| 549 |
+
{
|
| 550 |
+
"epoch": 1.7221286628494443,
|
| 551 |
+
"grad_norm": 1.1700606931618611,
|
| 552 |
+
"learning_rate": 2.1518987341772153e-05,
|
| 553 |
+
"loss": 0.6233,
|
| 554 |
+
"step": 640
|
| 555 |
+
},
|
| 556 |
+
{
|
| 557 |
+
"epoch": 1.7490737622094983,
|
| 558 |
+
"grad_norm": 1.1565551201360744,
|
| 559 |
+
"learning_rate": 2.1066907775768534e-05,
|
| 560 |
+
"loss": 0.624,
|
| 561 |
+
"step": 650
|
| 562 |
+
},
|
| 563 |
+
{
|
| 564 |
+
"epoch": 1.7490737622094983,
|
| 565 |
+
"eval_loss": 0.7739421129226685,
|
| 566 |
+
"eval_runtime": 148.2001,
|
| 567 |
+
"eval_samples_per_second": 33.738,
|
| 568 |
+
"eval_steps_per_second": 0.533,
|
| 569 |
+
"step": 650
|
| 570 |
+
},
|
| 571 |
+
{
|
| 572 |
+
"epoch": 1.776018861569552,
|
| 573 |
+
"grad_norm": 1.2558394571278007,
|
| 574 |
+
"learning_rate": 2.061482820976492e-05,
|
| 575 |
+
"loss": 0.621,
|
| 576 |
+
"step": 660
|
| 577 |
+
},
|
| 578 |
+
{
|
| 579 |
+
"epoch": 1.802963960929606,
|
| 580 |
+
"grad_norm": 1.1487412967519839,
|
| 581 |
+
"learning_rate": 2.0162748643761304e-05,
|
| 582 |
+
"loss": 0.6201,
|
| 583 |
+
"step": 670
|
| 584 |
+
},
|
| 585 |
+
{
|
| 586 |
+
"epoch": 1.8299090602896597,
|
| 587 |
+
"grad_norm": 1.1633700130604714,
|
| 588 |
+
"learning_rate": 1.971066907775769e-05,
|
| 589 |
+
"loss": 0.6182,
|
| 590 |
+
"step": 680
|
| 591 |
+
},
|
| 592 |
+
{
|
| 593 |
+
"epoch": 1.8568541596497137,
|
| 594 |
+
"grad_norm": 1.0892080498580619,
|
| 595 |
+
"learning_rate": 1.925858951175407e-05,
|
| 596 |
+
"loss": 0.6218,
|
| 597 |
+
"step": 690
|
| 598 |
+
},
|
| 599 |
+
{
|
| 600 |
+
"epoch": 1.8837992590097676,
|
| 601 |
+
"grad_norm": 1.162193434275119,
|
| 602 |
+
"learning_rate": 1.8806509945750454e-05,
|
| 603 |
+
"loss": 0.612,
|
| 604 |
+
"step": 700
|
| 605 |
+
},
|
| 606 |
+
{
|
| 607 |
+
"epoch": 1.8837992590097676,
|
| 608 |
+
"eval_loss": 0.7593940496444702,
|
| 609 |
+
"eval_runtime": 113.5973,
|
| 610 |
+
"eval_samples_per_second": 44.015,
|
| 611 |
+
"eval_steps_per_second": 0.695,
|
| 612 |
+
"step": 700
|
| 613 |
+
},
|
| 614 |
+
{
|
| 615 |
+
"epoch": 1.9107443583698216,
|
| 616 |
+
"grad_norm": 1.477614030615022,
|
| 617 |
+
"learning_rate": 1.8354430379746836e-05,
|
| 618 |
+
"loss": 0.4361,
|
| 619 |
+
"step": 710
|
| 620 |
+
},
|
| 621 |
+
{
|
| 622 |
+
"epoch": 1.9376894577298753,
|
| 623 |
+
"grad_norm": 1.211596696990758,
|
| 624 |
+
"learning_rate": 1.7902350813743217e-05,
|
| 625 |
+
"loss": 0.4174,
|
| 626 |
+
"step": 720
|
| 627 |
+
},
|
| 628 |
+
{
|
| 629 |
+
"epoch": 1.9646345570899293,
|
| 630 |
+
"grad_norm": 1.208841417920371,
|
| 631 |
+
"learning_rate": 1.7450271247739602e-05,
|
| 632 |
+
"loss": 0.4162,
|
| 633 |
+
"step": 730
|
| 634 |
+
},
|
| 635 |
+
{
|
| 636 |
+
"epoch": 1.991579656449983,
|
| 637 |
+
"grad_norm": 1.2740412194613278,
|
| 638 |
+
"learning_rate": 1.6998191681735987e-05,
|
| 639 |
+
"loss": 0.4115,
|
| 640 |
+
"step": 740
|
| 641 |
+
},
|
| 642 |
+
{
|
| 643 |
+
"epoch": 2.0188615695520378,
|
| 644 |
+
"grad_norm": 1.1897059830697447,
|
| 645 |
+
"learning_rate": 1.654611211573237e-05,
|
| 646 |
+
"loss": 0.4224,
|
| 647 |
+
"step": 750
|
| 648 |
+
},
|
| 649 |
+
{
|
| 650 |
+
"epoch": 2.0188615695520378,
|
| 651 |
+
"eval_loss": 0.8485522270202637,
|
| 652 |
+
"eval_runtime": 115.805,
|
| 653 |
+
"eval_samples_per_second": 43.176,
|
| 654 |
+
"eval_steps_per_second": 0.682,
|
| 655 |
+
"step": 750
|
| 656 |
+
},
|
| 657 |
+
{
|
| 658 |
+
"epoch": 2.0458066689120917,
|
| 659 |
+
"grad_norm": 1.2120571201563564,
|
| 660 |
+
"learning_rate": 1.6094032549728753e-05,
|
| 661 |
+
"loss": 0.4192,
|
| 662 |
+
"step": 760
|
| 663 |
+
},
|
| 664 |
+
{
|
| 665 |
+
"epoch": 2.0727517682721457,
|
| 666 |
+
"grad_norm": 1.2006852199531266,
|
| 667 |
+
"learning_rate": 1.5641952983725134e-05,
|
| 668 |
+
"loss": 0.4101,
|
| 669 |
+
"step": 770
|
| 670 |
+
},
|
| 671 |
+
{
|
| 672 |
+
"epoch": 2.099696867632199,
|
| 673 |
+
"grad_norm": 1.2005979870584054,
|
| 674 |
+
"learning_rate": 1.5189873417721521e-05,
|
| 675 |
+
"loss": 0.4164,
|
| 676 |
+
"step": 780
|
| 677 |
+
},
|
| 678 |
+
{
|
| 679 |
+
"epoch": 2.126641966992253,
|
| 680 |
+
"grad_norm": 1.148665043003728,
|
| 681 |
+
"learning_rate": 1.4737793851717904e-05,
|
| 682 |
+
"loss": 0.4194,
|
| 683 |
+
"step": 790
|
| 684 |
+
},
|
| 685 |
+
{
|
| 686 |
+
"epoch": 2.153587066352307,
|
| 687 |
+
"grad_norm": 1.134303382163784,
|
| 688 |
+
"learning_rate": 1.4285714285714285e-05,
|
| 689 |
+
"loss": 0.4213,
|
| 690 |
+
"step": 800
|
| 691 |
+
},
|
| 692 |
+
{
|
| 693 |
+
"epoch": 2.153587066352307,
|
| 694 |
+
"eval_loss": 0.838707447052002,
|
| 695 |
+
"eval_runtime": 139.7297,
|
| 696 |
+
"eval_samples_per_second": 35.783,
|
| 697 |
+
"eval_steps_per_second": 0.565,
|
| 698 |
+
"step": 800
|
| 699 |
+
},
|
| 700 |
+
{
|
| 701 |
+
"epoch": 2.180532165712361,
|
| 702 |
+
"grad_norm": 1.2301409422954543,
|
| 703 |
+
"learning_rate": 1.383363471971067e-05,
|
| 704 |
+
"loss": 0.4179,
|
| 705 |
+
"step": 810
|
| 706 |
+
},
|
| 707 |
+
{
|
| 708 |
+
"epoch": 2.207477265072415,
|
| 709 |
+
"grad_norm": 1.1312377076286286,
|
| 710 |
+
"learning_rate": 1.3381555153707053e-05,
|
| 711 |
+
"loss": 0.4178,
|
| 712 |
+
"step": 820
|
| 713 |
+
},
|
| 714 |
+
{
|
| 715 |
+
"epoch": 2.234422364432469,
|
| 716 |
+
"grad_norm": 1.2707527556350058,
|
| 717 |
+
"learning_rate": 1.2929475587703435e-05,
|
| 718 |
+
"loss": 0.4125,
|
| 719 |
+
"step": 830
|
| 720 |
+
},
|
| 721 |
+
{
|
| 722 |
+
"epoch": 2.2613674637925225,
|
| 723 |
+
"grad_norm": 1.185885154215189,
|
| 724 |
+
"learning_rate": 1.247739602169982e-05,
|
| 725 |
+
"loss": 0.414,
|
| 726 |
+
"step": 840
|
| 727 |
+
},
|
| 728 |
+
{
|
| 729 |
+
"epoch": 2.2883125631525765,
|
| 730 |
+
"grad_norm": 1.1012295953218187,
|
| 731 |
+
"learning_rate": 1.2025316455696203e-05,
|
| 732 |
+
"loss": 0.414,
|
| 733 |
+
"step": 850
|
| 734 |
+
},
|
| 735 |
+
{
|
| 736 |
+
"epoch": 2.2883125631525765,
|
| 737 |
+
"eval_loss": 0.831937313079834,
|
| 738 |
+
"eval_runtime": 144.9314,
|
| 739 |
+
"eval_samples_per_second": 34.499,
|
| 740 |
+
"eval_steps_per_second": 0.545,
|
| 741 |
+
"step": 850
|
| 742 |
+
},
|
| 743 |
+
{
|
| 744 |
+
"epoch": 2.3152576625126304,
|
| 745 |
+
"grad_norm": 1.1388819607995708,
|
| 746 |
+
"learning_rate": 1.1573236889692586e-05,
|
| 747 |
+
"loss": 0.4151,
|
| 748 |
+
"step": 860
|
| 749 |
+
},
|
| 750 |
+
{
|
| 751 |
+
"epoch": 2.3422027618726844,
|
| 752 |
+
"grad_norm": 1.2140213674018405,
|
| 753 |
+
"learning_rate": 1.112115732368897e-05,
|
| 754 |
+
"loss": 0.4159,
|
| 755 |
+
"step": 870
|
| 756 |
+
},
|
| 757 |
+
{
|
| 758 |
+
"epoch": 2.3691478612327384,
|
| 759 |
+
"grad_norm": 1.1631774357185438,
|
| 760 |
+
"learning_rate": 1.0669077757685354e-05,
|
| 761 |
+
"loss": 0.4136,
|
| 762 |
+
"step": 880
|
| 763 |
+
},
|
| 764 |
+
{
|
| 765 |
+
"epoch": 2.3960929605927923,
|
| 766 |
+
"grad_norm": 1.24334716793248,
|
| 767 |
+
"learning_rate": 1.0216998191681737e-05,
|
| 768 |
+
"loss": 0.4076,
|
| 769 |
+
"step": 890
|
| 770 |
+
},
|
| 771 |
+
{
|
| 772 |
+
"epoch": 2.4230380599528463,
|
| 773 |
+
"grad_norm": 1.156296740645565,
|
| 774 |
+
"learning_rate": 9.76491862567812e-06,
|
| 775 |
+
"loss": 0.4145,
|
| 776 |
+
"step": 900
|
| 777 |
+
},
|
| 778 |
+
{
|
| 779 |
+
"epoch": 2.4230380599528463,
|
| 780 |
+
"eval_loss": 0.823464572429657,
|
| 781 |
+
"eval_runtime": 141.3831,
|
| 782 |
+
"eval_samples_per_second": 35.365,
|
| 783 |
+
"eval_steps_per_second": 0.559,
|
| 784 |
+
"step": 900
|
| 785 |
+
},
|
| 786 |
+
{
|
| 787 |
+
"epoch": 2.4499831593129,
|
| 788 |
+
"grad_norm": 1.2360058092342656,
|
| 789 |
+
"learning_rate": 9.312839059674505e-06,
|
| 790 |
+
"loss": 0.4071,
|
| 791 |
+
"step": 910
|
| 792 |
+
},
|
| 793 |
+
{
|
| 794 |
+
"epoch": 2.4769282586729537,
|
| 795 |
+
"grad_norm": 1.1672627428975908,
|
| 796 |
+
"learning_rate": 8.860759493670886e-06,
|
| 797 |
+
"loss": 0.4052,
|
| 798 |
+
"step": 920
|
| 799 |
+
},
|
| 800 |
+
{
|
| 801 |
+
"epoch": 2.5038733580330077,
|
| 802 |
+
"grad_norm": 1.142198240950353,
|
| 803 |
+
"learning_rate": 8.408679927667269e-06,
|
| 804 |
+
"loss": 0.3995,
|
| 805 |
+
"step": 930
|
| 806 |
+
},
|
| 807 |
+
{
|
| 808 |
+
"epoch": 2.5308184573930617,
|
| 809 |
+
"grad_norm": 1.1336163759218327,
|
| 810 |
+
"learning_rate": 7.956600361663654e-06,
|
| 811 |
+
"loss": 0.4109,
|
| 812 |
+
"step": 940
|
| 813 |
+
},
|
| 814 |
+
{
|
| 815 |
+
"epoch": 2.5577635567531156,
|
| 816 |
+
"grad_norm": 1.1520513715336371,
|
| 817 |
+
"learning_rate": 7.504520795660036e-06,
|
| 818 |
+
"loss": 0.4021,
|
| 819 |
+
"step": 950
|
| 820 |
+
},
|
| 821 |
+
{
|
| 822 |
+
"epoch": 2.5577635567531156,
|
| 823 |
+
"eval_loss": 0.8257409930229187,
|
| 824 |
+
"eval_runtime": 145.0235,
|
| 825 |
+
"eval_samples_per_second": 34.477,
|
| 826 |
+
"eval_steps_per_second": 0.545,
|
| 827 |
+
"step": 950
|
| 828 |
+
},
|
| 829 |
+
{
|
| 830 |
+
"epoch": 2.5847086561131696,
|
| 831 |
+
"grad_norm": 1.1137257622476067,
|
| 832 |
+
"learning_rate": 7.05244122965642e-06,
|
| 833 |
+
"loss": 0.3979,
|
| 834 |
+
"step": 960
|
| 835 |
+
},
|
| 836 |
+
{
|
| 837 |
+
"epoch": 2.611653755473223,
|
| 838 |
+
"grad_norm": 1.107368997807173,
|
| 839 |
+
"learning_rate": 6.600361663652803e-06,
|
| 840 |
+
"loss": 0.4011,
|
| 841 |
+
"step": 970
|
| 842 |
+
},
|
| 843 |
+
{
|
| 844 |
+
"epoch": 2.638598854833277,
|
| 845 |
+
"grad_norm": 1.1780589934268402,
|
| 846 |
+
"learning_rate": 6.148282097649186e-06,
|
| 847 |
+
"loss": 0.4013,
|
| 848 |
+
"step": 980
|
| 849 |
+
},
|
| 850 |
+
{
|
| 851 |
+
"epoch": 2.665543954193331,
|
| 852 |
+
"grad_norm": 1.174979594904003,
|
| 853 |
+
"learning_rate": 5.69620253164557e-06,
|
| 854 |
+
"loss": 0.3992,
|
| 855 |
+
"step": 990
|
| 856 |
+
},
|
| 857 |
+
{
|
| 858 |
+
"epoch": 2.692489053553385,
|
| 859 |
+
"grad_norm": 1.1164061245257322,
|
| 860 |
+
"learning_rate": 5.244122965641953e-06,
|
| 861 |
+
"loss": 0.393,
|
| 862 |
+
"step": 1000
|
| 863 |
+
},
|
| 864 |
+
{
|
| 865 |
+
"epoch": 2.692489053553385,
|
| 866 |
+
"eval_loss": 0.8172587156295776,
|
| 867 |
+
"eval_runtime": 147.8118,
|
| 868 |
+
"eval_samples_per_second": 33.827,
|
| 869 |
+
"eval_steps_per_second": 0.534,
|
| 870 |
+
"step": 1000
|
| 871 |
+
}
|
| 872 |
+
],
|
| 873 |
+
"logging_steps": 10,
|
| 874 |
+
"max_steps": 1116,
|
| 875 |
+
"num_input_tokens_seen": 0,
|
| 876 |
+
"num_train_epochs": 3,
|
| 877 |
+
"save_steps": 50,
|
| 878 |
+
"stateful_callbacks": {
|
| 879 |
+
"TrainerControl": {
|
| 880 |
+
"args": {
|
| 881 |
+
"should_epoch_stop": false,
|
| 882 |
+
"should_evaluate": false,
|
| 883 |
+
"should_log": false,
|
| 884 |
+
"should_save": true,
|
| 885 |
+
"should_training_stop": false
|
| 886 |
+
},
|
| 887 |
+
"attributes": {}
|
| 888 |
+
}
|
| 889 |
+
},
|
| 890 |
+
"total_flos": 588328797732864.0,
|
| 891 |
+
"train_batch_size": 4,
|
| 892 |
+
"trial_name": null,
|
| 893 |
+
"trial_params": null
|
| 894 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7142dd73a436ab023d78446a9700a5d3d3376496f1ff098532e2130dec697703
|
| 3 |
+
size 8017
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
zero_to_fp32.py
ADDED
|
@@ -0,0 +1,760 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 ZERO_STAGE not 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("Extracting fp32 weights")
|
| 713 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
|
| 714 |
+
|
| 715 |
+
logger.info("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)
|