Jinrui commited on
Commit
0ba8983
·
verified ·
1 Parent(s): 116cbdd

Upload folder using huggingface_hub

Browse files
Files changed (24) hide show
  1. .gitattributes +1 -0
  2. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/added_tokens.json +28 -0
  3. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/config.json +57 -0
  4. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/generation_config.json +7 -0
  5. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/global_step8192/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt +3 -0
  6. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/global_step8192/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt +3 -0
  7. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/global_step8192/bf16_zero_pp_rank_2_mp_rank_00_optim_states.pt +3 -0
  8. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/global_step8192/bf16_zero_pp_rank_3_mp_rank_00_optim_states.pt +3 -0
  9. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/global_step8192/mp_rank_00_model_states.pt +3 -0
  10. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/latest +1 -0
  11. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/merges.txt +0 -0
  12. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/model.safetensors +3 -0
  13. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/rng_state_0.pth +3 -0
  14. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/rng_state_1.pth +3 -0
  15. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/rng_state_2.pth +3 -0
  16. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/rng_state_3.pth +3 -0
  17. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/scheduler.pt +3 -0
  18. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/special_tokens_map.json +31 -0
  19. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/tokenizer.json +3 -0
  20. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/tokenizer_config.json +241 -0
  21. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/trainer_state.json +665 -0
  22. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/training_args.bin +3 -0
  23. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/vocab.json +0 -0
  24. checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/zero_to_fp32.py +604 -0
.gitattributes CHANGED
@@ -44,3 +44,4 @@ checkpoints/qwen3/qwen3_p1621m_t1_16_suite-owt_scaling_v3_family-qwen3_geometry_
44
  checkpoints/qwen3/qwen3_p223m_t1_128_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt1_20260211_204923/checkpoint-251/tokenizer.json filter=lfs diff=lfs merge=lfs -text
45
  checkpoints/qwen3/qwen3_p047m_t1_32_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt1_20260211_235341/checkpoint-768/tokenizer.json filter=lfs diff=lfs merge=lfs -text
46
  checkpoints/qwen3/qwen3_p1083m_t1_16_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt1_20260210_122411/checkpoint-768/tokenizer.json filter=lfs diff=lfs merge=lfs -text
 
 
44
  checkpoints/qwen3/qwen3_p223m_t1_128_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt1_20260211_204923/checkpoint-251/tokenizer.json filter=lfs diff=lfs merge=lfs -text
45
  checkpoints/qwen3/qwen3_p047m_t1_32_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt1_20260211_235341/checkpoint-768/tokenizer.json filter=lfs diff=lfs merge=lfs -text
46
  checkpoints/qwen3/qwen3_p1083m_t1_16_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt1_20260210_122411/checkpoint-768/tokenizer.json filter=lfs diff=lfs merge=lfs -text
