zx10086 commited on
Commit
3ec32c5
·
verified ·
1 Parent(s): 63ed41e

Add files using upload-large-folder tool

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2ForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 151643,
7
+ "eos_token_id": 151643,
8
+ "hidden_act": "silu",
9
+ "hidden_size": 3584,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 18944,
12
+ "max_position_embeddings": 131072,
13
+ "max_window_layers": 28,
14
+ "model_type": "qwen2",
15
+ "num_attention_heads": 28,
16
+ "num_hidden_layers": 28,
17
+ "num_key_value_heads": 4,
18
+ "rms_norm_eps": 1e-06,
19
+ "rope_scaling": null,
20
+ "rope_theta": 10000,
21
+ "sliding_window": 4096,
22
+ "tie_word_embeddings": false,
23
+ "torch_dtype": "bfloat16",
24
+ "transformers_version": "4.51.3",
25
+ "use_cache": false,
26
+ "use_mrope": false,
27
+ "use_sliding_window": false,
28
+ "vocab_size": 152064
29
+ }
generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 151646,
4
+ "do_sample": true,
5
+ "eos_token_id": 151643,
6
+ "temperature": 0.6,
7
+ "top_p": 0.95,
8
+ "transformers_version": "4.51.3"
9
+ }
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step128
model-00001-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f4b8e660a21b9b75d6b590f4f5c39ec8e12d9a9cbaa0235891272a543762f933
3
+ size 4877660776
model-00002-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df37157f450cebf1136915b159b10820bd48970f29922975704bf008d678dc13
3
+ size 4932751008
model-00003-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ff3d8a5cbe10af91145da2f8983c1013d31ba20a4b99eeb844f6c36cdc63d67
3
+ size 4330865200
model-00004-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3a451f70dd8bd44768fc6c2d66a02fd2bacbf38b226173f41e1b4a06d665e1f
3
+ size 1089994880
model.safetensors.index.json ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 15231233024
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "model-00004-of-00004.safetensors",
7
+ "model.embed_tokens.weight": "model-00001-of-00004.safetensors",
8
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00004.safetensors",
9
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
10
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
11
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
12
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
13
+ "model.layers.0.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
14
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
15
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
16
+ "model.layers.0.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
17
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
18
+ "model.layers.0.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
19
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
20
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00004.safetensors",
21
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
22
+ "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
23
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
24
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
25
+ "model.layers.1.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
26
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
27
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
28
+ "model.layers.1.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
29
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
30
+ "model.layers.1.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
31
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
32
+ "model.layers.10.input_layernorm.weight": "model-00002-of-00004.safetensors",
33
+ "model.layers.10.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
34
+ "model.layers.10.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
35
+ "model.layers.10.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
36
+ "model.layers.10.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
37
+ "model.layers.10.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
38
+ "model.layers.10.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
39
+ "model.layers.10.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
40
+ "model.layers.10.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
41
+ "model.layers.10.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
42
+ "model.layers.10.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
43
+ "model.layers.10.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
44
+ "model.layers.11.input_layernorm.weight": "model-00002-of-00004.safetensors",
45
+ "model.layers.11.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
46
+ "model.layers.11.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
47
+ "model.layers.11.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
48
+ "model.layers.11.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
49
+ "model.layers.11.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
50
+ "model.layers.11.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
51
+ "model.layers.11.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
52
+ "model.layers.11.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
53
+ "model.layers.11.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
54
+ "model.layers.11.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
55
+ "model.layers.11.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
56
+ "model.layers.12.input_layernorm.weight": "model-00002-of-00004.safetensors",
57
+ "model.layers.12.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
58
+ "model.layers.12.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
59
+ "model.layers.12.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
60
+ "model.layers.12.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
61
+ "model.layers.12.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
62
+ "model.layers.12.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
63
+ "model.layers.12.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
64
+ "model.layers.12.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
65
+ "model.layers.12.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
66
+ "model.layers.12.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
67
+ "model.layers.12.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
68
+ "model.layers.13.input_layernorm.weight": "model-00002-of-00004.safetensors",
69
+ "model.layers.13.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
70
+ "model.layers.13.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
71
+ "model.layers.13.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
72
+ "model.layers.13.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
73
+ "model.layers.13.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
74
+ "model.layers.13.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
75
+ "model.layers.13.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
76
+ "model.layers.13.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
77
+ "model.layers.13.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
78
+ "model.layers.13.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
79
+ "model.layers.13.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
80
+ "model.layers.14.input_layernorm.weight": "model-00002-of-00004.safetensors",
81
+ "model.layers.14.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
82
+ "model.layers.14.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
83
+ "model.layers.14.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
84
+ "model.layers.14.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
85
+ "model.layers.14.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
86
+ "model.layers.14.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
87
+ "model.layers.14.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
88
+ "model.layers.14.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
89
+ "model.layers.14.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
90
+ "model.layers.14.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
91
+ "model.layers.14.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
92
+ "model.layers.15.input_layernorm.weight": "model-00002-of-00004.safetensors",
93
+ "model.layers.15.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
94
+ "model.layers.15.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
95
+ "model.layers.15.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
96
+ "model.layers.15.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
97
+ "model.layers.15.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
98
+ "model.layers.15.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
99
+ "model.layers.15.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
100
+ "model.layers.15.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
101
+ "model.layers.15.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
102
+ "model.layers.15.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
103
+ "model.layers.15.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
104
+ "model.layers.16.input_layernorm.weight": "model-00002-of-00004.safetensors",
105
+ "model.layers.16.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
106
+ "model.layers.16.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
107
+ "model.layers.16.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
108
+ "model.layers.16.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
109
+ "model.layers.16.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
110
+ "model.layers.16.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
111
+ "model.layers.16.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
112
+ "model.layers.16.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
113
+ "model.layers.16.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
114
+ "model.layers.16.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
115
+ "model.layers.16.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
116
+ "model.layers.17.input_layernorm.weight": "model-00002-of-00004.safetensors",
117
+ "model.layers.17.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
118
+ "model.layers.17.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
119
+ "model.layers.17.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
120
+ "model.layers.17.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
121
+ "model.layers.17.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
122
+ "model.layers.17.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
123
+ "model.layers.17.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
124
+ "model.layers.17.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
125
+ "model.layers.17.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
126
+ "model.layers.17.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
127
+ "model.layers.17.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
128
+ "model.layers.18.input_layernorm.weight": "model-00003-of-00004.safetensors",
129
+ "model.layers.18.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
130
+ "model.layers.18.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
131
+ "model.layers.18.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
132
+ "model.layers.18.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
133
+ "model.layers.18.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
134
+ "model.layers.18.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
135
+ "model.layers.18.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
136
+ "model.layers.18.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
137
+ "model.layers.18.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
138
+ "model.layers.18.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
139
+ "model.layers.18.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
140
+ "model.layers.19.input_layernorm.weight": "model-00003-of-00004.safetensors",
141
+ "model.layers.19.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
142
+ "model.layers.19.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
143
+ "model.layers.19.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
144
+ "model.layers.19.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
145
+ "model.layers.19.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
146
+ "model.layers.19.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
147
+ "model.layers.19.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
148
+ "model.layers.19.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
149
+ "model.layers.19.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
150
+ "model.layers.19.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
151
+ "model.layers.19.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
152
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00004.safetensors",
153
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
154
+ "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
155
+ "model.layers.2.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
156
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
157
+ "model.layers.2.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
158
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
159
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
160
+ "model.layers.2.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
161
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
162
+ "model.layers.2.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
163
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
164
+ "model.layers.20.input_layernorm.weight": "model-00003-of-00004.safetensors",
165
+ "model.layers.20.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
166
+ "model.layers.20.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
167
+ "model.layers.20.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
168
+ "model.layers.20.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
169
+ "model.layers.20.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
170
+ "model.layers.20.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
171
+ "model.layers.20.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
172
+ "model.layers.20.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
173
+ "model.layers.20.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
174
+ "model.layers.20.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
175
+ "model.layers.20.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
176
+ "model.layers.21.input_layernorm.weight": "model-00003-of-00004.safetensors",
177
+ "model.layers.21.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
178
+ "model.layers.21.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
179
+ "model.layers.21.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
180
+ "model.layers.21.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
181
+ "model.layers.21.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
182
+ "model.layers.21.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
183
+ "model.layers.21.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
184
+ "model.layers.21.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
185
+ "model.layers.21.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
186
+ "model.layers.21.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
187
+ "model.layers.21.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
188
+ "model.layers.22.input_layernorm.weight": "model-00003-of-00004.safetensors",
189
+ "model.layers.22.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
190
+ "model.layers.22.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
191
+ "model.layers.22.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
192
+ "model.layers.22.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
193
+ "model.layers.22.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
194
+ "model.layers.22.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
195
+ "model.layers.22.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
196
+ "model.layers.22.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
197
+ "model.layers.22.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
198
+ "model.layers.22.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
199
+ "model.layers.22.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
200
+ "model.layers.23.input_layernorm.weight": "model-00003-of-00004.safetensors",
201
+ "model.layers.23.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
202
+ "model.layers.23.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
203
+ "model.layers.23.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
204
+ "model.layers.23.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
205
+ "model.layers.23.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
206
+ "model.layers.23.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
207
+ "model.layers.23.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
208
+ "model.layers.23.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
209
+ "model.layers.23.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
210
+ "model.layers.23.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
211
+ "model.layers.23.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
212
+ "model.layers.24.input_layernorm.weight": "model-00003-of-00004.safetensors",
213
+ "model.layers.24.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
214
+ "model.layers.24.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
215
+ "model.layers.24.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
216
+ "model.layers.24.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
217
+ "model.layers.24.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
218
+ "model.layers.24.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
219
+ "model.layers.24.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
220
+ "model.layers.24.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
221
+ "model.layers.24.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
222
+ "model.layers.24.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
223
+ "model.layers.24.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
224
+ "model.layers.25.input_layernorm.weight": "model-00003-of-00004.safetensors",
225
+ "model.layers.25.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
226
+ "model.layers.25.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
227
+ "model.layers.25.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
228
+ "model.layers.25.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
229
+ "model.layers.25.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
230
+ "model.layers.25.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
231
+ "model.layers.25.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
232
+ "model.layers.25.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
233
+ "model.layers.25.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
234
+ "model.layers.25.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
235
+ "model.layers.25.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
236
+ "model.layers.26.input_layernorm.weight": "model-00003-of-00004.safetensors",
237
+ "model.layers.26.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
238
+ "model.layers.26.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
239
+ "model.layers.26.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
240
+ "model.layers.26.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
241
+ "model.layers.26.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
242
+ "model.layers.26.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
243
+ "model.layers.26.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
244
+ "model.layers.26.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
245
+ "model.layers.26.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
246
+ "model.layers.26.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
247
+ "model.layers.26.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
248
+ "model.layers.27.input_layernorm.weight": "model-00003-of-00004.safetensors",
249
+ "model.layers.27.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
250
+ "model.layers.27.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
251
+ "model.layers.27.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
252
+ "model.layers.27.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
253
+ "model.layers.27.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
254
+ "model.layers.27.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
255
+ "model.layers.27.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
256
+ "model.layers.27.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
257
+ "model.layers.27.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
258
+ "model.layers.27.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
259
+ "model.layers.27.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
260
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00004.safetensors",
261
+ "model.layers.3.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
262
+ "model.layers.3.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
263
+ "model.layers.3.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
264
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
265
+ "model.layers.3.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
266
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
267
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
268
+ "model.layers.3.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
269
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
270
+ "model.layers.3.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
271
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
272
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00004.safetensors",
273
+ "model.layers.4.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
274
+ "model.layers.4.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
275
+ "model.layers.4.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
276
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
277
+ "model.layers.4.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
278
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
279
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
280
+ "model.layers.4.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
281
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
282
+ "model.layers.4.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
283
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
284
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00004.safetensors",
285
+ "model.layers.5.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
286
+ "model.layers.5.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
287
+ "model.layers.5.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
288
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
289
+ "model.layers.5.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
290
+ "model.layers.5.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
291
+ "model.layers.5.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
292
+ "model.layers.5.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
293
+ "model.layers.5.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
294
+ "model.layers.5.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
295
+ "model.layers.5.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
296
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00004.safetensors",
297
+ "model.layers.6.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
298
+ "model.layers.6.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
299
+ "model.layers.6.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
300
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
301
+ "model.layers.6.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
302
+ "model.layers.6.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
303
+ "model.layers.6.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
304
+ "model.layers.6.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
305
+ "model.layers.6.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
306
+ "model.layers.6.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
307
+ "model.layers.6.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
308
+ "model.layers.7.input_layernorm.weight": "model-00001-of-00004.safetensors",
309
+ "model.layers.7.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
310
+ "model.layers.7.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
311
+ "model.layers.7.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
312
+ "model.layers.7.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
313
+ "model.layers.7.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
314
+ "model.layers.7.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
315
+ "model.layers.7.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
316
+ "model.layers.7.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
317
+ "model.layers.7.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
318
+ "model.layers.7.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
319
+ "model.layers.7.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
320
+ "model.layers.8.input_layernorm.weight": "model-00002-of-00004.safetensors",
321
+ "model.layers.8.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
322
+ "model.layers.8.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
323
+ "model.layers.8.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
324
+ "model.layers.8.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
325
+ "model.layers.8.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
326
+ "model.layers.8.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
327
+ "model.layers.8.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
328
+ "model.layers.8.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
329
+ "model.layers.8.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
330
+ "model.layers.8.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
331
+ "model.layers.8.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
332
+ "model.layers.9.input_layernorm.weight": "model-00002-of-00004.safetensors",
333
+ "model.layers.9.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
334
+ "model.layers.9.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
335
+ "model.layers.9.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
336
+ "model.layers.9.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
337
+ "model.layers.9.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
338
+ "model.layers.9.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
339
+ "model.layers.9.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
340
+ "model.layers.9.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
341
+ "model.layers.9.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
342
+ "model.layers.9.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
343
+ "model.layers.9.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
344
+ "model.norm.weight": "model-00003-of-00004.safetensors"
345
+ }
346
+ }
rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:85ad2cbc3c7a0fefa416ca212a3ca0c765342dd508d3b01b19c9bdea93628432
3
+ size 14768
rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c61f0d108ae90b8446a06c2dbbf771f253a6739aa2c4fd678b0fb6cdebbad0e5
3
+ size 14768
rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5599955f9c18cf845e77f327ca171b5415ea5761828d42a4a50471361c2db5b3
3
+ size 14768
scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c08382702ddd82a8d3c4634e3a5b6022d662094ef35784771681d2bc226bec4a
3
+ size 1064
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|begin▁of▁sentence|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|end▁of▁sentence|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<|end▁of▁sentence|>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4256422650d141f228fe954acee98679da412984c29a569877eefd3af69315a
3
+ size 11422959
tokenizer_config.json ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": null,
5
+ "added_tokens_decoder": {
6
+ "151643": {
7
+ "content": "<|end▁of▁sentence|>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "151644": {
15
+ "content": "<|User|>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": false
21
+ },
22
+ "151645": {
23
+ "content": "<|Assistant|>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": false
29
+ },
30
+ "151646": {
31
+ "content": "<|begin▁of▁sentence|>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false,
36
+ "special": true
37
+ },
38
+ "151647": {
39
+ "content": "<|EOT|>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false,
44
+ "special": false
45
+ },
46
+ "151648": {
47
+ "content": "<think>",
48
+ "lstrip": false,
49
+ "normalized": false,
50
+ "rstrip": false,
51
+ "single_word": false,
52
+ "special": false
53
+ },
54
+ "151649": {
55
+ "content": "</think>",
56
+ "lstrip": false,
57
+ "normalized": false,
58
+ "rstrip": false,
59
+ "single_word": false,
60
+ "special": false
61
+ },
62
+ "151650": {
63
+ "content": "<|quad_start|>",
64
+ "lstrip": false,
65
+ "normalized": false,
66
+ "rstrip": false,
67
+ "single_word": false,
68
+ "special": true
69
+ },
70
+ "151651": {
71
+ "content": "<|quad_end|>",
72
+ "lstrip": false,
73
+ "normalized": false,
74
+ "rstrip": false,
75
+ "single_word": false,
76
+ "special": true
77
+ },
78
+ "151652": {
79
+ "content": "<|vision_start|>",
80
+ "lstrip": false,
81
+ "normalized": false,
82
+ "rstrip": false,
83
+ "single_word": false,
84
+ "special": true
85
+ },
86
+ "151653": {
87
+ "content": "<|vision_end|>",
88
+ "lstrip": false,
89
+ "normalized": false,
90
+ "rstrip": false,
91
+ "single_word": false,
92
+ "special": true
93
+ },
94
+ "151654": {
95
+ "content": "<|vision_pad|>",
96
+ "lstrip": false,
97
+ "normalized": false,
98
+ "rstrip": false,
99
+ "single_word": false,
100
+ "special": true
101
+ },
102
+ "151655": {
103
+ "content": "<|image_pad|>",
104
+ "lstrip": false,
105
+ "normalized": false,
106
+ "rstrip": false,
107
+ "single_word": false,
108
+ "special": true
109
+ },
110
+ "151656": {
111
+ "content": "<|video_pad|>",
112
+ "lstrip": false,
113
+ "normalized": false,
114
+ "rstrip": false,
115
+ "single_word": false,
116
+ "special": true
117
+ },
118
+ "151657": {
119
+ "content": "<tool_call>",
120
+ "lstrip": false,
121
+ "normalized": false,
122
+ "rstrip": false,
123
+ "single_word": false,
124
+ "special": false
125
+ },
126
+ "151658": {
127
+ "content": "</tool_call>",
128
+ "lstrip": false,
129
+ "normalized": false,
130
+ "rstrip": false,
131
+ "single_word": false,
132
+ "special": false
133
+ },
134
+ "151659": {
135
+ "content": "<|fim_prefix|>",
136
+ "lstrip": false,
137
+ "normalized": false,
138
+ "rstrip": false,
139
+ "single_word": false,
140
+ "special": false
141
+ },
142
+ "151660": {
143
+ "content": "<|fim_middle|>",
144
+ "lstrip": false,
145
+ "normalized": false,
146
+ "rstrip": false,
147
+ "single_word": false,
148
+ "special": false
149
+ },
150
+ "151661": {
151
+ "content": "<|fim_suffix|>",
152
+ "lstrip": false,
153
+ "normalized": false,
154
+ "rstrip": false,
155
+ "single_word": false,
156
+ "special": false
157
+ },
158
+ "151662": {
159
+ "content": "<|fim_pad|>",
160
+ "lstrip": false,
161
+ "normalized": false,
162
+ "rstrip": false,
163
+ "single_word": false,
164
+ "special": false
165
+ },
166
+ "151663": {
167
+ "content": "<|repo_name|>",
168
+ "lstrip": false,
169
+ "normalized": false,
170
+ "rstrip": false,
171
+ "single_word": false,
172
+ "special": false
173
+ },
174
+ "151664": {
175
+ "content": "<|file_sep|>",
176
+ "lstrip": false,
177
+ "normalized": false,
178
+ "rstrip": false,
179
+ "single_word": false,
180
+ "special": false
181
+ }
182
+ },
183
+ "bos_token": "<|begin▁of▁sentence|>",
184
+ "chat_template": "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% set ns = namespace(is_first=false, is_tool=false, is_output_first=true, system_prompt='') %}{%- for message in messages %}{%- if message['role'] == 'system' %}{% set ns.system_prompt = message['content'] %}{%- endif %}{%- endfor %}{{bos_token}}{{ns.system_prompt}}{%- for message in messages %}{%- if message['role'] == 'user' %}{%- set ns.is_tool = false -%}{{'<|User|>' + message['content']}}{%- endif %}{%- if message['role'] == 'assistant' and message['content'] is none %}{%- set ns.is_tool = false -%}{%- for tool in message['tool_calls']%}{%- if not ns.is_first %}{{'<|Assistant|><|tool▁calls▁begin|><|tool▁call▁begin��>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\\n' + '```json' + '\\n' + tool['function']['arguments'] + '\\n' + '```' + '<|tool▁call▁end|>'}}{%- set ns.is_first = true -%}{%- else %}{{'\\n' + '<|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\\n' + '```json' + '\\n' + tool['function']['arguments'] + '\\n' + '```' + '<|tool▁call▁end|>'}}{{'<|tool▁calls▁end|><|end▁of▁sentence|>'}}{%- endif %}{%- endfor %}{%- endif %}{%- if message['role'] == 'assistant' and message['content'] is not none %}{%- if ns.is_tool %}{{'<|tool▁outputs▁end|>' + message['content'] + '<|end▁of▁sentence|>'}}{%- set ns.is_tool = false -%}{%- else %}{% set content = message['content'] %}{% if '</think>' in content %}{% set content = content.split('</think>')[-1] %}{% endif %}{{'<|Assistant|>' + content + '<|end▁of▁sentence|>'}}{%- endif %}{%- endif %}{%- if message['role'] == 'tool' %}{%- set ns.is_tool = true -%}{%- if ns.is_output_first %}{{'<|tool▁outputs▁begin|><|tool▁output▁begin|>' + message['content'] + '<|tool▁output▁end|>'}}{%- set ns.is_output_first = false %}{%- else %}{{'\\n<|tool▁output▁begin|>' + message['content'] + '<|tool▁output▁end|>'}}{%- endif %}{%- endif %}{%- endfor -%}{% if ns.is_tool %}{{'<|tool▁outputs▁end|>'}}{% endif %}{% if add_generation_prompt and not ns.is_tool %}{{'<|Assistant|><think>\\n'}}{% endif %}",
185
+ "clean_up_tokenization_spaces": false,
186
+ "eos_token": "<|end▁of▁sentence|>",
187
+ "extra_special_tokens": {},
188
+ "legacy": true,
189
+ "model_max_length": 16384,
190
+ "pad_token": "<|end▁of▁sentence|>",
191
+ "padding_side": "left",
192
+ "sp_model_kwargs": {},
193
+ "tokenizer_class": "LlamaTokenizerFast",
194
+ "unk_token": null,
195
+ "use_default_system_prompt": false
196
+ }
trainer_state.json ADDED
@@ -0,0 +1,1168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 0.8192,
6
+ "eval_steps": 500,
7
+ "global_step": 128,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "clip_ratio/high_max": 0.0,
14
+ "clip_ratio/high_mean": 0.0,
15
+ "clip_ratio/low_mean": 0.0,
16
+ "clip_ratio/low_min": 0.0,
17
+ "clip_ratio/region_mean": 0.0,
18
+ "completions/clipped_ratio": 0.07638888888888888,
19
+ "completions/max_length": 8192.0,
20
+ "completions/max_terminated_length": 7457.0,
21
+ "completions/mean_length": 2484.15283203125,
22
+ "completions/mean_terminated_length": 2012.1199951171875,
23
+ "completions/min_length": 559.6666666666666,
24
+ "completions/min_terminated_length": 559.6666666666666,
25
+ "epoch": 0.0192,
26
+ "grad_norm": 0.11786151677370071,
27
+ "kl": 0.000663916269938151,
28
+ "learning_rate": 3.948717948717949e-06,
29
+ "loss": 0.0792,
30
+ "num_tokens": 736454.0,
31
+ "reward": 1.920138915379842,
32
+ "reward_std": 0.06854866879681747,
33
+ "rewards/accuracy_reward/mean": 0.9965277711550394,
34
+ "rewards/accuracy_reward/std": 0.03402068714300791,
35
+ "rewards/format_reward/mean": 0.9236111044883728,
36
+ "rewards/format_reward/std": 0.2288934737443924,
37
+ "step": 3
38
+ },
39
+ {
40
+ "clip_ratio/high_max": 0.0,
41
+ "clip_ratio/high_mean": 0.0,
42
+ "clip_ratio/low_mean": 0.0,
43
+ "clip_ratio/low_min": 0.0,
44
+ "clip_ratio/region_mean": 0.0,
45
+ "completions/clipped_ratio": 0.09027777777777779,
46
+ "completions/max_length": 8192.0,
47
+ "completions/max_terminated_length": 7337.333333333333,
48
+ "completions/mean_length": 2525.18408203125,
49
+ "completions/mean_terminated_length": 1964.8008219401042,
50
+ "completions/min_length": 538.0,
51
+ "completions/min_terminated_length": 538.0,
52
+ "epoch": 0.0384,
53
+ "grad_norm": 0.10443487018346786,
54
+ "kl": 0.001732190450032552,
55
+ "learning_rate": 3.8717948717948715e-06,
56
+ "loss": 0.0688,
57
+ "num_tokens": 1486231.0,
58
+ "reward": 1.90625003973643,
59
+ "reward_std": 0.11128650108973186,
60
+ "rewards/accuracy_reward/mean": 0.993055542310079,
61
+ "rewards/accuracy_reward/std": 0.0680413767695427,
62
+ "rewards/format_reward/mean": 0.9131944378217062,
63
+ "rewards/format_reward/std": 0.28209365407625836,
64
+ "step": 6
65
+ },
66
+ {
67
+ "clip_ratio/high_max": 0.0,
68
+ "clip_ratio/high_mean": 0.0,
69
+ "clip_ratio/low_mean": 0.0,
70
+ "clip_ratio/low_min": 0.0,
71
+ "clip_ratio/region_mean": 0.0,
72
+ "completions/clipped_ratio": 0.07638888888888891,
73
+ "completions/max_length": 8192.0,
74
+ "completions/max_terminated_length": 7734.0,
75
+ "completions/mean_length": 2304.361124674479,
76
+ "completions/mean_terminated_length": 1825.1893717447917,
77
+ "completions/min_length": 428.6666666666667,
78
+ "completions/min_terminated_length": 428.6666666666667,
79
+ "epoch": 0.0576,
80
+ "grad_norm": 0.11160896718502045,
81
+ "kl": 0.0075155893961588545,
82
+ "learning_rate": 3.7948717948717945e-06,
83
+ "loss": 0.0532,
84
+ "num_tokens": 2170377.0,
85
+ "reward": 1.9062500794728596,
86
+ "reward_std": 0.09471678485472997,
87
+ "rewards/accuracy_reward/mean": 0.9791666666666666,
88
+ "rewards/accuracy_reward/std": 0.11481705804665883,
89
+ "rewards/format_reward/mean": 0.9270833333333334,
90
+ "rewards/format_reward/std": 0.25792460640271503,
91
+ "step": 9
92
+ },
93
+ {
94
+ "clip_ratio/high_max": 0.0,
95
+ "clip_ratio/high_mean": 0.0,
96
+ "clip_ratio/low_mean": 0.0,
97
+ "clip_ratio/low_min": 0.0,
98
+ "clip_ratio/region_mean": 0.0,
99
+ "completions/clipped_ratio": 0.07986111111111112,
100
+ "completions/max_length": 8192.0,
101
+ "completions/max_terminated_length": 7192.333333333333,
102
+ "completions/mean_length": 2486.7847900390625,
103
+ "completions/mean_terminated_length": 2002.9917805989583,
104
+ "completions/min_length": 588.6666666666666,
105
+ "completions/min_terminated_length": 588.6666666666666,
106
+ "epoch": 0.0768,
107
+ "grad_norm": 0.07670364528894424,
108
+ "kl": 0.007045745849609375,
109
+ "learning_rate": 3.717948717948718e-06,
110
+ "loss": 0.0655,
111
+ "num_tokens": 2906641.0,
112
+ "reward": 1.9027778307596843,
113
+ "reward_std": 0.08286526799201965,
114
+ "rewards/accuracy_reward/mean": 0.9826388955116272,
115
+ "rewards/accuracy_reward/std": 0.12973794837792715,
116
+ "rewards/format_reward/mean": 0.9201388955116272,
117
+ "rewards/format_reward/std": 0.25063540538152057,
118
+ "step": 12
119
+ },
120
+ {
121
+ "clip_ratio/high_max": 0.0,
122
+ "clip_ratio/high_mean": 0.0,
123
+ "clip_ratio/low_mean": 0.0,
124
+ "clip_ratio/low_min": 0.0,
125
+ "clip_ratio/region_mean": 0.0,
126
+ "completions/clipped_ratio": 0.048611111111111084,
127
+ "completions/max_length": 8192.0,
128
+ "completions/max_terminated_length": 5679.0,
129
+ "completions/mean_length": 2111.114705403646,
130
+ "completions/mean_terminated_length": 1806.3657633463542,
131
+ "completions/min_length": 638.3333333333334,
132
+ "completions/min_terminated_length": 638.3333333333334,
133
+ "epoch": 0.096,
134
+ "grad_norm": 0.08451474457979202,
135
+ "kl": 0.01056671142578125,
136
+ "learning_rate": 3.6410256410256406e-06,
137
+ "loss": 0.0438,
138
+ "num_tokens": 3534238.0,
139
+ "reward": 1.93750003973643,
140
+ "reward_std": 0.08955795814593633,
141
+ "rewards/accuracy_reward/mean": 0.9861111044883728,
142
+ "rewards/accuracy_reward/std": 0.11590000987052917,
143
+ "rewards/format_reward/mean": 0.9513888756434122,
144
+ "rewards/format_reward/std": 0.20225290457407633,
145
+ "step": 15
146
+ },
147
+ {
148
+ "clip_ratio/high_max": 0.0,
149
+ "clip_ratio/high_mean": 0.0,
150
+ "clip_ratio/low_mean": 0.0,
151
+ "clip_ratio/low_min": 0.0,
152
+ "clip_ratio/region_mean": 0.0,
153
+ "completions/clipped_ratio": 0.013888888888888876,
154
+ "completions/max_length": 8192.0,
155
+ "completions/max_terminated_length": 6870.666666666667,
156
+ "completions/mean_length": 1940.4757486979167,
157
+ "completions/mean_terminated_length": 1853.5159098307292,
158
+ "completions/min_length": 632.0,
159
+ "completions/min_terminated_length": 632.0,
160
+ "epoch": 0.1152,
161
+ "grad_norm": 0.10638942569494247,
162
+ "kl": 0.013872782389322916,
163
+ "learning_rate": 3.564102564102564e-06,
164
+ "loss": 0.0318,
165
+ "num_tokens": 4114947.0,
166
+ "reward": 1.9236111640930176,
167
+ "reward_std": 0.086211613068978,
168
+ "rewards/accuracy_reward/mean": 0.9340277711550394,
169
+ "rewards/accuracy_reward/std": 0.21398874868949255,
170
+ "rewards/format_reward/mean": 0.9895833134651184,
171
+ "rewards/format_reward/std": 0.10206206391255061,
172
+ "step": 18
173
+ },
174
+ {
175
+ "clip_ratio/high_max": 0.0,
176
+ "clip_ratio/high_mean": 0.0,
177
+ "clip_ratio/low_mean": 0.0,
178
+ "clip_ratio/low_min": 0.0,
179
+ "clip_ratio/region_mean": 0.0,
180
+ "completions/clipped_ratio": 0.041666666666666664,
181
+ "completions/max_length": 7178.333333333333,
182
+ "completions/max_terminated_length": 5503.666666666667,
183
+ "completions/mean_length": 2042.7118733723958,
184
+ "completions/mean_terminated_length": 1780.8347981770833,
185
+ "completions/min_length": 534.6666666666666,
186
+ "completions/min_terminated_length": 534.6666666666666,
187
+ "epoch": 0.1344,
188
+ "grad_norm": 0.06415776163339615,
189
+ "kl": 0.016947428385416668,
190
+ "learning_rate": 3.487179487179487e-06,
191
+ "loss": 0.0258,
192
+ "num_tokens": 4722190.0,
193
+ "reward": 1.9236111640930176,
194
+ "reward_std": 0.03402068962653478,
195
+ "rewards/accuracy_reward/mean": 0.9548611243565878,
196
+ "rewards/accuracy_reward/std": 0.15458878378073374,
197
+ "rewards/format_reward/mean": 0.96875,
198
+ "rewards/format_reward/std": 0.12663276741902033,
199
+ "step": 21
200
+ },
201
+ {
202
+ "clip_ratio/high_max": 0.0,
203
+ "clip_ratio/high_mean": 0.0,
204
+ "clip_ratio/low_mean": 0.0,
205
+ "clip_ratio/low_min": 0.0,
206
+ "clip_ratio/region_mean": 0.0,
207
+ "completions/clipped_ratio": 0.045138888888888916,
208
+ "completions/max_length": 8192.0,
209
+ "completions/max_terminated_length": 7599.333333333333,
210
+ "completions/mean_length": 2192.9861653645835,
211
+ "completions/mean_terminated_length": 1915.0709635416667,
212
+ "completions/min_length": 501.6666666666667,
213
+ "completions/min_terminated_length": 501.6666666666667,
214
+ "epoch": 0.1536,
215
+ "grad_norm": 0.08798938244581223,
216
+ "kl": 0.02048492431640625,
217
+ "learning_rate": 3.41025641025641e-06,
218
+ "loss": 0.0258,
219
+ "num_tokens": 5379972.0,
220
+ "reward": 1.8645833730697632,
221
+ "reward_std": 0.09762249266107877,
222
+ "rewards/accuracy_reward/mean": 0.9027777711550394,
223
+ "rewards/accuracy_reward/std": 0.286453440785408,
224
+ "rewards/format_reward/mean": 0.9618055621782938,
225
+ "rewards/format_reward/std": 0.18727133671442667,
226
+ "step": 24
227
+ },
228
+ {
229
+ "clip_ratio/high_max": 0.0,
230
+ "clip_ratio/high_mean": 0.0,
231
+ "clip_ratio/low_mean": 0.0,
232
+ "clip_ratio/low_min": 0.0,
233
+ "clip_ratio/region_mean": 0.0,
234
+ "completions/clipped_ratio": 0.020833333333333332,
235
+ "completions/max_length": 7410.0,
236
+ "completions/max_terminated_length": 6817.666666666667,
237
+ "completions/mean_length": 2016.982666015625,
238
+ "completions/mean_terminated_length": 1887.3319091796875,
239
+ "completions/min_length": 514.0,
240
+ "completions/min_terminated_length": 514.0,
241
+ "epoch": 0.1728,
242
+ "grad_norm": 0.10734036564826965,
243
+ "kl": 0.0256195068359375,
244
+ "learning_rate": 3.3333333333333333e-06,
245
+ "loss": 0.0323,
246
+ "num_tokens": 5984941.0,
247
+ "reward": 1.8993055820465088,
248
+ "reward_std": 0.10998130093018214,
249
+ "rewards/accuracy_reward/mean": 0.9201388955116272,
250
+ "rewards/accuracy_reward/std": 0.2663828631242116,
251
+ "rewards/format_reward/mean": 0.9791666666666666,
252
+ "rewards/format_reward/std": 0.10847451289494832,
253
+ "step": 27
254
+ },
255
+ {
256
+ "clip_ratio/high_max": 0.0,
257
+ "clip_ratio/high_mean": 0.0,
258
+ "clip_ratio/low_mean": 0.0,
259
+ "clip_ratio/low_min": 0.0,
260
+ "clip_ratio/region_mean": 0.0,
261
+ "completions/clipped_ratio": 0.03125,
262
+ "completions/max_length": 8192.0,
263
+ "completions/max_terminated_length": 7886.666666666667,
264
+ "completions/mean_length": 2276.7084147135415,
265
+ "completions/mean_terminated_length": 2084.757283528646,
266
+ "completions/min_length": 573.6666666666666,
267
+ "completions/min_terminated_length": 573.6666666666666,
268
+ "epoch": 0.192,
269
+ "grad_norm": 0.09922217577695847,
270
+ "kl": 0.022427876790364582,
271
+ "learning_rate": 3.2564102564102564e-06,
272
+ "loss": 0.0182,
273
+ "num_tokens": 6662305.0,
274
+ "reward": 1.8333333730697632,
275
+ "reward_std": 0.1692849819858869,
276
+ "rewards/accuracy_reward/mean": 0.875,
277
+ "rewards/accuracy_reward/std": 0.31955354909102124,
278
+ "rewards/format_reward/mean": 0.9583333333333334,
279
+ "rewards/format_reward/std": 0.197714701294899,
280
+ "step": 30
281
+ },
282
+ {
283
+ "clip_ratio/high_max": 0.0,
284
+ "clip_ratio/high_mean": 0.0,
285
+ "clip_ratio/low_mean": 0.0,
286
+ "clip_ratio/low_min": 0.0,
287
+ "clip_ratio/region_mean": 0.0,
288
+ "completions/clipped_ratio": 0.03125,
289
+ "completions/max_length": 6856.333333333333,
290
+ "completions/max_terminated_length": 5939.666666666667,
291
+ "completions/mean_length": 2417.1563313802085,
292
+ "completions/mean_terminated_length": 2233.5343424479165,
293
+ "completions/min_length": 661.3333333333334,
294
+ "completions/min_terminated_length": 661.3333333333334,
295
+ "epoch": 0.2112,
296
+ "grad_norm": 0.13434383273124695,
297
+ "kl": 0.019597371419270832,
298
+ "learning_rate": 3.179487179487179e-06,
299
+ "loss": 0.0666,
300
+ "num_tokens": 7382296.0,
301
+ "reward": 1.87500003973643,
302
+ "reward_std": 0.14174887910485268,
303
+ "rewards/accuracy_reward/mean": 0.90625,
304
+ "rewards/accuracy_reward/std": 0.27019980053106946,
305
+ "rewards/format_reward/mean": 0.96875,
306
+ "rewards/format_reward/std": 0.1349801371494929,
307
+ "step": 33
308
+ },
309
+ {
310
+ "clip_ratio/high_max": 0.0,
311
+ "clip_ratio/high_mean": 0.0,
312
+ "clip_ratio/low_mean": 0.0,
313
+ "clip_ratio/low_min": 0.0,
314
+ "clip_ratio/region_mean": 0.0,
315
+ "completions/clipped_ratio": 0.010416666666666666,
316
+ "completions/max_length": 6942.666666666667,
317
+ "completions/max_terminated_length": 6595.333333333333,
318
+ "completions/mean_length": 1717.2361653645833,
319
+ "completions/mean_terminated_length": 1649.8081461588542,
320
+ "completions/min_length": 371.3333333333333,
321
+ "completions/min_terminated_length": 371.3333333333333,
322
+ "epoch": 0.2304,
323
+ "grad_norm": 0.11780474334955215,
324
+ "kl": 0.028951009114583332,
325
+ "learning_rate": 3.1025641025641025e-06,
326
+ "loss": 0.0318,
327
+ "num_tokens": 7898124.0,
328
+ "reward": 1.9409722884496052,
329
+ "reward_std": 0.08892839774489403,
330
+ "rewards/accuracy_reward/mean": 0.9652777910232544,
331
+ "rewards/accuracy_reward/std": 0.17682797213395438,
332
+ "rewards/format_reward/mean": 0.975694457689921,
333
+ "rewards/format_reward/std": 0.15401925643285116,
334
+ "step": 36
335
+ },
336
+ {
337
+ "clip_ratio/high_max": 0.0,
338
+ "clip_ratio/high_mean": 0.0,
339
+ "clip_ratio/low_mean": 0.0,
340
+ "clip_ratio/low_min": 0.0,
341
+ "clip_ratio/region_mean": 0.0,
342
+ "completions/clipped_ratio": 0.045138888888888874,
343
+ "completions/max_length": 7901.0,
344
+ "completions/max_terminated_length": 7665.0,
345
+ "completions/mean_length": 1984.8681233723958,
346
+ "completions/mean_terminated_length": 1685.4075520833333,
347
+ "completions/min_length": 326.3333333333333,
348
+ "completions/min_terminated_length": 326.3333333333333,
349
+ "epoch": 0.2496,
350
+ "grad_norm": 0.1302698850631714,
351
+ "kl": 0.0289154052734375,
352
+ "learning_rate": 3.0256410256410256e-06,
353
+ "loss": 0.0366,
354
+ "num_tokens": 8500984.0,
355
+ "reward": 1.8715278307596843,
356
+ "reward_std": 0.13606221228837967,
357
+ "rewards/accuracy_reward/mean": 0.9270833333333334,
358
+ "rewards/accuracy_reward/std": 0.25223057965437573,
359
+ "rewards/format_reward/mean": 0.9444444378217062,
360
+ "rewards/format_reward/std": 0.2128016253312429,
361
+ "step": 39
362
+ },
363
+ {
364
+ "clip_ratio/high_max": 0.0,
365
+ "clip_ratio/high_mean": 0.0,
366
+ "clip_ratio/low_mean": 0.0,
367
+ "clip_ratio/low_min": 0.0,
368
+ "clip_ratio/region_mean": 0.0,
369
+ "completions/clipped_ratio": 0.02430555555555558,
370
+ "completions/max_length": 6943.666666666667,
371
+ "completions/max_terminated_length": 6541.0,
372
+ "completions/mean_length": 1753.7569986979167,
373
+ "completions/mean_terminated_length": 1596.4458414713542,
374
+ "completions/min_length": 336.0,
375
+ "completions/min_terminated_length": 336.0,
376
+ "epoch": 0.2688,
377
+ "grad_norm": 0.12249383330345154,
378
+ "kl": 0.030186971028645832,
379
+ "learning_rate": 2.9487179487179486e-06,
380
+ "loss": 0.0353,
381
+ "num_tokens": 9033138.0,
382
+ "reward": 1.8680555820465088,
383
+ "reward_std": 0.19277991354465485,
384
+ "rewards/accuracy_reward/mean": 0.906250019868215,
385
+ "rewards/accuracy_reward/std": 0.29195430874824524,
386
+ "rewards/format_reward/mean": 0.961805542310079,
387
+ "rewards/format_reward/std": 0.18208982795476913,
388
+ "step": 42
389
+ },
390
+ {
391
+ "clip_ratio/high_max": 0.0,
392
+ "clip_ratio/high_mean": 0.0,
393
+ "clip_ratio/low_mean": 0.0,
394
+ "clip_ratio/low_min": 0.0,
395
+ "clip_ratio/region_mean": 0.0,
396
+ "completions/clipped_ratio": 0.027777777777777752,
397
+ "completions/max_length": 7697.333333333333,
398
+ "completions/max_terminated_length": 6401.666666666667,
399
+ "completions/mean_length": 1648.7222493489583,
400
+ "completions/mean_terminated_length": 1464.5533447265625,
401
+ "completions/min_length": 229.66666666666666,
402
+ "completions/min_terminated_length": 229.66666666666666,
403
+ "epoch": 0.288,
404
+ "grad_norm": 0.1356375366449356,
405
+ "kl": 0.034571329752604164,
406
+ "learning_rate": 2.8717948717948717e-06,
407
+ "loss": 0.0566,
408
+ "num_tokens": 9541138.0,
409
+ "reward": 1.87500003973643,
410
+ "reward_std": 0.14326218763987222,
411
+ "rewards/accuracy_reward/mean": 0.9236111044883728,
412
+ "rewards/accuracy_reward/std": 0.24128751705090204,
413
+ "rewards/format_reward/mean": 0.9513888955116272,
414
+ "rewards/format_reward/std": 0.17212405304114023,
415
+ "step": 45
416
+ },
417
+ {
418
+ "clip_ratio/high_max": 0.0,
419
+ "clip_ratio/high_mean": 0.0,
420
+ "clip_ratio/low_mean": 0.0,
421
+ "clip_ratio/low_min": 0.0,
422
+ "clip_ratio/region_mean": 0.0,
423
+ "completions/clipped_ratio": 0.059027777777777755,
424
+ "completions/max_length": 8192.0,
425
+ "completions/max_terminated_length": 7894.0,
426
+ "completions/mean_length": 2024.1111653645833,
427
+ "completions/mean_terminated_length": 1630.966552734375,
428
+ "completions/min_length": 298.3333333333333,
429
+ "completions/min_terminated_length": 298.3333333333333,
430
+ "epoch": 0.3072,
431
+ "grad_norm": 0.14614339172840118,
432
+ "kl": 0.033233642578125,
433
+ "learning_rate": 2.7948717948717948e-06,
434
+ "loss": 0.0668,
435
+ "num_tokens": 10152390.0,
436
+ "reward": 1.8819444974263508,
437
+ "reward_std": 0.14595978458722433,
438
+ "rewards/accuracy_reward/mean": 0.9479166666666666,
439
+ "rewards/accuracy_reward/std": 0.2198773274819056,
440
+ "rewards/format_reward/mean": 0.9340277711550394,
441
+ "rewards/format_reward/std": 0.24177277584870657,
442
+ "step": 48
443
+ },
444
+ {
445
+ "clip_ratio/high_max": 0.0,
446
+ "clip_ratio/high_mean": 0.0,
447
+ "clip_ratio/low_mean": 0.0,
448
+ "clip_ratio/low_min": 0.0,
449
+ "clip_ratio/region_mean": 0.0,
450
+ "completions/clipped_ratio": 0.03125,
451
+ "completions/max_length": 8080.333333333333,
452
+ "completions/max_terminated_length": 6668.333333333333,
453
+ "completions/mean_length": 2075.5382486979165,
454
+ "completions/mean_terminated_length": 1875.0848795572917,
455
+ "completions/min_length": 313.0,
456
+ "completions/min_terminated_length": 313.0,
457
+ "epoch": 0.3264,
458
+ "grad_norm": 0.13130497932434082,
459
+ "kl": 0.029052734375,
460
+ "learning_rate": 2.717948717948718e-06,
461
+ "loss": 0.0391,
462
+ "num_tokens": 10781333.0,
463
+ "reward": 1.8715277910232544,
464
+ "reward_std": 0.173075832426548,
465
+ "rewards/accuracy_reward/mean": 0.9131944378217062,
466
+ "rewards/accuracy_reward/std": 0.27422525485356647,
467
+ "rewards/format_reward/mean": 0.9583333532015482,
468
+ "rewards/format_reward/std": 0.18832933902740479,
469
+ "step": 51
470
+ },
471
+ {
472
+ "clip_ratio/high_max": 0.0,
473
+ "clip_ratio/high_mean": 0.0,
474
+ "clip_ratio/low_mean": 0.0,
475
+ "clip_ratio/low_min": 0.0,
476
+ "clip_ratio/region_mean": 0.0,
477
+ "completions/clipped_ratio": 0.03472222222222221,
478
+ "completions/max_length": 8192.0,
479
+ "completions/max_terminated_length": 6894.666666666667,
480
+ "completions/mean_length": 1978.5972900390625,
481
+ "completions/mean_terminated_length": 1754.5013020833333,
482
+ "completions/min_length": 291.0,
483
+ "completions/min_terminated_length": 291.0,
484
+ "epoch": 0.3456,
485
+ "grad_norm": 0.11747946590185165,
486
+ "kl": 0.025873819986979168,
487
+ "learning_rate": 2.641025641025641e-06,
488
+ "loss": 0.0452,
489
+ "num_tokens": 11385513.0,
490
+ "reward": 1.8368055820465088,
491
+ "reward_std": 0.1378952513138453,
492
+ "rewards/accuracy_reward/mean": 0.8819444378217062,
493
+ "rewards/accuracy_reward/std": 0.3174315243959427,
494
+ "rewards/format_reward/mean": 0.9548611243565878,
495
+ "rewards/format_reward/std": 0.20342316726843515,
496
+ "step": 54
497
+ },
498
+ {
499
+ "clip_ratio/high_max": 0.0,
500
+ "clip_ratio/high_mean": 0.0,
501
+ "clip_ratio/low_mean": 0.0,
502
+ "clip_ratio/low_min": 0.0,
503
+ "clip_ratio/region_mean": 0.0,
504
+ "completions/clipped_ratio": 0.013888888888888876,
505
+ "completions/max_length": 7534.0,
506
+ "completions/max_terminated_length": 7530.666666666667,
507
+ "completions/mean_length": 1764.263916015625,
508
+ "completions/mean_terminated_length": 1680.0013834635417,
509
+ "completions/min_length": 283.0,
510
+ "completions/min_terminated_length": 283.0,
511
+ "epoch": 0.3648,
512
+ "grad_norm": 0.12080682069063187,
513
+ "kl": 0.032323201497395836,
514
+ "learning_rate": 2.5641025641025644e-06,
515
+ "loss": 0.0415,
516
+ "num_tokens": 11918815.0,
517
+ "reward": 1.864583412806193,
518
+ "reward_std": 0.17177063475052515,
519
+ "rewards/accuracy_reward/mean": 0.9027777711550394,
520
+ "rewards/accuracy_reward/std": 0.28834333022435504,
521
+ "rewards/format_reward/mean": 0.961805542310079,
522
+ "rewards/format_reward/std": 0.1363807593782743,
523
+ "step": 57
524
+ },
525
+ {
526
+ "clip_ratio/high_max": 0.0,
527
+ "clip_ratio/high_mean": 0.0,
528
+ "clip_ratio/low_mean": 0.0,
529
+ "clip_ratio/low_min": 0.0,
530
+ "clip_ratio/region_mean": 0.0,
531
+ "completions/clipped_ratio": 0.048611111111111126,
532
+ "completions/max_length": 8192.0,
533
+ "completions/max_terminated_length": 6987.666666666667,
534
+ "completions/mean_length": 2011.3229573567708,
535
+ "completions/mean_terminated_length": 1690.6886393229167,
536
+ "completions/min_length": 294.0,
537
+ "completions/min_terminated_length": 294.0,
538
+ "epoch": 0.384,
539
+ "grad_norm": 0.12239208817481995,
540
+ "kl": 0.030438741048177082,
541
+ "learning_rate": 2.487179487179487e-06,
542
+ "loss": 0.0768,
543
+ "num_tokens": 12522634.0,
544
+ "reward": 1.8854167064030964,
545
+ "reward_std": 0.15016684432824454,
546
+ "rewards/accuracy_reward/mean": 0.9409722089767456,
547
+ "rewards/accuracy_reward/std": 0.23519064486026764,
548
+ "rewards/format_reward/mean": 0.944444457689921,
549
+ "rewards/format_reward/std": 0.22536789874235788,
550
+ "step": 60
551
+ },
552
+ {
553
+ "clip_ratio/high_max": 0.0,
554
+ "clip_ratio/high_mean": 0.0,
555
+ "clip_ratio/low_mean": 0.0,
556
+ "clip_ratio/low_min": 0.0,
557
+ "clip_ratio/region_mean": 0.0,
558
+ "completions/clipped_ratio": 0.034722222222222245,
559
+ "completions/max_length": 8192.0,
560
+ "completions/max_terminated_length": 6971.333333333333,
561
+ "completions/mean_length": 2042.4896647135417,
562
+ "completions/mean_terminated_length": 1825.8701578776042,
563
+ "completions/min_length": 314.0,
564
+ "completions/min_terminated_length": 314.0,
565
+ "epoch": 0.4032,
566
+ "grad_norm": 0.10179228335618973,
567
+ "kl": 0.031634012858072914,
568
+ "learning_rate": 2.41025641025641e-06,
569
+ "loss": 0.0337,
570
+ "num_tokens": 13138633.0,
571
+ "reward": 1.8541667064030964,
572
+ "reward_std": 0.20934962232907614,
573
+ "rewards/accuracy_reward/mean": 0.8958333333333334,
574
+ "rewards/accuracy_reward/std": 0.3057904740174611,
575
+ "rewards/format_reward/mean": 0.9583333333333334,
576
+ "rewards/format_reward/std": 0.197714701294899,
577
+ "step": 63
578
+ },
579
+ {
580
+ "clip_ratio/high_max": 0.0,
581
+ "clip_ratio/high_mean": 0.0,
582
+ "clip_ratio/low_mean": 0.0,
583
+ "clip_ratio/low_min": 0.0,
584
+ "clip_ratio/region_mean": 0.0,
585
+ "completions/clipped_ratio": 0.038194444444444454,
586
+ "completions/max_length": 8192.0,
587
+ "completions/max_terminated_length": 7261.666666666667,
588
+ "completions/mean_length": 1903.9722493489583,
589
+ "completions/mean_terminated_length": 1650.5534261067708,
590
+ "completions/min_length": 227.66666666666666,
591
+ "completions/min_terminated_length": 227.66666666666666,
592
+ "epoch": 0.4224,
593
+ "grad_norm": 0.10856553167104721,
594
+ "kl": 0.031336466471354164,
595
+ "learning_rate": 2.3333333333333336e-06,
596
+ "loss": 0.0397,
597
+ "num_tokens": 13714469.0,
598
+ "reward": 1.8819444576899211,
599
+ "reward_std": 0.15875921150048575,
600
+ "rewards/accuracy_reward/mean": 0.9270833333333334,
601
+ "rewards/accuracy_reward/std": 0.2572407325108846,
602
+ "rewards/format_reward/mean": 0.9548611044883728,
603
+ "rewards/format_reward/std": 0.19624211142460504,
604
+ "step": 66
605
+ },
606
+ {
607
+ "clip_ratio/high_max": 0.0,
608
+ "clip_ratio/high_mean": 0.0,
609
+ "clip_ratio/low_mean": 0.0,
610
+ "clip_ratio/low_min": 0.0,
611
+ "clip_ratio/region_mean": 0.0,
612
+ "completions/clipped_ratio": 0.038194444444444454,
613
+ "completions/max_length": 7431.666666666667,
614
+ "completions/max_terminated_length": 7204.666666666667,
615
+ "completions/mean_length": 1631.7222900390625,
616
+ "completions/mean_terminated_length": 1369.1958414713542,
617
+ "completions/min_length": 245.0,
618
+ "completions/min_terminated_length": 245.0,
619
+ "epoch": 0.4416,
620
+ "grad_norm": 0.11824989318847656,
621
+ "kl": 0.03619384765625,
622
+ "learning_rate": 2.2564102564102562e-06,
623
+ "loss": 0.0374,
624
+ "num_tokens": 14208711.0,
625
+ "reward": 1.81250003973643,
626
+ "reward_std": 0.16117709378401437,
627
+ "rewards/accuracy_reward/mean": 0.8611111044883728,
628
+ "rewards/accuracy_reward/std": 0.3456921974817912,
629
+ "rewards/format_reward/mean": 0.9513888955116272,
630
+ "rewards/format_reward/std": 0.20108659317096075,
631
+ "step": 69
632
+ },
633
+ {
634
+ "clip_ratio/high_max": 0.0,
635
+ "clip_ratio/high_mean": 0.0,
636
+ "clip_ratio/low_mean": 0.0,
637
+ "clip_ratio/low_min": 0.0,
638
+ "clip_ratio/region_mean": 0.0,
639
+ "completions/clipped_ratio": 0.041666666666666664,
640
+ "completions/max_length": 8192.0,
641
+ "completions/max_terminated_length": 6924.666666666667,
642
+ "completions/mean_length": 1506.6423746744792,
643
+ "completions/mean_terminated_length": 1216.2833251953125,
644
+ "completions/min_length": 246.0,
645
+ "completions/min_terminated_length": 246.0,
646
+ "epoch": 0.4608,
647
+ "grad_norm": 0.1255887746810913,
648
+ "kl": 0.053243001302083336,
649
+ "learning_rate": 2.1794871794871793e-06,
650
+ "loss": 0.0383,
651
+ "num_tokens": 14664410.0,
652
+ "reward": 1.9236111640930176,
653
+ "reward_std": 0.10031624138355255,
654
+ "rewards/accuracy_reward/mean": 0.9548611044883728,
655
+ "rewards/accuracy_reward/std": 0.2063711335261663,
656
+ "rewards/format_reward/mean": 0.968749980131785,
657
+ "rewards/format_reward/std": 0.16793753455082575,
658
+ "step": 72
659
+ },
660
+ {
661
+ "clip_ratio/high_max": 0.0,
662
+ "clip_ratio/high_mean": 0.0,
663
+ "clip_ratio/low_mean": 0.0,
664
+ "clip_ratio/low_min": 0.0,
665
+ "clip_ratio/region_mean": 0.0,
666
+ "completions/clipped_ratio": 0.024305555555555542,
667
+ "completions/max_length": 7341.0,
668
+ "completions/max_terminated_length": 7337.666666666667,
669
+ "completions/mean_length": 1445.312520345052,
670
+ "completions/mean_terminated_length": 1281.9166463216145,
671
+ "completions/min_length": 166.66666666666666,
672
+ "completions/min_terminated_length": 166.66666666666666,
673
+ "epoch": 0.48,
674
+ "grad_norm": 0.14921000599861145,
675
+ "kl": 0.042795817057291664,
676
+ "learning_rate": 2.1025641025641023e-06,
677
+ "loss": 0.036,
678
+ "num_tokens": 15103004.0,
679
+ "reward": 1.87500003973643,
680
+ "reward_std": 0.11799862856666248,
681
+ "rewards/accuracy_reward/mean": 0.9027777711550394,
682
+ "rewards/accuracy_reward/std": 0.28232812881469727,
683
+ "rewards/format_reward/mean": 0.9722222089767456,
684
+ "rewards/format_reward/std": 0.1211421936750412,
685
+ "step": 75
686
+ },
687
+ {
688
+ "clip_ratio/high_max": 0.0,
689
+ "clip_ratio/high_mean": 0.0,
690
+ "clip_ratio/low_mean": 0.0,
691
+ "clip_ratio/low_min": 0.0,
692
+ "clip_ratio/region_mean": 0.0,
693
+ "completions/clipped_ratio": 0.045138888888888874,
694
+ "completions/max_length": 7986.666666666667,
695
+ "completions/max_terminated_length": 7702.333333333333,
696
+ "completions/mean_length": 1538.5555826822917,
697
+ "completions/mean_terminated_length": 1232.4976399739583,
698
+ "completions/min_length": 201.0,
699
+ "completions/min_terminated_length": 201.0,
700
+ "epoch": 0.4992,
701
+ "grad_norm": 0.09636721014976501,
702
+ "kl": 0.04656982421875,
703
+ "learning_rate": 2.0256410256410254e-06,
704
+ "loss": 0.0377,
705
+ "num_tokens": 15574308.0,
706
+ "reward": 1.87500003973643,
707
+ "reward_std": 0.10612767189741135,
708
+ "rewards/accuracy_reward/mean": 0.9166666666666666,
709
+ "rewards/accuracy_reward/std": 0.26633305847644806,
710
+ "rewards/format_reward/mean": 0.9583333333333334,
711
+ "rewards/format_reward/std": 0.16222142179807028,
712
+ "step": 78
713
+ },
714
+ {
715
+ "clip_ratio/high_max": 0.0,
716
+ "clip_ratio/high_mean": 0.0,
717
+ "clip_ratio/low_mean": 0.0,
718
+ "clip_ratio/low_min": 0.0,
719
+ "clip_ratio/region_mean": 0.0,
720
+ "completions/clipped_ratio": 0.038194444444444454,
721
+ "completions/max_length": 8137.666666666667,
722
+ "completions/max_terminated_length": 7975.0,
723
+ "completions/mean_length": 1834.2222900390625,
724
+ "completions/mean_terminated_length": 1581.649169921875,
725
+ "completions/min_length": 203.0,
726
+ "completions/min_terminated_length": 203.0,
727
+ "epoch": 0.5184,
728
+ "grad_norm": 0.9437447786331177,
729
+ "kl": 0.051630655924479164,
730
+ "learning_rate": 1.9487179487179485e-06,
731
+ "loss": 0.0323,
732
+ "num_tokens": 16131508.0,
733
+ "reward": 1.8506944974263508,
734
+ "reward_std": 0.13935044904549918,
735
+ "rewards/accuracy_reward/mean": 0.8923611044883728,
736
+ "rewards/accuracy_reward/std": 0.30875815947850543,
737
+ "rewards/format_reward/mean": 0.9583333333333334,
738
+ "rewards/format_reward/std": 0.18958522379398346,
739
+ "step": 81
740
+ },
741
+ {
742
+ "clip_ratio/high_max": 0.0,
743
+ "clip_ratio/high_mean": 0.0,
744
+ "clip_ratio/low_mean": 0.0,
745
+ "clip_ratio/low_min": 0.0,
746
+ "clip_ratio/region_mean": 0.0,
747
+ "completions/clipped_ratio": 0.045138888888888916,
748
+ "completions/max_length": 8192.0,
749
+ "completions/max_terminated_length": 7797.666666666667,
750
+ "completions/mean_length": 1368.4097900390625,
751
+ "completions/mean_terminated_length": 1047.0757649739583,
752
+ "completions/min_length": 174.33333333333334,
753
+ "completions/min_terminated_length": 174.33333333333334,
754
+ "epoch": 0.5376,
755
+ "grad_norm": 0.12685449421405792,
756
+ "kl": 0.043909708658854164,
757
+ "learning_rate": 1.8717948717948718e-06,
758
+ "loss": 0.0486,
759
+ "num_tokens": 16552250.0,
760
+ "reward": 1.9166667064030964,
761
+ "reward_std": 0.08621161431074142,
762
+ "rewards/accuracy_reward/mean": 0.9583333333333334,
763
+ "rewards/accuracy_reward/std": 0.19592776894569397,
764
+ "rewards/format_reward/mean": 0.9583333333333334,
765
+ "rewards/format_reward/std": 0.18958522627751032,
766
+ "step": 84
767
+ },
768
+ {
769
+ "clip_ratio/high_max": 0.0,
770
+ "clip_ratio/high_mean": 0.0,
771
+ "clip_ratio/low_mean": 0.0,
772
+ "clip_ratio/low_min": 0.0,
773
+ "clip_ratio/region_mean": 0.0,
774
+ "completions/clipped_ratio": 0.00694444444444442,
775
+ "completions/max_length": 8058.0,
776
+ "completions/max_terminated_length": 7524.0,
777
+ "completions/mean_length": 1276.295166015625,
778
+ "completions/mean_terminated_length": 1228.2986246744792,
779
+ "completions/min_length": 176.33333333333334,
780
+ "completions/min_terminated_length": 176.33333333333334,
781
+ "epoch": 0.5568,
782
+ "grad_norm": 0.10477358847856522,
783
+ "kl": 0.041203816731770836,
784
+ "learning_rate": 1.7948717948717948e-06,
785
+ "loss": 0.03,
786
+ "num_tokens": 16944123.0,
787
+ "reward": 1.93750003973643,
788
+ "reward_std": 0.0895579606294632,
789
+ "rewards/accuracy_reward/mean": 0.9513888955116272,
790
+ "rewards/accuracy_reward/std": 0.21386653184890747,
791
+ "rewards/format_reward/mean": 0.9861111044883728,
792
+ "rewards/format_reward/std": 0.11590000490347545,
793
+ "step": 87
794
+ },
795
+ {
796
+ "clip_ratio/high_max": 0.0,
797
+ "clip_ratio/high_mean": 0.0,
798
+ "clip_ratio/low_mean": 0.0,
799
+ "clip_ratio/low_min": 0.0,
800
+ "clip_ratio/region_mean": 0.0,
801
+ "completions/clipped_ratio": 0.048611111111111126,
802
+ "completions/max_length": 7305.0,
803
+ "completions/max_terminated_length": 6282.333333333333,
804
+ "completions/mean_length": 1492.5034993489583,
805
+ "completions/mean_terminated_length": 1149.2331136067708,
806
+ "completions/min_length": 252.0,
807
+ "completions/min_terminated_length": 252.0,
808
+ "epoch": 0.576,
809
+ "grad_norm": 0.13828961551189423,
810
+ "kl": 0.037953694661458336,
811
+ "learning_rate": 1.7179487179487177e-06,
812
+ "loss": 0.0362,
813
+ "num_tokens": 17398714.0,
814
+ "reward": 1.8854167064030964,
815
+ "reward_std": 0.10882141316930453,
816
+ "rewards/accuracy_reward/mean": 0.9375,
817
+ "rewards/accuracy_reward/std": 0.24268604318300882,
818
+ "rewards/format_reward/mean": 0.9479166666666666,
819
+ "rewards/format_reward/std": 0.17973358432451883,
820
+ "step": 90
821
+ },
822
+ {
823
+ "clip_ratio/high_max": 0.0,
824
+ "clip_ratio/high_mean": 0.0,
825
+ "clip_ratio/low_mean": 0.0,
826
+ "clip_ratio/low_min": 0.0,
827
+ "clip_ratio/region_mean": 0.0,
828
+ "completions/clipped_ratio": 0.03125,
829
+ "completions/max_length": 8192.0,
830
+ "completions/max_terminated_length": 7929.0,
831
+ "completions/mean_length": 1596.2466227213542,
832
+ "completions/mean_terminated_length": 1390.1203206380208,
833
+ "completions/min_length": 207.0,
834
+ "completions/min_terminated_length": 207.0,
835
+ "epoch": 0.5952,
836
+ "grad_norm": 0.10115975886583328,
837
+ "kl": 0.037958780924479164,
838
+ "learning_rate": 1.641025641025641e-06,
839
+ "loss": 0.0531,
840
+ "num_tokens": 17882805.0,
841
+ "reward": 1.8784722487131755,
842
+ "reward_std": 0.08846472824613254,
843
+ "rewards/accuracy_reward/mean": 0.906250019868215,
844
+ "rewards/accuracy_reward/std": 0.28532982369263965,
845
+ "rewards/format_reward/mean": 0.9722222288449606,
846
+ "rewards/format_reward/std": 0.1563331459959348,
847
+ "step": 93
848
+ },
849
+ {
850
+ "clip_ratio/high_max": 0.0,
851
+ "clip_ratio/high_mean": 0.0,
852
+ "clip_ratio/low_mean": 0.0,
853
+ "clip_ratio/low_min": 0.0,
854
+ "clip_ratio/region_mean": 0.0,
855
+ "completions/clipped_ratio": 0.03472222222222221,
856
+ "completions/max_length": 6898.333333333333,
857
+ "completions/max_terminated_length": 6688.666666666667,
858
+ "completions/mean_length": 1595.3646647135417,
859
+ "completions/mean_terminated_length": 1364.8641357421875,
860
+ "completions/min_length": 208.66666666666666,
861
+ "completions/min_terminated_length": 208.66666666666666,
862
+ "epoch": 0.6144,
863
+ "grad_norm": 0.08329301327466965,
864
+ "kl": 0.038645426432291664,
865
+ "learning_rate": 1.564102564102564e-06,
866
+ "loss": 0.0404,
867
+ "num_tokens": 18366630.0,
868
+ "reward": 1.9097222884496052,
869
+ "reward_std": 0.1264843593041102,
870
+ "rewards/accuracy_reward/mean": 0.9513888756434122,
871
+ "rewards/accuracy_reward/std": 0.21502756575743356,
872
+ "rewards/format_reward/mean": 0.9583333333333334,
873
+ "rewards/format_reward/std": 0.18493476013342539,
874
+ "step": 96
875
+ },
876
+ {
877
+ "clip_ratio/high_max": 0.0,
878
+ "clip_ratio/high_mean": 0.0,
879
+ "clip_ratio/low_mean": 0.0,
880
+ "clip_ratio/low_min": 0.0,
881
+ "clip_ratio/region_mean": 0.0,
882
+ "completions/clipped_ratio": 0.038194444444444454,
883
+ "completions/max_length": 7504.666666666667,
884
+ "completions/max_terminated_length": 6996.0,
885
+ "completions/mean_length": 1620.4861246744792,
886
+ "completions/mean_terminated_length": 1355.0765380859375,
887
+ "completions/min_length": 182.66666666666666,
888
+ "completions/min_terminated_length": 182.66666666666666,
889
+ "epoch": 0.6336,
890
+ "grad_norm": 0.07651077955961227,
891
+ "kl": 0.038045247395833336,
892
+ "learning_rate": 1.487179487179487e-06,
893
+ "loss": 0.0408,
894
+ "num_tokens": 18857216.0,
895
+ "reward": 1.9131944576899211,
896
+ "reward_std": 0.03627380480368932,
897
+ "rewards/accuracy_reward/mean": 0.9479166666666666,
898
+ "rewards/accuracy_reward/std": 0.19905283798774084,
899
+ "rewards/format_reward/mean": 0.9652777711550394,
900
+ "rewards/format_reward/std": 0.13169091691573462,
901
+ "step": 99
902
+ },
903
+ {
904
+ "clip_ratio/high_max": 0.0,
905
+ "clip_ratio/high_mean": 0.0,
906
+ "clip_ratio/low_mean": 0.0,
907
+ "clip_ratio/low_min": 0.0,
908
+ "clip_ratio/region_mean": 0.0,
909
+ "completions/clipped_ratio": 0.038194444444444454,
910
+ "completions/max_length": 8192.0,
911
+ "completions/max_terminated_length": 7569.0,
912
+ "completions/mean_length": 1601.21533203125,
913
+ "completions/mean_terminated_length": 1339.799072265625,
914
+ "completions/min_length": 140.33333333333334,
915
+ "completions/min_terminated_length": 140.33333333333334,
916
+ "epoch": 0.6528,
917
+ "grad_norm": 0.1341271549463272,
918
+ "kl": 0.035313924153645836,
919
+ "learning_rate": 1.4102564102564104e-06,
920
+ "loss": 0.0451,
921
+ "num_tokens": 19348528.0,
922
+ "reward": 1.87500003973643,
923
+ "reward_std": 0.14174888034661612,
924
+ "rewards/accuracy_reward/mean": 0.9270833333333334,
925
+ "rewards/accuracy_reward/std": 0.26084429522355396,
926
+ "rewards/format_reward/mean": 0.9479166666666666,
927
+ "rewards/format_reward/std": 0.22252296408017477,
928
+ "step": 102
929
+ },
930
+ {
931
+ "clip_ratio/high_max": 0.0,
932
+ "clip_ratio/high_mean": 0.0,
933
+ "clip_ratio/low_mean": 0.0,
934
+ "clip_ratio/low_min": 0.0,
935
+ "clip_ratio/region_mean": 0.0,
936
+ "completions/clipped_ratio": 0.045138888888888874,
937
+ "completions/max_length": 8192.0,
938
+ "completions/max_terminated_length": 7510.666666666667,
939
+ "completions/mean_length": 1486.263916015625,
940
+ "completions/mean_terminated_length": 1165.8067626953125,
941
+ "completions/min_length": 135.33333333333334,
942
+ "completions/min_terminated_length": 135.33333333333334,
943
+ "epoch": 0.672,
944
+ "grad_norm": 0.11015435308218002,
945
+ "kl": 0.034245808919270836,
946
+ "learning_rate": 1.3333333333333332e-06,
947
+ "loss": 0.0214,
948
+ "num_tokens": 19798676.0,
949
+ "reward": 1.9166667064030964,
950
+ "reward_std": 0.0998756115635236,
951
+ "rewards/accuracy_reward/mean": 0.961805542310079,
952
+ "rewards/accuracy_reward/std": 0.19221885005633035,
953
+ "rewards/format_reward/mean": 0.9548611044883728,
954
+ "rewards/format_reward/std": 0.20372549692789713,
955
+ "step": 105
956
+ },
957
+ {
958
+ "clip_ratio/high_max": 0.0,
959
+ "clip_ratio/high_mean": 0.0,
960
+ "clip_ratio/low_mean": 0.0,
961
+ "clip_ratio/low_min": 0.0,
962
+ "clip_ratio/region_mean": 0.0,
963
+ "completions/clipped_ratio": 0.03125,
964
+ "completions/max_length": 7331.0,
965
+ "completions/max_terminated_length": 7054.666666666667,
966
+ "completions/mean_length": 1494.9896647135417,
967
+ "completions/mean_terminated_length": 1280.5859375,
968
+ "completions/min_length": 221.0,
969
+ "completions/min_terminated_length": 221.0,
970
+ "epoch": 0.6912,
971
+ "grad_norm": 0.11232707649469376,
972
+ "kl": 0.0319671630859375,
973
+ "learning_rate": 1.2564102564102563e-06,
974
+ "loss": 0.0022,
975
+ "num_tokens": 20265089.0,
976
+ "reward": 1.8819444974263508,
977
+ "reward_std": 0.10322195539871852,
978
+ "rewards/accuracy_reward/mean": 0.9166666666666666,
979
+ "rewards/accuracy_reward/std": 0.27038883169492084,
980
+ "rewards/format_reward/mean": 0.9652777711550394,
981
+ "rewards/format_reward/std": 0.1454235017299652,
982
+ "step": 108
983
+ },
984
+ {
985
+ "clip_ratio/high_max": 0.0,
986
+ "clip_ratio/high_mean": 0.0,
987
+ "clip_ratio/low_mean": 0.0,
988
+ "clip_ratio/low_min": 0.0,
989
+ "clip_ratio/region_mean": 0.0,
990
+ "completions/clipped_ratio": 0.045138888888888874,
991
+ "completions/max_length": 7708.333333333333,
992
+ "completions/max_terminated_length": 6119.333333333333,
993
+ "completions/mean_length": 1444.1944580078125,
994
+ "completions/mean_terminated_length": 1120.3043619791667,
995
+ "completions/min_length": 238.33333333333334,
996
+ "completions/min_terminated_length": 238.33333333333334,
997
+ "epoch": 0.7104,
998
+ "grad_norm": 0.09397315979003906,
999
+ "kl": 0.029179890950520832,
1000
+ "learning_rate": 1.1794871794871795e-06,
1001
+ "loss": 0.0349,
1002
+ "num_tokens": 20706937.0,
1003
+ "reward": 1.9027778307596843,
1004
+ "reward_std": 0.0833058978120486,
1005
+ "rewards/accuracy_reward/mean": 0.937499980131785,
1006
+ "rewards/accuracy_reward/std": 0.24120144049326578,
1007
+ "rewards/format_reward/mean": 0.9652777711550394,
1008
+ "rewards/format_reward/std": 0.1454235017299652,
1009
+ "step": 111
1010
+ },
1011
+ {
1012
+ "clip_ratio/high_max": 0.0,
1013
+ "clip_ratio/high_mean": 0.0,
1014
+ "clip_ratio/low_mean": 0.0,
1015
+ "clip_ratio/low_min": 0.0,
1016
+ "clip_ratio/region_mean": 0.0,
1017
+ "completions/clipped_ratio": 0.09027777777777779,
1018
+ "completions/max_length": 8192.0,
1019
+ "completions/max_terminated_length": 7374.666666666667,
1020
+ "completions/mean_length": 1775.2361653645833,
1021
+ "completions/mean_terminated_length": 1136.4374389648438,
1022
+ "completions/min_length": 140.33333333333334,
1023
+ "completions/min_terminated_length": 140.33333333333334,
1024
+ "epoch": 0.7296,
1025
+ "grad_norm": 0.17233380675315857,
1026
+ "kl": 0.0392608642578125,
1027
+ "learning_rate": 1.1025641025641026e-06,
1028
+ "loss": 0.0398,
1029
+ "num_tokens": 21245775.0,
1030
+ "reward": 1.8645833730697632,
1031
+ "reward_std": 0.10707558691501617,
1032
+ "rewards/accuracy_reward/mean": 0.9513888756434122,
1033
+ "rewards/accuracy_reward/std": 0.21238192915916443,
1034
+ "rewards/format_reward/mean": 0.913194457689921,
1035
+ "rewards/format_reward/std": 0.27788423001766205,
1036
+ "step": 114
1037
+ },
1038
+ {
1039
+ "clip_ratio/high_max": 0.0,
1040
+ "clip_ratio/high_mean": 0.0,
1041
+ "clip_ratio/low_mean": 0.0,
1042
+ "clip_ratio/low_min": 0.0,
1043
+ "clip_ratio/region_mean": 0.0,
1044
+ "completions/clipped_ratio": 0.05902777777777779,
1045
+ "completions/max_length": 7707.333333333333,
1046
+ "completions/max_terminated_length": 6991.333333333333,
1047
+ "completions/mean_length": 1498.5417073567708,
1048
+ "completions/mean_terminated_length": 1070.8243408203125,
1049
+ "completions/min_length": 130.0,
1050
+ "completions/min_terminated_length": 130.0,
1051
+ "epoch": 0.7488,
1052
+ "grad_norm": 0.10053375363349915,
1053
+ "kl": 0.030309041341145832,
1054
+ "learning_rate": 1.0256410256410255e-06,
1055
+ "loss": 0.0379,
1056
+ "num_tokens": 21700377.0,
1057
+ "reward": 1.8506944974263508,
1058
+ "reward_std": 0.1034339318672816,
1059
+ "rewards/accuracy_reward/mean": 0.9097222288449606,
1060
+ "rewards/accuracy_reward/std": 0.2692435334126155,
1061
+ "rewards/format_reward/mean": 0.9409722288449606,
1062
+ "rewards/format_reward/std": 0.18527215222517648,
1063
+ "step": 117
1064
+ },
1065
+ {
1066
+ "clip_ratio/high_max": 0.0,
1067
+ "clip_ratio/high_mean": 0.0,
1068
+ "clip_ratio/low_mean": 0.0,
1069
+ "clip_ratio/low_min": 0.0,
1070
+ "clip_ratio/region_mean": 0.0,
1071
+ "completions/clipped_ratio": 0.0625,
1072
+ "completions/max_length": 8080.333333333333,
1073
+ "completions/max_terminated_length": 8074.0,
1074
+ "completions/mean_length": 1560.0416666666667,
1075
+ "completions/mean_terminated_length": 1113.6520182291667,
1076
+ "completions/min_length": 227.0,
1077
+ "completions/min_terminated_length": 227.0,
1078
+ "epoch": 0.768,
1079
+ "grad_norm": 0.09212761372327805,
1080
+ "kl": 0.033299763997395836,
1081
+ "learning_rate": 9.487179487179486e-07,
1082
+ "loss": 0.0356,
1083
+ "num_tokens": 22176393.0,
1084
+ "reward": 1.90625003973643,
1085
+ "reward_std": 0.09762249638636906,
1086
+ "rewards/accuracy_reward/mean": 0.9583333333333334,
1087
+ "rewards/accuracy_reward/std": 0.197714701294899,
1088
+ "rewards/format_reward/mean": 0.9479166666666666,
1089
+ "rewards/format_reward/std": 0.1926976442337036,
1090
+ "step": 120
1091
+ },
1092
+ {
1093
+ "clip_ratio/high_max": 0.0,
1094
+ "clip_ratio/high_mean": 0.0,
1095
+ "clip_ratio/low_mean": 0.0,
1096
+ "clip_ratio/low_min": 0.0,
1097
+ "clip_ratio/region_mean": 0.0,
1098
+ "completions/clipped_ratio": 0.052083333333333336,
1099
+ "completions/max_length": 7240.0,
1100
+ "completions/max_terminated_length": 6940.666666666667,
1101
+ "completions/mean_length": 1487.6284993489583,
1102
+ "completions/mean_terminated_length": 1119.332051595052,
1103
+ "completions/min_length": 180.66666666666666,
1104
+ "completions/min_terminated_length": 180.66666666666666,
1105
+ "epoch": 0.7872,
1106
+ "grad_norm": 0.1242799237370491,
1107
+ "kl": 0.03277587890625,
1108
+ "learning_rate": 8.717948717948718e-07,
1109
+ "loss": 0.0342,
1110
+ "num_tokens": 22636012.0,
1111
+ "reward": 1.857638915379842,
1112
+ "reward_std": 0.10882141441106796,
1113
+ "rewards/accuracy_reward/mean": 0.9166666666666666,
1114
+ "rewards/accuracy_reward/std": 0.23966746032238007,
1115
+ "rewards/format_reward/mean": 0.9409722288449606,
1116
+ "rewards/format_reward/std": 0.18527215222517648,
1117
+ "step": 123
1118
+ },
1119
+ {
1120
+ "clip_ratio/high_max": 0.0,
1121
+ "clip_ratio/high_mean": 0.0,
1122
+ "clip_ratio/low_mean": 0.0,
1123
+ "clip_ratio/low_min": 0.0,
1124
+ "clip_ratio/region_mean": 0.0,
1125
+ "completions/clipped_ratio": 0.06597222222222221,
1126
+ "completions/max_length": 8192.0,
1127
+ "completions/max_terminated_length": 6789.333333333333,
1128
+ "completions/mean_length": 1534.1597493489583,
1129
+ "completions/mean_terminated_length": 1059.709248860677,
1130
+ "completions/min_length": 198.0,
1131
+ "completions/min_terminated_length": 198.0,
1132
+ "epoch": 0.8064,
1133
+ "grad_norm": 0.09035886079072952,
1134
+ "kl": 0.034245808919270836,
1135
+ "learning_rate": 7.948717948717948e-07,
1136
+ "loss": 0.0458,
1137
+ "num_tokens": 23103896.0,
1138
+ "reward": 1.8854167064030964,
1139
+ "reward_std": 0.1067802719771862,
1140
+ "rewards/accuracy_reward/mean": 0.9583333333333334,
1141
+ "rewards/accuracy_reward/std": 0.18493476261695227,
1142
+ "rewards/format_reward/mean": 0.9270833134651184,
1143
+ "rewards/format_reward/std": 0.2387408266464869,
1144
+ "step": 126
1145
+ }
1146
+ ],
1147
+ "logging_steps": 3,
1148
+ "max_steps": 156,
1149
+ "num_input_tokens_seen": 23493835,
1150
+ "num_train_epochs": 1,
1151
+ "save_steps": 32,
1152
+ "stateful_callbacks": {
1153
+ "TrainerControl": {
1154
+ "args": {
1155
+ "should_epoch_stop": false,
1156
+ "should_evaluate": false,
1157
+ "should_log": false,
1158
+ "should_save": true,
1159
+ "should_training_stop": false
1160
+ },
1161
+ "attributes": {}
1162
+ }
1163
+ },
1164
+ "total_flos": 0.0,
1165
+ "train_batch_size": 4,
1166
+ "trial_name": null,
1167
+ "trial_params": null
1168
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db38230b28081e24464a87f7c4d5240f139856cb1aee7a42ebf5f6c3efc93bc2
3
+ size 7864
zero_to_fp32.py ADDED
@@ -0,0 +1,760 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example:
14
+ # python zero_to_fp32.py . output_dir/
15
+ # or
16
+ # python zero_to_fp32.py . output_dir/ --safe_serialization
17
+
18
+ import argparse
19
+ import torch
20
+ import glob
21
+ import math
22
+ import os
23
+ import re
24
+ import gc
25
+ import json
26
+ import numpy as np
27
+ from tqdm import tqdm
28
+ from collections import OrderedDict
29
+ from dataclasses import dataclass
30
+
31
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
32
+ # DeepSpeed data structures it has to be available in the current python environment.
33
+ from deepspeed.utils import logger
34
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
35
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
36
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
37
+
38
+
39
+ @dataclass
40
+ class zero_model_state:
41
+ buffers: dict()
42
+ param_shapes: dict()
43
+ shared_params: list
44
+ ds_version: int
45
+ frozen_param_shapes: dict()
46
+ frozen_param_fragments: dict()
47
+
48
+
49
+ debug = 0
50
+
51
+ # load to cpu
52
+ device = torch.device('cpu')
53
+
54
+
55
+ def atoi(text):
56
+ return int(text) if text.isdigit() else text
57
+
58
+
59
+ def natural_keys(text):
60
+ '''
61
+ alist.sort(key=natural_keys) sorts in human order
62
+ http://nedbatchelder.com/blog/200712/human_sorting.html
63
+ (See Toothy's implementation in the comments)
64
+ '''
65
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
66
+
67
+
68
+ def get_model_state_file(checkpoint_dir, zero_stage):
69
+ if not os.path.isdir(checkpoint_dir):
70
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
71
+
72
+ # there should be only one file
73
+ if zero_stage <= 2:
74
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
75
+ elif zero_stage == 3:
76
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
77
+
78
+ if not os.path.exists(file):
79
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
80
+
81
+ return file
82
+
83
+
84
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
85
+ # XXX: need to test that this simple glob rule works for multi-node setup too
86
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
87
+
88
+ if len(ckpt_files) == 0:
89
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
90
+
91
+ return ckpt_files
92
+
93
+
94
+ def get_optim_files(checkpoint_dir):
95
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
96
+
97
+
98
+ def get_model_state_files(checkpoint_dir):
99
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
100
+
101
+
102
+ def parse_model_states(files):
103
+ zero_model_states = []
104
+ for file in files:
105
+ state_dict = torch.load(file, map_location=device, weights_only=False)
106
+
107
+ if BUFFER_NAMES not in state_dict:
108
+ raise ValueError(f"{file} is not a model state checkpoint")
109
+ buffer_names = state_dict[BUFFER_NAMES]
110
+ if debug:
111
+ print("Found buffers:", buffer_names)
112
+
113
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
114
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
115
+ param_shapes = state_dict[PARAM_SHAPES]
116
+
117
+ # collect parameters that are included in param_shapes
118
+ param_names = []
119
+ for s in param_shapes:
120
+ for name in s.keys():
121
+ param_names.append(name)
122
+
123
+ # update with frozen parameters
124
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
125
+ if frozen_param_shapes is not None:
126
+ if debug:
127
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
128
+ param_names += list(frozen_param_shapes.keys())
129
+
130
+ # handle shared params
131
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
132
+
133
+ ds_version = state_dict.get(DS_VERSION, None)
134
+
135
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
136
+
137
+ z_model_state = zero_model_state(buffers=buffers,
138
+ param_shapes=param_shapes,
139
+ shared_params=shared_params,
140
+ ds_version=ds_version,
141
+ frozen_param_shapes=frozen_param_shapes,
142
+ frozen_param_fragments=frozen_param_fragments)
143
+ zero_model_states.append(z_model_state)
144
+
145
+ return zero_model_states
146
+
147
+
148
+ def parse_optim_states(files, ds_checkpoint_dir):
149
+ total_files = len(files)
150
+ state_dicts = []
151
+ for f in tqdm(files, desc='Loading checkpoint shards'):
152
+ state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
153
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
154
+ # and also handle the case where it was already removed by another helper script
155
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
156
+ state_dicts.append(state_dict)
157
+
158
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
159
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
160
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
161
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
162
+
163
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
164
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
165
+ # use the max of the partition_count to get the dp world_size.
166
+
167
+ if type(world_size) is list:
168
+ world_size = max(world_size)
169
+
170
+ if world_size != total_files:
171
+ raise ValueError(
172
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
173
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
174
+ )
175
+
176
+ # the groups are named differently in each stage
177
+ if zero_stage <= 2:
178
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
179
+ elif zero_stage == 3:
180
+ fp32_groups_key = FP32_FLAT_GROUPS
181
+ else:
182
+ raise ValueError(f"unknown zero stage {zero_stage}")
183
+
184
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
185
+ return zero_stage, world_size, fp32_flat_groups
186
+
187
+
188
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
189
+ """
190
+ Returns fp32 state_dict reconstructed from ds checkpoint
191
+
192
+ Args:
193
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
194
+
195
+ """
196
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
197
+
198
+ optim_files = get_optim_files(ds_checkpoint_dir)
199
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
200
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
201
+
202
+ model_files = get_model_state_files(ds_checkpoint_dir)
203
+
204
+ zero_model_states = parse_model_states(model_files)
205
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
206
+
207
+ if zero_stage <= 2:
208
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
209
+ exclude_frozen_parameters)
210
+ elif zero_stage == 3:
211
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
212
+ exclude_frozen_parameters)
213
+
214
+
215
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
216
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
217
+ return
218
+
219
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
220
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
221
+
222
+ if debug:
223
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
224
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
225
+
226
+ wanted_params = len(frozen_param_shapes)
227
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
228
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
229
+ print(f'Frozen params: Have {avail_numel} numels to process.')
230
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
231
+
232
+ total_params = 0
233
+ total_numel = 0
234
+ for name, shape in frozen_param_shapes.items():
235
+ total_params += 1
236
+ unpartitioned_numel = shape.numel()
237
+ total_numel += unpartitioned_numel
238
+
239
+ state_dict[name] = frozen_param_fragments[name]
240
+
241
+ if debug:
242
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
243
+
244
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
245
+
246
+
247
+ def _has_callable(obj, fn):
248
+ attr = getattr(obj, fn, None)
249
+ return callable(attr)
250
+
251
+
252
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
253
+ param_shapes = zero_model_states[0].param_shapes
254
+
255
+ # Reconstruction protocol:
256
+ #
257
+ # XXX: document this
258
+
259
+ if debug:
260
+ for i in range(world_size):
261
+ for j in range(len(fp32_flat_groups[0])):
262
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
263
+
264
+ # XXX: memory usage doubles here (zero2)
265
+ num_param_groups = len(fp32_flat_groups[0])
266
+ merged_single_partition_of_fp32_groups = []
267
+ for i in range(num_param_groups):
268
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
269
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
270
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
271
+ avail_numel = sum(
272
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
273
+
274
+ if debug:
275
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
276
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
277
+ # not asserting if there is a mismatch due to possible padding
278
+ print(f"Have {avail_numel} numels to process.")
279
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
280
+
281
+ # params
282
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
283
+ # out-of-core computing solution
284
+ total_numel = 0
285
+ total_params = 0
286
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
287
+ offset = 0
288
+ avail_numel = full_single_fp32_vector.numel()
289
+ for name, shape in shapes.items():
290
+
291
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
292
+ total_numel += unpartitioned_numel
293
+ total_params += 1
294
+
295
+ if debug:
296
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
297
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
298
+ offset += unpartitioned_numel
299
+
300
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
301
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
302
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
303
+ # live optimizer object, so we are checking that the numbers are within the right range
304
+ align_to = 2 * world_size
305
+
306
+ def zero2_align(x):
307
+ return align_to * math.ceil(x / align_to)
308
+
309
+ if debug:
310
+ print(f"original offset={offset}, avail_numel={avail_numel}")
311
+
312
+ offset = zero2_align(offset)
313
+ avail_numel = zero2_align(avail_numel)
314
+
315
+ if debug:
316
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
317
+
318
+ # Sanity check
319
+ if offset != avail_numel:
320
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
321
+
322
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
323
+
324
+
325
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
326
+ exclude_frozen_parameters):
327
+ state_dict = OrderedDict()
328
+
329
+ # buffers
330
+ buffers = zero_model_states[0].buffers
331
+ state_dict.update(buffers)
332
+ if debug:
333
+ print(f"added {len(buffers)} buffers")
334
+
335
+ if not exclude_frozen_parameters:
336
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
337
+
338
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
339
+
340
+ # recover shared parameters
341
+ for pair in zero_model_states[0].shared_params:
342
+ if pair[1] in state_dict:
343
+ state_dict[pair[0]] = state_dict[pair[1]]
344
+
345
+ return state_dict
346
+
347
+
348
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
349
+ remainder = unpartitioned_numel % world_size
350
+ padding_numel = (world_size - remainder) if remainder else 0
351
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
352
+ return partitioned_numel, padding_numel
353
+
354
+
355
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
356
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
357
+ return
358
+
359
+ if debug:
360
+ for i in range(world_size):
361
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
362
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
363
+
364
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
365
+ wanted_params = len(frozen_param_shapes)
366
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
367
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
368
+ print(f'Frozen params: Have {avail_numel} numels to process.')
369
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
370
+
371
+ total_params = 0
372
+ total_numel = 0
373
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
374
+ total_params += 1
375
+ unpartitioned_numel = shape.numel()
376
+ total_numel += unpartitioned_numel
377
+
378
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
379
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
380
+
381
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
382
+
383
+ if debug:
384
+ print(
385
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
386
+ )
387
+
388
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
389
+
390
+
391
+ class GatheredTensor:
392
+ """
393
+ A pseudo tensor that collects partitioned weights.
394
+ It is more memory efficient when there are multiple groups.
395
+ """
396
+
397
+ def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
398
+ self.flat_groups = flat_groups
399
+ self.flat_groups_offset = flat_groups_offset
400
+ self.offset = offset
401
+ self.partitioned_numel = partitioned_numel
402
+ self.shape = shape
403
+ self.dtype = self.flat_groups[0][0].dtype
404
+
405
+ def contiguous(self):
406
+ """
407
+ Merge partitioned weights from flat_groups into a single tensor.
408
+ """
409
+ end_idx = self.offset + self.partitioned_numel
410
+ world_size = len(self.flat_groups)
411
+ pad_flat_param_chunks = []
412
+
413
+ for rank_i in range(world_size):
414
+ # for each rank, we need to collect weights from related group/groups
415
+ flat_groups_at_rank_i = self.flat_groups[rank_i]
416
+ start_group_id = None
417
+ end_group_id = None
418
+ for group_id in range(len(self.flat_groups_offset)):
419
+ if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
420
+ start_group_id = group_id
421
+ if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
422
+ end_group_id = group_id
423
+ break
424
+ # collect weights from related group/groups
425
+ for group_id in range(start_group_id, end_group_id + 1):
426
+ flat_tensor = flat_groups_at_rank_i[group_id]
427
+ start_offset = self.offset - self.flat_groups_offset[group_id]
428
+ end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
429
+ pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
430
+
431
+ # collect weights from all ranks
432
+ pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
433
+ param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
434
+ return param
435
+
436
+
437
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
438
+ param_shapes = zero_model_states[0].param_shapes
439
+ avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
440
+
441
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
442
+ # param, re-consolidating each param, while dealing with padding if any
443
+
444
+ # merge list of dicts, preserving order
445
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
446
+
447
+ if debug:
448
+ for i in range(world_size):
449
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
450
+
451
+ wanted_params = len(param_shapes)
452
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
453
+ # not asserting if there is a mismatch due to possible padding
454
+ avail_numel = fp32_flat_groups[0].numel() * world_size
455
+ print(f"Trainable params: Have {avail_numel} numels to process.")
456
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
457
+
458
+ # params
459
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
460
+ # out-of-core computing solution
461
+ offset = 0
462
+ total_numel = 0
463
+ total_params = 0
464
+ flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
465
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
466
+ unpartitioned_numel = shape.numel()
467
+ total_numel += unpartitioned_numel
468
+ total_params += 1
469
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
470
+
471
+ if debug:
472
+ print(
473
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
474
+ )
475
+
476
+ # memory efficient tensor
477
+ tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
478
+ state_dict[name] = tensor
479
+ offset += partitioned_numel
480
+
481
+ offset *= world_size
482
+
483
+ # Sanity check
484
+ if offset != avail_numel:
485
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
486
+
487
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
488
+
489
+
490
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
491
+ exclude_frozen_parameters):
492
+ state_dict = OrderedDict()
493
+
494
+ # buffers
495
+ buffers = zero_model_states[0].buffers
496
+ state_dict.update(buffers)
497
+ if debug:
498
+ print(f"added {len(buffers)} buffers")
499
+
500
+ if not exclude_frozen_parameters:
501
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
502
+
503
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
504
+
505
+ # recover shared parameters
506
+ for pair in zero_model_states[0].shared_params:
507
+ if pair[1] in state_dict:
508
+ state_dict[pair[0]] = state_dict[pair[1]]
509
+
510
+ return state_dict
511
+
512
+
513
+ def to_torch_tensor(state_dict, return_empty_tensor=False):
514
+ """
515
+ Convert state_dict of GatheredTensor to torch tensor
516
+ """
517
+ torch_state_dict = {}
518
+ converted_tensors = {}
519
+ for name, tensor in state_dict.items():
520
+ tensor_id = id(tensor)
521
+ if tensor_id in converted_tensors: # shared tensors
522
+ shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
523
+ torch_state_dict[name] = shared_tensor
524
+ else:
525
+ converted_tensors[tensor_id] = name
526
+ if return_empty_tensor:
527
+ torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
528
+ else:
529
+ torch_state_dict[name] = tensor.contiguous()
530
+ return torch_state_dict
531
+
532
+
533
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
534
+ tag=None,
535
+ exclude_frozen_parameters=False,
536
+ lazy_mode=False):
537
+ """
538
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
539
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
540
+ via a model hub.
541
+
542
+ Args:
543
+ - ``checkpoint_dir``: path to the desired checkpoint folder
544
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
545
+ - ``exclude_frozen_parameters``: exclude frozen parameters
546
+ - ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
547
+ Convert the pesduo tensor to torch tensor by ``.contiguous()``
548
+
549
+ Returns:
550
+ - pytorch ``state_dict``
551
+
552
+ A typical usage might be ::
553
+
554
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
555
+ # do the training and checkpoint saving
556
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
557
+ model = model.cpu() # move to cpu
558
+ model.load_state_dict(state_dict)
559
+ # submit to model hub or save the model to share with others
560
+
561
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
562
+ application. i.e. you will need to re-initialize the deepspeed engine, since
563
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
564
+
565
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
566
+
567
+ Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
568
+ You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
569
+ the checkpoint. Or you can load state_dict in lazy mode ::
570
+
571
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
572
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
573
+ for name, lazy_tensor in state_dict.item():
574
+ tensor = lazy_tensor.contiguous() # to cpu
575
+ print(name, tensor)
576
+ # del tensor to release memory if it no longer in use
577
+ """
578
+ if tag is None:
579
+ latest_path = os.path.join(checkpoint_dir, 'latest')
580
+ if os.path.isfile(latest_path):
581
+ with open(latest_path, 'r') as fd:
582
+ tag = fd.read().strip()
583
+ else:
584
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
585
+
586
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
587
+
588
+ if not os.path.isdir(ds_checkpoint_dir):
589
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
590
+
591
+ state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
592
+ if lazy_mode:
593
+ return state_dict
594
+ else:
595
+ return to_torch_tensor(state_dict)
596
+
597
+
598
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
599
+ output_dir,
600
+ max_shard_size="5GB",
601
+ safe_serialization=False,
602
+ tag=None,
603
+ exclude_frozen_parameters=False):
604
+ """
605
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
606
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
607
+
608
+ Args:
609
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
610
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
611
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
612
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
613
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
614
+ - ``exclude_frozen_parameters``: exclude frozen parameters
615
+ """
616
+
617
+ # Dependency pre-check
618
+ if safe_serialization:
619
+ try:
620
+ from safetensors.torch import save_file
621
+ except ImportError:
622
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
623
+ raise
624
+ if max_shard_size is not None:
625
+ try:
626
+ from huggingface_hub import split_torch_state_dict_into_shards
627
+ except ImportError:
628
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
629
+ raise
630
+
631
+ # Convert zero checkpoint to state_dict
632
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
633
+ tag,
634
+ exclude_frozen_parameters,
635
+ lazy_mode=True)
636
+
637
+ # Shard the model if it is too big.
638
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
639
+ if max_shard_size is not None:
640
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
641
+ # an memory-efficient approach for sharding
642
+ empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
643
+ state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
644
+ filename_pattern=filename_pattern,
645
+ max_shard_size=max_shard_size)
646
+ else:
647
+ from collections import namedtuple
648
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
649
+ state_dict_split = StateDictSplit(is_sharded=False,
650
+ filename_to_tensors={weights_name: list(state_dict.keys())})
651
+
652
+ # Save the model by shard
653
+ os.makedirs(output_dir, exist_ok=True)
654
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
655
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
656
+ shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
657
+ shard_state_dict = to_torch_tensor(shard_state_dict)
658
+ output_path = os.path.join(output_dir, shard_file)
659
+ if safe_serialization:
660
+ save_file(shard_state_dict, output_path, metadata={"format": "pt"})
661
+ else:
662
+ torch.save(shard_state_dict, output_path)
663
+ # release the memory of current shard
664
+ for tensor_name in list(shard_state_dict.keys()):
665
+ del state_dict[tensor_name]
666
+ del shard_state_dict[tensor_name]
667
+ del shard_state_dict
668
+ gc.collect()
669
+
670
+ # Save index if sharded
671
+ if state_dict_split.is_sharded:
672
+ index = {
673
+ "metadata": state_dict_split.metadata,
674
+ "weight_map": state_dict_split.tensor_to_filename,
675
+ }
676
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
677
+ save_index_file = os.path.join(output_dir, save_index_file)
678
+ with open(save_index_file, "w", encoding="utf-8") as f:
679
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
680
+ f.write(content)
681
+
682
+
683
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
684
+ """
685
+ 1. Put the provided model to cpu
686
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
687
+ 3. Load it into the provided model
688
+
689
+ Args:
690
+ - ``model``: the model object to update
691
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
692
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
693
+
694
+ Returns:
695
+ - ``model`: modified model
696
+
697
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
698
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
699
+ conveniently placed for you in the checkpoint folder.
700
+
701
+ A typical usage might be ::
702
+
703
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
704
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
705
+ # submit to model hub or save the model to share with others
706
+
707
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
708
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
709
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
710
+
711
+ """
712
+ logger.info(f"Extracting fp32 weights")
713
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
714
+
715
+ logger.info(f"Overwriting model with fp32 weights")
716
+ model = model.cpu()
717
+ model.load_state_dict(state_dict, strict=False)
718
+
719
+ return model
720
+
721
+
722
+ if __name__ == "__main__":
723
+ parser = argparse.ArgumentParser()
724
+ parser.add_argument("checkpoint_dir",
725
+ type=str,
726
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
727
+ parser.add_argument("output_dir",
728
+ type=str,
729
+ help="directory to the pytorch fp32 state_dict output files"
730
+ "(e.g. path/checkpoint-12-output/)")
731
+ parser.add_argument(
732
+ "--max_shard_size",
733
+ type=str,
734
+ default="5GB",
735
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
736
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
737
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
738
+ "without CPU OOM issues.")
739
+ parser.add_argument(
740
+ "--safe_serialization",
741
+ default=False,
742
+ action='store_true',
743
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
744
+ parser.add_argument("-t",
745
+ "--tag",
746
+ type=str,
747
+ default=None,
748
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
749
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
750
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
751
+ args = parser.parse_args()
752
+
753
+ debug = args.debug
754
+
755
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
756
+ args.output_dir,
757
+ max_shard_size=args.max_shard_size,
758
+ safe_serialization=args.safe_serialization,
759
+ tag=args.tag,
760
+ exclude_frozen_parameters=args.exclude_frozen_parameters)