jiagaoxiang commited on
Commit
0759ecc
1 Parent(s): 5bf8d30

Upload folder using huggingface_hub

Browse files
config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "tiiuae/falcon-7b-instruct",
3
+ "activation": "gelu",
4
+ "alibi": false,
5
+ "apply_residual_connection_post_layernorm": false,
6
+ "architectures": [
7
+ "FalconForCausalLM"
8
+ ],
9
+ "attention_dropout": 0.0,
10
+ "auto_map": {
11
+ "AutoConfig": "tiiuae/falcon-7b-instruct--configuration_falcon.FalconConfig",
12
+ "AutoModel": "tiiuae/falcon-7b-instruct--modeling_falcon.FalconModel",
13
+ "AutoModelForCausalLM": "tiiuae/falcon-7b-instruct--modeling_falcon.FalconForCausalLM",
14
+ "AutoModelForQuestionAnswering": "tiiuae/falcon-7b-instruct--modeling_falcon.FalconForQuestionAnswering",
15
+ "AutoModelForSequenceClassification": "tiiuae/falcon-7b-instruct--modeling_falcon.FalconForSequenceClassification",
16
+ "AutoModelForTokenClassification": "tiiuae/falcon-7b-instruct--modeling_falcon.FalconForTokenClassification"
17
+ },
18
+ "bias": false,
19
+ "bos_token_id": 11,
20
+ "eos_token_id": 11,
21
+ "ffn_hidden_size": 18176,
22
+ "hidden_dropout": 0.0,
23
+ "hidden_size": 4544,
24
+ "initializer_range": 0.02,
25
+ "layer_norm_epsilon": 1e-05,
26
+ "max_position_embeddings": 2048,
27
+ "model_type": "falcon",
28
+ "multi_query": true,
29
+ "new_decoder_architecture": false,
30
+ "num_attention_heads": 71,
31
+ "num_hidden_layers": 32,
32
+ "num_kv_heads": 71,
33
+ "num_ln_in_parallel_attn": null,
34
+ "parallel_attn": true,
35
+ "rope_scaling": null,
36
+ "rope_theta": 10000.0,
37
+ "torch_dtype": "bfloat16",
38
+ "transformers_version": "4.45.1",
39
+ "use_cache": true,
40
+ "vocab_size": 65024
41
+ }
generation_config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 11,
4
+ "transformers_version": "4.45.1"
5
+ }
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step800
model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0b1f5abc2ddabdd7649da73e6531cfd0389856df5532594add3cd60b9d91384
3
+ size 4981285848
model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c92cdfc4633f8ac1d03ad0d74fd8c601bc2f955df4bdc6eaa5a38ff104499a00
3
+ size 4969690568
model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1628eab89ff3e4c24049f297463bc659fbfa74d6adb0aa108902968ef3309907
3
+ size 4483426544
model.safetensors.index.json ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 14434379520
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "model-00003-of-00003.safetensors",
7
+ "transformer.h.0.input_layernorm.bias": "model-00001-of-00003.safetensors",
8
+ "transformer.h.0.input_layernorm.weight": "model-00001-of-00003.safetensors",
9
+ "transformer.h.0.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
10
+ "transformer.h.0.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
11
+ "transformer.h.0.self_attention.dense.weight": "model-00001-of-00003.safetensors",
12
+ "transformer.h.0.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
13
+ "transformer.h.1.input_layernorm.bias": "model-00001-of-00003.safetensors",
14
+ "transformer.h.1.input_layernorm.weight": "model-00001-of-00003.safetensors",
15
+ "transformer.h.1.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
16
+ "transformer.h.1.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
17
+ "transformer.h.1.self_attention.dense.weight": "model-00001-of-00003.safetensors",
18
+ "transformer.h.1.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
19
+ "transformer.h.10.input_layernorm.bias": "model-00002-of-00003.safetensors",
20
+ "transformer.h.10.input_layernorm.weight": "model-00002-of-00003.safetensors",
21
+ "transformer.h.10.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
22
+ "transformer.h.10.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
23
+ "transformer.h.10.self_attention.dense.weight": "model-00001-of-00003.safetensors",
24
+ "transformer.h.10.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
25
+ "transformer.h.11.input_layernorm.bias": "model-00002-of-00003.safetensors",
26
+ "transformer.h.11.input_layernorm.weight": "model-00002-of-00003.safetensors",
27
+ "transformer.h.11.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
28
+ "transformer.h.11.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
29
+ "transformer.h.11.self_attention.dense.weight": "model-00002-of-00003.safetensors",
30
+ "transformer.h.11.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
31
+ "transformer.h.12.input_layernorm.bias": "model-00002-of-00003.safetensors",
32
+ "transformer.h.12.input_layernorm.weight": "model-00002-of-00003.safetensors",
33
+ "transformer.h.12.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
34
+ "transformer.h.12.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
35
+ "transformer.h.12.self_attention.dense.weight": "model-00002-of-00003.safetensors",
36
+ "transformer.h.12.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
37
+ "transformer.h.13.input_layernorm.bias": "model-00002-of-00003.safetensors",
38
+ "transformer.h.13.input_layernorm.weight": "model-00002-of-00003.safetensors",
39
+ "transformer.h.13.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
40
+ "transformer.h.13.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
41
+ "transformer.h.13.self_attention.dense.weight": "model-00002-of-00003.safetensors",
42
+ "transformer.h.13.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
43
+ "transformer.h.14.input_layernorm.bias": "model-00002-of-00003.safetensors",
44
+ "transformer.h.14.input_layernorm.weight": "model-00002-of-00003.safetensors",
45
+ "transformer.h.14.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
46
+ "transformer.h.14.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
47
+ "transformer.h.14.self_attention.dense.weight": "model-00002-of-00003.safetensors",
48
+ "transformer.h.14.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
49
+ "transformer.h.15.input_layernorm.bias": "model-00002-of-00003.safetensors",
50
+ "transformer.h.15.input_layernorm.weight": "model-00002-of-00003.safetensors",
51
+ "transformer.h.15.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
52
+ "transformer.h.15.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
53
+ "transformer.h.15.self_attention.dense.weight": "model-00002-of-00003.safetensors",
54
+ "transformer.h.15.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
55
+ "transformer.h.16.input_layernorm.bias": "model-00002-of-00003.safetensors",
56
+ "transformer.h.16.input_layernorm.weight": "model-00002-of-00003.safetensors",
57
+ "transformer.h.16.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
58
+ "transformer.h.16.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
59
+ "transformer.h.16.self_attention.dense.weight": "model-00002-of-00003.safetensors",
60
+ "transformer.h.16.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
61
+ "transformer.h.17.input_layernorm.bias": "model-00002-of-00003.safetensors",
62
+ "transformer.h.17.input_layernorm.weight": "model-00002-of-00003.safetensors",
63
+ "transformer.h.17.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
64
+ "transformer.h.17.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
65
+ "transformer.h.17.self_attention.dense.weight": "model-00002-of-00003.safetensors",
66
+ "transformer.h.17.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
67
+ "transformer.h.18.input_layernorm.bias": "model-00002-of-00003.safetensors",
68
+ "transformer.h.18.input_layernorm.weight": "model-00002-of-00003.safetensors",
69
+ "transformer.h.18.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
70
+ "transformer.h.18.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
71
+ "transformer.h.18.self_attention.dense.weight": "model-00002-of-00003.safetensors",
72
+ "transformer.h.18.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
73
+ "transformer.h.19.input_layernorm.bias": "model-00002-of-00003.safetensors",
74
+ "transformer.h.19.input_layernorm.weight": "model-00002-of-00003.safetensors",
75
+ "transformer.h.19.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
76
+ "transformer.h.19.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
77
+ "transformer.h.19.self_attention.dense.weight": "model-00002-of-00003.safetensors",
78
+ "transformer.h.19.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
79
+ "transformer.h.2.input_layernorm.bias": "model-00001-of-00003.safetensors",
80
+ "transformer.h.2.input_layernorm.weight": "model-00001-of-00003.safetensors",
81
+ "transformer.h.2.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
82
+ "transformer.h.2.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
83
+ "transformer.h.2.self_attention.dense.weight": "model-00001-of-00003.safetensors",
84
+ "transformer.h.2.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
85
+ "transformer.h.20.input_layernorm.bias": "model-00002-of-00003.safetensors",
86
+ "transformer.h.20.input_layernorm.weight": "model-00002-of-00003.safetensors",
87
+ "transformer.h.20.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
88
+ "transformer.h.20.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
89
+ "transformer.h.20.self_attention.dense.weight": "model-00002-of-00003.safetensors",
90
+ "transformer.h.20.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
91
+ "transformer.h.21.input_layernorm.bias": "model-00002-of-00003.safetensors",
92
+ "transformer.h.21.input_layernorm.weight": "model-00002-of-00003.safetensors",
93
+ "transformer.h.21.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
94
+ "transformer.h.21.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
95
+ "transformer.h.21.self_attention.dense.weight": "model-00002-of-00003.safetensors",
96
+ "transformer.h.21.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
97
+ "transformer.h.22.input_layernorm.bias": "model-00003-of-00003.safetensors",
98
+ "transformer.h.22.input_layernorm.weight": "model-00003-of-00003.safetensors",
99
+ "transformer.h.22.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
100
+ "transformer.h.22.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
101
+ "transformer.h.22.self_attention.dense.weight": "model-00002-of-00003.safetensors",
102
+ "transformer.h.22.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
103
+ "transformer.h.23.input_layernorm.bias": "model-00003-of-00003.safetensors",
104
+ "transformer.h.23.input_layernorm.weight": "model-00003-of-00003.safetensors",
105
+ "transformer.h.23.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
106
+ "transformer.h.23.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
107
+ "transformer.h.23.self_attention.dense.weight": "model-00003-of-00003.safetensors",
108
+ "transformer.h.23.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
109
+ "transformer.h.24.input_layernorm.bias": "model-00003-of-00003.safetensors",
110
+ "transformer.h.24.input_layernorm.weight": "model-00003-of-00003.safetensors",
111
+ "transformer.h.24.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
112
+ "transformer.h.24.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
113
+ "transformer.h.24.self_attention.dense.weight": "model-00003-of-00003.safetensors",
114
+ "transformer.h.24.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
115
+ "transformer.h.25.input_layernorm.bias": "model-00003-of-00003.safetensors",
116
+ "transformer.h.25.input_layernorm.weight": "model-00003-of-00003.safetensors",
117
+ "transformer.h.25.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
118
+ "transformer.h.25.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
119
+ "transformer.h.25.self_attention.dense.weight": "model-00003-of-00003.safetensors",
120
+ "transformer.h.25.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
121
+ "transformer.h.26.input_layernorm.bias": "model-00003-of-00003.safetensors",
122
+ "transformer.h.26.input_layernorm.weight": "model-00003-of-00003.safetensors",
123
+ "transformer.h.26.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
124
+ "transformer.h.26.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
125
+ "transformer.h.26.self_attention.dense.weight": "model-00003-of-00003.safetensors",
126
+ "transformer.h.26.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
127
+ "transformer.h.27.input_layernorm.bias": "model-00003-of-00003.safetensors",
128
+ "transformer.h.27.input_layernorm.weight": "model-00003-of-00003.safetensors",
129
+ "transformer.h.27.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
130
+ "transformer.h.27.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
131
+ "transformer.h.27.self_attention.dense.weight": "model-00003-of-00003.safetensors",
132
+ "transformer.h.27.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
133
+ "transformer.h.28.input_layernorm.bias": "model-00003-of-00003.safetensors",
134
+ "transformer.h.28.input_layernorm.weight": "model-00003-of-00003.safetensors",
135
+ "transformer.h.28.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
136
+ "transformer.h.28.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
137
+ "transformer.h.28.self_attention.dense.weight": "model-00003-of-00003.safetensors",
138
+ "transformer.h.28.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
139
+ "transformer.h.29.input_layernorm.bias": "model-00003-of-00003.safetensors",
140
+ "transformer.h.29.input_layernorm.weight": "model-00003-of-00003.safetensors",
141
+ "transformer.h.29.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
142
+ "transformer.h.29.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
143
+ "transformer.h.29.self_attention.dense.weight": "model-00003-of-00003.safetensors",
144
+ "transformer.h.29.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
145
+ "transformer.h.3.input_layernorm.bias": "model-00001-of-00003.safetensors",
146
+ "transformer.h.3.input_layernorm.weight": "model-00001-of-00003.safetensors",
147
+ "transformer.h.3.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
148
+ "transformer.h.3.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
149
+ "transformer.h.3.self_attention.dense.weight": "model-00001-of-00003.safetensors",
150
+ "transformer.h.3.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
151
+ "transformer.h.30.input_layernorm.bias": "model-00003-of-00003.safetensors",
152
+ "transformer.h.30.input_layernorm.weight": "model-00003-of-00003.safetensors",
153
+ "transformer.h.30.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
154
+ "transformer.h.30.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
155
+ "transformer.h.30.self_attention.dense.weight": "model-00003-of-00003.safetensors",
156
+ "transformer.h.30.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
157
+ "transformer.h.31.input_layernorm.bias": "model-00003-of-00003.safetensors",
158
+ "transformer.h.31.input_layernorm.weight": "model-00003-of-00003.safetensors",
159
+ "transformer.h.31.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
160
+ "transformer.h.31.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
161
+ "transformer.h.31.self_attention.dense.weight": "model-00003-of-00003.safetensors",
162
+ "transformer.h.31.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
163
+ "transformer.h.4.input_layernorm.bias": "model-00001-of-00003.safetensors",
164
+ "transformer.h.4.input_layernorm.weight": "model-00001-of-00003.safetensors",
165
+ "transformer.h.4.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
166
+ "transformer.h.4.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
167
+ "transformer.h.4.self_attention.dense.weight": "model-00001-of-00003.safetensors",
168
+ "transformer.h.4.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
169
+ "transformer.h.5.input_layernorm.bias": "model-00001-of-00003.safetensors",
170
+ "transformer.h.5.input_layernorm.weight": "model-00001-of-00003.safetensors",
171
+ "transformer.h.5.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
172
+ "transformer.h.5.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
173
+ "transformer.h.5.self_attention.dense.weight": "model-00001-of-00003.safetensors",
174
+ "transformer.h.5.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
175
+ "transformer.h.6.input_layernorm.bias": "model-00001-of-00003.safetensors",
176
+ "transformer.h.6.input_layernorm.weight": "model-00001-of-00003.safetensors",
177
+ "transformer.h.6.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
178
+ "transformer.h.6.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
179
+ "transformer.h.6.self_attention.dense.weight": "model-00001-of-00003.safetensors",
180
+ "transformer.h.6.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
181
+ "transformer.h.7.input_layernorm.bias": "model-00001-of-00003.safetensors",
182
+ "transformer.h.7.input_layernorm.weight": "model-00001-of-00003.safetensors",
183
+ "transformer.h.7.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
184
+ "transformer.h.7.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
185
+ "transformer.h.7.self_attention.dense.weight": "model-00001-of-00003.safetensors",
186
+ "transformer.h.7.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
187
+ "transformer.h.8.input_layernorm.bias": "model-00001-of-00003.safetensors",
188
+ "transformer.h.8.input_layernorm.weight": "model-00001-of-00003.safetensors",
189
+ "transformer.h.8.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
190
+ "transformer.h.8.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
191
+ "transformer.h.8.self_attention.dense.weight": "model-00001-of-00003.safetensors",
192
+ "transformer.h.8.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
193
+ "transformer.h.9.input_layernorm.bias": "model-00001-of-00003.safetensors",
194
+ "transformer.h.9.input_layernorm.weight": "model-00001-of-00003.safetensors",
195
+ "transformer.h.9.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
196
+ "transformer.h.9.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
197
+ "transformer.h.9.self_attention.dense.weight": "model-00001-of-00003.safetensors",
198
+ "transformer.h.9.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
199
+ "transformer.ln_f.bias": "model-00003-of-00003.safetensors",
200
+ "transformer.ln_f.weight": "model-00003-of-00003.safetensors",
201
+ "transformer.word_embeddings.weight": "model-00001-of-00003.safetensors"
202
+ }
203
+ }
rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:49bb74509a68ae1d684edd01bd8152ef03389986e788c79340e90014b1c093a7
3
+ size 16048
rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1a774604014f7007e2de89811272669b6a022ea2b68062ccf74b61c9ea8ac0e3
3
+ size 15984
rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02820d2aeb1e5de420804feddf79eadda3c0be1e9c59bdc0f7ba20919f090dc8
3
+ size 15984
rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0a444f744bb3e6f2a00892f143f5fd742eb723766c00f3f53cc1604552c426a
3
+ size 15920
rng_state_4.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c7d4d95f20c320f7733600e6e5590678d222e27cf140a5855e11d7580df84c7
3
+ size 15984
rng_state_5.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:277d3eed142bae3463121377f4989f279c3d0b72eb3e48b4723235648d07b821
3
+ size 15920
rng_state_6.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:17f83d61fd54ce99289d3e71c80e1dddeb7e32d9b2b33ea5176b671ca1f9286d
3
+ size 15984
rng_state_7.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0d0d403853cbd3048c59ac8858aaca9521d016434d04b5504fb0bf56ad4a1767
3
+ size 15984
scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87e14469b0d7a429d79eefb2209aad8fe7d285c0eb29dc073223d14bb491aeb9
3
+ size 1064
special_tokens_map.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ ">>TITLE<<",
4
+ ">>ABSTRACT<<",
5
+ ">>INTRODUCTION<<",
6
+ ">>SUMMARY<<",
7
+ ">>COMMENT<<",
8
+ ">>ANSWER<<",
9
+ ">>QUESTION<<",
10
+ ">>DOMAIN<<",
11
+ ">>PREFIX<<",
12
+ ">>SUFFIX<<",
13
+ ">>MIDDLE<<"
14
+ ],
15
+ "eos_token": {
16
+ "content": "<|endoftext|>",
17
+ "lstrip": false,
18
+ "normalized": false,
19
+ "rstrip": false,
20
+ "single_word": false
21
+ },
22
+ "pad_token": {
23
+ "content": "[PAD]",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false
28
+ }
29
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": ">>TITLE<<",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": ">>ABSTRACT<<",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": ">>INTRODUCTION<<",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": ">>SUMMARY<<",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "4": {
37
+ "content": ">>COMMENT<<",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "5": {
45
+ "content": ">>ANSWER<<",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "6": {
53
+ "content": ">>QUESTION<<",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "7": {
61
+ "content": ">>DOMAIN<<",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "8": {
69
+ "content": ">>PREFIX<<",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "9": {
77
+ "content": ">>SUFFIX<<",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "10": {
85
+ "content": ">>MIDDLE<<",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "11": {
93
+ "content": "<|endoftext|>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "65024": {
101
+ "content": "[PAD]",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ }
108
+ },
109
+ "additional_special_tokens": [
110
+ ">>TITLE<<",
111
+ ">>ABSTRACT<<",
112
+ ">>INTRODUCTION<<",
113
+ ">>SUMMARY<<",
114
+ ">>COMMENT<<",
115
+ ">>ANSWER<<",
116
+ ">>QUESTION<<",
117
+ ">>DOMAIN<<",
118
+ ">>PREFIX<<",
119
+ ">>SUFFIX<<",
120
+ ">>MIDDLE<<"
121
+ ],
122
+ "chat_template": "{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% set system_message = '' %}{% endif %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if loop.index0 == 0 %}{{ system_message.strip() }}{% endif %}{% if message['role'] == 'user' %}{{ '\n\nUser: ' + message['content'].strip().replace('\r\n', '\n').replace('\n\n', '\n') }}{% elif message['role'] == 'assistant' %}{{ '\n\nAssistant: ' + message['content'].strip().replace('\r\n', '\n').replace('\n\n', '\n') }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '\n\nAssistant:' }}{% endif %}",
123
+ "clean_up_tokenization_spaces": false,
124
+ "eos_token": "<|endoftext|>",
125
+ "model_input_names": [
126
+ "input_ids",
127
+ "attention_mask"
128
+ ],
129
+ "model_max_length": 2048,
130
+ "pad_token": "[PAD]",
131
+ "padding_side": "left",
132
+ "tokenizer_class": "PreTrainedTokenizerFast"
133
+ }
trainer_state.json ADDED
@@ -0,0 +1,1084 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "episode": 12800,
5
+ "epoch": 0.1755661321958111,
6
+ "eval_steps": 200.0,
7
+ "global_step": 250,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "episode": 256,
14
+ "epoch": 0.003511322643916222,
15
+ "eps": 6,
16
+ "loss/policy_avg": -0.07090990990400314,
17
+ "loss/value_avg": 0.0,
18
+ "lr": 3e-06,
19
+ "objective/entropy": 49.42120361328125,
20
+ "objective/kl": 0.006465356796979904,
21
+ "objective/non_score_reward": -0.000646535714622587,
22
+ "objective/rlhf_reward": -1.1137903928756714,
23
+ "objective/scores": -1.109375,
24
+ "policy/approxkl_avg": 27.096786499023438,
25
+ "policy/clipfrac_avg": 0.732421875,
26
+ "policy/entropy_avg": 0.92181396484375,
27
+ "step": 5,
28
+ "val/clipfrac_avg": 0.0,
29
+ "val/num_eos_tokens": 12,
30
+ "val/ratio": 1.0399832725524902,
31
+ "val/ratio_var": 0.010045886039733887
32
+ },
33
+ {
34
+ "episode": 512,
35
+ "epoch": 0.007022645287832444,
36
+ "eps": 6,
37
+ "loss/policy_avg": -0.06497187167406082,
38
+ "loss/value_avg": 0.0,
39
+ "lr": 2.9923273657289e-06,
40
+ "objective/entropy": 48.286014556884766,
41
+ "objective/kl": 0.8119473457336426,
42
+ "objective/non_score_reward": -0.08119472861289978,
43
+ "objective/rlhf_reward": -1.266162633895874,
44
+ "objective/scores": -1.1875,
45
+ "policy/approxkl_avg": 18.666072845458984,
46
+ "policy/clipfrac_avg": 0.7314453125,
47
+ "policy/entropy_avg": 0.912261962890625,
48
+ "step": 10,
49
+ "val/clipfrac_avg": 0.0,
50
+ "val/num_eos_tokens": 16,
51
+ "val/ratio": 1.020957112312317,
52
+ "val/ratio_var": 0.00411860179156065
53
+ },
54
+ {
55
+ "episode": 768,
56
+ "epoch": 0.010533967931748666,
57
+ "eps": 6,
58
+ "loss/policy_avg": -0.0872286781668663,
59
+ "loss/value_avg": 0.0,
60
+ "lr": 2.9846547314578008e-06,
61
+ "objective/entropy": 49.34376525878906,
62
+ "objective/kl": 1.9591996669769287,
63
+ "objective/non_score_reward": -0.1959199756383896,
64
+ "objective/rlhf_reward": -1.2858657836914062,
65
+ "objective/scores": -1.09375,
66
+ "policy/approxkl_avg": 20.772502899169922,
67
+ "policy/clipfrac_avg": 0.73828125,
68
+ "policy/entropy_avg": 0.927978515625,
69
+ "step": 15,
70
+ "val/clipfrac_avg": 0.0,
71
+ "val/num_eos_tokens": 12,
72
+ "val/ratio": 1.0191609859466553,
73
+ "val/ratio_var": 0.00307083735242486
74
+ },
75
+ {
76
+ "episode": 1024,
77
+ "epoch": 0.014045290575664887,
78
+ "eps": 6,
79
+ "loss/policy_avg": -0.07566041499376297,
80
+ "loss/value_avg": 0.0,
81
+ "lr": 2.9769820971867007e-06,
82
+ "objective/entropy": 53.13662338256836,
83
+ "objective/kl": 2.4811532497406006,
84
+ "objective/non_score_reward": -0.24811533093452454,
85
+ "objective/rlhf_reward": -1.2548893690109253,
86
+ "objective/scores": -1.0078125,
87
+ "policy/approxkl_avg": 20.665164947509766,
88
+ "policy/clipfrac_avg": 0.7314453125,
89
+ "policy/entropy_avg": 0.989776611328125,
90
+ "step": 20,
91
+ "val/clipfrac_avg": 0.0,
92
+ "val/num_eos_tokens": 11,
93
+ "val/ratio": 1.011010766029358,
94
+ "val/ratio_var": 0.004201602190732956
95
+ },
96
+ {
97
+ "episode": 1280,
98
+ "epoch": 0.01755661321958111,
99
+ "eps": 6,
100
+ "loss/policy_avg": -0.08593496680259705,
101
+ "loss/value_avg": 0.0,
102
+ "lr": 2.9693094629156014e-06,
103
+ "objective/entropy": 53.72633743286133,
104
+ "objective/kl": 3.3111624717712402,
105
+ "objective/non_score_reward": -0.3311161994934082,
106
+ "objective/rlhf_reward": -1.339456558227539,
107
+ "objective/scores": -1.0078125,
108
+ "policy/approxkl_avg": 25.559288024902344,
109
+ "policy/clipfrac_avg": 0.7353515625,
110
+ "policy/entropy_avg": 0.997894287109375,
111
+ "step": 25,
112
+ "val/clipfrac_avg": 0.0,
113
+ "val/num_eos_tokens": 13,
114
+ "val/ratio": 1.0134021043777466,
115
+ "val/ratio_var": 0.0019979747012257576
116
+ },
117
+ {
118
+ "episode": 1536,
119
+ "epoch": 0.021067935863497332,
120
+ "eps": 6,
121
+ "loss/policy_avg": -0.09734417498111725,
122
+ "loss/value_avg": 0.0,
123
+ "lr": 2.9616368286445014e-06,
124
+ "objective/entropy": 51.259735107421875,
125
+ "objective/kl": 5.089182376861572,
126
+ "objective/non_score_reward": -0.5089181661605835,
127
+ "objective/rlhf_reward": -1.2202520370483398,
128
+ "objective/scores": -0.7109375,
129
+ "policy/approxkl_avg": 29.841636657714844,
130
+ "policy/clipfrac_avg": 0.736328125,
131
+ "policy/entropy_avg": 0.960479736328125,
132
+ "step": 30,
133
+ "val/clipfrac_avg": 0.0,
134
+ "val/num_eos_tokens": 26,
135
+ "val/ratio": 1.0178756713867188,
136
+ "val/ratio_var": 0.009866585955023766
137
+ },
138
+ {
139
+ "episode": 1792,
140
+ "epoch": 0.024579258507413555,
141
+ "eps": 6,
142
+ "loss/policy_avg": -0.06831618398427963,
143
+ "loss/value_avg": 0.0,
144
+ "lr": 2.9539641943734013e-06,
145
+ "objective/entropy": 40.643272399902344,
146
+ "objective/kl": 6.974010944366455,
147
+ "objective/non_score_reward": -0.6974011063575745,
148
+ "objective/rlhf_reward": -1.2684605121612549,
149
+ "objective/scores": -0.5703125,
150
+ "policy/approxkl_avg": 35.33942413330078,
151
+ "policy/clipfrac_avg": 0.6982421875,
152
+ "policy/entropy_avg": 0.7505035400390625,
153
+ "step": 35,
154
+ "val/clipfrac_avg": 0.0,
155
+ "val/num_eos_tokens": 16,
156
+ "val/ratio": 1.00449800491333,
157
+ "val/ratio_var": 0.0022142010275274515
158
+ },
159
+ {
160
+ "episode": 2048,
161
+ "epoch": 0.028090581151329775,
162
+ "eps": 6,
163
+ "loss/policy_avg": -0.04068079590797424,
164
+ "loss/value_avg": 0.0,
165
+ "lr": 2.946291560102302e-06,
166
+ "objective/entropy": 23.142562866210938,
167
+ "objective/kl": 8.180486679077148,
168
+ "objective/non_score_reward": -0.8180487155914307,
169
+ "objective/rlhf_reward": -1.0729957818984985,
170
+ "objective/scores": -0.255859375,
171
+ "policy/approxkl_avg": 23.68307876586914,
172
+ "policy/clipfrac_avg": 0.5859375,
173
+ "policy/entropy_avg": 0.4361400604248047,
174
+ "step": 40,
175
+ "val/clipfrac_avg": 0.0,
176
+ "val/num_eos_tokens": 8,
177
+ "val/ratio": 1.0077030658721924,
178
+ "val/ratio_var": 0.0024766812566667795
179
+ },
180
+ {
181
+ "episode": 2304,
182
+ "epoch": 0.031601903795246,
183
+ "eps": 6,
184
+ "loss/policy_avg": -0.07307010889053345,
185
+ "loss/value_avg": 0.0,
186
+ "lr": 2.938618925831202e-06,
187
+ "objective/entropy": 19.376842498779297,
188
+ "objective/kl": 8.770210266113281,
189
+ "objective/non_score_reward": -0.8770210146903992,
190
+ "objective/rlhf_reward": -1.0002652406692505,
191
+ "objective/scores": -0.12353515625,
192
+ "policy/approxkl_avg": 31.00873565673828,
193
+ "policy/clipfrac_avg": 0.5302734375,
194
+ "policy/entropy_avg": 0.33237457275390625,
195
+ "step": 45,
196
+ "val/clipfrac_avg": 0.0,
197
+ "val/num_eos_tokens": 20,
198
+ "val/ratio": 0.996111273765564,
199
+ "val/ratio_var": 0.001100091845728457
200
+ },
201
+ {
202
+ "episode": 2560,
203
+ "epoch": 0.03511322643916222,
204
+ "eps": 6,
205
+ "loss/policy_avg": -0.04584116116166115,
206
+ "loss/value_avg": 0.0,
207
+ "lr": 2.9309462915601027e-06,
208
+ "objective/entropy": 11.984097480773926,
209
+ "objective/kl": 8.4966402053833,
210
+ "objective/non_score_reward": -0.849664032459259,
211
+ "objective/rlhf_reward": -0.8017911911010742,
212
+ "objective/scores": 0.0478515625,
213
+ "policy/approxkl_avg": 22.561037063598633,
214
+ "policy/clipfrac_avg": 0.451171875,
215
+ "policy/entropy_avg": 0.19393539428710938,
216
+ "step": 50,
217
+ "val/clipfrac_avg": 0.0,
218
+ "val/num_eos_tokens": 20,
219
+ "val/ratio": 0.9952375888824463,
220
+ "val/ratio_var": 0.000761833623982966
221
+ },
222
+ {
223
+ "episode": 2816,
224
+ "epoch": 0.03862454908307844,
225
+ "eps": 5,
226
+ "loss/policy_avg": -0.029720915481448174,
227
+ "loss/value_avg": 0.0,
228
+ "lr": 2.9232736572890026e-06,
229
+ "objective/entropy": 4.9489898681640625,
230
+ "objective/kl": 8.733837127685547,
231
+ "objective/non_score_reward": -0.8733837604522705,
232
+ "objective/rlhf_reward": -0.7492713928222656,
233
+ "objective/scores": 0.1240234375,
234
+ "policy/approxkl_avg": 16.253189086914062,
235
+ "policy/clipfrac_avg": 0.341796875,
236
+ "policy/entropy_avg": 0.07728099822998047,
237
+ "step": 55,
238
+ "val/clipfrac_avg": 0.0,
239
+ "val/num_eos_tokens": 18,
240
+ "val/ratio": 0.9972053170204163,
241
+ "val/ratio_var": 0.00032430028659291565
242
+ },
243
+ {
244
+ "episode": 3072,
245
+ "epoch": 0.042135871726994664,
246
+ "eps": 5,
247
+ "loss/policy_avg": -0.01298562902957201,
248
+ "loss/value_avg": 0.0,
249
+ "lr": 2.9156010230179026e-06,
250
+ "objective/entropy": 1.3101667165756226,
251
+ "objective/kl": 8.699792861938477,
252
+ "objective/non_score_reward": -0.8699792623519897,
253
+ "objective/rlhf_reward": -0.5752952098846436,
254
+ "objective/scores": 0.294921875,
255
+ "policy/approxkl_avg": 2.27925968170166,
256
+ "policy/clipfrac_avg": 0.236328125,
257
+ "policy/entropy_avg": 0.02513742446899414,
258
+ "step": 60,
259
+ "val/clipfrac_avg": 0.0,
260
+ "val/num_eos_tokens": 20,
261
+ "val/ratio": 1.0017118453979492,
262
+ "val/ratio_var": 0.00016639505338389426
263
+ },
264
+ {
265
+ "episode": 3328,
266
+ "epoch": 0.04564719437091089,
267
+ "eps": 5,
268
+ "loss/policy_avg": -0.02618303708732128,
269
+ "loss/value_avg": 0.0,
270
+ "lr": 2.9079283887468033e-06,
271
+ "objective/entropy": 2.3685269355773926,
272
+ "objective/kl": 9.208517074584961,
273
+ "objective/non_score_reward": -0.9208516478538513,
274
+ "objective/rlhf_reward": -0.5182289481163025,
275
+ "objective/scores": 0.40234375,
276
+ "policy/approxkl_avg": 2.6189699172973633,
277
+ "policy/clipfrac_avg": 0.310546875,
278
+ "policy/entropy_avg": 0.04020071029663086,
279
+ "step": 65,
280
+ "val/clipfrac_avg": 0.0,
281
+ "val/num_eos_tokens": 20,
282
+ "val/ratio": 1.003983497619629,
283
+ "val/ratio_var": 0.0009448421187698841
284
+ },
285
+ {
286
+ "episode": 3584,
287
+ "epoch": 0.04915851701482711,
288
+ "eps": 5,
289
+ "loss/policy_avg": -0.02327096462249756,
290
+ "loss/value_avg": 0.0,
291
+ "lr": 2.9002557544757032e-06,
292
+ "objective/entropy": 2.0416018962860107,
293
+ "objective/kl": 9.701976776123047,
294
+ "objective/non_score_reward": -0.9701976776123047,
295
+ "objective/rlhf_reward": -0.49486449360847473,
296
+ "objective/scores": 0.474609375,
297
+ "policy/approxkl_avg": 1.271956443786621,
298
+ "policy/clipfrac_avg": 0.2734375,
299
+ "policy/entropy_avg": 0.041253089904785156,
300
+ "step": 70,
301
+ "val/clipfrac_avg": 0.0,
302
+ "val/num_eos_tokens": 16,
303
+ "val/ratio": 1.0039558410644531,
304
+ "val/ratio_var": 0.00041477559716440737
305
+ },
306
+ {
307
+ "episode": 3840,
308
+ "epoch": 0.052669839658743334,
309
+ "eps": 5,
310
+ "loss/policy_avg": -0.033096276223659515,
311
+ "loss/value_avg": 0.0,
312
+ "lr": 2.892583120204604e-06,
313
+ "objective/entropy": 2.7795495986938477,
314
+ "objective/kl": 10.028523445129395,
315
+ "objective/non_score_reward": -1.0028523206710815,
316
+ "objective/rlhf_reward": -0.46555712819099426,
317
+ "objective/scores": 0.5390625,
318
+ "policy/approxkl_avg": 3.055203676223755,
319
+ "policy/clipfrac_avg": 0.3427734375,
320
+ "policy/entropy_avg": 0.053270816802978516,
321
+ "step": 75,
322
+ "val/clipfrac_avg": 0.0,
323
+ "val/num_eos_tokens": 23,
324
+ "val/ratio": 1.0012407302856445,
325
+ "val/ratio_var": 0.00011274257121840492
326
+ },
327
+ {
328
+ "episode": 4096,
329
+ "epoch": 0.05618116230265955,
330
+ "eps": 5,
331
+ "loss/policy_avg": -0.01961323618888855,
332
+ "loss/value_avg": 0.0,
333
+ "lr": 2.884910485933504e-06,
334
+ "objective/entropy": 2.5525641441345215,
335
+ "objective/kl": 10.111019134521484,
336
+ "objective/non_score_reward": -1.0111019611358643,
337
+ "objective/rlhf_reward": -0.510233461856842,
338
+ "objective/scores": 0.5,
339
+ "policy/approxkl_avg": 1.331697940826416,
340
+ "policy/clipfrac_avg": 0.2861328125,
341
+ "policy/entropy_avg": 0.048857688903808594,
342
+ "step": 80,
343
+ "val/clipfrac_avg": 0.0,
344
+ "val/num_eos_tokens": 25,
345
+ "val/ratio": 1.011049509048462,
346
+ "val/ratio_var": 0.004252108279615641
347
+ },
348
+ {
349
+ "episode": 4352,
350
+ "epoch": 0.05969248494657577,
351
+ "eps": 5,
352
+ "loss/policy_avg": -0.009127877652645111,
353
+ "loss/value_avg": 0.0,
354
+ "lr": 2.877237851662404e-06,
355
+ "objective/entropy": 3.016789674758911,
356
+ "objective/kl": 11.257818222045898,
357
+ "objective/non_score_reward": -1.125781774520874,
358
+ "objective/rlhf_reward": -0.4276960492134094,
359
+ "objective/scores": 0.69921875,
360
+ "policy/approxkl_avg": 1.4772686958312988,
361
+ "policy/clipfrac_avg": 0.35546875,
362
+ "policy/entropy_avg": 0.053719520568847656,
363
+ "step": 85,
364
+ "val/clipfrac_avg": 0.0,
365
+ "val/num_eos_tokens": 6,
366
+ "val/ratio": 1.0042904615402222,
367
+ "val/ratio_var": 0.0008556774700991809
368
+ },
369
+ {
370
+ "episode": 4608,
371
+ "epoch": 0.063203807590492,
372
+ "eps": 5,
373
+ "loss/policy_avg": -0.025049656629562378,
374
+ "loss/value_avg": 0.0,
375
+ "lr": 2.8695652173913046e-06,
376
+ "objective/entropy": 2.5907459259033203,
377
+ "objective/kl": 10.457273483276367,
378
+ "objective/non_score_reward": -1.0457274913787842,
379
+ "objective/rlhf_reward": -0.3816419839859009,
380
+ "objective/scores": 0.6640625,
381
+ "policy/approxkl_avg": 2.3460922241210938,
382
+ "policy/clipfrac_avg": 0.322265625,
383
+ "policy/entropy_avg": 0.04626178741455078,
384
+ "step": 90,
385
+ "val/clipfrac_avg": 0.0,
386
+ "val/num_eos_tokens": 11,
387
+ "val/ratio": 1.0003862380981445,
388
+ "val/ratio_var": 7.93520302977413e-05
389
+ },
390
+ {
391
+ "episode": 4864,
392
+ "epoch": 0.06671513023440821,
393
+ "eps": 5,
394
+ "loss/policy_avg": -0.01828361675143242,
395
+ "loss/value_avg": 0.0,
396
+ "lr": 2.8618925831202045e-06,
397
+ "objective/entropy": 2.397810220718384,
398
+ "objective/kl": 10.732559204101562,
399
+ "objective/non_score_reward": -1.073256015777588,
400
+ "objective/rlhf_reward": -0.35966813564300537,
401
+ "objective/scores": 0.71484375,
402
+ "policy/approxkl_avg": 1.1093428134918213,
403
+ "policy/clipfrac_avg": 0.32421875,
404
+ "policy/entropy_avg": 0.041881561279296875,
405
+ "step": 95,
406
+ "val/clipfrac_avg": 0.0,
407
+ "val/num_eos_tokens": 15,
408
+ "val/ratio": 1.0054664611816406,
409
+ "val/ratio_var": 0.0017973663052543998
410
+ },
411
+ {
412
+ "episode": 5120,
413
+ "epoch": 0.07022645287832444,
414
+ "eps": 5,
415
+ "loss/policy_avg": -0.04088423401117325,
416
+ "loss/value_avg": 0.0,
417
+ "lr": 2.8542199488491053e-06,
418
+ "objective/entropy": 2.343449592590332,
419
+ "objective/kl": 11.780994415283203,
420
+ "objective/non_score_reward": -1.1780993938446045,
421
+ "objective/rlhf_reward": -0.4628324806690216,
422
+ "objective/scores": 0.71484375,
423
+ "policy/approxkl_avg": 0.894420325756073,
424
+ "policy/clipfrac_avg": 0.46875,
425
+ "policy/entropy_avg": 0.04486083984375,
426
+ "step": 100,
427
+ "val/clipfrac_avg": 0.0,
428
+ "val/num_eos_tokens": 11,
429
+ "val/ratio": 1.0009559392929077,
430
+ "val/ratio_var": 4.804596756002866e-05
431
+ },
432
+ {
433
+ "episode": 5376,
434
+ "epoch": 0.07373777552224066,
435
+ "eps": 5,
436
+ "loss/policy_avg": -0.020697183907032013,
437
+ "loss/value_avg": 0.0,
438
+ "lr": 2.846547314578005e-06,
439
+ "objective/entropy": 1.9023351669311523,
440
+ "objective/kl": 10.29288101196289,
441
+ "objective/non_score_reward": -1.0292882919311523,
442
+ "objective/rlhf_reward": -0.29047834873199463,
443
+ "objective/scores": 0.73828125,
444
+ "policy/approxkl_avg": 0.9143690466880798,
445
+ "policy/clipfrac_avg": 0.373046875,
446
+ "policy/entropy_avg": 0.028568267822265625,
447
+ "step": 105,
448
+ "val/clipfrac_avg": 0.0,
449
+ "val/num_eos_tokens": 10,
450
+ "val/ratio": 1.000715732574463,
451
+ "val/ratio_var": 4.201457340968773e-05
452
+ },
453
+ {
454
+ "episode": 5632,
455
+ "epoch": 0.07724909816615688,
456
+ "eps": 5,
457
+ "loss/policy_avg": -0.012633640319108963,
458
+ "loss/value_avg": 0.0,
459
+ "lr": 2.8388746803069055e-06,
460
+ "objective/entropy": 1.3839142322540283,
461
+ "objective/kl": 10.57151985168457,
462
+ "objective/non_score_reward": -1.0571520328521729,
463
+ "objective/rlhf_reward": -0.2935946583747864,
464
+ "objective/scores": 0.765625,
465
+ "policy/approxkl_avg": 0.6525547504425049,
466
+ "policy/clipfrac_avg": 0.2646484375,
467
+ "policy/entropy_avg": 0.0345916748046875,
468
+ "step": 110,
469
+ "val/clipfrac_avg": 0.0,
470
+ "val/num_eos_tokens": 10,
471
+ "val/ratio": 0.9999199509620667,
472
+ "val/ratio_var": 2.6978697860613465e-05
473
+ },
474
+ {
475
+ "episode": 5888,
476
+ "epoch": 0.0807604208100731,
477
+ "eps": 5,
478
+ "loss/policy_avg": -0.026668714359402657,
479
+ "loss/value_avg": 0.0,
480
+ "lr": 2.831202046035806e-06,
481
+ "objective/entropy": 2.17741322517395,
482
+ "objective/kl": 11.39688491821289,
483
+ "objective/non_score_reward": -1.139688491821289,
484
+ "objective/rlhf_reward": -0.3027456998825073,
485
+ "objective/scores": 0.8359375,
486
+ "policy/approxkl_avg": 8.829752922058105,
487
+ "policy/clipfrac_avg": 0.35546875,
488
+ "policy/entropy_avg": 0.034277915954589844,
489
+ "step": 115,
490
+ "val/clipfrac_avg": 0.0,
491
+ "val/num_eos_tokens": 8,
492
+ "val/ratio": 1.0012441873550415,
493
+ "val/ratio_var": 9.009366476675496e-05
494
+ },
495
+ {
496
+ "episode": 6144,
497
+ "epoch": 0.08427174345398933,
498
+ "eps": 5,
499
+ "loss/policy_avg": -0.011602860875427723,
500
+ "loss/value_avg": 0.0,
501
+ "lr": 2.823529411764706e-06,
502
+ "objective/entropy": 1.418602466583252,
503
+ "objective/kl": 10.246469497680664,
504
+ "objective/non_score_reward": -1.0246469974517822,
505
+ "objective/rlhf_reward": -0.22599510848522186,
506
+ "objective/scores": 0.796875,
507
+ "policy/approxkl_avg": 0.31790149211883545,
508
+ "policy/clipfrac_avg": 0.2314453125,
509
+ "policy/entropy_avg": 0.028847694396972656,
510
+ "step": 120,
511
+ "val/clipfrac_avg": 0.0,
512
+ "val/num_eos_tokens": 9,
513
+ "val/ratio": 1.0009679794311523,
514
+ "val/ratio_var": 3.900106457876973e-05
515
+ },
516
+ {
517
+ "episode": 6400,
518
+ "epoch": 0.08778306609790555,
519
+ "eps": 5,
520
+ "loss/policy_avg": -0.0157505851238966,
521
+ "loss/value_avg": 0.0,
522
+ "lr": 2.8158567774936066e-06,
523
+ "objective/entropy": 1.936393141746521,
524
+ "objective/kl": 10.550077438354492,
525
+ "objective/non_score_reward": -1.0550076961517334,
526
+ "objective/rlhf_reward": -0.252943217754364,
527
+ "objective/scores": 0.80078125,
528
+ "policy/approxkl_avg": 6.545133113861084,
529
+ "policy/clipfrac_avg": 0.341796875,
530
+ "policy/entropy_avg": 0.039971351623535156,
531
+ "step": 125,
532
+ "val/clipfrac_avg": 0.0,
533
+ "val/num_eos_tokens": 12,
534
+ "val/ratio": 1.0001187324523926,
535
+ "val/ratio_var": 0.00011527155584190041
536
+ },
537
+ {
538
+ "episode": 6656,
539
+ "epoch": 0.09129438874182177,
540
+ "eps": 5,
541
+ "loss/policy_avg": -0.00908716581761837,
542
+ "loss/value_avg": 0.0,
543
+ "lr": 2.8081841432225065e-06,
544
+ "objective/entropy": 1.9167767763137817,
545
+ "objective/kl": 10.831771850585938,
546
+ "objective/non_score_reward": -1.0831772089004517,
547
+ "objective/rlhf_reward": -0.24270595610141754,
548
+ "objective/scores": 0.83984375,
549
+ "policy/approxkl_avg": 13.507976531982422,
550
+ "policy/clipfrac_avg": 0.25,
551
+ "policy/entropy_avg": 0.034499168395996094,
552
+ "step": 130,
553
+ "val/clipfrac_avg": 0.0,
554
+ "val/num_eos_tokens": 7,
555
+ "val/ratio": 1.0004911422729492,
556
+ "val/ratio_var": 0.00018595268193166703
557
+ },
558
+ {
559
+ "episode": 6912,
560
+ "epoch": 0.094805711385738,
561
+ "eps": 5,
562
+ "loss/policy_avg": -0.017197387292981148,
563
+ "loss/value_avg": 0.0,
564
+ "lr": 2.800511508951407e-06,
565
+ "objective/entropy": 1.7237651348114014,
566
+ "objective/kl": 11.095592498779297,
567
+ "objective/non_score_reward": -1.1095592975616455,
568
+ "objective/rlhf_reward": -0.21057555079460144,
569
+ "objective/scores": 0.8984375,
570
+ "policy/approxkl_avg": 2.7560040950775146,
571
+ "policy/clipfrac_avg": 0.2841796875,
572
+ "policy/entropy_avg": 0.032952308654785156,
573
+ "step": 135,
574
+ "val/clipfrac_avg": 0.0,
575
+ "val/num_eos_tokens": 2,
576
+ "val/ratio": 0.9994020462036133,
577
+ "val/ratio_var": 3.074964843108319e-05
578
+ },
579
+ {
580
+ "episode": 7168,
581
+ "epoch": 0.09831703402965422,
582
+ "eps": 5,
583
+ "loss/policy_avg": -0.012010859325528145,
584
+ "loss/value_avg": 0.0,
585
+ "lr": 2.792838874680307e-06,
586
+ "objective/entropy": 1.5862581729888916,
587
+ "objective/kl": 10.674396514892578,
588
+ "objective/non_score_reward": -1.0674396753311157,
589
+ "objective/rlhf_reward": -0.14433012902736664,
590
+ "objective/scores": 0.921875,
591
+ "policy/approxkl_avg": 1.1186727285385132,
592
+ "policy/clipfrac_avg": 0.2783203125,
593
+ "policy/entropy_avg": 0.0295562744140625,
594
+ "step": 140,
595
+ "val/clipfrac_avg": 0.0,
596
+ "val/num_eos_tokens": 13,
597
+ "val/ratio": 1.0007727146148682,
598
+ "val/ratio_var": 4.557183274300769e-05
599
+ },
600
+ {
601
+ "episode": 7424,
602
+ "epoch": 0.10182835667357044,
603
+ "eps": 5,
604
+ "loss/policy_avg": -0.013728385791182518,
605
+ "loss/value_avg": 0.0,
606
+ "lr": 2.785166240409207e-06,
607
+ "objective/entropy": 1.5388869047164917,
608
+ "objective/kl": 10.359582901000977,
609
+ "objective/non_score_reward": -1.035958170890808,
610
+ "objective/rlhf_reward": -0.14511710405349731,
611
+ "objective/scores": 0.890625,
612
+ "policy/approxkl_avg": 0.5204602479934692,
613
+ "policy/clipfrac_avg": 0.283203125,
614
+ "policy/entropy_avg": 0.028924942016601562,
615
+ "step": 145,
616
+ "val/clipfrac_avg": 0.0,
617
+ "val/num_eos_tokens": 14,
618
+ "val/ratio": 1.056097149848938,
619
+ "val/ratio_var": 0.13372056186199188
620
+ },
621
+ {
622
+ "episode": 7680,
623
+ "epoch": 0.10533967931748667,
624
+ "eps": 5,
625
+ "loss/policy_avg": -0.014945434406399727,
626
+ "loss/value_avg": 0.0,
627
+ "lr": 2.7774936061381074e-06,
628
+ "objective/entropy": 2.0769755840301514,
629
+ "objective/kl": 11.147063255310059,
630
+ "objective/non_score_reward": -1.11470627784729,
631
+ "objective/rlhf_reward": -0.08940108120441437,
632
+ "objective/scores": 1.0234375,
633
+ "policy/approxkl_avg": 0.5961493253707886,
634
+ "policy/clipfrac_avg": 0.3681640625,
635
+ "policy/entropy_avg": 0.037804603576660156,
636
+ "step": 150,
637
+ "val/clipfrac_avg": 0.0,
638
+ "val/num_eos_tokens": 13,
639
+ "val/ratio": 1.0033739805221558,
640
+ "val/ratio_var": 0.00030022990540601313
641
+ },
642
+ {
643
+ "episode": 7936,
644
+ "epoch": 0.10885100196140288,
645
+ "eps": 5,
646
+ "loss/policy_avg": -0.02276831492781639,
647
+ "loss/value_avg": 0.0,
648
+ "lr": 2.7698209718670078e-06,
649
+ "objective/entropy": 2.1412830352783203,
650
+ "objective/kl": 11.697949409484863,
651
+ "objective/non_score_reward": -1.169795036315918,
652
+ "objective/rlhf_reward": -0.13582009077072144,
653
+ "objective/scores": 1.03125,
654
+ "policy/approxkl_avg": 0.7155288457870483,
655
+ "policy/clipfrac_avg": 0.3193359375,
656
+ "policy/entropy_avg": 0.037835121154785156,
657
+ "step": 155,
658
+ "val/clipfrac_avg": 0.0,
659
+ "val/num_eos_tokens": 13,
660
+ "val/ratio": 1.0014090538024902,
661
+ "val/ratio_var": 5.2470270020421594e-05
662
+ },
663
+ {
664
+ "episode": 8192,
665
+ "epoch": 0.1123623246053191,
666
+ "eps": 5,
667
+ "loss/policy_avg": -0.013076605275273323,
668
+ "loss/value_avg": 0.0,
669
+ "lr": 2.762148337595908e-06,
670
+ "objective/entropy": 1.634714126586914,
671
+ "objective/kl": 11.629154205322266,
672
+ "objective/non_score_reward": -1.1629154682159424,
673
+ "objective/rlhf_reward": -0.28488799929618835,
674
+ "objective/scores": 0.87890625,
675
+ "policy/approxkl_avg": 0.4181188941001892,
676
+ "policy/clipfrac_avg": 0.3037109375,
677
+ "policy/entropy_avg": 0.029273509979248047,
678
+ "step": 160,
679
+ "val/clipfrac_avg": 0.0,
680
+ "val/num_eos_tokens": 15,
681
+ "val/ratio": 1.0008339881896973,
682
+ "val/ratio_var": 1.4662801731901709e-05
683
+ },
684
+ {
685
+ "episode": 8448,
686
+ "epoch": 0.11587364724923532,
687
+ "eps": 5,
688
+ "loss/policy_avg": -0.01651182770729065,
689
+ "loss/value_avg": 0.0,
690
+ "lr": 2.7544757033248085e-06,
691
+ "objective/entropy": 1.9540742635726929,
692
+ "objective/kl": 11.4830322265625,
693
+ "objective/non_score_reward": -1.1483032703399658,
694
+ "objective/rlhf_reward": -0.05983233451843262,
695
+ "objective/scores": 1.0859375,
696
+ "policy/approxkl_avg": 18.791297912597656,
697
+ "policy/clipfrac_avg": 0.2880859375,
698
+ "policy/entropy_avg": 0.03601264953613281,
699
+ "step": 165,
700
+ "val/clipfrac_avg": 0.0,
701
+ "val/num_eos_tokens": 16,
702
+ "val/ratio": 1.0220942497253418,
703
+ "val/ratio_var": 0.02208283357322216
704
+ },
705
+ {
706
+ "episode": 8704,
707
+ "epoch": 0.11938496989315155,
708
+ "eps": 5,
709
+ "loss/policy_avg": -0.013821810483932495,
710
+ "loss/value_avg": 0.0,
711
+ "lr": 2.7468030690537084e-06,
712
+ "objective/entropy": 1.6243339776992798,
713
+ "objective/kl": 11.435280799865723,
714
+ "objective/non_score_reward": -1.1435281038284302,
715
+ "objective/rlhf_reward": -0.12443088740110397,
716
+ "objective/scores": 1.015625,
717
+ "policy/approxkl_avg": 0.29013216495513916,
718
+ "policy/clipfrac_avg": 0.28125,
719
+ "policy/entropy_avg": 0.03498649597167969,
720
+ "step": 170,
721
+ "val/clipfrac_avg": 0.0,
722
+ "val/num_eos_tokens": 15,
723
+ "val/ratio": 1.0027971267700195,
724
+ "val/ratio_var": 0.0002298366161994636
725
+ },
726
+ {
727
+ "episode": 8960,
728
+ "epoch": 0.12289629253706777,
729
+ "eps": 5,
730
+ "loss/policy_avg": -0.011003649793565273,
731
+ "loss/value_avg": 0.0,
732
+ "lr": 2.7391304347826087e-06,
733
+ "objective/entropy": 2.000375986099243,
734
+ "objective/kl": 11.78514575958252,
735
+ "objective/non_score_reward": -1.1785145998001099,
736
+ "objective/rlhf_reward": -0.2609584331512451,
737
+ "objective/scores": 0.91796875,
738
+ "policy/approxkl_avg": 0.8603074550628662,
739
+ "policy/clipfrac_avg": 0.2998046875,
740
+ "policy/entropy_avg": 0.034775733947753906,
741
+ "step": 175,
742
+ "val/clipfrac_avg": 0.0,
743
+ "val/num_eos_tokens": 19,
744
+ "val/ratio": 1.0012288093566895,
745
+ "val/ratio_var": 3.532394111971371e-05
746
+ },
747
+ {
748
+ "episode": 9216,
749
+ "epoch": 0.126407615180984,
750
+ "eps": 5,
751
+ "loss/policy_avg": -0.010885423980653286,
752
+ "loss/value_avg": 0.0,
753
+ "lr": 2.731457800511509e-06,
754
+ "objective/entropy": 1.5240473747253418,
755
+ "objective/kl": 12.420597076416016,
756
+ "objective/non_score_reward": -1.2420598268508911,
757
+ "objective/rlhf_reward": -0.16641265153884888,
758
+ "objective/scores": 1.078125,
759
+ "policy/approxkl_avg": 0.46217110753059387,
760
+ "policy/clipfrac_avg": 0.2783203125,
761
+ "policy/entropy_avg": 0.029424667358398438,
762
+ "step": 180,
763
+ "val/clipfrac_avg": 0.0,
764
+ "val/num_eos_tokens": 20,
765
+ "val/ratio": 1.0007582902908325,
766
+ "val/ratio_var": 2.4759892767178826e-05
767
+ },
768
+ {
769
+ "episode": 9472,
770
+ "epoch": 0.12991893782490022,
771
+ "eps": 5,
772
+ "loss/policy_avg": -0.01097183395177126,
773
+ "loss/value_avg": 0.0,
774
+ "lr": 2.7237851662404094e-06,
775
+ "objective/entropy": 1.6292238235473633,
776
+ "objective/kl": 12.73173713684082,
777
+ "objective/non_score_reward": -1.2731736898422241,
778
+ "objective/rlhf_reward": -0.10916168242692947,
779
+ "objective/scores": 1.1640625,
780
+ "policy/approxkl_avg": 0.5525862574577332,
781
+ "policy/clipfrac_avg": 0.310546875,
782
+ "policy/entropy_avg": 0.031815528869628906,
783
+ "step": 185,
784
+ "val/clipfrac_avg": 0.0,
785
+ "val/num_eos_tokens": 22,
786
+ "val/ratio": 1.0027148723602295,
787
+ "val/ratio_var": 0.00016600274830125272
788
+ },
789
+ {
790
+ "episode": 9728,
791
+ "epoch": 0.13343026046881643,
792
+ "eps": 5,
793
+ "loss/policy_avg": -0.010572239756584167,
794
+ "loss/value_avg": 0.0,
795
+ "lr": 2.7161125319693097e-06,
796
+ "objective/entropy": 2.028618335723877,
797
+ "objective/kl": 12.439943313598633,
798
+ "objective/non_score_reward": -1.2439942359924316,
799
+ "objective/rlhf_reward": -0.06748821586370468,
800
+ "objective/scores": 1.171875,
801
+ "policy/approxkl_avg": 0.4930054843425751,
802
+ "policy/clipfrac_avg": 0.2841796875,
803
+ "policy/entropy_avg": 0.03688812255859375,
804
+ "step": 190,
805
+ "val/clipfrac_avg": 0.0,
806
+ "val/num_eos_tokens": 22,
807
+ "val/ratio": 1.001340627670288,
808
+ "val/ratio_var": 4.4035481550963596e-05
809
+ },
810
+ {
811
+ "episode": 9984,
812
+ "epoch": 0.13694158311273266,
813
+ "eps": 5,
814
+ "loss/policy_avg": -0.019254155457019806,
815
+ "loss/value_avg": 0.0,
816
+ "lr": 2.7084398976982097e-06,
817
+ "objective/entropy": 2.295351266860962,
818
+ "objective/kl": 13.32223892211914,
819
+ "objective/non_score_reward": -1.332223892211914,
820
+ "objective/rlhf_reward": -0.1836824268102646,
821
+ "objective/scores": 1.1484375,
822
+ "policy/approxkl_avg": 3.1426281929016113,
823
+ "policy/clipfrac_avg": 0.3251953125,
824
+ "policy/entropy_avg": 0.03939247131347656,
825
+ "step": 195,
826
+ "val/clipfrac_avg": 0.0,
827
+ "val/num_eos_tokens": 17,
828
+ "val/ratio": 1.0032271146774292,
829
+ "val/ratio_var": 0.00019827872165478766
830
+ },
831
+ {
832
+ "episode": 10240,
833
+ "epoch": 0.14045290575664887,
834
+ "eps": 5,
835
+ "loss/policy_avg": -0.018122296780347824,
836
+ "loss/value_avg": 0.0,
837
+ "lr": 2.70076726342711e-06,
838
+ "objective/entropy": 2.345075845718384,
839
+ "objective/kl": 12.536066055297852,
840
+ "objective/non_score_reward": -1.2536065578460693,
841
+ "objective/rlhf_reward": -0.056986674666404724,
842
+ "objective/scores": 1.1953125,
843
+ "policy/approxkl_avg": 27.5201473236084,
844
+ "policy/clipfrac_avg": 0.3046875,
845
+ "policy/entropy_avg": 0.04156017303466797,
846
+ "step": 200,
847
+ "val/clipfrac_avg": 0.0,
848
+ "val/num_eos_tokens": 20,
849
+ "val/ratio": 0.9993807077407837,
850
+ "val/ratio_var": 0.00011275127326371148
851
+ },
852
+ {
853
+ "episode": 10496,
854
+ "epoch": 0.1439642284005651,
855
+ "eps": 5,
856
+ "loss/policy_avg": -0.019295353442430496,
857
+ "loss/value_avg": 0.0,
858
+ "lr": 2.6930946291560103e-06,
859
+ "objective/entropy": 2.091012477874756,
860
+ "objective/kl": 12.746508598327637,
861
+ "objective/non_score_reward": -1.2746508121490479,
862
+ "objective/rlhf_reward": -0.09065462648868561,
863
+ "objective/scores": 1.1875,
864
+ "policy/approxkl_avg": 0.5554059743881226,
865
+ "policy/clipfrac_avg": 0.2998046875,
866
+ "policy/entropy_avg": 0.03620719909667969,
867
+ "step": 205,
868
+ "val/clipfrac_avg": 0.0,
869
+ "val/num_eos_tokens": 17,
870
+ "val/ratio": 1.001387119293213,
871
+ "val/ratio_var": 3.4958156902575865e-05
872
+ },
873
+ {
874
+ "episode": 10752,
875
+ "epoch": 0.14747555104448132,
876
+ "eps": 5,
877
+ "loss/policy_avg": -0.010203800164163113,
878
+ "loss/value_avg": 0.0,
879
+ "lr": 2.6854219948849107e-06,
880
+ "objective/entropy": 2.1808600425720215,
881
+ "objective/kl": 12.404802322387695,
882
+ "objective/non_score_reward": -1.2404803037643433,
883
+ "objective/rlhf_reward": -0.059675075113773346,
884
+ "objective/scores": 1.1796875,
885
+ "policy/approxkl_avg": 0.5876989364624023,
886
+ "policy/clipfrac_avg": 0.27734375,
887
+ "policy/entropy_avg": 0.041385650634765625,
888
+ "step": 210,
889
+ "val/clipfrac_avg": 0.0,
890
+ "val/num_eos_tokens": 14,
891
+ "val/ratio": 1.0035128593444824,
892
+ "val/ratio_var": 0.0004931605653837323
893
+ },
894
+ {
895
+ "episode": 11008,
896
+ "epoch": 0.15098687368839755,
897
+ "eps": 5,
898
+ "loss/policy_avg": -0.018955286592245102,
899
+ "loss/value_avg": 0.0,
900
+ "lr": 2.677749360613811e-06,
901
+ "objective/entropy": 1.968322992324829,
902
+ "objective/kl": 13.322561264038086,
903
+ "objective/non_score_reward": -1.3322560787200928,
904
+ "objective/rlhf_reward": -0.0670965313911438,
905
+ "objective/scores": 1.265625,
906
+ "policy/approxkl_avg": 0.39782679080963135,
907
+ "policy/clipfrac_avg": 0.373046875,
908
+ "policy/entropy_avg": 0.03279399871826172,
909
+ "step": 215,
910
+ "val/clipfrac_avg": 0.0,
911
+ "val/num_eos_tokens": 14,
912
+ "val/ratio": 1.0017969608306885,
913
+ "val/ratio_var": 6.843745359219611e-05
914
+ },
915
+ {
916
+ "episode": 11264,
917
+ "epoch": 0.15449819633231376,
918
+ "eps": 5,
919
+ "loss/policy_avg": -0.014947709627449512,
920
+ "loss/value_avg": 0.0,
921
+ "lr": 2.670076726342711e-06,
922
+ "objective/entropy": 1.7985560894012451,
923
+ "objective/kl": 12.856376647949219,
924
+ "objective/non_score_reward": -1.285637617111206,
925
+ "objective/rlhf_reward": -0.03251491114497185,
926
+ "objective/scores": 1.25,
927
+ "policy/approxkl_avg": 0.4516296982765198,
928
+ "policy/clipfrac_avg": 0.3671875,
929
+ "policy/entropy_avg": 0.031859397888183594,
930
+ "step": 220,
931
+ "val/clipfrac_avg": 0.0,
932
+ "val/num_eos_tokens": 13,
933
+ "val/ratio": 1.0009992122650146,
934
+ "val/ratio_var": 4.1194460209226236e-05
935
+ },
936
+ {
937
+ "episode": 11520,
938
+ "epoch": 0.15800951897623,
939
+ "eps": 5,
940
+ "loss/policy_avg": -0.019819077104330063,
941
+ "loss/value_avg": 0.0,
942
+ "lr": 2.6624040920716113e-06,
943
+ "objective/entropy": 1.5284242630004883,
944
+ "objective/kl": 14.283391952514648,
945
+ "objective/non_score_reward": -1.4283392429351807,
946
+ "objective/rlhf_reward": -0.014965277165174484,
947
+ "objective/scores": 1.4140625,
948
+ "policy/approxkl_avg": 1.5518393516540527,
949
+ "policy/clipfrac_avg": 0.2744140625,
950
+ "policy/entropy_avg": 0.026048660278320312,
951
+ "step": 225,
952
+ "val/clipfrac_avg": 0.0,
953
+ "val/num_eos_tokens": 8,
954
+ "val/ratio": 1.0007925033569336,
955
+ "val/ratio_var": 3.721785105881281e-05
956
+ },
957
+ {
958
+ "episode": 11776,
959
+ "epoch": 0.1615208416201462,
960
+ "eps": 5,
961
+ "loss/policy_avg": -0.015632648020982742,
962
+ "loss/value_avg": 0.0,
963
+ "lr": 2.6547314578005116e-06,
964
+ "objective/entropy": 1.5101430416107178,
965
+ "objective/kl": 13.435927391052246,
966
+ "objective/non_score_reward": -1.3435927629470825,
967
+ "objective/rlhf_reward": 0.017792798578739166,
968
+ "objective/scores": 1.359375,
969
+ "policy/approxkl_avg": 0.22922199964523315,
970
+ "policy/clipfrac_avg": 0.271484375,
971
+ "policy/entropy_avg": 0.025536060333251953,
972
+ "step": 230,
973
+ "val/clipfrac_avg": 0.0,
974
+ "val/num_eos_tokens": 11,
975
+ "val/ratio": 1.0355898141860962,
976
+ "val/ratio_var": 0.09009659290313721
977
+ },
978
+ {
979
+ "episode": 12032,
980
+ "epoch": 0.16503216426406245,
981
+ "eps": 5,
982
+ "loss/policy_avg": -0.014460040256381035,
983
+ "loss/value_avg": 0.0,
984
+ "lr": 2.647058823529412e-06,
985
+ "objective/entropy": 1.412046194076538,
986
+ "objective/kl": 13.981653213500977,
987
+ "objective/non_score_reward": -1.3981653451919556,
988
+ "objective/rlhf_reward": -0.19434592127799988,
989
+ "objective/scores": 1.203125,
990
+ "policy/approxkl_avg": 0.48358476161956787,
991
+ "policy/clipfrac_avg": 0.287109375,
992
+ "policy/entropy_avg": 0.027116775512695312,
993
+ "step": 235,
994
+ "val/clipfrac_avg": 0.0,
995
+ "val/num_eos_tokens": 19,
996
+ "val/ratio": 1.0002431869506836,
997
+ "val/ratio_var": 1.317531587119447e-05
998
+ },
999
+ {
1000
+ "episode": 12288,
1001
+ "epoch": 0.16854348690797866,
1002
+ "eps": 5,
1003
+ "loss/policy_avg": -0.0144148338586092,
1004
+ "loss/value_avg": 0.0,
1005
+ "lr": 2.6393861892583123e-06,
1006
+ "objective/entropy": 1.5728825330734253,
1007
+ "objective/kl": 13.091099739074707,
1008
+ "objective/non_score_reward": -1.3091099262237549,
1009
+ "objective/rlhf_reward": -0.12438549101352692,
1010
+ "objective/scores": 1.1875,
1011
+ "policy/approxkl_avg": 0.5084937810897827,
1012
+ "policy/clipfrac_avg": 0.2587890625,
1013
+ "policy/entropy_avg": 0.028881072998046875,
1014
+ "step": 240,
1015
+ "val/clipfrac_avg": 0.0,
1016
+ "val/num_eos_tokens": 14,
1017
+ "val/ratio": 1.004534125328064,
1018
+ "val/ratio_var": 0.001037073670886457
1019
+ },
1020
+ {
1021
+ "episode": 12544,
1022
+ "epoch": 0.17205480955189487,
1023
+ "eps": 5,
1024
+ "loss/policy_avg": -0.02535724639892578,
1025
+ "loss/value_avg": 0.0,
1026
+ "lr": 2.6317135549872122e-06,
1027
+ "objective/entropy": 1.6895666122436523,
1028
+ "objective/kl": 13.036446571350098,
1029
+ "objective/non_score_reward": -1.3036446571350098,
1030
+ "objective/rlhf_reward": -0.08131173253059387,
1031
+ "objective/scores": 1.21875,
1032
+ "policy/approxkl_avg": 1.397173285484314,
1033
+ "policy/clipfrac_avg": 0.296875,
1034
+ "policy/entropy_avg": 0.025877952575683594,
1035
+ "step": 245,
1036
+ "val/clipfrac_avg": 0.0,
1037
+ "val/num_eos_tokens": 11,
1038
+ "val/ratio": 0.9993641972541809,
1039
+ "val/ratio_var": 3.554957584128715e-05
1040
+ },
1041
+ {
1042
+ "episode": 12800,
1043
+ "epoch": 0.1755661321958111,
1044
+ "eps": 5,
1045
+ "loss/policy_avg": -0.013989413157105446,
1046
+ "loss/value_avg": 0.0,
1047
+ "lr": 2.6240409207161126e-06,
1048
+ "objective/entropy": 1.4321318864822388,
1049
+ "objective/kl": 13.751260757446289,
1050
+ "objective/non_score_reward": -1.3751261234283447,
1051
+ "objective/rlhf_reward": 0.024946460500359535,
1052
+ "objective/scores": 1.3984375,
1053
+ "policy/approxkl_avg": 0.3265579044818878,
1054
+ "policy/clipfrac_avg": 0.3095703125,
1055
+ "policy/entropy_avg": 0.02507495880126953,
1056
+ "step": 250,
1057
+ "val/clipfrac_avg": 0.0,
1058
+ "val/num_eos_tokens": 14,
1059
+ "val/ratio": 1.0016669034957886,
1060
+ "val/ratio_var": 3.951354665332474e-05
1061
+ }
1062
+ ],
1063
+ "logging_steps": 100,
1064
+ "max_steps": 391,
1065
+ "num_input_tokens_seen": 0,
1066
+ "num_train_epochs": 1.3716104077797742,
1067
+ "save_steps": 50,
1068
+ "stateful_callbacks": {
1069
+ "TrainerControl": {
1070
+ "args": {
1071
+ "should_epoch_stop": false,
1072
+ "should_evaluate": false,
1073
+ "should_log": false,
1074
+ "should_save": true,
1075
+ "should_training_stop": false
1076
+ },
1077
+ "attributes": {}
1078
+ }
1079
+ },
1080
+ "total_flos": 0,
1081
+ "train_batch_size": null,
1082
+ "trial_name": null,
1083
+ "trial_params": null
1084
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f69fedf04484e314c878c0562873de1761b9262a2545636c76d80eb9a5506163
3
+ size 6840
zero_to_fp32.py ADDED
@@ -0,0 +1,604 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example: python zero_to_fp32.py . pytorch_model.bin
14
+
15
+ import argparse
16
+ import torch
17
+ import glob
18
+ import math
19
+ import os
20
+ import re
21
+ from collections import OrderedDict
22
+ from dataclasses import dataclass
23
+
24
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
25
+ # DeepSpeed data structures it has to be available in the current python environment.
26
+ from deepspeed.utils import logger
27
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
28
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
29
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
30
+
31
+
32
+ @dataclass
33
+ class zero_model_state:
34
+ buffers: dict()
35
+ param_shapes: dict()
36
+ shared_params: list
37
+ ds_version: int
38
+ frozen_param_shapes: dict()
39
+ frozen_param_fragments: dict()
40
+
41
+
42
+ debug = 0
43
+
44
+ # load to cpu
45
+ device = torch.device('cpu')
46
+
47
+
48
+ def atoi(text):
49
+ return int(text) if text.isdigit() else text
50
+
51
+
52
+ def natural_keys(text):
53
+ '''
54
+ alist.sort(key=natural_keys) sorts in human order
55
+ http://nedbatchelder.com/blog/200712/human_sorting.html
56
+ (See Toothy's implementation in the comments)
57
+ '''
58
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
59
+
60
+
61
+ def get_model_state_file(checkpoint_dir, zero_stage):
62
+ if not os.path.isdir(checkpoint_dir):
63
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
64
+
65
+ # there should be only one file
66
+ if zero_stage <= 2:
67
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
68
+ elif zero_stage == 3:
69
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
70
+
71
+ if not os.path.exists(file):
72
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
73
+
74
+ return file
75
+
76
+
77
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
78
+ # XXX: need to test that this simple glob rule works for multi-node setup too
79
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
80
+
81
+ if len(ckpt_files) == 0:
82
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
83
+
84
+ return ckpt_files
85
+
86
+
87
+ def get_optim_files(checkpoint_dir):
88
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
89
+
90
+
91
+ def get_model_state_files(checkpoint_dir):
92
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
93
+
94
+
95
+ def parse_model_states(files):
96
+ zero_model_states = []
97
+ for file in files:
98
+ state_dict = torch.load(file, map_location=device)
99
+
100
+ if BUFFER_NAMES not in state_dict:
101
+ raise ValueError(f"{file} is not a model state checkpoint")
102
+ buffer_names = state_dict[BUFFER_NAMES]
103
+ if debug:
104
+ print("Found buffers:", buffer_names)
105
+
106
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
107
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
108
+ param_shapes = state_dict[PARAM_SHAPES]
109
+
110
+ # collect parameters that are included in param_shapes
111
+ param_names = []
112
+ for s in param_shapes:
113
+ for name in s.keys():
114
+ param_names.append(name)
115
+
116
+ # update with frozen parameters
117
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
118
+ if frozen_param_shapes is not None:
119
+ if debug:
120
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
121
+ param_names += list(frozen_param_shapes.keys())
122
+
123
+ # handle shared params
124
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
125
+
126
+ ds_version = state_dict.get(DS_VERSION, None)
127
+
128
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
129
+
130
+ z_model_state = zero_model_state(buffers=buffers,
131
+ param_shapes=param_shapes,
132
+ shared_params=shared_params,
133
+ ds_version=ds_version,
134
+ frozen_param_shapes=frozen_param_shapes,
135
+ frozen_param_fragments=frozen_param_fragments)
136
+ zero_model_states.append(z_model_state)
137
+
138
+ return zero_model_states
139
+
140
+
141
+ def parse_optim_states(files, ds_checkpoint_dir):
142
+
143
+ total_files = len(files)
144
+ state_dicts = []
145
+ for f in files:
146
+ state_dict = torch.load(f, map_location=device)
147
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
148
+ # and also handle the case where it was already removed by another helper script
149
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
150
+ state_dicts.append(state_dict)
151
+
152
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
153
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
154
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
155
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
156
+
157
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
158
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
159
+ # use the max of the partition_count to get the dp world_size.
160
+
161
+ if type(world_size) is list:
162
+ world_size = max(world_size)
163
+
164
+ if world_size != total_files:
165
+ raise ValueError(
166
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
167
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
168
+ )
169
+
170
+ # the groups are named differently in each stage
171
+ if zero_stage <= 2:
172
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
173
+ elif zero_stage == 3:
174
+ fp32_groups_key = FP32_FLAT_GROUPS
175
+ else:
176
+ raise ValueError(f"unknown zero stage {zero_stage}")
177
+
178
+ if zero_stage <= 2:
179
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
180
+ elif zero_stage == 3:
181
+ # if there is more than one param group, there will be multiple flattened tensors - one
182
+ # flattened tensor per group - for simplicity merge them into a single tensor
183
+ #
184
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
185
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
186
+
187
+ fp32_flat_groups = [
188
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
189
+ ]
190
+
191
+ return zero_stage, world_size, fp32_flat_groups
192
+
193
+
194
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
195
+ """
196
+ Returns fp32 state_dict reconstructed from ds checkpoint
197
+
198
+ Args:
199
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
200
+
201
+ """
202
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
203
+
204
+ optim_files = get_optim_files(ds_checkpoint_dir)
205
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
206
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
207
+
208
+ model_files = get_model_state_files(ds_checkpoint_dir)
209
+
210
+ zero_model_states = parse_model_states(model_files)
211
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
212
+
213
+ if zero_stage <= 2:
214
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
215
+ exclude_frozen_parameters)
216
+ elif zero_stage == 3:
217
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
218
+ exclude_frozen_parameters)
219
+
220
+
221
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
222
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
223
+ return
224
+
225
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
226
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
227
+
228
+ if debug:
229
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
230
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
231
+
232
+ wanted_params = len(frozen_param_shapes)
233
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
234
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
235
+ print(f'Frozen params: Have {avail_numel} numels to process.')
236
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
237
+
238
+ total_params = 0
239
+ total_numel = 0
240
+ for name, shape in frozen_param_shapes.items():
241
+ total_params += 1
242
+ unpartitioned_numel = shape.numel()
243
+ total_numel += unpartitioned_numel
244
+
245
+ state_dict[name] = frozen_param_fragments[name]
246
+
247
+ if debug:
248
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
249
+
250
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
251
+
252
+
253
+ def _has_callable(obj, fn):
254
+ attr = getattr(obj, fn, None)
255
+ return callable(attr)
256
+
257
+
258
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
259
+ param_shapes = zero_model_states[0].param_shapes
260
+
261
+ # Reconstruction protocol:
262
+ #
263
+ # XXX: document this
264
+
265
+ if debug:
266
+ for i in range(world_size):
267
+ for j in range(len(fp32_flat_groups[0])):
268
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
269
+
270
+ # XXX: memory usage doubles here (zero2)
271
+ num_param_groups = len(fp32_flat_groups[0])
272
+ merged_single_partition_of_fp32_groups = []
273
+ for i in range(num_param_groups):
274
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
275
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
276
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
277
+ avail_numel = sum(
278
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
279
+
280
+ if debug:
281
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
282
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
283
+ # not asserting if there is a mismatch due to possible padding
284
+ print(f"Have {avail_numel} numels to process.")
285
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
286
+
287
+ # params
288
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
289
+ # out-of-core computing solution
290
+ total_numel = 0
291
+ total_params = 0
292
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
293
+ offset = 0
294
+ avail_numel = full_single_fp32_vector.numel()
295
+ for name, shape in shapes.items():
296
+
297
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
298
+ total_numel += unpartitioned_numel
299
+ total_params += 1
300
+
301
+ if debug:
302
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
303
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
304
+ offset += unpartitioned_numel
305
+
306
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
307
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
308
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
309
+ # live optimizer object, so we are checking that the numbers are within the right range
310
+ align_to = 2 * world_size
311
+
312
+ def zero2_align(x):
313
+ return align_to * math.ceil(x / align_to)
314
+
315
+ if debug:
316
+ print(f"original offset={offset}, avail_numel={avail_numel}")
317
+
318
+ offset = zero2_align(offset)
319
+ avail_numel = zero2_align(avail_numel)
320
+
321
+ if debug:
322
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
323
+
324
+ # Sanity check
325
+ if offset != avail_numel:
326
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
327
+
328
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
329
+
330
+
331
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
332
+ exclude_frozen_parameters):
333
+ state_dict = OrderedDict()
334
+
335
+ # buffers
336
+ buffers = zero_model_states[0].buffers
337
+ state_dict.update(buffers)
338
+ if debug:
339
+ print(f"added {len(buffers)} buffers")
340
+
341
+ if not exclude_frozen_parameters:
342
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
343
+
344
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
345
+
346
+ # recover shared parameters
347
+ for pair in zero_model_states[0].shared_params:
348
+ if pair[1] in state_dict:
349
+ state_dict[pair[0]] = state_dict[pair[1]]
350
+
351
+ return state_dict
352
+
353
+
354
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
355
+ remainder = unpartitioned_numel % world_size
356
+ padding_numel = (world_size - remainder) if remainder else 0
357
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
358
+ return partitioned_numel, padding_numel
359
+
360
+
361
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
362
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
363
+ return
364
+
365
+ if debug:
366
+ for i in range(world_size):
367
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
368
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
369
+
370
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
371
+ wanted_params = len(frozen_param_shapes)
372
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
373
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
374
+ print(f'Frozen params: Have {avail_numel} numels to process.')
375
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
376
+
377
+ total_params = 0
378
+ total_numel = 0
379
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
380
+ total_params += 1
381
+ unpartitioned_numel = shape.numel()
382
+ total_numel += unpartitioned_numel
383
+
384
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
385
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
386
+
387
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
388
+
389
+ if debug:
390
+ print(
391
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
392
+ )
393
+
394
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
395
+
396
+
397
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
398
+ param_shapes = zero_model_states[0].param_shapes
399
+ avail_numel = fp32_flat_groups[0].numel() * world_size
400
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
401
+ # param, re-consolidating each param, while dealing with padding if any
402
+
403
+ # merge list of dicts, preserving order
404
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
405
+
406
+ if debug:
407
+ for i in range(world_size):
408
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
409
+
410
+ wanted_params = len(param_shapes)
411
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
412
+ # not asserting if there is a mismatch due to possible padding
413
+ avail_numel = fp32_flat_groups[0].numel() * world_size
414
+ print(f"Trainable params: Have {avail_numel} numels to process.")
415
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
416
+
417
+ # params
418
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
419
+ # out-of-core computing solution
420
+ offset = 0
421
+ total_numel = 0
422
+ total_params = 0
423
+ for name, shape in param_shapes.items():
424
+
425
+ unpartitioned_numel = shape.numel()
426
+ total_numel += unpartitioned_numel
427
+ total_params += 1
428
+
429
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
430
+
431
+ if debug:
432
+ print(
433
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
434
+ )
435
+
436
+ # XXX: memory usage doubles here
437
+ state_dict[name] = torch.cat(
438
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
439
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
440
+ offset += partitioned_numel
441
+
442
+ offset *= world_size
443
+
444
+ # Sanity check
445
+ if offset != avail_numel:
446
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
447
+
448
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
449
+
450
+
451
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
452
+ exclude_frozen_parameters):
453
+ state_dict = OrderedDict()
454
+
455
+ # buffers
456
+ buffers = zero_model_states[0].buffers
457
+ state_dict.update(buffers)
458
+ if debug:
459
+ print(f"added {len(buffers)} buffers")
460
+
461
+ if not exclude_frozen_parameters:
462
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
463
+
464
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
465
+
466
+ # recover shared parameters
467
+ for pair in zero_model_states[0].shared_params:
468
+ if pair[1] in state_dict:
469
+ state_dict[pair[0]] = state_dict[pair[1]]
470
+
471
+ return state_dict
472
+
473
+
474
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None, exclude_frozen_parameters=False):
475
+ """
476
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
477
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
478
+ via a model hub.
479
+
480
+ Args:
481
+ - ``checkpoint_dir``: path to the desired checkpoint folder
482
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
483
+ - ``exclude_frozen_parameters``: exclude frozen parameters
484
+
485
+ Returns:
486
+ - pytorch ``state_dict``
487
+
488
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
489
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
490
+ the checkpoint.
491
+
492
+ A typical usage might be ::
493
+
494
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
495
+ # do the training and checkpoint saving
496
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
497
+ model = model.cpu() # move to cpu
498
+ model.load_state_dict(state_dict)
499
+ # submit to model hub or save the model to share with others
500
+
501
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
502
+ application. i.e. you will need to re-initialize the deepspeed engine, since
503
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
504
+
505
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
506
+
507
+ """
508
+ if tag is None:
509
+ latest_path = os.path.join(checkpoint_dir, 'latest')
510
+ if os.path.isfile(latest_path):
511
+ with open(latest_path, 'r') as fd:
512
+ tag = fd.read().strip()
513
+ else:
514
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
515
+
516
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
517
+
518
+ if not os.path.isdir(ds_checkpoint_dir):
519
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
520
+
521
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
522
+
523
+
524
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None, exclude_frozen_parameters=False):
525
+ """
526
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
527
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
528
+
529
+ Args:
530
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
531
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
532
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
533
+ - ``exclude_frozen_parameters``: exclude frozen parameters
534
+ """
535
+
536
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag, exclude_frozen_parameters)
537
+ print(f"Saving fp32 state dict to {output_file}")
538
+ torch.save(state_dict, output_file)
539
+
540
+
541
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
542
+ """
543
+ 1. Put the provided model to cpu
544
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
545
+ 3. Load it into the provided model
546
+
547
+ Args:
548
+ - ``model``: the model object to update
549
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
550
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
551
+
552
+ Returns:
553
+ - ``model`: modified model
554
+
555
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
556
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
557
+ conveniently placed for you in the checkpoint folder.
558
+
559
+ A typical usage might be ::
560
+
561
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
562
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
563
+ # submit to model hub or save the model to share with others
564
+
565
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
566
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
567
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
568
+
569
+ """
570
+ logger.info(f"Extracting fp32 weights")
571
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
572
+
573
+ logger.info(f"Overwriting model with fp32 weights")
574
+ model = model.cpu()
575
+ model.load_state_dict(state_dict, strict=False)
576
+
577
+ return model
578
+
579
+
580
+ if __name__ == "__main__":
581
+
582
+ parser = argparse.ArgumentParser()
583
+ parser.add_argument("checkpoint_dir",
584
+ type=str,
585
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
586
+ parser.add_argument(
587
+ "output_file",
588
+ type=str,
589
+ help="path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)")
590
+ parser.add_argument("-t",
591
+ "--tag",
592
+ type=str,
593
+ default=None,
594
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
595
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
596
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
597
+ args = parser.parse_args()
598
+
599
+ debug = args.debug
600
+
601
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
602
+ args.output_file,
603
+ tag=args.tag,
604
+ exclude_frozen_parameters=args.exclude_frozen_parameters)