47
+ checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/tokenizer.json filter=lfs diff=lfs merge=lfs -text
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/added_tokens.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</think>": 151668,
3
+ "</tool_call>": 151658,
4
+ "</tool_response>": 151666,
5
+ "<think>": 151667,
6
+ "<tool_call>": 151657,
7
+ "<tool_response>": 151665,
8
+ "<|box_end|>": 151649,
9
+ "<|box_start|>": 151648,
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
+ "<|image_pad|>": 151655,
19
+ "<|object_ref_end|>": 151647,
20
+ "<|object_ref_start|>": 151646,
21
+ "<|quad_end|>": 151651,
22
+ "<|quad_start|>": 151650,
23
+ "<|repo_name|>": 151663,
24
+ "<|video_pad|>": 151656,
25
+ "<|vision_end|>": 151653,
26
+ "<|vision_pad|>": 151654,
27
+ "<|vision_start|>": 151652
28
+ }
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/config.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 151643,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 151645,
10
+ "head_dim": 128,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 1536,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 4608,
15
+ "layer_types": [
16
+ "full_attention",
17
+ "full_attention",
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention"
40
+ ],
41
+ "max_position_embeddings": 40960,
42
+ "max_window_layers": 24,
43
+ "model_type": "qwen3",
44
+ "num_attention_heads": 24,
45
+ "num_hidden_layers": 24,
46
+ "num_key_value_heads": 12,
47
+ "rms_norm_eps": 1e-06,
48
+ "rope_scaling": null,
49
+ "rope_theta": 1000000,
50
+ "sliding_window": null,
51
+ "tie_word_embeddings": true,
52
+ "torch_dtype": "bfloat16",
53
+ "transformers_version": "4.51.3",
54
+ "use_cache": false,
55
+ "use_sliding_window": false,
56
+ "vocab_size": 151936
57
+ }
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 151643,
4
+ "eos_token_id": 151645,
5
+ "transformers_version": "4.51.3",
6
+ "use_cache": false
7
+ }
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/global_step8192/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:ae4c63ffb3ff09b0b155479f717b42245e3b525170d12bcc81ca8402c9a151ec
3
+ size 3248411504
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/global_step8192/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:5e93cf221e1187582a0b0b41ff6833f85088cc506da6496825b1b09f44804d00
3
+ size 3248416112
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/global_step8192/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:819ead047105bf193a0b3315fb436858301b0c8167b91873b9384c6bc8070469
3
+ size 3248416048
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/global_step8192/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:a2147e05313806cf205f4f0f8155f27ab21b451806e8d858c99cc7337fb18ab3
3
+ size 3248416112
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/global_step8192/mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a19f89b00fe63d524a07a7634499da4903d37d045541831a4dc43eee0d4c675d
3
+ size 2165680184
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step8192
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88470a67430b03bcaf110104464fa439d4677b8d70fc02312e1779d20644bb9f
3
+ size 2632381440
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:543ef05f530d40ee20b8d626b07a69b86597aca643e48897571062f973efe84f
3
+ size 15024
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7a23f732e43838ce0398d2636885ac16badbb9bcbc04d1406069ba3027bc5ae0
3
+ size 15024
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e10cce960e7068b051c05e35ed6160656be9091c63f13796ac2ed7e9c84e5a72
3
+ size 15024
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b6f6049e212b1df5cefc5d834afcd8cc052c73f1457449e9fe8a38d514f54078
3
+ size 15024
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:334fb076f7d71bb621987f565fce1446b156844c3df0ecee01029beb434ae082
3
+ size 1064
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
3
+ size 11422654
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/tokenizer_config.json ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<tool_response>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "151667": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "151668": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ }
213
+ },
214
+ "additional_special_tokens": [
215
+ "<|im_start|>",
216
+ "<|im_end|>",
217
+ "<|object_ref_start|>",
218
+ "<|object_ref_end|>",
219
+ "<|box_start|>",
220
+ "<|box_end|>",
221
+ "<|quad_start|>",
222
+ "<|quad_end|>",
223
+ "<|vision_start|>",
224
+ "<|vision_end|>",
225
+ "<|vision_pad|>",
226
+ "<|image_pad|>",
227
+ "<|video_pad|>"
228
+ ],
229
+ "bos_token": null,
230
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}",
231
+ "clean_up_tokenization_spaces": false,
232
+ "eos_token": "<|im_end|>",
233
+ "errors": "replace",
234
+ "extra_special_tokens": {},
235
+ "model_max_length": 131072,
236
+ "pad_token": "<|endoftext|>",
237
+ "padding_side": "right",
238
+ "split_special_tokens": false,
239
+ "tokenizer_class": "Qwen2Tokenizer",
240
+ "unk_token": null
241
+ }
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/trainer_state.json ADDED
@@ -0,0 +1,665 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 0.24644727985168638,
6
+ "eval_steps": 1024,
7
+ "global_step": 8192,
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.003008389646627031,
14
+ "grad_norm": 1.8081544637680054,
15
+ "learning_rate": 3.08411214953271e-05,
16
+ "loss": 9.7352,
17
+ "step": 100
18
+ },
19
+ {
20
+ "epoch": 0.006016779293254062,
21
+ "grad_norm": 1.0897260904312134,
22
+ "learning_rate": 6.199376947040498e-05,
23
+ "loss": 7.0092,
24
+ "step": 200
25
+ },
26
+ {
27
+ "epoch": 0.009025168939881093,
28
+ "grad_norm": 1.0756351947784424,
29
+ "learning_rate": 9.314641744548286e-05,
30
+ "loss": 6.2106,
31
+ "step": 300
32
+ },
33
+ {
34
+ "epoch": 0.012033558586508125,
35
+ "grad_norm": 1.325608730316162,
36
+ "learning_rate": 9.999390218499588e-05,
37
+ "loss": 5.7481,
38
+ "step": 400
39
+ },
40
+ {
41
+ "epoch": 0.015041948233135156,
42
+ "grad_norm": 0.5563725233078003,
43
+ "learning_rate": 9.996824677076817e-05,
44
+ "loss": 5.4152,
45
+ "step": 500
46
+ },
47
+ {
48
+ "epoch": 0.018050337879762186,
49
+ "grad_norm": 0.6096261143684387,
50
+ "learning_rate": 9.992255893455041e-05,
51
+ "loss": 5.17,
52
+ "step": 600
53
+ },
54
+ {
55
+ "epoch": 0.021058727526389216,
56
+ "grad_norm": 0.7971847057342529,
57
+ "learning_rate": 9.9856856992735e-05,
58
+ "loss": 4.9735,
59
+ "step": 700
60
+ },
61
+ {
62
+ "epoch": 0.02406711717301625,
63
+ "grad_norm": 0.49311694502830505,
64
+ "learning_rate": 9.977116728543007e-05,
65
+ "loss": 4.8053,
66
+ "step": 800
67
+ },
68
+ {
69
+ "epoch": 0.02707550681964328,
70
+ "grad_norm": 0.6969898343086243,
71
+ "learning_rate": 9.966552416589973e-05,
72
+ "loss": 4.6446,
73
+ "step": 900
74
+ },
75
+ {
76
+ "epoch": 0.030083896466270313,
77
+ "grad_norm": 0.5000762939453125,
78
+ "learning_rate": 9.953996998679162e-05,
79
+ "loss": 4.5142,
80
+ "step": 1000
81
+ },
82
+ {
83
+ "epoch": 0.030805909981460797,
84
+ "eval_loss": 4.429453372955322,
85
+ "eval_runtime": 28.6882,
86
+ "eval_samples_per_second": 147.726,
87
+ "eval_steps_per_second": 4.636,
88
+ "step": 1024
89
+ },
90
+ {
91
+ "epoch": 0.03309228611289734,
92
+ "grad_norm": 0.4743868112564087,
93
+ "learning_rate": 9.939455508315775e-05,
94
+ "loss": 4.4023,
95
+ "step": 1100
96
+ },
97
+ {
98
+ "epoch": 0.03610067575952437,
99
+ "grad_norm": 0.5583599805831909,
100
+ "learning_rate": 9.92293377522749e-05,
101
+ "loss": 4.3164,
102
+ "step": 1200
103
+ },
104
+ {
105
+ "epoch": 0.0391090654061514,
106
+ "grad_norm": 0.442892462015152,
107
+ "learning_rate": 9.904438423027316e-05,
108
+ "loss": 4.2406,
109
+ "step": 1300
110
+ },
111
+ {
112
+ "epoch": 0.04211745505277843,
113
+ "grad_norm": 0.3826092779636383,
114
+ "learning_rate": 9.883976866558158e-05,
115
+ "loss": 4.1792,
116
+ "step": 1400
117
+ },
118
+ {
119
+ "epoch": 0.04512584469940547,
120
+ "grad_norm": 0.42428717017173767,
121
+ "learning_rate": 9.86155730892019e-05,
122
+ "loss": 4.1225,
123
+ "step": 1500
124
+ },
125
+ {
126
+ "epoch": 0.0481342343460325,
127
+ "grad_norm": 0.394997239112854,
128
+ "learning_rate": 9.837188738182205e-05,
129
+ "loss": 4.07,
130
+ "step": 1600
131
+ },
132
+ {
133
+ "epoch": 0.05114262399265953,
134
+ "grad_norm": 0.36051058769226074,
135
+ "learning_rate": 9.81088092377827e-05,
136
+ "loss": 4.0229,
137
+ "step": 1700
138
+ },
139
+ {
140
+ "epoch": 0.05415101363928656,
141
+ "grad_norm": 0.3929230272769928,
142
+ "learning_rate": 9.782644412591135e-05,
143
+ "loss": 3.9876,
144
+ "step": 1800
145
+ },
146
+ {
147
+ "epoch": 0.05715940328591359,
148
+ "grad_norm": 0.39373254776000977,
149
+ "learning_rate": 9.752490524723946e-05,
150
+ "loss": 3.9443,
151
+ "step": 1900
152
+ },
153
+ {
154
+ "epoch": 0.060167792932540626,
155
+ "grad_norm": 0.3637371361255646,
156
+ "learning_rate": 9.720431348961991e-05,
157
+ "loss": 3.9091,
158
+ "step": 2000
159
+ },
160
+ {
161
+ "epoch": 0.061611819962921595,
162
+ "eval_loss": 3.878706216812134,
163
+ "eval_runtime": 27.5639,
164
+ "eval_samples_per_second": 153.752,
165
+ "eval_steps_per_second": 4.825,
166
+ "step": 2048
167
+ },
168
+ {
169
+ "epoch": 0.06317618257916766,
170
+ "grad_norm": 0.3592907190322876,
171
+ "learning_rate": 9.686479737926266e-05,
172
+ "loss": 3.8722,
173
+ "step": 2100
174
+ },
175
+ {
176
+ "epoch": 0.06618457222579469,
177
+ "grad_norm": 0.34135356545448303,
178
+ "learning_rate": 9.650649302920819e-05,
179
+ "loss": 3.851,
180
+ "step": 2200
181
+ },
182
+ {
183
+ "epoch": 0.06919296187242172,
184
+ "grad_norm": 0.34740984439849854,
185
+ "learning_rate": 9.612954408475934e-05,
186
+ "loss": 3.8182,
187
+ "step": 2300
188
+ },
189
+ {
190
+ "epoch": 0.07220135151904875,
191
+ "grad_norm": 0.3434409201145172,
192
+ "learning_rate": 9.573410166589356e-05,
193
+ "loss": 3.8004,
194
+ "step": 2400
195
+ },
196
+ {
197
+ "epoch": 0.07520974116567578,
198
+ "grad_norm": 0.30977728962898254,
199
+ "learning_rate": 9.532032430667834e-05,
200
+ "loss": 3.7671,
201
+ "step": 2500
202
+ },
203
+ {
204
+ "epoch": 0.0782181308123028,
205
+ "grad_norm": 0.3274868428707123,
206
+ "learning_rate": 9.488837789171455e-05,
207
+ "loss": 3.7498,
208
+ "step": 2600
209
+ },
210
+ {
211
+ "epoch": 0.08122652045892984,
212
+ "grad_norm": 0.3402297794818878,
213
+ "learning_rate": 9.443843558963266e-05,
214
+ "loss": 3.7235,
215
+ "step": 2700
216
+ },
217
+ {
218
+ "epoch": 0.08423491010555686,
219
+ "grad_norm": 0.33715498447418213,
220
+ "learning_rate": 9.397067778366902e-05,
221
+ "loss": 3.7161,
222
+ "step": 2800
223
+ },
224
+ {
225
+ "epoch": 0.08724329975218391,
226
+ "grad_norm": 0.32197704911231995,
227
+ "learning_rate": 9.348529199934959e-05,
228
+ "loss": 3.6971,
229
+ "step": 2900
230
+ },
231
+ {
232
+ "epoch": 0.09025168939881094,
233
+ "grad_norm": 0.31326088309288025,
234
+ "learning_rate": 9.298247282931048e-05,
235
+ "loss": 3.6674,
236
+ "step": 3000
237
+ },
238
+ {
239
+ "epoch": 0.0924177299443824,
240
+ "eval_loss": 3.6544880867004395,
241
+ "eval_runtime": 27.8043,
242
+ "eval_samples_per_second": 152.422,
243
+ "eval_steps_per_second": 4.783,
244
+ "step": 3072
245
+ },
246
+ {
247
+ "epoch": 0.09326007904543797,
248
+ "grad_norm": 0.3117671608924866,
249
+ "learning_rate": 9.246242185528508e-05,
250
+ "loss": 3.6553,
251
+ "step": 3100
252
+ },
253
+ {
254
+ "epoch": 0.096268468692065,
255
+ "grad_norm": 0.31069496273994446,
256
+ "learning_rate": 9.192534756728936e-05,
257
+ "loss": 3.6431,
258
+ "step": 3200
259
+ },
260
+ {
261
+ "epoch": 0.09927685833869203,
262
+ "grad_norm": 0.31252533197402954,
263
+ "learning_rate": 9.137146528003762e-05,
264
+ "loss": 3.6309,
265
+ "step": 3300
266
+ },
267
+ {
268
+ "epoch": 0.10228524798531906,
269
+ "grad_norm": 0.29626986384391785,
270
+ "learning_rate": 9.080099704662214e-05,
271
+ "loss": 3.6096,
272
+ "step": 3400
273
+ },
274
+ {
275
+ "epoch": 0.10529363763194609,
276
+ "grad_norm": 0.3036186993122101,
277
+ "learning_rate": 9.021417156949143e-05,
278
+ "loss": 3.6025,
279
+ "step": 3500
280
+ },
281
+ {
282
+ "epoch": 0.10830202727857312,
283
+ "grad_norm": 0.3038487136363983,
284
+ "learning_rate": 8.961122410876268e-05,
285
+ "loss": 3.5854,
286
+ "step": 3600
287
+ },
288
+ {
289
+ "epoch": 0.11131041692520015,
290
+ "grad_norm": 0.2864755094051361,
291
+ "learning_rate": 8.899239638790535e-05,
292
+ "loss": 3.5725,
293
+ "step": 3700
294
+ },
295
+ {
296
+ "epoch": 0.11431880657182718,
297
+ "grad_norm": 0.2870684862136841,
298
+ "learning_rate": 8.835793649683342e-05,
299
+ "loss": 3.5572,
300
+ "step": 3800
301
+ },
302
+ {
303
+ "epoch": 0.11732719621845421,
304
+ "grad_norm": 0.30023226141929626,
305
+ "learning_rate": 8.770809879244541e-05,
306
+ "loss": 3.5447,
307
+ "step": 3900
308
+ },
309
+ {
310
+ "epoch": 0.12033558586508125,
311
+ "grad_norm": 0.2889101207256317,
312
+ "learning_rate": 8.704314379665195e-05,
313
+ "loss": 3.5334,
314
+ "step": 4000
315
+ },
316
+ {
317
+ "epoch": 0.12322363992584319,
318
+ "eval_loss": 3.5199642181396484,
319
+ "eval_runtime": 25.5123,
320
+ "eval_samples_per_second": 166.116,
321
+ "eval_steps_per_second": 5.213,
322
+ "step": 4096
323
+ },
324
+ {
325
+ "epoch": 0.12334397551170828,
326
+ "grad_norm": 0.2787327468395233,
327
+ "learning_rate": 8.636333809193176e-05,
328
+ "loss": 3.5224,
329
+ "step": 4100
330
+ },
331
+ {
332
+ "epoch": 0.1263523651583353,
333
+ "grad_norm": 0.28778326511383057,
334
+ "learning_rate": 8.566895421445784e-05,
335
+ "loss": 3.5129,
336
+ "step": 4200
337
+ },
338
+ {
339
+ "epoch": 0.12936075480496234,
340
+ "grad_norm": 0.2771563231945038,
341
+ "learning_rate": 8.496027054483702e-05,
342
+ "loss": 3.5002,
343
+ "step": 4300
344
+ },
345
+ {
346
+ "epoch": 0.13236914445158937,
347
+ "grad_norm": 0.28959691524505615,
348
+ "learning_rate": 8.423757119650619e-05,
349
+ "loss": 3.4917,
350
+ "step": 4400
351
+ },
352
+ {
353
+ "epoch": 0.1353775340982164,
354
+ "grad_norm": 0.27935898303985596,
355
+ "learning_rate": 8.35011459018305e-05,
356
+ "loss": 3.4875,
357
+ "step": 4500
358
+ },
359
+ {
360
+ "epoch": 0.13838592374484343,
361
+ "grad_norm": 0.2650796175003052,
362
+ "learning_rate": 8.275128989594867e-05,
363
+ "loss": 3.4685,
364
+ "step": 4600
365
+ },
366
+ {
367
+ "epoch": 0.14139431339147046,
368
+ "grad_norm": 0.2627846598625183,
369
+ "learning_rate": 8.198830379841233e-05,
370
+ "loss": 3.4681,
371
+ "step": 4700
372
+ },
373
+ {
374
+ "epoch": 0.1444027030380975,
375
+ "grad_norm": 0.28169551491737366,
376
+ "learning_rate": 8.121249349266684e-05,
377
+ "loss": 3.4556,
378
+ "step": 4800
379
+ },
380
+ {
381
+ "epoch": 0.14741109268472452,
382
+ "grad_norm": 0.2804490327835083,
383
+ "learning_rate": 8.042417000342151e-05,
384
+ "loss": 3.4503,
385
+ "step": 4900
386
+ },
387
+ {
388
+ "epoch": 0.15041948233135155,
389
+ "grad_norm": 0.3104579746723175,
390
+ "learning_rate": 7.962364937195902e-05,
391
+ "loss": 3.4394,
392
+ "step": 5000
393
+ },
394
+ {
395
+ "epoch": 0.15342787197797858,
396
+ "grad_norm": 0.27914077043533325,
397
+ "learning_rate": 7.88112525294334e-05,
398
+ "loss": 3.4354,
399
+ "step": 5100
400
+ },
401
+ {
402
+ "epoch": 0.154029549907304,
403
+ "eval_loss": 3.428358554840088,
404
+ "eval_runtime": 25.6005,
405
+ "eval_samples_per_second": 165.544,
406
+ "eval_steps_per_second": 5.195,
407
+ "step": 5120
408
+ },
409
+ {
410
+ "epoch": 0.1564362616246056,
411
+ "grad_norm": 0.2609664499759674,
412
+ "learning_rate": 7.798730516820779e-05,
413
+ "loss": 3.4221,
414
+ "step": 5200
415
+ },
416
+ {
417
+ "epoch": 0.15944465127123264,
418
+ "grad_norm": 0.26283183693885803,
419
+ "learning_rate": 7.715213761128337e-05,
420
+ "loss": 3.4155,
421
+ "step": 5300
422
+ },
423
+ {
424
+ "epoch": 0.16245304091785967,
425
+ "grad_norm": 0.27422934770584106,
426
+ "learning_rate": 7.63060846798719e-05,
427
+ "loss": 3.4033,
428
+ "step": 5400
429
+ },
430
+ {
431
+ "epoch": 0.1654614305644867,
432
+ "grad_norm": 0.28960829973220825,
433
+ "learning_rate": 7.544948555916485e-05,
434
+ "loss": 3.4011,
435
+ "step": 5500
436
+ },
437
+ {
438
+ "epoch": 0.16846982021111373,
439
+ "grad_norm": 0.26780277490615845,
440
+ "learning_rate": 7.4582683662353e-05,
441
+ "loss": 3.3995,
442
+ "step": 5600
443
+ },
444
+ {
445
+ "epoch": 0.1714782098577408,
446
+ "grad_norm": 0.26375481486320496,
447
+ "learning_rate": 7.370602649295112e-05,
448
+ "loss": 3.3901,
449
+ "step": 5700
450
+ },
451
+ {
452
+ "epoch": 0.17448659950436782,
453
+ "grad_norm": 0.26001670956611633,
454
+ "learning_rate": 7.281986550548268e-05,
455
+ "loss": 3.3838,
456
+ "step": 5800
457
+ },
458
+ {
459
+ "epoch": 0.17749498915099485,
460
+ "grad_norm": 0.2617439925670624,
461
+ "learning_rate": 7.192455596458073e-05,
462
+ "loss": 3.3786,
463
+ "step": 5900
464
+ },
465
+ {
466
+ "epoch": 0.18050337879762188,
467
+ "grad_norm": 0.2578573226928711,
468
+ "learning_rate": 7.102045680256113e-05,
469
+ "loss": 3.3686,
470
+ "step": 6000
471
+ },
472
+ {
473
+ "epoch": 0.1835117684442489,
474
+ "grad_norm": 0.25970160961151123,
475
+ "learning_rate": 7.010793047552565e-05,
476
+ "loss": 3.3599,
477
+ "step": 6100
478
+ },
479
+ {
480
+ "epoch": 0.1848354598887648,
481
+ "eval_loss": 3.3594183921813965,
482
+ "eval_runtime": 28.2705,
483
+ "eval_samples_per_second": 149.909,
484
+ "eval_steps_per_second": 4.705,
485
+ "step": 6144
486
+ },
487
+ {
488
+ "epoch": 0.18652015809087594,
489
+ "grad_norm": 0.25814658403396606,
490
+ "learning_rate": 6.918734281805204e-05,
491
+ "loss": 3.3542,
492
+ "step": 6200
493
+ },
494
+ {
495
+ "epoch": 0.18952854773750297,
496
+ "grad_norm": 0.26643288135528564,
497
+ "learning_rate": 6.825906289652998e-05,
498
+ "loss": 3.3486,
499
+ "step": 6300
500
+ },
501
+ {
502
+ "epoch": 0.19253693738413,
503
+ "grad_norm": 0.2631397545337677,
504
+ "learning_rate": 6.732346286120116e-05,
505
+ "loss": 3.3471,
506
+ "step": 6400
507
+ },
508
+ {
509
+ "epoch": 0.19554532703075703,
510
+ "grad_norm": 0.25272083282470703,
511
+ "learning_rate": 6.638091779696314e-05,
512
+ "loss": 3.3379,
513
+ "step": 6500
514
+ },
515
+ {
516
+ "epoch": 0.19855371667738406,
517
+ "grad_norm": 0.2605939507484436,
518
+ "learning_rate": 6.543180557299673e-05,
519
+ "loss": 3.3298,
520
+ "step": 6600
521
+ },
522
+ {
523
+ "epoch": 0.2015621063240111,
524
+ "grad_norm": 0.25710055232048035,
525
+ "learning_rate": 6.447650669127692e-05,
526
+ "loss": 3.3237,
527
+ "step": 6700
528
+ },
529
+ {
530
+ "epoch": 0.20457049597063812,
531
+ "grad_norm": 0.2481650710105896,
532
+ "learning_rate": 6.35154041340287e-05,
533
+ "loss": 3.3253,
534
+ "step": 6800
535
+ },
536
+ {
537
+ "epoch": 0.20757888561726515,
538
+ "grad_norm": 0.37661871314048767,
539
+ "learning_rate": 6.254888321018817e-05,
540
+ "loss": 3.3143,
541
+ "step": 6900
542
+ },
543
+ {
544
+ "epoch": 0.21058727526389218,
545
+ "grad_norm": 0.2581317722797394,
546
+ "learning_rate": 6.157733140093107e-05,
547
+ "loss": 3.3149,
548
+ "step": 7000
549
+ },
550
+ {
551
+ "epoch": 0.2135956649105192,
552
+ "grad_norm": 0.25675368309020996,
553
+ "learning_rate": 6.060113820433041e-05,
554
+ "loss": 3.3015,
555
+ "step": 7100
556
+ },
557
+ {
558
+ "epoch": 0.21564136987022559,
559
+ "eval_loss": 3.304588794708252,
560
+ "eval_runtime": 27.5945,
561
+ "eval_samples_per_second": 153.581,
562
+ "eval_steps_per_second": 4.82,
563
+ "step": 7168
564
+ },
565
+ {
566
+ "epoch": 0.21660405455714624,
567
+ "grad_norm": 0.25401395559310913,
568
+ "learning_rate": 5.962069497920546e-05,
569
+ "loss": 3.302,
570
+ "step": 7200
571
+ },
572
+ {
573
+ "epoch": 0.21961244420377327,
574
+ "grad_norm": 0.2600981295108795,
575
+ "learning_rate": 5.863639478822488e-05,
576
+ "loss": 3.2984,
577
+ "step": 7300
578
+ },
579
+ {
580
+ "epoch": 0.2226208338504003,
581
+ "grad_norm": 0.253537654876709,
582
+ "learning_rate": 5.764863224032663e-05,
583
+ "loss": 3.2987,
584
+ "step": 7400
585
+ },
586
+ {
587
+ "epoch": 0.22562922349702733,
588
+ "grad_norm": 0.2553566098213196,
589
+ "learning_rate": 5.66578033325181e-05,
590
+ "loss": 3.2817,
591
+ "step": 7500
592
+ },
593
+ {
594
+ "epoch": 0.22863761314365436,
595
+ "grad_norm": 0.2590862810611725,
596
+ "learning_rate": 5.566430529111969e-05,
597
+ "loss": 3.2848,
598
+ "step": 7600
599
+ },
600
+ {
601
+ "epoch": 0.23164600279028139,
602
+ "grad_norm": 0.24905967712402344,
603
+ "learning_rate": 5.4668536412515534e-05,
604
+ "loss": 3.2758,
605
+ "step": 7700
606
+ },
607
+ {
608
+ "epoch": 0.23465439243690842,
609
+ "grad_norm": 0.25471484661102295,
610
+ "learning_rate": 5.367089590347535e-05,
611
+ "loss": 3.2805,
612
+ "step": 7800
613
+ },
614
+ {
615
+ "epoch": 0.23766278208353547,
616
+ "grad_norm": 0.25363436341285706,
617
+ "learning_rate": 5.2671783721111145e-05,
618
+ "loss": 3.274,
619
+ "step": 7900
620
+ },
621
+ {
622
+ "epoch": 0.2406711717301625,
623
+ "grad_norm": 0.2578498423099518,
624
+ "learning_rate": 5.1671600412533284e-05,
625
+ "loss": 3.2648,
626
+ "step": 8000
627
+ },
628
+ {
629
+ "epoch": 0.24367956137678953,
630
+ "grad_norm": 0.2545549273490906,
631
+ "learning_rate": 5.067074695426984e-05,
632
+ "loss": 3.259,
633
+ "step": 8100
634
+ },
635
+ {
636
+ "epoch": 0.24644727985168638,
637
+ "eval_loss": 3.2613685131073,
638
+ "eval_runtime": 28.3851,
639
+ "eval_samples_per_second": 149.304,
640
+ "eval_steps_per_second": 4.686,
641
+ "step": 8192
642
+ }
643
+ ],
644
+ "logging_steps": 100,
645
+ "max_steps": 16011,
646
+ "num_input_tokens_seen": 0,
647
+ "num_train_epochs": 1,
648
+ "save_steps": 2048,
649
+ "stateful_callbacks": {
650
+ "TrainerControl": {
651
+ "args": {
652
+ "should_epoch_stop": false,
653
+ "should_evaluate": false,
654
+ "should_log": false,
655
+ "should_save": true,
656
+ "should_training_stop": false
657
+ },
658
+ "attributes": {}
659
+ }
660
+ },
661
+ "total_flos": 1.0944796278785049e+19,
662
+ "train_batch_size": 4,
663
+ "trial_name": null,
664
+ "trial_params": null
665
+ }
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0301c2ef51a631de0b3b6ebc6c3d958b7f37efc6d6c6e0bd2902aed002e99e04
3
+ size 7544
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoints/qwen3/qwen3_p1083m_t1_2_suite-owt_scaling_v3_family-qwen3_geometry_id-euclid_variant-base_init_slope-std/attempt2_20260219_093238/checkpoint-8192/zero_to_fp32.py ADDED
@@ -0,0 +1,604 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: python zero_to_fp32.py . pytorch_model.bin
14
+
15
+ import argparse
16
+ import torch
17
+ import glob
18
+ import math
19
+ import os
20
+ import re
21
+ from collections import OrderedDict
22
+ from dataclasses import dataclass
23
+
24
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
25
+ # DeepSpeed data structures it has to be available in the current python environment.
26
+ from deepspeed.utils import logger
27
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
28
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
29
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
30
+
31
+
32
+ @dataclass
33
+ class zero_model_state:
34
+ buffers: dict()
35
+ param_shapes: dict()
36
+ shared_params: list
37
+ ds_version: int
38
+ frozen_param_shapes: dict()
39
+ frozen_param_fragments: dict()
40
+
41
+
42
+ debug = 0
43
+
44
+ # load to cpu
45
+ device = torch.device('cpu')
46
+
47
+
48
+ def atoi(text):
49
+ return int(text) if text.isdigit() else text
50
+
51
+
52
+ def natural_keys(text):
53
+ '''
54
+ alist.sort(key=natural_keys) sorts in human order
55
+ http://nedbatchelder.com/blog/200712/human_sorting.html
56
+ (See Toothy's implementation in the comments)
57
+ '''
58
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
59
+
60
+
61
+ def get_model_state_file(checkpoint_dir, zero_stage):
62
+ if not os.path.isdir(checkpoint_dir):
63
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
64
+
65
+ # there should be only one file
66
+ if zero_stage <= 2:
67
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
68
+ elif zero_stage == 3:
69
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
70
+
71
+ if not os.path.exists(file):
72
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
73
+
74
+ return file
75
+
76
+
77
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
78
+ # XXX: need to test that this simple glob rule works for multi-node setup too
79
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
80
+
81
+ if len(ckpt_files) == 0:
82
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
83
+
84
+ return ckpt_files
85
+
86
+
87
+ def get_optim_files(checkpoint_dir):
88
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
89
+
90
+
91
+ def get_model_state_files(checkpoint_dir):
92
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
93
+
94
+
95
+ def parse_model_states(files):
96
+ zero_model_states = []
97
+ for file in files:
98
+ state_dict = torch.load(file, map_location=device)
99
+
100
+ if BUFFER_NAMES not in state_dict:
101
+ raise ValueError(f"{file} is not a model state checkpoint")
102
+ buffer_names = state_dict[BUFFER_NAMES]
103
+ if debug:
104
+ print("Found buffers:", buffer_names)
105
+
106
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
107
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
108
+ param_shapes = state_dict[PARAM_SHAPES]
109
+
110
+ # collect parameters that are included in param_shapes
111
+ param_names = []
112
+ for s in param_shapes:
113
+ for name in s.keys():
114
+ param_names.append(name)
115
+
116
+ # update with frozen parameters
117
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
118
+ if frozen_param_shapes is not None:
119
+ if debug:
120
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
121
+ param_names += list(frozen_param_shapes.keys())
122
+
123
+ # handle shared params
124
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
125
+
126
+ ds_version = state_dict.get(DS_VERSION, None)
127
+
128
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
129
+
130
+ z_model_state = zero_model_state(buffers=buffers,
131
+ param_shapes=param_shapes,
132
+ shared_params=shared_params,
133
+ ds_version=ds_version,
134
+ frozen_param_shapes=frozen_param_shapes,
135
+ frozen_param_fragments=frozen_param_fragments)
136
+ zero_model_states.append(z_model_state)
137
+
138
+ return zero_model_states
139
+
140
+
141
+ def parse_optim_states(files, ds_checkpoint_dir):
142
+
143
+ total_files = len(files)
144
+ state_dicts = []
145
+ for f in files:
146
+ state_dict = torch.load(f, map_location=device)
147
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
148
+ # and also handle the case where it was already removed by another helper script
149
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
150
+ state_dicts.append(state_dict)
151
+
152
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
153
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
154
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
155
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
156
+
157
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
158
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
159
+ # use the max of the partition_count to get the dp world_size.
160
+
161
+ if type(world_size) is list:
162
+ world_size = max(world_size)
163
+
164
+ if world_size != total_files:
165
+ raise ValueError(
166
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
167
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
168
+ )
169
+
170
+ # the groups are named differently in each stage
171
+ if zero_stage <= 2:
172
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
173
+ elif zero_stage == 3:
174
+ fp32_groups_key = FP32_FLAT_GROUPS
175
+ else:
176
+ raise ValueError(f"unknown zero stage {zero_stage}")
177
+
178
+ if zero_stage <= 2:
179
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
180
+ elif zero_stage == 3:
181
+ # if there is more than one param group, there will be multiple flattened tensors - one
182
+ # flattened tensor per group - for simplicity merge them into a single tensor
183
+ #
184
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
185
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
186
+
187
+ fp32_flat_groups = [
188
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
189
+ ]
190
+
191
+ return zero_stage, world_size, fp32_flat_groups
192
+
193
+
194
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
195
+ """
196
+ Returns fp32 state_dict reconstructed from ds checkpoint
197
+
198
+ Args:
199
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
200
+
201
+ """
202
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
203
+
204
+ optim_files = get_optim_files(ds_checkpoint_dir)
205
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
206
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
207
+
208
+ model_files = get_model_state_files(ds_checkpoint_dir)
209
+
210
+ zero_model_states = parse_model_states(model_files)
211
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
212
+
213
+ if zero_stage <= 2:
214
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
215
+ exclude_frozen_parameters)
216
+ elif zero_stage == 3:
217
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
218
+ exclude_frozen_parameters)
219
+
220
+
221
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
222
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
223
+ return
224
+
225
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
226
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
227
+
228
+ if debug:
229
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
230
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
231
+
232
+ wanted_params = len(frozen_param_shapes)
233
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
234
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
235
+ print(f'Frozen params: Have {avail_numel} numels to process.')
236
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
237
+
238
+ total_params = 0
239
+ total_numel = 0
240
+ for name, shape in frozen_param_shapes.items():
241
+ total_params += 1
242
+ unpartitioned_numel = shape.numel()
243
+ total_numel += unpartitioned_numel
244
+
245
+ state_dict[name] = frozen_param_fragments[name]
246
+
247
+ if debug:
248
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
249
+
250
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
251
+
252
+
253
+ def _has_callable(obj, fn):
254
+ attr = getattr(obj, fn, None)
255
+ return callable(attr)
256
+
257
+
258
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
259
+ param_shapes = zero_model_states[0].param_shapes
260
+
261
+ # Reconstruction protocol:
262
+ #
263
+ # XXX: document this
264
+
265
+ if debug:
266
+ for i in range(world_size):
267
+ for j in range(len(fp32_flat_groups[0])):
268
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
269
+
270
+ # XXX: memory usage doubles here (zero2)
271
+ num_param_groups = len(fp32_flat_groups[0])
272
+ merged_single_partition_of_fp32_groups = []
273
+ for i in range(num_param_groups):
274
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
275
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
276
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
277
+ avail_numel = sum(
278
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
279
+
280
+ if debug:
281
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
282
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
283
+ # not asserting if there is a mismatch due to possible padding
284
+ print(f"Have {avail_numel} numels to process.")
285
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
286
+
287
+ # params
288
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
289
+ # out-of-core computing solution
290
+ total_numel = 0
291
+ total_params = 0
292
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
293
+ offset = 0
294
+ avail_numel = full_single_fp32_vector.numel()
295
+ for name, shape in shapes.items():
296
+
297
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
298
+ total_numel += unpartitioned_numel
299
+ total_params += 1
300
+
301
+ if debug:
302
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
303
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
304
+ offset += unpartitioned_numel
305
+
306
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
307
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
308
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
309
+ # live optimizer object, so we are checking that the numbers are within the right range
310
+ align_to = 2 * world_size
311
+
312
+ def zero2_align(x):
313
+ return align_to * math.ceil(x / align_to)
314
+
315
+ if debug:
316
+ print(f"original offset={offset}, avail_numel={avail_numel}")
317
+
318
+ offset = zero2_align(offset)
319
+ avail_numel = zero2_align(avail_numel)
320
+
321
+ if debug:
322
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
323
+
324
+ # Sanity check
325
+ if offset != avail_numel:
326
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
327
+
328
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
329
+
330
+
331
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
332
+ exclude_frozen_parameters):
333
+ state_dict = OrderedDict()
334
+
335
+ # buffers
336
+ buffers = zero_model_states[0].buffers
337
+ state_dict.update(buffers)
338
+ if debug:
339
+ print(f"added {len(buffers)} buffers")
340
+
341
+ if not exclude_frozen_parameters:
342
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
343
+
344
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
345
+
346
+ # recover shared parameters
347
+ for pair in zero_model_states[0].shared_params:
348
+ if pair[1] in state_dict:
349
+ state_dict[pair[0]] = state_dict[pair[1]]
350
+
351
+ return state_dict
352
+
353
+
354
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
355
+ remainder = unpartitioned_numel % world_size
356
+ padding_numel = (world_size - remainder) if remainder else 0
357
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
358
+ return partitioned_numel, padding_numel
359
+
360
+
361
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
362
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
363
+ return
364
+
365
+ if debug:
366
+ for i in range(world_size):
367
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
368
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
369
+
370
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
371
+ wanted_params = len(frozen_param_shapes)
372
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
373
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
374
+ print(f'Frozen params: Have {avail_numel} numels to process.')
375
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
376
+
377
+ total_params = 0
378
+ total_numel = 0
379
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
380
+ total_params += 1
381
+ unpartitioned_numel = shape.numel()
382
+ total_numel += unpartitioned_numel
383
+
384
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
385
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
386
+
387
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
388
+
389
+ if debug:
390
+ print(
391
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
392
+ )
393
+
394
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
395
+
396
+
397
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
398
+ param_shapes = zero_model_states[0].param_shapes
399
+ avail_numel = fp32_flat_groups[0].numel() * world_size
400
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
401
+ # param, re-consolidating each param, while dealing with padding if any
402
+
403
+ # merge list of dicts, preserving order
404
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
405
+
406
+ if debug:
407
+ for i in range(world_size):
408
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
409
+
410
+ wanted_params = len(param_shapes)
411
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
412
+ # not asserting if there is a mismatch due to possible padding
413
+ avail_numel = fp32_flat_groups[0].numel() * world_size
414
+ print(f"Trainable params: Have {avail_numel} numels to process.")
415
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
416
+
417
+ # params
418
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
419
+ # out-of-core computing solution
420
+ offset = 0
421
+ total_numel = 0
422
+ total_params = 0
423
+ for name, shape in param_shapes.items():
424
+
425
+ unpartitioned_numel = shape.numel()
426
+ total_numel += unpartitioned_numel
427
+ total_params += 1
428
+
429
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
430
+
431
+ if debug:
432
+ print(
433
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
434
+ )
435
+
436
+ # XXX: memory usage doubles here
437
+ state_dict[name] = torch.cat(
438
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
439
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
440
+ offset += partitioned_numel
441
+
442
+ offset *= world_size
443
+
444
+ # Sanity check
445
+ if offset != avail_numel:
446
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
447
+
448
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
449
+
450
+
451
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
452
+ exclude_frozen_parameters):
453
+ state_dict = OrderedDict()
454
+
455
+ # buffers
456
+ buffers = zero_model_states[0].buffers
457
+ state_dict.update(buffers)
458
+ if debug:
459
+ print(f"added {len(buffers)} buffers")
460
+
461
+ if not exclude_frozen_parameters:
462
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
463
+
464
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
465
+
466
+ # recover shared parameters
467
+ for pair in zero_model_states[0].shared_params:
468
+ if pair[1] in state_dict:
469
+ state_dict[pair[0]] = state_dict[pair[1]]
470
+
471
+ return state_dict
472
+
473
+
474
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None, exclude_frozen_parameters=False):
475
+ """
476
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
477
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
478
+ via a model hub.
479
+
480
+ Args:
481
+ - ``checkpoint_dir``: path to the desired checkpoint folder
482
+ - ``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``
483
+ - ``exclude_frozen_parameters``: exclude frozen parameters
484
+
485
+ Returns:
486
+ - pytorch ``state_dict``
487
+
488
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
489
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
490
+ the checkpoint.
491
+
492
+ A typical usage might be ::
493
+
494
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
495
+ # do the training and checkpoint saving
496
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
497
+ model = model.cpu() # move to cpu
498
+ model.load_state_dict(state_dict)
499
+ # submit to model hub or save the model to share with others
500
+
501
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
502
+ application. i.e. you will need to re-initialize the deepspeed engine, since
503
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
504
+
505
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
506
+
507
+ """
508
+ if tag is None:
509
+ latest_path = os.path.join(checkpoint_dir, 'latest')
510
+ if os.path.isfile(latest_path):
511
+ with open(latest_path, 'r') as fd:
512
+ tag = fd.read().strip()
513
+ else:
514
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
515
+
516
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
517
+
518
+ if not os.path.isdir(ds_checkpoint_dir):
519
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
520
+
521
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
522
+
523
+
524
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None, exclude_frozen_parameters=False):
525
+ """
526
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
527
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
528
+
529
+ Args:
530
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
531
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
532
+ - ``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``
533
+ - ``exclude_frozen_parameters``: exclude frozen parameters
534
+ """
535
+
536
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag, exclude_frozen_parameters)
537
+ print(f"Saving fp32 state dict to {output_file}")
538
+ torch.save(state_dict, output_file)
539
+
540
+
541
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
542
+ """
543
+ 1. Put the provided model to cpu
544
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
545
+ 3. Load it into the provided model
546
+
547
+ Args:
548
+ - ``model``: the model object to update
549
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
550
+ - ``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``
551
+
552
+ Returns:
553
+ - ``model`: modified model
554
+
555
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
556
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
557
+ conveniently placed for you in the checkpoint folder.
558
+
559
+ A typical usage might be ::
560
+
561
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
562
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
563
+ # submit to model hub or save the model to share with others
564
+
565
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
566
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
567
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
568
+
569
+ """
570
+ logger.info(f"Extracting fp32 weights")
571
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
572
+
573
+ logger.info(f"Overwriting model with fp32 weights")
574
+ model = model.cpu()
575
+ model.load_state_dict(state_dict, strict=False)
576
+
577
+ return model
578
+
579
+
580
+ if __name__ == "__main__":
581
+
582
+ parser = argparse.ArgumentParser()
583
+ parser.add_argument("checkpoint_dir",
584
+ type=str,
585
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
586
+ parser.add_argument(
587
+ "output_file",
588
+ type=str,
589
+ help="path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)")
590
+ parser.add_argument("-t",
591
+ "--tag",
592
+ type=str,
593
+ default=None,
594
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
595
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
596
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
597
+ args = parser.parse_args()
598
+
599
+ debug = args.debug
600
+
601
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
602
+ args.output_file,
603
+ tag=args.tag,
604
+ exclude_frozen_parameters=args.exclude_frozen_parameters)