LLucass commited on
Commit
1b6f6d0
·
verified ·
1 Parent(s): 2e21f0d

Training in progress, step 50, checkpoint

Browse files
.gitattributes CHANGED
@@ -34,3 +34,4 @@ saved_model/**/* 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
 
 
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
37
+ checkpoint-50/tokenizer.json filter=lfs diff=lfs merge=lfs -text
checkpoint-50/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": 1536,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 8960,
12
+ "max_position_embeddings": 131072,
13
+ "max_window_layers": 21,
14
+ "model_type": "qwen2",
15
+ "num_attention_heads": 12,
16
+ "num_hidden_layers": 28,
17
+ "num_key_value_heads": 2,
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": 151936
29
+ }
checkpoint-50/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
+ }
checkpoint-50/global_step50/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:04d7c4a753ad8773e2bc43bcfeb2976f8837949927125a64e5587cfc2187b89e
3
+ size 5331274140
checkpoint-50/global_step50/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cd6cd1723ab6752efaea5a922408fdf67cfef7c8af98509f7d8384e09b992cb6
3
+ size 5331276572
checkpoint-50/global_step50/bf16_zero_pp_rank_2_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d2523a1882f16bcf66cf73a7b1d0710fba96bfe430068dddc0a8682ae23c6686
3
+ size 5331276892
checkpoint-50/global_step50/bf16_zero_pp_rank_3_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:70e5c0eda53efef25069fb4e290ad2de62b0a6bb07153b0c2803465ac175808d
3
+ size 5331273884
checkpoint-50/global_step50/mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a3168d276e15e44440db87bd9594897cd34871b3a5ca24040924d51bbb4b47d0
3
+ size 3554267640
checkpoint-50/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step50
checkpoint-50/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:396f0d1abcb130e9903eccdcabcb61e7502a8ded1258d55c9749c124dee7c71a
3
+ size 3554214752
checkpoint-50/rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2702d282c4493893603dc2a13af95d09e111a64c63f52fb9af5255406ae8d654
3
+ size 14960
checkpoint-50/rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:430e93858450810d232345690d663543e8bbf2a60c00a022392222fb16ec625f
3
+ size 14960
checkpoint-50/rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:158ffd4abe490709b9e9d3b062da97147f2d078f352a84f7c20b893ff17f6452
3
+ size 14960
checkpoint-50/rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:67b5fbbcde50895969936bc2537f01f041594a2ca632fbec18fb08928d76422d
3
+ size 14960
checkpoint-50/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0208179da2b605778b21720a99ccfb3d5e515115ee90824c90bfcabf8ad99120
3
+ size 1064
checkpoint-50/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
+ }
checkpoint-50/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4256422650d141f228fe954acee98679da412984c29a569877eefd3af69315a
3
+ size 11422959
checkpoint-50/tokenizer_config.json ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "sp_model_kwargs": {},
192
+ "tokenizer_class": "LlamaTokenizerFast",
193
+ "unk_token": null,
194
+ "use_default_system_prompt": false
195
+ }
checkpoint-50/trainer_state.json ADDED
@@ -0,0 +1,1384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 0.05714285714285714,
6
+ "eval_steps": 500,
7
+ "global_step": 50,
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.671875,
19
+ "completions/max_length": 2048.0,
20
+ "completions/max_terminated_length": 1734.0,
21
+ "completions/mean_length": 1702.03125,
22
+ "completions/mean_terminated_length": 993.6190795898438,
23
+ "completions/min_length": 483.0,
24
+ "completions/min_terminated_length": 483.0,
25
+ "epoch": 0.001142857142857143,
26
+ "frac_reward_zero_std": 0.0,
27
+ "grad_norm": 0.20054349303245544,
28
+ "learning_rate": 0.0,
29
+ "loss": 0.0427,
30
+ "num_tokens": 118418.0,
31
+ "reward": 0.17899775505065918,
32
+ "reward_std": 0.7650213241577148,
33
+ "rewards/cosine_scaled_reward/mean": -0.09800112992525101,
34
+ "rewards/cosine_scaled_reward/std": 0.37953105568885803,
35
+ "rewards/format_reward/mean": 0.375,
36
+ "rewards/format_reward/std": 0.48795005679130554,
37
+ "step": 1
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.71875,
46
+ "completions/max_length": 2048.0,
47
+ "completions/max_terminated_length": 1894.0,
48
+ "completions/mean_length": 1738.90625,
49
+ "completions/mean_terminated_length": 949.0,
50
+ "completions/min_length": 435.0,
51
+ "completions/min_terminated_length": 435.0,
52
+ "epoch": 0.002285714285714286,
53
+ "frac_reward_zero_std": 0.0,
54
+ "grad_norm": 0.19502359628677368,
55
+ "learning_rate": 5e-08,
56
+ "loss": 0.0561,
57
+ "num_tokens": 239748.0,
58
+ "reward": 0.3848632574081421,
59
+ "reward_std": 0.9111153483390808,
60
+ "rewards/cosine_scaled_reward/mean": 0.020556632429361343,
61
+ "rewards/cosine_scaled_reward/std": 0.4492928683757782,
62
+ "rewards/format_reward/mean": 0.34375,
63
+ "rewards/format_reward/std": 0.4787135720252991,
64
+ "step": 2
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.90625,
73
+ "completions/max_length": 2048.0,
74
+ "completions/max_terminated_length": 1287.0,
75
+ "completions/mean_length": 1944.453125,
76
+ "completions/mean_terminated_length": 943.5,
77
+ "completions/min_length": 608.0,
78
+ "completions/min_terminated_length": 608.0,
79
+ "epoch": 0.0034285714285714284,
80
+ "frac_reward_zero_std": 0.0,
81
+ "grad_norm": 0.230765700340271,
82
+ "learning_rate": 1e-07,
83
+ "loss": 0.0549,
84
+ "num_tokens": 374665.0,
85
+ "reward": -0.28856638073921204,
86
+ "reward_std": 0.4003669023513794,
87
+ "rewards/cosine_scaled_reward/mean": -0.19897069036960602,
88
+ "rewards/cosine_scaled_reward/std": 0.18252794444561005,
89
+ "rewards/format_reward/mean": 0.109375,
90
+ "rewards/format_reward/std": 0.3145764470100403,
91
+ "step": 3
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.5625,
100
+ "completions/max_length": 2048.0,
101
+ "completions/max_terminated_length": 1871.0,
102
+ "completions/mean_length": 1592.3125,
103
+ "completions/mean_terminated_length": 1006.4285888671875,
104
+ "completions/min_length": 450.0,
105
+ "completions/min_terminated_length": 450.0,
106
+ "epoch": 0.004571428571428572,
107
+ "frac_reward_zero_std": 0.0,
108
+ "grad_norm": 0.20995420217514038,
109
+ "learning_rate": 1.5e-07,
110
+ "loss": 0.1266,
111
+ "num_tokens": 486381.0,
112
+ "reward": 0.20640414953231812,
113
+ "reward_std": 0.8193759918212891,
114
+ "rewards/cosine_scaled_reward/mean": -0.13117292523384094,
115
+ "rewards/cosine_scaled_reward/std": 0.35454094409942627,
116
+ "rewards/format_reward/mean": 0.46875,
117
+ "rewards/format_reward/std": 0.5029674172401428,
118
+ "step": 4
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.953125,
127
+ "completions/max_length": 2048.0,
128
+ "completions/max_terminated_length": 1680.0,
129
+ "completions/mean_length": 2002.859375,
130
+ "completions/mean_terminated_length": 1085.0,
131
+ "completions/min_length": 755.0,
132
+ "completions/min_terminated_length": 755.0,
133
+ "epoch": 0.005714285714285714,
134
+ "frac_reward_zero_std": 0.0,
135
+ "grad_norm": 0.23816199600696564,
136
+ "learning_rate": 2e-07,
137
+ "loss": 0.01,
138
+ "num_tokens": 625380.0,
139
+ "reward": -0.41131818294525146,
140
+ "reward_std": 0.30660682916641235,
141
+ "rewards/cosine_scaled_reward/mean": -0.24472159147262573,
142
+ "rewards/cosine_scaled_reward/std": 0.19079075753688812,
143
+ "rewards/format_reward/mean": 0.078125,
144
+ "rewards/format_reward/std": 0.27048972249031067,
145
+ "step": 5
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.875,
154
+ "completions/max_length": 2048.0,
155
+ "completions/max_terminated_length": 1344.0,
156
+ "completions/mean_length": 1890.0,
157
+ "completions/mean_terminated_length": 784.0,
158
+ "completions/min_length": 440.0,
159
+ "completions/min_terminated_length": 440.0,
160
+ "epoch": 0.006857142857142857,
161
+ "frac_reward_zero_std": 0.0,
162
+ "grad_norm": 0.24285951256752014,
163
+ "learning_rate": 2.5e-07,
164
+ "loss": -0.0119,
165
+ "num_tokens": 757988.0,
166
+ "reward": -0.24828195571899414,
167
+ "reward_std": 0.3839319050312042,
168
+ "rewards/cosine_scaled_reward/mean": -0.19445347785949707,
169
+ "rewards/cosine_scaled_reward/std": 0.19692479074001312,
170
+ "rewards/format_reward/mean": 0.140625,
171
+ "rewards/format_reward/std": 0.3503824472427368,
172
+ "step": 6
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.828125,
181
+ "completions/max_length": 2048.0,
182
+ "completions/max_terminated_length": 1941.0,
183
+ "completions/mean_length": 1935.046875,
184
+ "completions/mean_terminated_length": 1390.8182373046875,
185
+ "completions/min_length": 886.0,
186
+ "completions/min_terminated_length": 886.0,
187
+ "epoch": 0.008,
188
+ "frac_reward_zero_std": 0.0,
189
+ "grad_norm": 0.2183438539505005,
190
+ "learning_rate": 3e-07,
191
+ "loss": 0.0412,
192
+ "num_tokens": 892239.0,
193
+ "reward": -0.07044821977615356,
194
+ "reward_std": 0.5991545915603638,
195
+ "rewards/cosine_scaled_reward/mean": -0.14459910988807678,
196
+ "rewards/cosine_scaled_reward/std": 0.3703240156173706,
197
+ "rewards/format_reward/mean": 0.21875,
198
+ "rewards/format_reward/std": 0.4166666865348816,
199
+ "step": 7
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.71875,
208
+ "completions/max_length": 2048.0,
209
+ "completions/max_terminated_length": 1957.0,
210
+ "completions/mean_length": 1743.921875,
211
+ "completions/mean_terminated_length": 966.8333129882812,
212
+ "completions/min_length": 296.0,
213
+ "completions/min_terminated_length": 296.0,
214
+ "epoch": 0.009142857142857144,
215
+ "frac_reward_zero_std": 0.0,
216
+ "grad_norm": 0.18490855395793915,
217
+ "learning_rate": 3.5e-07,
218
+ "loss": 0.0096,
219
+ "num_tokens": 1014266.0,
220
+ "reward": 0.07391861081123352,
221
+ "reward_std": 0.5062483549118042,
222
+ "rewards/cosine_scaled_reward/mean": -0.11929068714380264,
223
+ "rewards/cosine_scaled_reward/std": 0.4095526933670044,
224
+ "rewards/format_reward/mean": 0.3125,
225
+ "rewards/format_reward/std": 0.467176616191864,
226
+ "step": 8
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.859375,
235
+ "completions/max_length": 2048.0,
236
+ "completions/max_terminated_length": 1790.0,
237
+ "completions/mean_length": 1965.46875,
238
+ "completions/mean_terminated_length": 1461.111083984375,
239
+ "completions/min_length": 1029.0,
240
+ "completions/min_terminated_length": 1029.0,
241
+ "epoch": 0.010285714285714285,
242
+ "frac_reward_zero_std": 0.0,
243
+ "grad_norm": 0.21707069873809814,
244
+ "learning_rate": 4e-07,
245
+ "loss": 0.0566,
246
+ "num_tokens": 1151512.0,
247
+ "reward": -0.15350507199764252,
248
+ "reward_std": 0.7245944738388062,
249
+ "rewards/cosine_scaled_reward/mean": -0.18612754344940186,
250
+ "rewards/cosine_scaled_reward/std": 0.30883485078811646,
251
+ "rewards/format_reward/mean": 0.21875,
252
+ "rewards/format_reward/std": 0.4166666865348816,
253
+ "step": 9
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.703125,
262
+ "completions/max_length": 2048.0,
263
+ "completions/max_terminated_length": 1745.0,
264
+ "completions/mean_length": 1682.59375,
265
+ "completions/mean_terminated_length": 817.1578979492188,
266
+ "completions/min_length": 394.0,
267
+ "completions/min_terminated_length": 394.0,
268
+ "epoch": 0.011428571428571429,
269
+ "frac_reward_zero_std": 0.0,
270
+ "grad_norm": 0.20094214379787445,
271
+ "learning_rate": 4.5e-07,
272
+ "loss": 0.0457,
273
+ "num_tokens": 1270030.0,
274
+ "reward": 0.027805477380752563,
275
+ "reward_std": 0.4805509150028229,
276
+ "rewards/cosine_scaled_reward/mean": -0.14234726130962372,
277
+ "rewards/cosine_scaled_reward/std": 0.26565250754356384,
278
+ "rewards/format_reward/mean": 0.3125,
279
+ "rewards/format_reward/std": 0.467176616191864,
280
+ "step": 10
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.953125,
289
+ "completions/max_length": 2048.0,
290
+ "completions/max_terminated_length": 1094.0,
291
+ "completions/mean_length": 1998.15625,
292
+ "completions/mean_terminated_length": 984.6666870117188,
293
+ "completions/min_length": 798.0,
294
+ "completions/min_terminated_length": 798.0,
295
+ "epoch": 0.012571428571428572,
296
+ "frac_reward_zero_std": 0.0,
297
+ "grad_norm": 0.2170705795288086,
298
+ "learning_rate": 5e-07,
299
+ "loss": 0.0247,
300
+ "num_tokens": 1409584.0,
301
+ "reward": -0.43332377076148987,
302
+ "reward_std": 0.36288702487945557,
303
+ "rewards/cosine_scaled_reward/mean": -0.24791188538074493,
304
+ "rewards/cosine_scaled_reward/std": 0.17533892393112183,
305
+ "rewards/format_reward/mean": 0.0625,
306
+ "rewards/format_reward/std": 0.24397502839565277,
307
+ "step": 11
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.5625,
316
+ "completions/max_length": 2048.0,
317
+ "completions/max_terminated_length": 2044.0,
318
+ "completions/mean_length": 1630.375,
319
+ "completions/mean_terminated_length": 1093.4285888671875,
320
+ "completions/min_length": 427.0,
321
+ "completions/min_terminated_length": 427.0,
322
+ "epoch": 0.013714285714285714,
323
+ "frac_reward_zero_std": 0.0,
324
+ "grad_norm": 0.2160935252904892,
325
+ "learning_rate": 5.5e-07,
326
+ "loss": 0.0753,
327
+ "num_tokens": 1524872.0,
328
+ "reward": 0.0067175328731536865,
329
+ "reward_std": 0.689138650894165,
330
+ "rewards/cosine_scaled_reward/mean": -0.22320374846458435,
331
+ "rewards/cosine_scaled_reward/std": 0.3645767867565155,
332
+ "rewards/format_reward/mean": 0.453125,
333
+ "rewards/format_reward/std": 0.501733124256134,
334
+ "step": 12
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.78125,
343
+ "completions/max_length": 2048.0,
344
+ "completions/max_terminated_length": 1751.0,
345
+ "completions/mean_length": 1833.453125,
346
+ "completions/mean_terminated_length": 1067.21435546875,
347
+ "completions/min_length": 616.0,
348
+ "completions/min_terminated_length": 616.0,
349
+ "epoch": 0.014857142857142857,
350
+ "frac_reward_zero_std": 0.0,
351
+ "grad_norm": 0.2122364640235901,
352
+ "learning_rate": 6e-07,
353
+ "loss": 0.0326,
354
+ "num_tokens": 1653253.0,
355
+ "reward": -0.09265299141407013,
356
+ "reward_std": 0.5985201001167297,
357
+ "rewards/cosine_scaled_reward/mean": -0.17913900315761566,
358
+ "rewards/cosine_scaled_reward/std": 0.306300550699234,
359
+ "rewards/format_reward/mean": 0.265625,
360
+ "rewards/format_reward/std": 0.44515693187713623,
361
+ "step": 13
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.734375,
370
+ "completions/max_length": 2048.0,
371
+ "completions/max_terminated_length": 1897.0,
372
+ "completions/mean_length": 1823.40625,
373
+ "completions/mean_terminated_length": 1202.4705810546875,
374
+ "completions/min_length": 605.0,
375
+ "completions/min_terminated_length": 605.0,
376
+ "epoch": 0.016,
377
+ "frac_reward_zero_std": 0.0,
378
+ "grad_norm": 0.2076576203107834,
379
+ "learning_rate": 6.5e-07,
380
+ "loss": 0.0261,
381
+ "num_tokens": 1780559.0,
382
+ "reward": 0.005522748455405235,
383
+ "reward_std": 0.7086418867111206,
384
+ "rewards/cosine_scaled_reward/mean": -0.1378636360168457,
385
+ "rewards/cosine_scaled_reward/std": 0.35400503873825073,
386
+ "rewards/format_reward/mean": 0.28125,
387
+ "rewards/format_reward/std": 0.4531635046005249,
388
+ "step": 14
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.734375,
397
+ "completions/max_length": 2048.0,
398
+ "completions/max_terminated_length": 1328.0,
399
+ "completions/mean_length": 1698.171875,
400
+ "completions/mean_terminated_length": 731.0,
401
+ "completions/min_length": 391.0,
402
+ "completions/min_terminated_length": 391.0,
403
+ "epoch": 0.017142857142857144,
404
+ "frac_reward_zero_std": 0.0,
405
+ "grad_norm": 0.1969502866268158,
406
+ "learning_rate": 7e-07,
407
+ "loss": 0.0216,
408
+ "num_tokens": 1900162.0,
409
+ "reward": 0.2789269685745239,
410
+ "reward_std": 0.43547046184539795,
411
+ "rewards/cosine_scaled_reward/mean": -0.00897398591041565,
412
+ "rewards/cosine_scaled_reward/std": 0.4515364170074463,
413
+ "rewards/format_reward/mean": 0.296875,
414
+ "rewards/format_reward/std": 0.4604927599430084,
415
+ "step": 15
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": 1.0,
424
+ "completions/max_length": 2048.0,
425
+ "completions/max_terminated_length": 0.0,
426
+ "completions/mean_length": 2048.0,
427
+ "completions/mean_terminated_length": 0.0,
428
+ "completions/min_length": 2048.0,
429
+ "completions/min_terminated_length": 0.0,
430
+ "epoch": 0.018285714285714287,
431
+ "frac_reward_zero_std": 0.0,
432
+ "grad_norm": 0.23300249874591827,
433
+ "learning_rate": 7.5e-07,
434
+ "loss": -0.0,
435
+ "num_tokens": 2041674.0,
436
+ "reward": -0.5078557729721069,
437
+ "reward_std": 0.3458974361419678,
438
+ "rewards/cosine_scaled_reward/mean": -0.25392788648605347,
439
+ "rewards/cosine_scaled_reward/std": 0.18378609418869019,
440
+ "rewards/format_reward/mean": 0.0,
441
+ "rewards/format_reward/std": 0.0,
442
+ "step": 16
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.5625,
451
+ "completions/max_length": 2048.0,
452
+ "completions/max_terminated_length": 1916.0,
453
+ "completions/mean_length": 1563.734375,
454
+ "completions/mean_terminated_length": 941.107177734375,
455
+ "completions/min_length": 389.0,
456
+ "completions/min_terminated_length": 389.0,
457
+ "epoch": 0.019428571428571427,
458
+ "frac_reward_zero_std": 0.0,
459
+ "grad_norm": 0.20892462134361267,
460
+ "learning_rate": 8e-07,
461
+ "loss": 0.0477,
462
+ "num_tokens": 2152273.0,
463
+ "reward": 0.3328002989292145,
464
+ "reward_std": 0.7669951319694519,
465
+ "rewards/cosine_scaled_reward/mean": -0.06797486543655396,
466
+ "rewards/cosine_scaled_reward/std": 0.4412795305252075,
467
+ "rewards/format_reward/mean": 0.46875,
468
+ "rewards/format_reward/std": 0.5029674172401428,
469
+ "step": 17
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.765625,
478
+ "completions/max_length": 2048.0,
479
+ "completions/max_terminated_length": 1465.0,
480
+ "completions/mean_length": 1778.90625,
481
+ "completions/mean_terminated_length": 899.86669921875,
482
+ "completions/min_length": 535.0,
483
+ "completions/min_terminated_length": 535.0,
484
+ "epoch": 0.02057142857142857,
485
+ "frac_reward_zero_std": 0.0,
486
+ "grad_norm": 0.19322611391544342,
487
+ "learning_rate": 8.499999999999999e-07,
488
+ "loss": 0.0726,
489
+ "num_tokens": 2276499.0,
490
+ "reward": -0.18389344215393066,
491
+ "reward_std": 0.5934990644454956,
492
+ "rewards/cosine_scaled_reward/mean": -0.23257172107696533,
493
+ "rewards/cosine_scaled_reward/std": 0.256833553314209,
494
+ "rewards/format_reward/mean": 0.28125,
495
+ "rewards/format_reward/std": 0.4531635046005249,
496
+ "step": 18
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.78125,
505
+ "completions/max_length": 2048.0,
506
+ "completions/max_terminated_length": 1771.0,
507
+ "completions/mean_length": 1869.53125,
508
+ "completions/mean_terminated_length": 1232.1429443359375,
509
+ "completions/min_length": 711.0,
510
+ "completions/min_terminated_length": 711.0,
511
+ "epoch": 0.021714285714285714,
512
+ "frac_reward_zero_std": 0.0,
513
+ "grad_norm": 0.21417103707790375,
514
+ "learning_rate": 9e-07,
515
+ "loss": 0.0378,
516
+ "num_tokens": 2407405.0,
517
+ "reward": -0.05162222683429718,
518
+ "reward_std": 0.7635236978530884,
519
+ "rewards/cosine_scaled_reward/mean": -0.158623605966568,
520
+ "rewards/cosine_scaled_reward/std": 0.4003170132637024,
521
+ "rewards/format_reward/mean": 0.265625,
522
+ "rewards/format_reward/std": 0.44515693187713623,
523
+ "step": 19
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.59375,
532
+ "completions/max_length": 2048.0,
533
+ "completions/max_terminated_length": 1836.0,
534
+ "completions/mean_length": 1572.90625,
535
+ "completions/mean_terminated_length": 878.5385131835938,
536
+ "completions/min_length": 369.0,
537
+ "completions/min_terminated_length": 369.0,
538
+ "epoch": 0.022857142857142857,
539
+ "frac_reward_zero_std": 0.0,
540
+ "grad_norm": 0.1591554582118988,
541
+ "learning_rate": 9.499999999999999e-07,
542
+ "loss": 0.0507,
543
+ "num_tokens": 2519423.0,
544
+ "reward": 0.2816518545150757,
545
+ "reward_std": 0.7381908893585205,
546
+ "rewards/cosine_scaled_reward/mean": -0.07011157274246216,
547
+ "rewards/cosine_scaled_reward/std": 0.35477158427238464,
548
+ "rewards/format_reward/mean": 0.421875,
549
+ "rewards/format_reward/std": 0.49776285886764526,
550
+ "step": 20
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.71875,
559
+ "completions/max_length": 2048.0,
560
+ "completions/max_terminated_length": 1827.0,
561
+ "completions/mean_length": 1776.28125,
562
+ "completions/mean_terminated_length": 1081.888916015625,
563
+ "completions/min_length": 332.0,
564
+ "completions/min_terminated_length": 332.0,
565
+ "epoch": 0.024,
566
+ "frac_reward_zero_std": 0.0,
567
+ "grad_norm": 0.22487252950668335,
568
+ "learning_rate": 1e-06,
569
+ "loss": 0.0137,
570
+ "num_tokens": 2643913.0,
571
+ "reward": -0.0122755765914917,
572
+ "reward_std": 0.4569401443004608,
573
+ "rewards/cosine_scaled_reward/mean": -0.16238778829574585,
574
+ "rewards/cosine_scaled_reward/std": 0.3900769054889679,
575
+ "rewards/format_reward/mean": 0.3125,
576
+ "rewards/format_reward/std": 0.467176616191864,
577
+ "step": 21
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.390625,
586
+ "completions/max_length": 2048.0,
587
+ "completions/max_terminated_length": 1851.0,
588
+ "completions/mean_length": 1273.1875,
589
+ "completions/mean_terminated_length": 776.5128173828125,
590
+ "completions/min_length": 242.0,
591
+ "completions/min_terminated_length": 242.0,
592
+ "epoch": 0.025142857142857144,
593
+ "frac_reward_zero_std": 0.0,
594
+ "grad_norm": 0.1901247799396515,
595
+ "learning_rate": 9.99931462820376e-07,
596
+ "loss": -0.0442,
597
+ "num_tokens": 2734413.0,
598
+ "reward": 0.5235691666603088,
599
+ "reward_std": 0.4210290312767029,
600
+ "rewards/cosine_scaled_reward/mean": -0.07415291666984558,
601
+ "rewards/cosine_scaled_reward/std": 0.40765848755836487,
602
+ "rewards/format_reward/mean": 0.671875,
603
+ "rewards/format_reward/std": 0.4732423722743988,
604
+ "step": 22
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.578125,
613
+ "completions/max_length": 2048.0,
614
+ "completions/max_terminated_length": 1954.0,
615
+ "completions/mean_length": 1640.84375,
616
+ "completions/mean_terminated_length": 1082.888916015625,
617
+ "completions/min_length": 363.0,
618
+ "completions/min_terminated_length": 363.0,
619
+ "epoch": 0.026285714285714287,
620
+ "frac_reward_zero_std": 0.0,
621
+ "grad_norm": 0.21930935978889465,
622
+ "learning_rate": 9.997258721585931e-07,
623
+ "loss": 0.0518,
624
+ "num_tokens": 2850219.0,
625
+ "reward": 0.23656107485294342,
626
+ "reward_std": 0.6851356029510498,
627
+ "rewards/cosine_scaled_reward/mean": -0.10046947002410889,
628
+ "rewards/cosine_scaled_reward/std": 0.45323267579078674,
629
+ "rewards/format_reward/mean": 0.4375,
630
+ "rewards/format_reward/std": 0.5,
631
+ "step": 23
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.71875,
640
+ "completions/max_length": 2048.0,
641
+ "completions/max_terminated_length": 1985.0,
642
+ "completions/mean_length": 1785.265625,
643
+ "completions/mean_terminated_length": 1113.8333740234375,
644
+ "completions/min_length": 475.0,
645
+ "completions/min_terminated_length": 475.0,
646
+ "epoch": 0.027428571428571427,
647
+ "frac_reward_zero_std": 0.0,
648
+ "grad_norm": 0.196747824549675,
649
+ "learning_rate": 9.993832906395582e-07,
650
+ "loss": 0.0687,
651
+ "num_tokens": 2975404.0,
652
+ "reward": 0.04860962927341461,
653
+ "reward_std": 0.8576602935791016,
654
+ "rewards/cosine_scaled_reward/mean": -0.1475701779127121,
655
+ "rewards/cosine_scaled_reward/std": 0.4082482159137726,
656
+ "rewards/format_reward/mean": 0.34375,
657
+ "rewards/format_reward/std": 0.4787135720252991,
658
+ "step": 24
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.6875,
667
+ "completions/max_length": 2048.0,
668
+ "completions/max_terminated_length": 1752.0,
669
+ "completions/mean_length": 1695.234375,
670
+ "completions/mean_terminated_length": 919.1500244140625,
671
+ "completions/min_length": 502.0,
672
+ "completions/min_terminated_length": 502.0,
673
+ "epoch": 0.02857142857142857,
674
+ "frac_reward_zero_std": 0.0,
675
+ "grad_norm": 0.22251193225383759,
676
+ "learning_rate": 9.989038226169207e-07,
677
+ "loss": 0.0401,
678
+ "num_tokens": 3094195.0,
679
+ "reward": 0.2244701385498047,
680
+ "reward_std": 0.6461865901947021,
681
+ "rewards/cosine_scaled_reward/mean": -0.06745242327451706,
682
+ "rewards/cosine_scaled_reward/std": 0.41534900665283203,
683
+ "rewards/format_reward/mean": 0.359375,
684
+ "rewards/format_reward/std": 0.4836103618144989,
685
+ "step": 25
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.859375,
694
+ "completions/max_length": 2048.0,
695
+ "completions/max_terminated_length": 2016.0,
696
+ "completions/mean_length": 1974.4375,
697
+ "completions/mean_terminated_length": 1524.888916015625,
698
+ "completions/min_length": 1105.0,
699
+ "completions/min_terminated_length": 1105.0,
700
+ "epoch": 0.029714285714285714,
701
+ "frac_reward_zero_std": 0.0,
702
+ "grad_norm": 0.23350541293621063,
703
+ "learning_rate": 9.982876141412855e-07,
704
+ "loss": 0.0101,
705
+ "num_tokens": 3231191.0,
706
+ "reward": 0.16762161254882812,
707
+ "reward_std": 0.5227605104446411,
708
+ "rewards/cosine_scaled_reward/mean": -0.041189197450876236,
709
+ "rewards/cosine_scaled_reward/std": 0.37332749366760254,
710
+ "rewards/format_reward/mean": 0.25,
711
+ "rewards/format_reward/std": 0.4364357888698578,
712
+ "step": 26
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.828125,
721
+ "completions/max_length": 2048.0,
722
+ "completions/max_terminated_length": 1999.0,
723
+ "completions/mean_length": 1915.5,
724
+ "completions/mean_terminated_length": 1277.0909423828125,
725
+ "completions/min_length": 554.0,
726
+ "completions/min_terminated_length": 554.0,
727
+ "epoch": 0.030857142857142857,
728
+ "frac_reward_zero_std": 0.0,
729
+ "grad_norm": 0.21174418926239014,
730
+ "learning_rate": 9.975348529157229e-07,
731
+ "loss": 0.0312,
732
+ "num_tokens": 3364071.0,
733
+ "reward": -0.18293717503547668,
734
+ "reward_std": 0.5386844873428345,
735
+ "rewards/cosine_scaled_reward/mean": -0.20865610241889954,
736
+ "rewards/cosine_scaled_reward/std": 0.2562413811683655,
737
+ "rewards/format_reward/mean": 0.234375,
738
+ "rewards/format_reward/std": 0.42695629596710205,
739
+ "step": 27
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.71875,
748
+ "completions/max_length": 2048.0,
749
+ "completions/max_terminated_length": 2007.0,
750
+ "completions/mean_length": 1815.140625,
751
+ "completions/mean_terminated_length": 1220.0555419921875,
752
+ "completions/min_length": 445.0,
753
+ "completions/min_terminated_length": 445.0,
754
+ "epoch": 0.032,
755
+ "frac_reward_zero_std": 0.0,
756
+ "grad_norm": 0.213092640042305,
757
+ "learning_rate": 9.96645768238595e-07,
758
+ "loss": 0.0361,
759
+ "num_tokens": 3490576.0,
760
+ "reward": 0.04266031086444855,
761
+ "reward_std": 0.776748776435852,
762
+ "rewards/cosine_scaled_reward/mean": -0.13491985201835632,
763
+ "rewards/cosine_scaled_reward/std": 0.37269750237464905,
764
+ "rewards/format_reward/mean": 0.3125,
765
+ "rewards/format_reward/std": 0.467176616191864,
766
+ "step": 28
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.859375,
775
+ "completions/max_length": 2048.0,
776
+ "completions/max_terminated_length": 2033.0,
777
+ "completions/mean_length": 1906.15625,
778
+ "completions/mean_terminated_length": 1039.3333740234375,
779
+ "completions/min_length": 633.0,
780
+ "completions/min_terminated_length": 633.0,
781
+ "epoch": 0.03314285714285714,
782
+ "frac_reward_zero_std": 0.0,
783
+ "grad_norm": 0.22322852909564972,
784
+ "learning_rate": 9.956206309337066e-07,
785
+ "loss": 0.0389,
786
+ "num_tokens": 3623042.0,
787
+ "reward": -0.1004815474152565,
788
+ "reward_std": 0.539789080619812,
789
+ "rewards/cosine_scaled_reward/mean": -0.12836576998233795,
790
+ "rewards/cosine_scaled_reward/std": 0.28681084513664246,
791
+ "rewards/format_reward/mean": 0.15625,
792
+ "rewards/format_reward/std": 0.36596253514289856,
793
+ "step": 29
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.78125,
802
+ "completions/max_length": 2048.0,
803
+ "completions/max_terminated_length": 1992.0,
804
+ "completions/mean_length": 1854.1875,
805
+ "completions/mean_terminated_length": 1162.0,
806
+ "completions/min_length": 592.0,
807
+ "completions/min_terminated_length": 592.0,
808
+ "epoch": 0.03428571428571429,
809
+ "frac_reward_zero_std": 0.0,
810
+ "grad_norm": 0.2063974291086197,
811
+ "learning_rate": 9.944597532678119e-07,
812
+ "loss": 0.0115,
813
+ "num_tokens": 3752246.0,
814
+ "reward": -0.030107807368040085,
815
+ "reward_std": 0.6322507858276367,
816
+ "rewards/cosine_scaled_reward/mean": -0.1634913980960846,
817
+ "rewards/cosine_scaled_reward/std": 0.31110286712646484,
818
+ "rewards/format_reward/mean": 0.296875,
819
+ "rewards/format_reward/std": 0.4604927599430084,
820
+ "step": 30
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.84375,
829
+ "completions/max_length": 2048.0,
830
+ "completions/max_terminated_length": 1523.0,
831
+ "completions/mean_length": 1841.15625,
832
+ "completions/mean_terminated_length": 724.2000122070312,
833
+ "completions/min_length": 165.0,
834
+ "completions/min_terminated_length": 165.0,
835
+ "epoch": 0.03542857142857143,
836
+ "frac_reward_zero_std": 0.0,
837
+ "grad_norm": 0.2025275081396103,
838
+ "learning_rate": 9.931634888554935e-07,
839
+ "loss": 0.0143,
840
+ "num_tokens": 3880576.0,
841
+ "reward": -0.34719598293304443,
842
+ "reward_std": 0.5259275436401367,
843
+ "rewards/cosine_scaled_reward/mean": -0.2595354914665222,
844
+ "rewards/cosine_scaled_reward/std": 0.24079306423664093,
845
+ "rewards/format_reward/mean": 0.171875,
846
+ "rewards/format_reward/std": 0.38025420904159546,
847
+ "step": 31
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.84375,
856
+ "completions/max_length": 2048.0,
857
+ "completions/max_terminated_length": 1998.0,
858
+ "completions/mean_length": 1945.65625,
859
+ "completions/mean_terminated_length": 1393.0,
860
+ "completions/min_length": 899.0,
861
+ "completions/min_terminated_length": 899.0,
862
+ "epoch": 0.036571428571428574,
863
+ "frac_reward_zero_std": 0.0,
864
+ "grad_norm": 0.22421319782733917,
865
+ "learning_rate": 9.917322325514487e-07,
866
+ "loss": 0.0542,
867
+ "num_tokens": 4015450.0,
868
+ "reward": -0.2238868921995163,
869
+ "reward_std": 0.6127103567123413,
870
+ "rewards/cosine_scaled_reward/mean": -0.20569345355033875,
871
+ "rewards/cosine_scaled_reward/std": 0.26141345500946045,
872
+ "rewards/format_reward/mean": 0.1875,
873
+ "rewards/format_reward/std": 0.39339789748191833,
874
+ "step": 32
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.90625,
883
+ "completions/max_length": 2048.0,
884
+ "completions/max_terminated_length": 1959.0,
885
+ "completions/mean_length": 1976.890625,
886
+ "completions/mean_terminated_length": 1289.5,
887
+ "completions/min_length": 581.0,
888
+ "completions/min_terminated_length": 581.0,
889
+ "epoch": 0.037714285714285714,
890
+ "frac_reward_zero_std": 0.0,
891
+ "grad_norm": 0.2219865769147873,
892
+ "learning_rate": 9.901664203302124e-07,
893
+ "loss": 0.0139,
894
+ "num_tokens": 4153187.0,
895
+ "reward": -0.5050230026245117,
896
+ "reward_std": 0.38754361867904663,
897
+ "rewards/cosine_scaled_reward/mean": -0.31501150131225586,
898
+ "rewards/cosine_scaled_reward/std": 0.19765734672546387,
899
+ "rewards/format_reward/mean": 0.125,
900
+ "rewards/format_reward/std": 0.3333333432674408,
901
+ "step": 33
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.515625,
910
+ "completions/max_length": 2048.0,
911
+ "completions/max_terminated_length": 2029.0,
912
+ "completions/mean_length": 1573.625,
913
+ "completions/mean_terminated_length": 1068.6451416015625,
914
+ "completions/min_length": 517.0,
915
+ "completions/min_terminated_length": 517.0,
916
+ "epoch": 0.038857142857142854,
917
+ "frac_reward_zero_std": 0.0,
918
+ "grad_norm": 0.23140408098697662,
919
+ "learning_rate": 9.88466529153356e-07,
920
+ "loss": 0.0697,
921
+ "num_tokens": 4263451.0,
922
+ "reward": 0.3802332282066345,
923
+ "reward_std": 0.8625352382659912,
924
+ "rewards/cosine_scaled_reward/mean": -0.05207090824842453,
925
+ "rewards/cosine_scaled_reward/std": 0.4423771798610687,
926
+ "rewards/format_reward/mean": 0.484375,
927
+ "rewards/format_reward/std": 0.5037065148353577,
928
+ "step": 34
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.765625,
937
+ "completions/max_length": 2048.0,
938
+ "completions/max_terminated_length": 1957.0,
939
+ "completions/mean_length": 1814.875,
940
+ "completions/mean_terminated_length": 1053.3333740234375,
941
+ "completions/min_length": 359.0,
942
+ "completions/min_terminated_length": 359.0,
943
+ "epoch": 0.04,
944
+ "frac_reward_zero_std": 0.0,
945
+ "grad_norm": 0.21747314929962158,
946
+ "learning_rate": 9.866330768241983e-07,
947
+ "loss": 0.0288,
948
+ "num_tokens": 4391099.0,
949
+ "reward": 0.11022068560123444,
950
+ "reward_std": 0.898347795009613,
951
+ "rewards/cosine_scaled_reward/mean": -0.08551465719938278,
952
+ "rewards/cosine_scaled_reward/std": 0.4119128882884979,
953
+ "rewards/format_reward/mean": 0.28125,
954
+ "rewards/format_reward/std": 0.4531635046005249,
955
+ "step": 35
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.90625,
964
+ "completions/max_length": 2048.0,
965
+ "completions/max_terminated_length": 1775.0,
966
+ "completions/mean_length": 1976.765625,
967
+ "completions/mean_terminated_length": 1288.166748046875,
968
+ "completions/min_length": 964.0,
969
+ "completions/min_terminated_length": 964.0,
970
+ "epoch": 0.04114285714285714,
971
+ "frac_reward_zero_std": 0.0,
972
+ "grad_norm": 0.23834578692913055,
973
+ "learning_rate": 9.846666218300807e-07,
974
+ "loss": 0.021,
975
+ "num_tokens": 4528724.0,
976
+ "reward": -0.38736510276794434,
977
+ "reward_std": 0.5356569290161133,
978
+ "rewards/cosine_scaled_reward/mean": -0.24837006628513336,
979
+ "rewards/cosine_scaled_reward/std": 0.23275430500507355,
980
+ "rewards/format_reward/mean": 0.109375,
981
+ "rewards/format_reward/std": 0.3145764470100403,
982
+ "step": 36
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.9375,
991
+ "completions/max_length": 2048.0,
992
+ "completions/max_terminated_length": 2047.0,
993
+ "completions/mean_length": 2013.9375,
994
+ "completions/mean_terminated_length": 1503.0,
995
+ "completions/min_length": 1027.0,
996
+ "completions/min_terminated_length": 1027.0,
997
+ "epoch": 0.04228571428571429,
998
+ "frac_reward_zero_std": 0.0,
999
+ "grad_norm": 0.22654284536838531,
1000
+ "learning_rate": 9.825677631722435e-07,
1001
+ "loss": 0.0142,
1002
+ "num_tokens": 4668640.0,
1003
+ "reward": -0.42377781867980957,
1004
+ "reward_std": 0.379480242729187,
1005
+ "rewards/cosine_scaled_reward/mean": -0.2665764391422272,
1006
+ "rewards/cosine_scaled_reward/std": 0.18001720309257507,
1007
+ "rewards/format_reward/mean": 0.109375,
1008
+ "rewards/format_reward/std": 0.3145764470100403,
1009
+ "step": 37
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.859375,
1018
+ "completions/max_length": 2048.0,
1019
+ "completions/max_terminated_length": 1254.0,
1020
+ "completions/mean_length": 1912.265625,
1021
+ "completions/mean_terminated_length": 1082.77783203125,
1022
+ "completions/min_length": 920.0,
1023
+ "completions/min_terminated_length": 920.0,
1024
+ "epoch": 0.04342857142857143,
1025
+ "frac_reward_zero_std": 0.0,
1026
+ "grad_norm": 0.22495149075984955,
1027
+ "learning_rate": 9.80337140183366e-07,
1028
+ "loss": 0.0353,
1029
+ "num_tokens": 4802737.0,
1030
+ "reward": -0.15185467898845673,
1031
+ "reward_std": 0.38927191495895386,
1032
+ "rewards/cosine_scaled_reward/mean": -0.14623984694480896,
1033
+ "rewards/cosine_scaled_reward/std": 0.32866883277893066,
1034
+ "rewards/format_reward/mean": 0.140625,
1035
+ "rewards/format_reward/std": 0.3503824472427368,
1036
+ "step": 38
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.734375,
1045
+ "completions/max_length": 2048.0,
1046
+ "completions/max_terminated_length": 1979.0,
1047
+ "completions/mean_length": 1678.4375,
1048
+ "completions/mean_terminated_length": 656.7058715820312,
1049
+ "completions/min_length": 300.0,
1050
+ "completions/min_terminated_length": 300.0,
1051
+ "epoch": 0.044571428571428574,
1052
+ "frac_reward_zero_std": 0.0,
1053
+ "grad_norm": 0.19435559213161469,
1054
+ "learning_rate": 9.779754323328192e-07,
1055
+ "loss": 0.0416,
1056
+ "num_tokens": 4920941.0,
1057
+ "reward": 0.17510981857776642,
1058
+ "reward_std": 0.559760570526123,
1059
+ "rewards/cosine_scaled_reward/mean": -0.0765075832605362,
1060
+ "rewards/cosine_scaled_reward/std": 0.3369429409503937,
1061
+ "rewards/format_reward/mean": 0.328125,
1062
+ "rewards/format_reward/std": 0.4732423722743988,
1063
+ "step": 39
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.6875,
1072
+ "completions/max_length": 2048.0,
1073
+ "completions/max_terminated_length": 1762.0,
1074
+ "completions/mean_length": 1682.25,
1075
+ "completions/mean_terminated_length": 877.6000366210938,
1076
+ "completions/min_length": 465.0,
1077
+ "completions/min_terminated_length": 465.0,
1078
+ "epoch": 0.045714285714285714,
1079
+ "frac_reward_zero_std": 0.0,
1080
+ "grad_norm": 0.19440439343452454,
1081
+ "learning_rate": 9.754833590196926e-07,
1082
+ "loss": 0.0685,
1083
+ "num_tokens": 5038677.0,
1084
+ "reward": 0.09382888674736023,
1085
+ "reward_std": 0.4140171706676483,
1086
+ "rewards/cosine_scaled_reward/mean": -0.12496057152748108,
1087
+ "rewards/cosine_scaled_reward/std": 0.3649806082248688,
1088
+ "rewards/format_reward/mean": 0.34375,
1089
+ "rewards/format_reward/std": 0.4787135720252991,
1090
+ "step": 40
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.671875,
1099
+ "completions/max_length": 2048.0,
1100
+ "completions/max_terminated_length": 1905.0,
1101
+ "completions/mean_length": 1841.0625,
1102
+ "completions/mean_terminated_length": 1417.3333740234375,
1103
+ "completions/min_length": 965.0,
1104
+ "completions/min_terminated_length": 965.0,
1105
+ "epoch": 0.046857142857142854,
1106
+ "frac_reward_zero_std": 0.0,
1107
+ "grad_norm": 0.21685408055782318,
1108
+ "learning_rate": 9.728616793536587e-07,
1109
+ "loss": 0.0105,
1110
+ "num_tokens": 5167657.0,
1111
+ "reward": -0.15476089715957642,
1112
+ "reward_std": 0.5854519605636597,
1113
+ "rewards/cosine_scaled_reward/mean": -0.2648804187774658,
1114
+ "rewards/cosine_scaled_reward/std": 0.26939424872398376,
1115
+ "rewards/format_reward/mean": 0.375,
1116
+ "rewards/format_reward/std": 0.48795005679130554,
1117
+ "step": 41
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.734375,
1126
+ "completions/max_length": 2048.0,
1127
+ "completions/max_terminated_length": 1933.0,
1128
+ "completions/mean_length": 1695.0,
1129
+ "completions/mean_terminated_length": 719.058837890625,
1130
+ "completions/min_length": 205.0,
1131
+ "completions/min_terminated_length": 205.0,
1132
+ "epoch": 0.048,
1133
+ "frac_reward_zero_std": 0.0,
1134
+ "grad_norm": 0.23794473707675934,
1135
+ "learning_rate": 9.701111919237408e-07,
1136
+ "loss": 0.0327,
1137
+ "num_tokens": 5286497.0,
1138
+ "reward": -0.2923233211040497,
1139
+ "reward_std": 0.36149862408638,
1140
+ "rewards/cosine_scaled_reward/mean": -0.27897417545318604,
1141
+ "rewards/cosine_scaled_reward/std": 0.17192503809928894,
1142
+ "rewards/format_reward/mean": 0.265625,
1143
+ "rewards/format_reward/std": 0.44515693187713623,
1144
+ "step": 42
1145
+ },
1146
+ {
1147
+ "clip_ratio/high_max": 0.0,
1148
+ "clip_ratio/high_mean": 0.0,
1149
+ "clip_ratio/low_mean": 0.0,
1150
+ "clip_ratio/low_min": 0.0,
1151
+ "clip_ratio/region_mean": 0.0,
1152
+ "completions/clipped_ratio": 0.75,
1153
+ "completions/max_length": 2048.0,
1154
+ "completions/max_terminated_length": 2045.0,
1155
+ "completions/mean_length": 1793.84375,
1156
+ "completions/mean_terminated_length": 1031.375,
1157
+ "completions/min_length": 714.0,
1158
+ "completions/min_terminated_length": 714.0,
1159
+ "epoch": 0.04914285714285714,
1160
+ "frac_reward_zero_std": 0.0,
1161
+ "grad_norm": 0.21354877948760986,
1162
+ "learning_rate": 9.672327345550543e-07,
1163
+ "loss": 0.0597,
1164
+ "num_tokens": 5412919.0,
1165
+ "reward": -0.0004070103168487549,
1166
+ "reward_std": 0.5297929048538208,
1167
+ "rewards/cosine_scaled_reward/mean": -0.12520350515842438,
1168
+ "rewards/cosine_scaled_reward/std": 0.3128352463245392,
1169
+ "rewards/format_reward/mean": 0.25,
1170
+ "rewards/format_reward/std": 0.4364357888698578,
1171
+ "step": 43
1172
+ },
1173
+ {
1174
+ "clip_ratio/high_max": 0.0,
1175
+ "clip_ratio/high_mean": 0.0,
1176
+ "clip_ratio/low_mean": 0.0,
1177
+ "clip_ratio/low_min": 0.0,
1178
+ "clip_ratio/region_mean": 0.0,
1179
+ "completions/clipped_ratio": 0.6875,
1180
+ "completions/max_length": 2048.0,
1181
+ "completions/max_terminated_length": 1729.0,
1182
+ "completions/mean_length": 1651.1875,
1183
+ "completions/mean_terminated_length": 778.2000122070312,
1184
+ "completions/min_length": 251.0,
1185
+ "completions/min_terminated_length": 251.0,
1186
+ "epoch": 0.05028571428571429,
1187
+ "frac_reward_zero_std": 0.0,
1188
+ "grad_norm": 0.20100052654743195,
1189
+ "learning_rate": 9.64227184053598e-07,
1190
+ "loss": 0.0089,
1191
+ "num_tokens": 5529291.0,
1192
+ "reward": 0.13101597130298615,
1193
+ "reward_std": 0.5976744890213013,
1194
+ "rewards/cosine_scaled_reward/mean": -0.09855452179908752,
1195
+ "rewards/cosine_scaled_reward/std": 0.46046286821365356,
1196
+ "rewards/format_reward/mean": 0.328125,
1197
+ "rewards/format_reward/std": 0.4732423722743988,
1198
+ "step": 44
1199
+ },
1200
+ {
1201
+ "clip_ratio/high_max": 0.0,
1202
+ "clip_ratio/high_mean": 0.0,
1203
+ "clip_ratio/low_mean": 0.0,
1204
+ "clip_ratio/low_min": 0.0,
1205
+ "clip_ratio/region_mean": 0.0,
1206
+ "completions/clipped_ratio": 0.921875,
1207
+ "completions/max_length": 2048.0,
1208
+ "completions/max_terminated_length": 1953.0,
1209
+ "completions/mean_length": 2011.765625,
1210
+ "completions/mean_terminated_length": 1584.2000732421875,
1211
+ "completions/min_length": 1146.0,
1212
+ "completions/min_terminated_length": 1146.0,
1213
+ "epoch": 0.05142857142857143,
1214
+ "frac_reward_zero_std": 0.0,
1215
+ "grad_norm": 0.2144525796175003,
1216
+ "learning_rate": 9.610954559391704e-07,
1217
+ "loss": 0.0108,
1218
+ "num_tokens": 5669700.0,
1219
+ "reward": -0.15992262959480286,
1220
+ "reward_std": 0.5183610916137695,
1221
+ "rewards/cosine_scaled_reward/mean": -0.14246131479740143,
1222
+ "rewards/cosine_scaled_reward/std": 0.37169432640075684,
1223
+ "rewards/format_reward/mean": 0.125,
1224
+ "rewards/format_reward/std": 0.3333333432674408,
1225
+ "step": 45
1226
+ },
1227
+ {
1228
+ "clip_ratio/high_max": 0.0,
1229
+ "clip_ratio/high_mean": 0.0,
1230
+ "clip_ratio/low_mean": 0.0,
1231
+ "clip_ratio/low_min": 0.0,
1232
+ "clip_ratio/region_mean": 0.0,
1233
+ "completions/clipped_ratio": 0.78125,
1234
+ "completions/max_length": 2048.0,
1235
+ "completions/max_terminated_length": 1566.0,
1236
+ "completions/mean_length": 1811.21875,
1237
+ "completions/mean_terminated_length": 965.5714721679688,
1238
+ "completions/min_length": 578.0,
1239
+ "completions/min_terminated_length": 578.0,
1240
+ "epoch": 0.052571428571428575,
1241
+ "frac_reward_zero_std": 0.0,
1242
+ "grad_norm": 0.2243409901857376,
1243
+ "learning_rate": 9.578385041664925e-07,
1244
+ "loss": 0.0324,
1245
+ "num_tokens": 5796786.0,
1246
+ "reward": -0.2682954668998718,
1247
+ "reward_std": 0.47855472564697266,
1248
+ "rewards/cosine_scaled_reward/mean": -0.2435227334499359,
1249
+ "rewards/cosine_scaled_reward/std": 0.21708372235298157,
1250
+ "rewards/format_reward/mean": 0.21875,
1251
+ "rewards/format_reward/std": 0.4166666865348816,
1252
+ "step": 46
1253
+ },
1254
+ {
1255
+ "clip_ratio/high_max": 0.0,
1256
+ "clip_ratio/high_mean": 0.0,
1257
+ "clip_ratio/low_mean": 0.0,
1258
+ "clip_ratio/low_min": 0.0,
1259
+ "clip_ratio/region_mean": 0.0,
1260
+ "completions/clipped_ratio": 0.71875,
1261
+ "completions/max_length": 2048.0,
1262
+ "completions/max_terminated_length": 1730.0,
1263
+ "completions/mean_length": 1720.15625,
1264
+ "completions/mean_terminated_length": 882.3333129882812,
1265
+ "completions/min_length": 432.0,
1266
+ "completions/min_terminated_length": 432.0,
1267
+ "epoch": 0.053714285714285714,
1268
+ "frac_reward_zero_std": 0.0,
1269
+ "grad_norm": 0.1925242692232132,
1270
+ "learning_rate": 9.54457320834625e-07,
1271
+ "loss": 0.0641,
1272
+ "num_tokens": 5917276.0,
1273
+ "reward": -0.03124237060546875,
1274
+ "reward_std": 0.6693180203437805,
1275
+ "rewards/cosine_scaled_reward/mean": -0.17968368530273438,
1276
+ "rewards/cosine_scaled_reward/std": 0.379862517118454,
1277
+ "rewards/format_reward/mean": 0.328125,
1278
+ "rewards/format_reward/std": 0.4732423722743988,
1279
+ "step": 47
1280
+ },
1281
+ {
1282
+ "clip_ratio/high_max": 0.0,
1283
+ "clip_ratio/high_mean": 0.0,
1284
+ "clip_ratio/low_mean": 0.0,
1285
+ "clip_ratio/low_min": 0.0,
1286
+ "clip_ratio/region_mean": 0.0,
1287
+ "completions/clipped_ratio": 0.671875,
1288
+ "completions/max_length": 2048.0,
1289
+ "completions/max_terminated_length": 2012.0,
1290
+ "completions/mean_length": 1723.734375,
1291
+ "completions/mean_terminated_length": 1059.761962890625,
1292
+ "completions/min_length": 617.0,
1293
+ "completions/min_terminated_length": 617.0,
1294
+ "epoch": 0.054857142857142854,
1295
+ "frac_reward_zero_std": 0.0,
1296
+ "grad_norm": 0.20502391457557678,
1297
+ "learning_rate": 9.509529358847654e-07,
1298
+ "loss": 0.0544,
1299
+ "num_tokens": 6038139.0,
1300
+ "reward": 0.21815460920333862,
1301
+ "reward_std": 0.6701791286468506,
1302
+ "rewards/cosine_scaled_reward/mean": -0.05498518794775009,
1303
+ "rewards/cosine_scaled_reward/std": 0.42852458357810974,
1304
+ "rewards/format_reward/mean": 0.328125,
1305
+ "rewards/format_reward/std": 0.4732423722743988,
1306
+ "step": 48
1307
+ },
1308
+ {
1309
+ "clip_ratio/high_max": 0.0,
1310
+ "clip_ratio/high_mean": 0.0,
1311
+ "clip_ratio/low_mean": 0.0,
1312
+ "clip_ratio/low_min": 0.0,
1313
+ "clip_ratio/region_mean": 0.0,
1314
+ "completions/clipped_ratio": 0.515625,
1315
+ "completions/max_length": 2048.0,
1316
+ "completions/max_terminated_length": 1571.0,
1317
+ "completions/mean_length": 1450.3125,
1318
+ "completions/mean_terminated_length": 814.0645141601562,
1319
+ "completions/min_length": 275.0,
1320
+ "completions/min_terminated_length": 275.0,
1321
+ "epoch": 0.056,
1322
+ "frac_reward_zero_std": 0.0,
1323
+ "grad_norm": 0.18392837047576904,
1324
+ "learning_rate": 9.473264167865171e-07,
1325
+ "loss": 0.0771,
1326
+ "num_tokens": 6141023.0,
1327
+ "reward": 0.20156216621398926,
1328
+ "reward_std": 0.7049944400787354,
1329
+ "rewards/cosine_scaled_reward/mean": -0.14921891689300537,
1330
+ "rewards/cosine_scaled_reward/std": 0.35212206840515137,
1331
+ "rewards/format_reward/mean": 0.5,
1332
+ "rewards/format_reward/std": 0.5039526224136353,
1333
+ "step": 49
1334
+ },
1335
+ {
1336
+ "clip_ratio/high_max": 0.0,
1337
+ "clip_ratio/high_mean": 0.0,
1338
+ "clip_ratio/low_mean": 0.0,
1339
+ "clip_ratio/low_min": 0.0,
1340
+ "clip_ratio/region_mean": 0.0,
1341
+ "completions/clipped_ratio": 0.78125,
1342
+ "completions/max_length": 2048.0,
1343
+ "completions/max_terminated_length": 1605.0,
1344
+ "completions/mean_length": 1740.84375,
1345
+ "completions/mean_terminated_length": 643.857177734375,
1346
+ "completions/min_length": 307.0,
1347
+ "completions/min_terminated_length": 307.0,
1348
+ "epoch": 0.05714285714285714,
1349
+ "frac_reward_zero_std": 0.0,
1350
+ "grad_norm": 0.1936425119638443,
1351
+ "learning_rate": 9.43578868212728e-07,
1352
+ "loss": 0.0292,
1353
+ "num_tokens": 6263253.0,
1354
+ "reward": -0.08827750384807587,
1355
+ "reward_std": 0.3788633346557617,
1356
+ "rewards/cosine_scaled_reward/mean": -0.16132624447345734,
1357
+ "rewards/cosine_scaled_reward/std": 0.36572694778442383,
1358
+ "rewards/format_reward/mean": 0.234375,
1359
+ "rewards/format_reward/std": 0.42695629596710205,
1360
+ "step": 50
1361
+ }
1362
+ ],
1363
+ "logging_steps": 1,
1364
+ "max_steps": 200,
1365
+ "num_input_tokens_seen": 6263253,
1366
+ "num_train_epochs": 1,
1367
+ "save_steps": 50,
1368
+ "stateful_callbacks": {
1369
+ "TrainerControl": {
1370
+ "args": {
1371
+ "should_epoch_stop": false,
1372
+ "should_evaluate": false,
1373
+ "should_log": false,
1374
+ "should_save": true,
1375
+ "should_training_stop": false
1376
+ },
1377
+ "attributes": {}
1378
+ }
1379
+ },
1380
+ "total_flos": 0.0,
1381
+ "train_batch_size": 4,
1382
+ "trial_name": null,
1383
+ "trial_params": null
1384
+ }
checkpoint-50/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3bfcdb0ec897893bf3e1232fa71465d92c0536fcf2ace560791d47a887fbdd3c
3
+ size 8888
checkpoint-50/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)