avemio-digital commited on
Commit
750b81f
verified
1 Parent(s): d31f6ce

Upload 16 files

Browse files
.gitattributes CHANGED
@@ -1,35 +1,35 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "<|im_end|>": 32769,
3
+ "<|im_start|>": 32768
4
+ }
config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "avemio-digital/GRAG-Mistral7B-v3-SFT-after-CPT-fulldata-new-template",
3
+ "architectures": [
4
+ "MistralForCausalLM"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 1,
8
+ "eos_token_id": 2,
9
+ "hidden_act": "silu",
10
+ "hidden_size": 4096,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 14336,
13
+ "max_position_embeddings": 32768,
14
+ "model_type": "mistral",
15
+ "num_attention_heads": 32,
16
+ "num_hidden_layers": 32,
17
+ "num_key_value_heads": 8,
18
+ "rms_norm_eps": 1e-05,
19
+ "rope_theta": 1000000.0,
20
+ "sliding_window": null,
21
+ "tie_word_embeddings": false,
22
+ "torch_dtype": "bfloat16",
23
+ "transformers_version": "4.40.1",
24
+ "use_cache": true,
25
+ "vocab_size": 32832
26
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "transformers_version": "4.40.1"
6
+ }
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step840
model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:203ea77fa169dd5e3c24a761887b860818e7c621becef746578efba2480009ab
3
+ size 4949978080
model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ffce50353e862690976d69551f2b1b186228ee4338a31c0b54d39a60ceba5d84
3
+ size 4999819336
model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d1a1123a57d1e8da1cc5cb5c92e25ad178c2fcfcd8a984619fb084da11dcad13
3
+ size 4547332088
model.safetensors.index.json ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 14497095680
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "model-00003-of-00003.safetensors",
7
+ "model.embed_tokens.weight": "model-00001-of-00003.safetensors",
8
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00003.safetensors",
9
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
10
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
11
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
12
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
13
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
14
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
15
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
16
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
17
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00003.safetensors",
18
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
19
+ "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
20
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
21
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
22
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
23
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
24
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
25
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
26
+ "model.layers.10.input_layernorm.weight": "model-00002-of-00003.safetensors",
27
+ "model.layers.10.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
28
+ "model.layers.10.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
29
+ "model.layers.10.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
30
+ "model.layers.10.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
31
+ "model.layers.10.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
32
+ "model.layers.10.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
33
+ "model.layers.10.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
34
+ "model.layers.10.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
35
+ "model.layers.11.input_layernorm.weight": "model-00002-of-00003.safetensors",
36
+ "model.layers.11.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
37
+ "model.layers.11.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
38
+ "model.layers.11.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
39
+ "model.layers.11.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
40
+ "model.layers.11.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
41
+ "model.layers.11.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
42
+ "model.layers.11.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
43
+ "model.layers.11.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
44
+ "model.layers.12.input_layernorm.weight": "model-00002-of-00003.safetensors",
45
+ "model.layers.12.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
46
+ "model.layers.12.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
47
+ "model.layers.12.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
48
+ "model.layers.12.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
49
+ "model.layers.12.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
50
+ "model.layers.12.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
51
+ "model.layers.12.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
52
+ "model.layers.12.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
53
+ "model.layers.13.input_layernorm.weight": "model-00002-of-00003.safetensors",
54
+ "model.layers.13.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
55
+ "model.layers.13.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
56
+ "model.layers.13.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
57
+ "model.layers.13.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
58
+ "model.layers.13.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
59
+ "model.layers.13.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
60
+ "model.layers.13.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
61
+ "model.layers.13.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
62
+ "model.layers.14.input_layernorm.weight": "model-00002-of-00003.safetensors",
63
+ "model.layers.14.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
64
+ "model.layers.14.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
65
+ "model.layers.14.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
66
+ "model.layers.14.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
67
+ "model.layers.14.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
68
+ "model.layers.14.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
69
+ "model.layers.14.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
70
+ "model.layers.14.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
71
+ "model.layers.15.input_layernorm.weight": "model-00002-of-00003.safetensors",
72
+ "model.layers.15.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
73
+ "model.layers.15.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
74
+ "model.layers.15.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
75
+ "model.layers.15.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
76
+ "model.layers.15.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
77
+ "model.layers.15.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
78
+ "model.layers.15.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
79
+ "model.layers.15.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
80
+ "model.layers.16.input_layernorm.weight": "model-00002-of-00003.safetensors",
81
+ "model.layers.16.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
82
+ "model.layers.16.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
83
+ "model.layers.16.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
84
+ "model.layers.16.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
85
+ "model.layers.16.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
86
+ "model.layers.16.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
87
+ "model.layers.16.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
88
+ "model.layers.16.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
89
+ "model.layers.17.input_layernorm.weight": "model-00002-of-00003.safetensors",
90
+ "model.layers.17.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
91
+ "model.layers.17.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
92
+ "model.layers.17.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
93
+ "model.layers.17.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
94
+ "model.layers.17.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
95
+ "model.layers.17.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
96
+ "model.layers.17.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
97
+ "model.layers.17.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
98
+ "model.layers.18.input_layernorm.weight": "model-00002-of-00003.safetensors",
99
+ "model.layers.18.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
100
+ "model.layers.18.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
101
+ "model.layers.18.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
102
+ "model.layers.18.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
103
+ "model.layers.18.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
104
+ "model.layers.18.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
105
+ "model.layers.18.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
106
+ "model.layers.18.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
107
+ "model.layers.19.input_layernorm.weight": "model-00002-of-00003.safetensors",
108
+ "model.layers.19.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
109
+ "model.layers.19.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
110
+ "model.layers.19.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
111
+ "model.layers.19.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
112
+ "model.layers.19.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
113
+ "model.layers.19.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
114
+ "model.layers.19.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
115
+ "model.layers.19.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
116
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00003.safetensors",
117
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
118
+ "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
119
+ "model.layers.2.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
120
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
121
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
122
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
123
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
124
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
125
+ "model.layers.20.input_layernorm.weight": "model-00002-of-00003.safetensors",
126
+ "model.layers.20.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
127
+ "model.layers.20.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
128
+ "model.layers.20.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
129
+ "model.layers.20.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
130
+ "model.layers.20.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
131
+ "model.layers.20.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
132
+ "model.layers.20.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
133
+ "model.layers.20.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
134
+ "model.layers.21.input_layernorm.weight": "model-00002-of-00003.safetensors",
135
+ "model.layers.21.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
136
+ "model.layers.21.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
137
+ "model.layers.21.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
138
+ "model.layers.21.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
139
+ "model.layers.21.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
140
+ "model.layers.21.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
141
+ "model.layers.21.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
142
+ "model.layers.21.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
143
+ "model.layers.22.input_layernorm.weight": "model-00003-of-00003.safetensors",
144
+ "model.layers.22.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
145
+ "model.layers.22.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
146
+ "model.layers.22.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
147
+ "model.layers.22.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
148
+ "model.layers.22.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
149
+ "model.layers.22.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
150
+ "model.layers.22.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
151
+ "model.layers.22.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
152
+ "model.layers.23.input_layernorm.weight": "model-00003-of-00003.safetensors",
153
+ "model.layers.23.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
154
+ "model.layers.23.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
155
+ "model.layers.23.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
156
+ "model.layers.23.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
157
+ "model.layers.23.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
158
+ "model.layers.23.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
159
+ "model.layers.23.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
160
+ "model.layers.23.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
161
+ "model.layers.24.input_layernorm.weight": "model-00003-of-00003.safetensors",
162
+ "model.layers.24.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
163
+ "model.layers.24.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
164
+ "model.layers.24.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
165
+ "model.layers.24.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
166
+ "model.layers.24.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
167
+ "model.layers.24.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
168
+ "model.layers.24.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
169
+ "model.layers.24.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
170
+ "model.layers.25.input_layernorm.weight": "model-00003-of-00003.safetensors",
171
+ "model.layers.25.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
172
+ "model.layers.25.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
173
+ "model.layers.25.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
174
+ "model.layers.25.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
175
+ "model.layers.25.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
176
+ "model.layers.25.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
177
+ "model.layers.25.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
178
+ "model.layers.25.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
179
+ "model.layers.26.input_layernorm.weight": "model-00003-of-00003.safetensors",
180
+ "model.layers.26.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
181
+ "model.layers.26.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
182
+ "model.layers.26.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
183
+ "model.layers.26.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
184
+ "model.layers.26.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
185
+ "model.layers.26.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
186
+ "model.layers.26.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
187
+ "model.layers.26.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
188
+ "model.layers.27.input_layernorm.weight": "model-00003-of-00003.safetensors",
189
+ "model.layers.27.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
190
+ "model.layers.27.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
191
+ "model.layers.27.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
192
+ "model.layers.27.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
193
+ "model.layers.27.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
194
+ "model.layers.27.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
195
+ "model.layers.27.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
196
+ "model.layers.27.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
197
+ "model.layers.28.input_layernorm.weight": "model-00003-of-00003.safetensors",
198
+ "model.layers.28.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
199
+ "model.layers.28.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
200
+ "model.layers.28.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
201
+ "model.layers.28.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
202
+ "model.layers.28.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
203
+ "model.layers.28.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
204
+ "model.layers.28.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
205
+ "model.layers.28.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
206
+ "model.layers.29.input_layernorm.weight": "model-00003-of-00003.safetensors",
207
+ "model.layers.29.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
208
+ "model.layers.29.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
209
+ "model.layers.29.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
210
+ "model.layers.29.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
211
+ "model.layers.29.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
212
+ "model.layers.29.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
213
+ "model.layers.29.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
214
+ "model.layers.29.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
215
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00003.safetensors",
216
+ "model.layers.3.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
217
+ "model.layers.3.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
218
+ "model.layers.3.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
219
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
220
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
221
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
222
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
223
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
224
+ "model.layers.30.input_layernorm.weight": "model-00003-of-00003.safetensors",
225
+ "model.layers.30.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
226
+ "model.layers.30.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
227
+ "model.layers.30.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
228
+ "model.layers.30.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
229
+ "model.layers.30.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
230
+ "model.layers.30.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
231
+ "model.layers.30.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
232
+ "model.layers.30.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
233
+ "model.layers.31.input_layernorm.weight": "model-00003-of-00003.safetensors",
234
+ "model.layers.31.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
235
+ "model.layers.31.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
236
+ "model.layers.31.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
237
+ "model.layers.31.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
238
+ "model.layers.31.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
239
+ "model.layers.31.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
240
+ "model.layers.31.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
241
+ "model.layers.31.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
242
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00003.safetensors",
243
+ "model.layers.4.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
244
+ "model.layers.4.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
245
+ "model.layers.4.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
246
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
247
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
248
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
249
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
250
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
251
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00003.safetensors",
252
+ "model.layers.5.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
253
+ "model.layers.5.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
254
+ "model.layers.5.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
255
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
256
+ "model.layers.5.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
257
+ "model.layers.5.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
258
+ "model.layers.5.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
259
+ "model.layers.5.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
260
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00003.safetensors",
261
+ "model.layers.6.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
262
+ "model.layers.6.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
263
+ "model.layers.6.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
264
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
265
+ "model.layers.6.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
266
+ "model.layers.6.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
267
+ "model.layers.6.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
268
+ "model.layers.6.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
269
+ "model.layers.7.input_layernorm.weight": "model-00001-of-00003.safetensors",
270
+ "model.layers.7.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
271
+ "model.layers.7.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
272
+ "model.layers.7.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
273
+ "model.layers.7.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
274
+ "model.layers.7.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
275
+ "model.layers.7.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
276
+ "model.layers.7.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
277
+ "model.layers.7.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
278
+ "model.layers.8.input_layernorm.weight": "model-00001-of-00003.safetensors",
279
+ "model.layers.8.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
280
+ "model.layers.8.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
281
+ "model.layers.8.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
282
+ "model.layers.8.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
283
+ "model.layers.8.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
284
+ "model.layers.8.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
285
+ "model.layers.8.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
286
+ "model.layers.8.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
287
+ "model.layers.9.input_layernorm.weight": "model-00001-of-00003.safetensors",
288
+ "model.layers.9.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
289
+ "model.layers.9.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
290
+ "model.layers.9.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
291
+ "model.layers.9.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
292
+ "model.layers.9.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
293
+ "model.layers.9.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
294
+ "model.layers.9.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
295
+ "model.layers.9.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
296
+ "model.norm.weight": "model-00003-of-00003.safetensors"
297
+ }
298
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ {
4
+ "content": "<|im_start|>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false
9
+ },
10
+ {
11
+ "content": "<|im_end|>",
12
+ "lstrip": false,
13
+ "normalized": false,
14
+ "rstrip": false,
15
+ "single_word": false
16
+ }
17
+ ],
18
+ "bos_token": {
19
+ "content": "<s>",
20
+ "lstrip": false,
21
+ "normalized": false,
22
+ "rstrip": false,
23
+ "single_word": false
24
+ },
25
+ "eos_token": {
26
+ "content": "</s>",
27
+ "lstrip": false,
28
+ "normalized": false,
29
+ "rstrip": false,
30
+ "single_word": false
31
+ },
32
+ "pad_token": {
33
+ "content": "</s>",
34
+ "lstrip": false,
35
+ "normalized": false,
36
+ "rstrip": false,
37
+ "single_word": false
38
+ },
39
+ "unk_token": {
40
+ "content": "<unk>",
41
+ "lstrip": false,
42
+ "normalized": false,
43
+ "rstrip": false,
44
+ "single_word": false
45
+ }
46
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37f00374dea48658ee8f5d0f21895b9bc55cb0103939607c8185bfd1c6ca1f89
3
+ size 587404
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff
 
trainer_state.json ADDED
@@ -0,0 +1,716 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 15.886524822695035,
5
+ "eval_steps": 80,
6
+ "global_step": 840,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.6052009456264775,
13
+ "grad_norm": 897.57861328125,
14
+ "learning_rate": 1.9047619047619045e-07,
15
+ "log_odds_chosen": 0.061996445059776306,
16
+ "log_odds_ratio": -0.7339106202125549,
17
+ "logits/chosen": -2.475102663040161,
18
+ "logits/rejected": -2.5303642749786377,
19
+ "logps/chosen": -1.3030776977539062,
20
+ "logps/rejected": -1.351835012435913,
21
+ "loss": 1.9448,
22
+ "nll_loss": 1.881751298904419,
23
+ "rewards/accuracies": 0.5,
24
+ "rewards/chosen": -0.13030776381492615,
25
+ "rewards/margins": 0.004875739570707083,
26
+ "rewards/rejected": -0.13518351316452026,
27
+ "step": 32
28
+ },
29
+ {
30
+ "epoch": 1.210401891252955,
31
+ "grad_norm": 555.6674194335938,
32
+ "learning_rate": 3.809523809523809e-07,
33
+ "log_odds_chosen": 0.13086628913879395,
34
+ "log_odds_ratio": -0.6972255110740662,
35
+ "logits/chosen": -2.408938407897949,
36
+ "logits/rejected": -2.4563820362091064,
37
+ "logps/chosen": -1.2012869119644165,
38
+ "logps/rejected": -1.3022348880767822,
39
+ "loss": 1.5253,
40
+ "nll_loss": 1.4454330205917358,
41
+ "rewards/accuracies": 0.54296875,
42
+ "rewards/chosen": -0.12012868374586105,
43
+ "rewards/margins": 0.010094808414578438,
44
+ "rewards/rejected": -0.13022349774837494,
45
+ "step": 64
46
+ },
47
+ {
48
+ "epoch": 1.5130023640661938,
49
+ "eval_log_odds_chosen": 1.2037408351898193,
50
+ "eval_log_odds_ratio": -0.2748129367828369,
51
+ "eval_logits/chosen": -2.1409010887145996,
52
+ "eval_logits/rejected": -2.1931569576263428,
53
+ "eval_logps/chosen": -1.156149983406067,
54
+ "eval_logps/rejected": -2.1107430458068848,
55
+ "eval_loss": 1.3948438167572021,
56
+ "eval_nll_loss": 1.5358692407608032,
57
+ "eval_rewards/accuracies": 1.0,
58
+ "eval_rewards/chosen": -0.11561501026153564,
59
+ "eval_rewards/margins": 0.09545929729938507,
60
+ "eval_rewards/rejected": -0.21107430756092072,
61
+ "eval_runtime": 0.8754,
62
+ "eval_samples_per_second": 156.493,
63
+ "eval_steps_per_second": 5.711,
64
+ "step": 80
65
+ },
66
+ {
67
+ "epoch": 1.8156028368794326,
68
+ "grad_norm": 140.96612548828125,
69
+ "learning_rate": 4.996892303047305e-07,
70
+ "log_odds_chosen": 0.16402098536491394,
71
+ "log_odds_ratio": -0.6756913065910339,
72
+ "logits/chosen": -2.3939661979675293,
73
+ "logits/rejected": -2.389753580093384,
74
+ "logps/chosen": -1.0995960235595703,
75
+ "logps/rejected": -1.2302087545394897,
76
+ "loss": 1.3931,
77
+ "nll_loss": 1.3130543231964111,
78
+ "rewards/accuracies": 0.49609375,
79
+ "rewards/chosen": -0.10995960980653763,
80
+ "rewards/margins": 0.013061259873211384,
81
+ "rewards/rejected": -0.12302087247371674,
82
+ "step": 96
83
+ },
84
+ {
85
+ "epoch": 2.42080378250591,
86
+ "grad_norm": 3005.20654296875,
87
+ "learning_rate": 4.958326378681848e-07,
88
+ "log_odds_chosen": 0.05211365222930908,
89
+ "log_odds_ratio": -0.7710955142974854,
90
+ "logits/chosen": -2.4226865768432617,
91
+ "logits/rejected": -2.4471077919006348,
92
+ "logps/chosen": -1.8894121646881104,
93
+ "logps/rejected": -1.878553867340088,
94
+ "loss": 1.9751,
95
+ "nll_loss": 1.9949692487716675,
96
+ "rewards/accuracies": 0.54296875,
97
+ "rewards/chosen": -0.18894124031066895,
98
+ "rewards/margins": -0.001085837371647358,
99
+ "rewards/rejected": -0.18785539269447327,
100
+ "step": 128
101
+ },
102
+ {
103
+ "epoch": 3.0260047281323876,
104
+ "grad_norm": 3593.66064453125,
105
+ "learning_rate": 4.876353872369572e-07,
106
+ "log_odds_chosen": 0.010831637308001518,
107
+ "log_odds_ratio": -0.8205243349075317,
108
+ "logits/chosen": -2.4603629112243652,
109
+ "logits/rejected": -2.4731788635253906,
110
+ "logps/chosen": -1.9289910793304443,
111
+ "logps/rejected": -1.854127049446106,
112
+ "loss": 2.0756,
113
+ "nll_loss": 2.116929769515991,
114
+ "rewards/accuracies": 0.58203125,
115
+ "rewards/chosen": -0.19289910793304443,
116
+ "rewards/margins": -0.0074864043854177,
117
+ "rewards/rejected": -0.1854127049446106,
118
+ "step": 160
119
+ },
120
+ {
121
+ "epoch": 3.0260047281323876,
122
+ "eval_log_odds_chosen": 1.280719518661499,
123
+ "eval_log_odds_ratio": -0.25084003806114197,
124
+ "eval_logits/chosen": -2.156606912612915,
125
+ "eval_logits/rejected": -2.2219834327697754,
126
+ "eval_logps/chosen": -1.4854581356048584,
127
+ "eval_logps/rejected": -2.5444798469543457,
128
+ "eval_loss": 1.3283345699310303,
129
+ "eval_nll_loss": 1.4989588260650635,
130
+ "eval_rewards/accuracies": 1.0,
131
+ "eval_rewards/chosen": -0.14854581654071808,
132
+ "eval_rewards/margins": 0.10590219497680664,
133
+ "eval_rewards/rejected": -0.2544480264186859,
134
+ "eval_runtime": 0.8785,
135
+ "eval_samples_per_second": 155.943,
136
+ "eval_steps_per_second": 5.691,
137
+ "step": 160
138
+ },
139
+ {
140
+ "epoch": 3.631205673758865,
141
+ "grad_norm": 817.2037353515625,
142
+ "learning_rate": 4.752422169756047e-07,
143
+ "log_odds_chosen": 0.09074901789426804,
144
+ "log_odds_ratio": -0.7456185817718506,
145
+ "logits/chosen": -2.377356767654419,
146
+ "logits/rejected": -2.396003007888794,
147
+ "logps/chosen": -1.5171489715576172,
148
+ "logps/rejected": -1.5251379013061523,
149
+ "loss": 1.9051,
150
+ "nll_loss": 1.6593117713928223,
151
+ "rewards/accuracies": 0.609375,
152
+ "rewards/chosen": -0.15171489119529724,
153
+ "rewards/margins": 0.0007988963043317199,
154
+ "rewards/rejected": -0.152513787150383,
155
+ "step": 192
156
+ },
157
+ {
158
+ "epoch": 4.236406619385343,
159
+ "grad_norm": 954.6674194335938,
160
+ "learning_rate": 4.588719528532341e-07,
161
+ "log_odds_chosen": 0.1411646008491516,
162
+ "log_odds_ratio": -0.6900860667228699,
163
+ "logits/chosen": -2.398102283477783,
164
+ "logits/rejected": -2.397972345352173,
165
+ "logps/chosen": -1.2695732116699219,
166
+ "logps/rejected": -1.3286174535751343,
167
+ "loss": 1.4204,
168
+ "nll_loss": 1.3868590593338013,
169
+ "rewards/accuracies": 0.6171875,
170
+ "rewards/chosen": -0.12695731222629547,
171
+ "rewards/margins": 0.005904428660869598,
172
+ "rewards/rejected": -0.13286174833774567,
173
+ "step": 224
174
+ },
175
+ {
176
+ "epoch": 4.539007092198582,
177
+ "eval_log_odds_chosen": 1.1990762948989868,
178
+ "eval_log_odds_ratio": -0.2697806656360626,
179
+ "eval_logits/chosen": -2.137376546859741,
180
+ "eval_logits/rejected": -2.1972498893737793,
181
+ "eval_logps/chosen": -1.2540639638900757,
182
+ "eval_logps/rejected": -2.2160115242004395,
183
+ "eval_loss": 1.2844356298446655,
184
+ "eval_nll_loss": 1.4172712564468384,
185
+ "eval_rewards/accuracies": 1.0,
186
+ "eval_rewards/chosen": -0.125406414270401,
187
+ "eval_rewards/margins": 0.09619472920894623,
188
+ "eval_rewards/rejected": -0.22160112857818604,
189
+ "eval_runtime": 0.8664,
190
+ "eval_samples_per_second": 158.119,
191
+ "eval_steps_per_second": 5.771,
192
+ "step": 240
193
+ },
194
+ {
195
+ "epoch": 4.84160756501182,
196
+ "grad_norm": 790.6442260742188,
197
+ "learning_rate": 4.3881364404463375e-07,
198
+ "log_odds_chosen": 0.20751571655273438,
199
+ "log_odds_ratio": -0.6614270210266113,
200
+ "logits/chosen": -2.3498642444610596,
201
+ "logits/rejected": -2.370640993118286,
202
+ "logps/chosen": -1.1192173957824707,
203
+ "logps/rejected": -1.2252520322799683,
204
+ "loss": 1.3469,
205
+ "nll_loss": 1.2267839908599854,
206
+ "rewards/accuracies": 0.65625,
207
+ "rewards/chosen": -0.1119217574596405,
208
+ "rewards/margins": 0.010603459551930428,
209
+ "rewards/rejected": -0.12252521514892578,
210
+ "step": 256
211
+ },
212
+ {
213
+ "epoch": 5.446808510638298,
214
+ "grad_norm": 2515.4189453125,
215
+ "learning_rate": 4.154214593992149e-07,
216
+ "log_odds_chosen": 0.23377765715122223,
217
+ "log_odds_ratio": -0.6729075312614441,
218
+ "logits/chosen": -2.322608709335327,
219
+ "logits/rejected": -2.361389636993408,
220
+ "logps/chosen": -1.1726882457733154,
221
+ "logps/rejected": -1.2837783098220825,
222
+ "loss": 1.3539,
223
+ "nll_loss": 1.2735731601715088,
224
+ "rewards/accuracies": 0.6875,
225
+ "rewards/chosen": -0.11726883798837662,
226
+ "rewards/margins": 0.011109001003205776,
227
+ "rewards/rejected": -0.12837782502174377,
228
+ "step": 288
229
+ },
230
+ {
231
+ "epoch": 6.052009456264775,
232
+ "grad_norm": 2093.776611328125,
233
+ "learning_rate": 3.891084338941603e-07,
234
+ "log_odds_chosen": 0.16962425410747528,
235
+ "log_odds_ratio": -0.6696641445159912,
236
+ "logits/chosen": -2.325108051300049,
237
+ "logits/rejected": -2.3817710876464844,
238
+ "logps/chosen": -3.6265933513641357,
239
+ "logps/rejected": -3.700042724609375,
240
+ "loss": 3.6173,
241
+ "nll_loss": 3.7216219902038574,
242
+ "rewards/accuracies": 0.59765625,
243
+ "rewards/chosen": -0.3626593351364136,
244
+ "rewards/margins": 0.007344960235059261,
245
+ "rewards/rejected": -0.3700042963027954,
246
+ "step": 320
247
+ },
248
+ {
249
+ "epoch": 6.052009456264775,
250
+ "eval_log_odds_chosen": 1.1228582859039307,
251
+ "eval_log_odds_ratio": -0.2914997637271881,
252
+ "eval_logits/chosen": -2.153041362762451,
253
+ "eval_logits/rejected": -2.239081621170044,
254
+ "eval_logps/chosen": -1.1402614116668701,
255
+ "eval_logps/rejected": -2.0236728191375732,
256
+ "eval_loss": 1.2484513521194458,
257
+ "eval_nll_loss": 1.3337957859039307,
258
+ "eval_rewards/accuracies": 1.0,
259
+ "eval_rewards/chosen": -0.11402615159749985,
260
+ "eval_rewards/margins": 0.0883411318063736,
261
+ "eval_rewards/rejected": -0.20236727595329285,
262
+ "eval_runtime": 0.8835,
263
+ "eval_samples_per_second": 155.057,
264
+ "eval_steps_per_second": 5.659,
265
+ "step": 320
266
+ },
267
+ {
268
+ "epoch": 6.657210401891253,
269
+ "grad_norm": 750.7427978515625,
270
+ "learning_rate": 3.6033917569043597e-07,
271
+ "log_odds_chosen": 0.2158849686384201,
272
+ "log_odds_ratio": -0.651162326335907,
273
+ "logits/chosen": -2.2999160289764404,
274
+ "logits/rejected": -2.3155159950256348,
275
+ "logps/chosen": -3.3152918815612793,
276
+ "logps/rejected": -3.4116926193237305,
277
+ "loss": 3.4506,
278
+ "nll_loss": 3.4377260208129883,
279
+ "rewards/accuracies": 0.6015625,
280
+ "rewards/chosen": -0.3315292000770569,
281
+ "rewards/margins": 0.00964003149420023,
282
+ "rewards/rejected": -0.34116923809051514,
283
+ "step": 352
284
+ },
285
+ {
286
+ "epoch": 7.26241134751773,
287
+ "grad_norm": 466.0474548339844,
288
+ "learning_rate": 3.296216625629211e-07,
289
+ "log_odds_chosen": 0.2518257200717926,
290
+ "log_odds_ratio": -0.6292858123779297,
291
+ "logits/chosen": -2.287289619445801,
292
+ "logits/rejected": -2.274383783340454,
293
+ "logps/chosen": -2.936006784439087,
294
+ "logps/rejected": -3.0706114768981934,
295
+ "loss": 3.1836,
296
+ "nll_loss": 3.031456708908081,
297
+ "rewards/accuracies": 0.66796875,
298
+ "rewards/chosen": -0.2936007082462311,
299
+ "rewards/margins": 0.013460462912917137,
300
+ "rewards/rejected": -0.30706116557121277,
301
+ "step": 384
302
+ },
303
+ {
304
+ "epoch": 7.5650118203309695,
305
+ "eval_log_odds_chosen": 1.1787246465682983,
306
+ "eval_log_odds_ratio": -0.27878421545028687,
307
+ "eval_logits/chosen": -2.131922721862793,
308
+ "eval_logits/rejected": -2.198315143585205,
309
+ "eval_logps/chosen": -1.1629152297973633,
310
+ "eval_logps/rejected": -2.102142810821533,
311
+ "eval_loss": 1.2289972305297852,
312
+ "eval_nll_loss": 1.3089702129364014,
313
+ "eval_rewards/accuracies": 1.0,
314
+ "eval_rewards/chosen": -0.11629153788089752,
315
+ "eval_rewards/margins": 0.09392273426055908,
316
+ "eval_rewards/rejected": -0.2102142572402954,
317
+ "eval_runtime": 0.8657,
318
+ "eval_samples_per_second": 158.25,
319
+ "eval_steps_per_second": 5.776,
320
+ "step": 400
321
+ },
322
+ {
323
+ "epoch": 7.867612293144208,
324
+ "grad_norm": 493.2022399902344,
325
+ "learning_rate": 2.974982725547975e-07,
326
+ "log_odds_chosen": 0.29160410165786743,
327
+ "log_odds_ratio": -0.6114708781242371,
328
+ "logits/chosen": -2.296574115753174,
329
+ "logits/rejected": -2.3063693046569824,
330
+ "logps/chosen": -2.907156229019165,
331
+ "logps/rejected": -3.049989938735962,
332
+ "loss": 3.0885,
333
+ "nll_loss": 2.9950599670410156,
334
+ "rewards/accuracies": 0.6953125,
335
+ "rewards/chosen": -0.29071560502052307,
336
+ "rewards/margins": 0.014283367432653904,
337
+ "rewards/rejected": -0.3049989938735962,
338
+ "step": 416
339
+ },
340
+ {
341
+ "epoch": 8.472813238770685,
342
+ "grad_norm": 2084.139892578125,
343
+ "learning_rate": 2.6453620722761895e-07,
344
+ "log_odds_chosen": 0.2739107012748718,
345
+ "log_odds_ratio": -0.6295269727706909,
346
+ "logits/chosen": -2.3001277446746826,
347
+ "logits/rejected": -2.2884907722473145,
348
+ "logps/chosen": -2.9699883460998535,
349
+ "logps/rejected": -3.114020586013794,
350
+ "loss": 2.9983,
351
+ "nll_loss": 3.031224012374878,
352
+ "rewards/accuracies": 0.65234375,
353
+ "rewards/chosen": -0.29699885845184326,
354
+ "rewards/margins": 0.014403235167264938,
355
+ "rewards/rejected": -0.3114020824432373,
356
+ "step": 448
357
+ },
358
+ {
359
+ "epoch": 9.078014184397164,
360
+ "grad_norm": 557.6774291992188,
361
+ "learning_rate": 2.3131747660339394e-07,
362
+ "log_odds_chosen": 0.2703976333141327,
363
+ "log_odds_ratio": -0.6236827969551086,
364
+ "logits/chosen": -2.2672348022460938,
365
+ "logits/rejected": -2.2586584091186523,
366
+ "logps/chosen": -2.937666893005371,
367
+ "logps/rejected": -3.061203718185425,
368
+ "loss": 2.8082,
369
+ "nll_loss": 3.023472785949707,
370
+ "rewards/accuracies": 0.66015625,
371
+ "rewards/chosen": -0.29376670718193054,
372
+ "rewards/margins": 0.012353670783340931,
373
+ "rewards/rejected": -0.306120365858078,
374
+ "step": 480
375
+ },
376
+ {
377
+ "epoch": 9.078014184397164,
378
+ "eval_log_odds_chosen": 1.1980304718017578,
379
+ "eval_log_odds_ratio": -0.27382025122642517,
380
+ "eval_logits/chosen": -2.1204967498779297,
381
+ "eval_logits/rejected": -2.1800942420959473,
382
+ "eval_logps/chosen": -1.192492961883545,
383
+ "eval_logps/rejected": -2.1554245948791504,
384
+ "eval_loss": 1.2367494106292725,
385
+ "eval_nll_loss": 1.3177238702774048,
386
+ "eval_rewards/accuracies": 1.0,
387
+ "eval_rewards/chosen": -0.11924929916858673,
388
+ "eval_rewards/margins": 0.09629315137863159,
389
+ "eval_rewards/rejected": -0.21554246544837952,
390
+ "eval_runtime": 0.88,
391
+ "eval_samples_per_second": 155.689,
392
+ "eval_steps_per_second": 5.682,
393
+ "step": 480
394
+ },
395
+ {
396
+ "epoch": 9.68321513002364,
397
+ "grad_norm": 8620.671875,
398
+ "learning_rate": 1.984286226342056e-07,
399
+ "log_odds_chosen": 0.36868974566459656,
400
+ "log_odds_ratio": -0.6002693176269531,
401
+ "logits/chosen": -2.237966537475586,
402
+ "logits/rejected": -2.2450058460235596,
403
+ "logps/chosen": -2.536555290222168,
404
+ "logps/rejected": -2.738464117050171,
405
+ "loss": 2.7562,
406
+ "nll_loss": 2.642591714859009,
407
+ "rewards/accuracies": 0.69921875,
408
+ "rewards/chosen": -0.2536555230617523,
409
+ "rewards/margins": 0.020190902054309845,
410
+ "rewards/rejected": -0.27384641766548157,
411
+ "step": 512
412
+ },
413
+ {
414
+ "epoch": 10.288416075650119,
415
+ "grad_norm": 8913.7607421875,
416
+ "learning_rate": 1.6645036265170313e-07,
417
+ "log_odds_chosen": 0.23036888241767883,
418
+ "log_odds_ratio": -0.6965319514274597,
419
+ "logits/chosen": -2.346311092376709,
420
+ "logits/rejected": -2.3196349143981934,
421
+ "logps/chosen": -2.625997543334961,
422
+ "logps/rejected": -2.695284605026245,
423
+ "loss": 2.9109,
424
+ "nll_loss": 2.6460041999816895,
425
+ "rewards/accuracies": 0.68359375,
426
+ "rewards/chosen": -0.26259979605674744,
427
+ "rewards/margins": 0.006928655784577131,
428
+ "rewards/rejected": -0.26952844858169556,
429
+ "step": 544
430
+ },
431
+ {
432
+ "epoch": 10.591016548463356,
433
+ "eval_log_odds_chosen": 1.2137528657913208,
434
+ "eval_log_odds_ratio": -0.2704525589942932,
435
+ "eval_logits/chosen": -2.1178054809570312,
436
+ "eval_logits/rejected": -2.1774165630340576,
437
+ "eval_logps/chosen": -1.1941485404968262,
438
+ "eval_logps/rejected": -2.171353340148926,
439
+ "eval_loss": 1.237461805343628,
440
+ "eval_nll_loss": 1.3179538249969482,
441
+ "eval_rewards/accuracies": 1.0,
442
+ "eval_rewards/chosen": -0.11941485106945038,
443
+ "eval_rewards/margins": 0.09772048145532608,
444
+ "eval_rewards/rejected": -0.21713533997535706,
445
+ "eval_runtime": 0.8664,
446
+ "eval_samples_per_second": 158.121,
447
+ "eval_steps_per_second": 5.771,
448
+ "step": 560
449
+ },
450
+ {
451
+ "epoch": 10.893617021276595,
452
+ "grad_norm": 11410.7939453125,
453
+ "learning_rate": 1.3594733566170925e-07,
454
+ "log_odds_chosen": 0.2925941050052643,
455
+ "log_odds_ratio": -0.6866809725761414,
456
+ "logits/chosen": -2.3280415534973145,
457
+ "logits/rejected": -2.308394432067871,
458
+ "logps/chosen": -3.2026498317718506,
459
+ "logps/rejected": -3.3342018127441406,
460
+ "loss": 2.9544,
461
+ "nll_loss": 3.251168966293335,
462
+ "rewards/accuracies": 0.66796875,
463
+ "rewards/chosen": -0.320264995098114,
464
+ "rewards/margins": 0.013155205175280571,
465
+ "rewards/rejected": -0.33342018723487854,
466
+ "step": 576
467
+ },
468
+ {
469
+ "epoch": 11.498817966903074,
470
+ "grad_norm": 2123.895751953125,
471
+ "learning_rate": 1.0745813253325956e-07,
472
+ "log_odds_chosen": 0.3092188239097595,
473
+ "log_odds_ratio": -0.6492509245872498,
474
+ "logits/chosen": -2.3580808639526367,
475
+ "logits/rejected": -2.349421501159668,
476
+ "logps/chosen": -2.5302317142486572,
477
+ "logps/rejected": -2.662865161895752,
478
+ "loss": 2.8523,
479
+ "nll_loss": 2.578503131866455,
480
+ "rewards/accuracies": 0.6953125,
481
+ "rewards/chosen": -0.2530231475830078,
482
+ "rewards/margins": 0.013263333588838577,
483
+ "rewards/rejected": -0.2662864923477173,
484
+ "step": 608
485
+ },
486
+ {
487
+ "epoch": 12.10401891252955,
488
+ "grad_norm": 1731.5615234375,
489
+ "learning_rate": 8.148578611867113e-08,
490
+ "log_odds_chosen": 0.3393189013004303,
491
+ "log_odds_ratio": -0.6164168119430542,
492
+ "logits/chosen": -2.1805524826049805,
493
+ "logits/rejected": -2.177432060241699,
494
+ "logps/chosen": -2.5276594161987305,
495
+ "logps/rejected": -2.710268497467041,
496
+ "loss": 2.5512,
497
+ "nll_loss": 2.681882381439209,
498
+ "rewards/accuracies": 0.67578125,
499
+ "rewards/chosen": -0.252765953540802,
500
+ "rewards/margins": 0.01826086826622486,
501
+ "rewards/rejected": -0.2710268199443817,
502
+ "step": 640
503
+ },
504
+ {
505
+ "epoch": 12.10401891252955,
506
+ "eval_log_odds_chosen": 1.2131071090698242,
507
+ "eval_log_odds_ratio": -0.270443856716156,
508
+ "eval_logits/chosen": -2.1185622215270996,
509
+ "eval_logits/rejected": -2.178537368774414,
510
+ "eval_logps/chosen": -1.198697566986084,
511
+ "eval_logps/rejected": -2.176114559173584,
512
+ "eval_loss": 1.2388056516647339,
513
+ "eval_nll_loss": 1.3213987350463867,
514
+ "eval_rewards/accuracies": 1.0,
515
+ "eval_rewards/chosen": -0.11986975371837616,
516
+ "eval_rewards/margins": 0.09774170815944672,
517
+ "eval_rewards/rejected": -0.21761147677898407,
518
+ "eval_runtime": 0.8825,
519
+ "eval_samples_per_second": 155.235,
520
+ "eval_steps_per_second": 5.666,
521
+ "step": 640
522
+ },
523
+ {
524
+ "epoch": 12.709219858156029,
525
+ "grad_norm": 1997.690185546875,
526
+ "learning_rate": 5.848888922025552e-08,
527
+ "log_odds_chosen": 0.3624497354030609,
528
+ "log_odds_ratio": -0.6123137474060059,
529
+ "logits/chosen": -2.179229259490967,
530
+ "logits/rejected": -2.1755523681640625,
531
+ "logps/chosen": -2.486222743988037,
532
+ "logps/rejected": -2.6808714866638184,
533
+ "loss": 2.5628,
534
+ "nll_loss": 2.6199562549591064,
535
+ "rewards/accuracies": 0.69140625,
536
+ "rewards/chosen": -0.24862225353717804,
537
+ "rewards/margins": 0.019464917480945587,
538
+ "rewards/rejected": -0.2680871784687042,
539
+ "step": 672
540
+ },
541
+ {
542
+ "epoch": 13.314420803782506,
543
+ "grad_norm": 2036.525146484375,
544
+ "learning_rate": 3.887349723342303e-08,
545
+ "log_odds_chosen": 0.3463588356971741,
546
+ "log_odds_ratio": -0.6327537298202515,
547
+ "logits/chosen": -2.181072235107422,
548
+ "logits/rejected": -2.1947262287139893,
549
+ "logps/chosen": -2.517810344696045,
550
+ "logps/rejected": -2.672647476196289,
551
+ "loss": 2.6212,
552
+ "nll_loss": 2.6852023601531982,
553
+ "rewards/accuracies": 0.68359375,
554
+ "rewards/chosen": -0.25178101658821106,
555
+ "rewards/margins": 0.01548372209072113,
556
+ "rewards/rejected": -0.2672647535800934,
557
+ "step": 704
558
+ },
559
+ {
560
+ "epoch": 13.617021276595745,
561
+ "eval_log_odds_chosen": 1.2199119329452515,
562
+ "eval_log_odds_ratio": -0.26896363496780396,
563
+ "eval_logits/chosen": -2.1166138648986816,
564
+ "eval_logits/rejected": -2.1762003898620605,
565
+ "eval_logps/chosen": -1.1962625980377197,
566
+ "eval_logps/rejected": -2.1790993213653564,
567
+ "eval_loss": 1.2387369871139526,
568
+ "eval_nll_loss": 1.3203083276748657,
569
+ "eval_rewards/accuracies": 1.0,
570
+ "eval_rewards/chosen": -0.11962626129388809,
571
+ "eval_rewards/margins": 0.09828367829322815,
572
+ "eval_rewards/rejected": -0.21790993213653564,
573
+ "eval_runtime": 0.8708,
574
+ "eval_samples_per_second": 157.334,
575
+ "eval_steps_per_second": 5.742,
576
+ "step": 720
577
+ },
578
+ {
579
+ "epoch": 13.919621749408984,
580
+ "grad_norm": 9910.3740234375,
581
+ "learning_rate": 2.298595844092377e-08,
582
+ "log_odds_chosen": 0.3617098927497864,
583
+ "log_odds_ratio": -0.6060731410980225,
584
+ "logits/chosen": -2.2685229778289795,
585
+ "logits/rejected": -2.2752606868743896,
586
+ "logps/chosen": -1.9047422409057617,
587
+ "logps/rejected": -2.0876576900482178,
588
+ "loss": 2.4957,
589
+ "nll_loss": 1.975754737854004,
590
+ "rewards/accuracies": 0.71484375,
591
+ "rewards/chosen": -0.19047421216964722,
592
+ "rewards/margins": 0.01829155907034874,
593
+ "rewards/rejected": -0.20876577496528625,
594
+ "step": 736
595
+ },
596
+ {
597
+ "epoch": 14.52482269503546,
598
+ "grad_norm": 1543.000244140625,
599
+ "learning_rate": 1.1106798553464802e-08,
600
+ "log_odds_chosen": 0.42522603273391724,
601
+ "log_odds_ratio": -0.5653746128082275,
602
+ "logits/chosen": -2.353919744491577,
603
+ "logits/rejected": -2.358372688293457,
604
+ "logps/chosen": -1.2913402318954468,
605
+ "logps/rejected": -1.542799711227417,
606
+ "loss": 1.4582,
607
+ "nll_loss": 1.3932266235351562,
608
+ "rewards/accuracies": 0.765625,
609
+ "rewards/chosen": -0.12913402915000916,
610
+ "rewards/margins": 0.025145962834358215,
611
+ "rewards/rejected": -0.15427997708320618,
612
+ "step": 768
613
+ },
614
+ {
615
+ "epoch": 15.130023640661939,
616
+ "grad_norm": 698.0999755859375,
617
+ "learning_rate": 3.4457674771554422e-09,
618
+ "log_odds_chosen": 0.4467349052429199,
619
+ "log_odds_ratio": -0.545281171798706,
620
+ "logits/chosen": -2.313391923904419,
621
+ "logits/rejected": -2.3118624687194824,
622
+ "logps/chosen": -1.2114390134811401,
623
+ "logps/rejected": -1.4863505363464355,
624
+ "loss": 1.3504,
625
+ "nll_loss": 1.3252184391021729,
626
+ "rewards/accuracies": 0.75,
627
+ "rewards/chosen": -0.1211438924074173,
628
+ "rewards/margins": 0.027491170912981033,
629
+ "rewards/rejected": -0.14863505959510803,
630
+ "step": 800
631
+ },
632
+ {
633
+ "epoch": 15.130023640661939,
634
+ "eval_log_odds_chosen": 1.211981177330017,
635
+ "eval_log_odds_ratio": -0.27068275213241577,
636
+ "eval_logits/chosen": -2.118680715560913,
637
+ "eval_logits/rejected": -2.1784884929656982,
638
+ "eval_logps/chosen": -1.1996212005615234,
639
+ "eval_logps/rejected": -2.176278829574585,
640
+ "eval_loss": 1.2384228706359863,
641
+ "eval_nll_loss": 1.3189568519592285,
642
+ "eval_rewards/accuracies": 1.0,
643
+ "eval_rewards/chosen": -0.11996213346719742,
644
+ "eval_rewards/margins": 0.09766574203968048,
645
+ "eval_rewards/rejected": -0.2176278829574585,
646
+ "eval_runtime": 0.8764,
647
+ "eval_samples_per_second": 156.329,
648
+ "eval_steps_per_second": 5.705,
649
+ "step": 800
650
+ },
651
+ {
652
+ "epoch": 15.735224586288416,
653
+ "grad_norm": 295.0424499511719,
654
+ "learning_rate": 1.3813576683111006e-10,
655
+ "log_odds_chosen": 0.44846177101135254,
656
+ "log_odds_ratio": -0.5449205636978149,
657
+ "logits/chosen": -2.3085861206054688,
658
+ "logits/rejected": -2.3130688667297363,
659
+ "logps/chosen": -1.1487438678741455,
660
+ "logps/rejected": -1.4232044219970703,
661
+ "loss": 1.3316,
662
+ "nll_loss": 1.246992588043213,
663
+ "rewards/accuracies": 0.74609375,
664
+ "rewards/chosen": -0.11487438529729843,
665
+ "rewards/margins": 0.027446046471595764,
666
+ "rewards/rejected": -0.142320454120636,
667
+ "step": 832
668
+ },
669
+ {
670
+ "epoch": 15.886524822695035,
671
+ "grad_norm": 305.3218078613281,
672
+ "learning_rate": 0.0,
673
+ "log_odds_chosen": 0.500209391117096,
674
+ "log_odds_ratio": -0.5302451848983765,
675
+ "logits/chosen": -2.2818732261657715,
676
+ "logits/rejected": -2.2850182056427,
677
+ "logps/chosen": -1.1465669870376587,
678
+ "logps/rejected": -1.4646430015563965,
679
+ "loss": 1.3265,
680
+ "nll_loss": 1.2768977880477905,
681
+ "rewards/accuracies": 0.75,
682
+ "rewards/chosen": -0.11465670168399811,
683
+ "rewards/margins": 0.03180759772658348,
684
+ "rewards/rejected": -0.1464642882347107,
685
+ "step": 840
686
+ },
687
+ {
688
+ "epoch": 15.886524822695035,
689
+ "eval_log_odds_chosen": 1.2168288230895996,
690
+ "eval_log_odds_ratio": -0.26950639486312866,
691
+ "eval_logits/chosen": -2.1189827919006348,
692
+ "eval_logits/rejected": -2.1787045001983643,
693
+ "eval_logps/chosen": -1.1971455812454224,
694
+ "eval_logps/rejected": -2.1773040294647217,
695
+ "eval_loss": 1.2378294467926025,
696
+ "eval_nll_loss": 1.3174165487289429,
697
+ "eval_rewards/accuracies": 1.0,
698
+ "eval_rewards/chosen": -0.11971455812454224,
699
+ "eval_rewards/margins": 0.09801585972309113,
700
+ "eval_rewards/rejected": -0.21773043274879456,
701
+ "eval_runtime": 0.8739,
702
+ "eval_samples_per_second": 156.768,
703
+ "eval_steps_per_second": 5.721,
704
+ "step": 840
705
+ }
706
+ ],
707
+ "logging_steps": 32,
708
+ "max_steps": 840,
709
+ "num_input_tokens_seen": 0,
710
+ "num_train_epochs": 17,
711
+ "save_steps": 80,
712
+ "total_flos": 0.0,
713
+ "train_batch_size": 1,
714
+ "trial_name": null,
715
+ "trial_params": null
716
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a9cf4bad153a8a42ca1b3fea065697abe1e976b7710797d509935abc59411d2b
3
+ size 6968
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)