Delta-Vector commited on
Commit
35498a0
·
verified ·
1 Parent(s): a4e427b

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
chat_template.jinja ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <s>{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% for message in messages %}{{'<|im_start|>' + message['role'] + '
2
+ ' + message['content'] + '<|im_end|>' + '
3
+ '}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant
4
+ ' }}{% endif %}
config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ApertusForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_apertus.ApertusConfig",
9
+ "AutoModel": "modeling_apertus.ApertusModel",
10
+ "AutoModelForCausalLM": "modeling_apertus.ApertusForCausalLM"
11
+ },
12
+ "bos_token_id": 1,
13
+ "dtype": "bfloat16",
14
+ "eos_token_id": 74,
15
+ "hidden_act": "xielu",
16
+ "hidden_dropout": 0.0,
17
+ "hidden_size": 4096,
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 21504,
20
+ "max_position_embeddings": 65536,
21
+ "mlp_bias": false,
22
+ "model_type": "apertus",
23
+ "num_attention_heads": 32,
24
+ "num_hidden_layers": 32,
25
+ "num_key_value_heads": 8,
26
+ "pad_token_id": 3,
27
+ "post_norm": false,
28
+ "qk_norm": true,
29
+ "rms_norm_eps": 1e-05,
30
+ "rope_scaling": {
31
+ "factor": 8.0,
32
+ "high_freq_factor": 4.0,
33
+ "low_freq_factor": 1.0,
34
+ "original_max_position_embeddings": 8192,
35
+ "rope_type": "llama3",
36
+ "type": "llama3"
37
+ },
38
+ "rope_theta": 12000000,
39
+ "tie_word_embeddings": false,
40
+ "transformers_version": "4.56.1",
41
+ "use_cache": false,
42
+ "vocab_size": 131072
43
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "do_sample": true,
5
+ "eos_token_id": [
6
+ 74
7
+ ],
8
+ "pad_token_id": 3,
9
+ "transformers_version": "4.56.1"
10
+ }
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step104
model-00001-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53885a828db7f1548d57e6eecaee8616b5f37ab26d5c26a4212c17c810dc076c
3
+ size 4999776656
model-00002-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:70d446f63ab248de8bd3c223ef9c9b8d3facb9decbbc851854286a82120c733f
3
+ size 4882374192
model-00003-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2ab0d22b58be4a4705a63e3dff958cfe64c714b6e259758d2f2a8b0b7a209551
3
+ size 4974647808
model-00004-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:59845fdef69972f525936551b7842373e76498535810c408f37cc901072b4611
3
+ size 1249928160
model.safetensors.index.json ADDED
@@ -0,0 +1,459 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_parameters": 274496,
4
+ "total_size": 16106676480
5
+ },
6
+ "weight_map": {
7
+ "lm_head.weight": "model-00004-of-00004.safetensors",
8
+ "model.embed_tokens.weight": "model-00001-of-00004.safetensors",
9
+ "model.layers.0.attention_layernorm.weight": "model-00001-of-00004.safetensors",
10
+ "model.layers.0.feedforward_layernorm.weight": "model-00001-of-00004.safetensors",
11
+ "model.layers.0.mlp.act_fn.alpha_n": "model-00001-of-00004.safetensors",
12
+ "model.layers.0.mlp.act_fn.alpha_p": "model-00001-of-00004.safetensors",
13
+ "model.layers.0.mlp.act_fn.beta": "model-00001-of-00004.safetensors",
14
+ "model.layers.0.mlp.act_fn.eps": "model-00001-of-00004.safetensors",
15
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
16
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
17
+ "model.layers.0.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
18
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
19
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
20
+ "model.layers.0.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
21
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
22
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
23
+ "model.layers.1.attention_layernorm.weight": "model-00001-of-00004.safetensors",
24
+ "model.layers.1.feedforward_layernorm.weight": "model-00001-of-00004.safetensors",
25
+ "model.layers.1.mlp.act_fn.alpha_n": "model-00001-of-00004.safetensors",
26
+ "model.layers.1.mlp.act_fn.alpha_p": "model-00001-of-00004.safetensors",
27
+ "model.layers.1.mlp.act_fn.beta": "model-00001-of-00004.safetensors",
28
+ "model.layers.1.mlp.act_fn.eps": "model-00001-of-00004.safetensors",
29
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
30
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
31
+ "model.layers.1.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
32
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
33
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
34
+ "model.layers.1.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
35
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
36
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
37
+ "model.layers.10.attention_layernorm.weight": "model-00002-of-00004.safetensors",
38
+ "model.layers.10.feedforward_layernorm.weight": "model-00002-of-00004.safetensors",
39
+ "model.layers.10.mlp.act_fn.alpha_n": "model-00002-of-00004.safetensors",
40
+ "model.layers.10.mlp.act_fn.alpha_p": "model-00002-of-00004.safetensors",
41
+ "model.layers.10.mlp.act_fn.beta": "model-00002-of-00004.safetensors",
42
+ "model.layers.10.mlp.act_fn.eps": "model-00002-of-00004.safetensors",
43
+ "model.layers.10.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
44
+ "model.layers.10.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
45
+ "model.layers.10.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
46
+ "model.layers.10.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
47
+ "model.layers.10.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
48
+ "model.layers.10.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
49
+ "model.layers.10.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
50
+ "model.layers.10.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
51
+ "model.layers.11.attention_layernorm.weight": "model-00002-of-00004.safetensors",
52
+ "model.layers.11.feedforward_layernorm.weight": "model-00002-of-00004.safetensors",
53
+ "model.layers.11.mlp.act_fn.alpha_n": "model-00002-of-00004.safetensors",
54
+ "model.layers.11.mlp.act_fn.alpha_p": "model-00002-of-00004.safetensors",
55
+ "model.layers.11.mlp.act_fn.beta": "model-00002-of-00004.safetensors",
56
+ "model.layers.11.mlp.act_fn.eps": "model-00002-of-00004.safetensors",
57
+ "model.layers.11.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
58
+ "model.layers.11.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
59
+ "model.layers.11.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
60
+ "model.layers.11.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
61
+ "model.layers.11.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
62
+ "model.layers.11.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
63
+ "model.layers.11.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
64
+ "model.layers.11.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
65
+ "model.layers.12.attention_layernorm.weight": "model-00002-of-00004.safetensors",
66
+ "model.layers.12.feedforward_layernorm.weight": "model-00002-of-00004.safetensors",
67
+ "model.layers.12.mlp.act_fn.alpha_n": "model-00002-of-00004.safetensors",
68
+ "model.layers.12.mlp.act_fn.alpha_p": "model-00002-of-00004.safetensors",
69
+ "model.layers.12.mlp.act_fn.beta": "model-00002-of-00004.safetensors",
70
+ "model.layers.12.mlp.act_fn.eps": "model-00002-of-00004.safetensors",
71
+ "model.layers.12.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
72
+ "model.layers.12.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
73
+ "model.layers.12.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
74
+ "model.layers.12.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
75
+ "model.layers.12.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
76
+ "model.layers.12.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
77
+ "model.layers.12.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
78
+ "model.layers.12.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
79
+ "model.layers.13.attention_layernorm.weight": "model-00002-of-00004.safetensors",
80
+ "model.layers.13.feedforward_layernorm.weight": "model-00002-of-00004.safetensors",
81
+ "model.layers.13.mlp.act_fn.alpha_n": "model-00002-of-00004.safetensors",
82
+ "model.layers.13.mlp.act_fn.alpha_p": "model-00002-of-00004.safetensors",
83
+ "model.layers.13.mlp.act_fn.beta": "model-00002-of-00004.safetensors",
84
+ "model.layers.13.mlp.act_fn.eps": "model-00002-of-00004.safetensors",
85
+ "model.layers.13.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
86
+ "model.layers.13.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
87
+ "model.layers.13.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
88
+ "model.layers.13.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
89
+ "model.layers.13.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
90
+ "model.layers.13.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
91
+ "model.layers.13.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
92
+ "model.layers.13.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
93
+ "model.layers.14.attention_layernorm.weight": "model-00002-of-00004.safetensors",
94
+ "model.layers.14.feedforward_layernorm.weight": "model-00002-of-00004.safetensors",
95
+ "model.layers.14.mlp.act_fn.alpha_n": "model-00002-of-00004.safetensors",
96
+ "model.layers.14.mlp.act_fn.alpha_p": "model-00002-of-00004.safetensors",
97
+ "model.layers.14.mlp.act_fn.beta": "model-00002-of-00004.safetensors",
98
+ "model.layers.14.mlp.act_fn.eps": "model-00002-of-00004.safetensors",
99
+ "model.layers.14.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
100
+ "model.layers.14.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
101
+ "model.layers.14.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
102
+ "model.layers.14.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
103
+ "model.layers.14.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
104
+ "model.layers.14.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
105
+ "model.layers.14.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
106
+ "model.layers.14.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
107
+ "model.layers.15.attention_layernorm.weight": "model-00002-of-00004.safetensors",
108
+ "model.layers.15.feedforward_layernorm.weight": "model-00002-of-00004.safetensors",
109
+ "model.layers.15.mlp.act_fn.alpha_n": "model-00002-of-00004.safetensors",
110
+ "model.layers.15.mlp.act_fn.alpha_p": "model-00002-of-00004.safetensors",
111
+ "model.layers.15.mlp.act_fn.beta": "model-00002-of-00004.safetensors",
112
+ "model.layers.15.mlp.act_fn.eps": "model-00002-of-00004.safetensors",
113
+ "model.layers.15.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
114
+ "model.layers.15.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
115
+ "model.layers.15.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
116
+ "model.layers.15.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
117
+ "model.layers.15.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
118
+ "model.layers.15.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
119
+ "model.layers.15.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
120
+ "model.layers.15.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
121
+ "model.layers.16.attention_layernorm.weight": "model-00002-of-00004.safetensors",
122
+ "model.layers.16.feedforward_layernorm.weight": "model-00002-of-00004.safetensors",
123
+ "model.layers.16.mlp.act_fn.alpha_n": "model-00002-of-00004.safetensors",
124
+ "model.layers.16.mlp.act_fn.alpha_p": "model-00002-of-00004.safetensors",
125
+ "model.layers.16.mlp.act_fn.beta": "model-00002-of-00004.safetensors",
126
+ "model.layers.16.mlp.act_fn.eps": "model-00002-of-00004.safetensors",
127
+ "model.layers.16.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
128
+ "model.layers.16.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
129
+ "model.layers.16.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
130
+ "model.layers.16.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
131
+ "model.layers.16.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
132
+ "model.layers.16.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
133
+ "model.layers.16.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
134
+ "model.layers.16.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
135
+ "model.layers.17.attention_layernorm.weight": "model-00002-of-00004.safetensors",
136
+ "model.layers.17.feedforward_layernorm.weight": "model-00002-of-00004.safetensors",
137
+ "model.layers.17.mlp.act_fn.alpha_n": "model-00002-of-00004.safetensors",
138
+ "model.layers.17.mlp.act_fn.alpha_p": "model-00002-of-00004.safetensors",
139
+ "model.layers.17.mlp.act_fn.beta": "model-00002-of-00004.safetensors",
140
+ "model.layers.17.mlp.act_fn.eps": "model-00002-of-00004.safetensors",
141
+ "model.layers.17.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
142
+ "model.layers.17.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
143
+ "model.layers.17.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
144
+ "model.layers.17.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
145
+ "model.layers.17.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
146
+ "model.layers.17.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
147
+ "model.layers.17.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
148
+ "model.layers.17.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
149
+ "model.layers.18.attention_layernorm.weight": "model-00002-of-00004.safetensors",
150
+ "model.layers.18.feedforward_layernorm.weight": "model-00002-of-00004.safetensors",
151
+ "model.layers.18.mlp.act_fn.alpha_n": "model-00002-of-00004.safetensors",
152
+ "model.layers.18.mlp.act_fn.alpha_p": "model-00002-of-00004.safetensors",
153
+ "model.layers.18.mlp.act_fn.beta": "model-00002-of-00004.safetensors",
154
+ "model.layers.18.mlp.act_fn.eps": "model-00002-of-00004.safetensors",
155
+ "model.layers.18.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
156
+ "model.layers.18.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
157
+ "model.layers.18.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
158
+ "model.layers.18.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
159
+ "model.layers.18.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
160
+ "model.layers.18.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
161
+ "model.layers.18.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
162
+ "model.layers.18.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
163
+ "model.layers.19.attention_layernorm.weight": "model-00002-of-00004.safetensors",
164
+ "model.layers.19.feedforward_layernorm.weight": "model-00002-of-00004.safetensors",
165
+ "model.layers.19.mlp.act_fn.alpha_n": "model-00002-of-00004.safetensors",
166
+ "model.layers.19.mlp.act_fn.alpha_p": "model-00002-of-00004.safetensors",
167
+ "model.layers.19.mlp.act_fn.beta": "model-00002-of-00004.safetensors",
168
+ "model.layers.19.mlp.act_fn.eps": "model-00002-of-00004.safetensors",
169
+ "model.layers.19.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
170
+ "model.layers.19.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
171
+ "model.layers.19.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
172
+ "model.layers.19.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
173
+ "model.layers.19.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
174
+ "model.layers.19.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
175
+ "model.layers.19.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
176
+ "model.layers.19.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
177
+ "model.layers.2.attention_layernorm.weight": "model-00001-of-00004.safetensors",
178
+ "model.layers.2.feedforward_layernorm.weight": "model-00001-of-00004.safetensors",
179
+ "model.layers.2.mlp.act_fn.alpha_n": "model-00001-of-00004.safetensors",
180
+ "model.layers.2.mlp.act_fn.alpha_p": "model-00001-of-00004.safetensors",
181
+ "model.layers.2.mlp.act_fn.beta": "model-00001-of-00004.safetensors",
182
+ "model.layers.2.mlp.act_fn.eps": "model-00001-of-00004.safetensors",
183
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
184
+ "model.layers.2.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
185
+ "model.layers.2.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
186
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
187
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
188
+ "model.layers.2.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
189
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
190
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
191
+ "model.layers.20.attention_layernorm.weight": "model-00003-of-00004.safetensors",
192
+ "model.layers.20.feedforward_layernorm.weight": "model-00003-of-00004.safetensors",
193
+ "model.layers.20.mlp.act_fn.alpha_n": "model-00003-of-00004.safetensors",
194
+ "model.layers.20.mlp.act_fn.alpha_p": "model-00003-of-00004.safetensors",
195
+ "model.layers.20.mlp.act_fn.beta": "model-00003-of-00004.safetensors",
196
+ "model.layers.20.mlp.act_fn.eps": "model-00003-of-00004.safetensors",
197
+ "model.layers.20.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
198
+ "model.layers.20.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
199
+ "model.layers.20.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
200
+ "model.layers.20.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
201
+ "model.layers.20.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
202
+ "model.layers.20.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
203
+ "model.layers.20.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
204
+ "model.layers.20.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
205
+ "model.layers.21.attention_layernorm.weight": "model-00003-of-00004.safetensors",
206
+ "model.layers.21.feedforward_layernorm.weight": "model-00003-of-00004.safetensors",
207
+ "model.layers.21.mlp.act_fn.alpha_n": "model-00003-of-00004.safetensors",
208
+ "model.layers.21.mlp.act_fn.alpha_p": "model-00003-of-00004.safetensors",
209
+ "model.layers.21.mlp.act_fn.beta": "model-00003-of-00004.safetensors",
210
+ "model.layers.21.mlp.act_fn.eps": "model-00003-of-00004.safetensors",
211
+ "model.layers.21.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
212
+ "model.layers.21.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
213
+ "model.layers.21.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
214
+ "model.layers.21.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
215
+ "model.layers.21.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
216
+ "model.layers.21.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
217
+ "model.layers.21.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
218
+ "model.layers.21.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
219
+ "model.layers.22.attention_layernorm.weight": "model-00003-of-00004.safetensors",
220
+ "model.layers.22.feedforward_layernorm.weight": "model-00003-of-00004.safetensors",
221
+ "model.layers.22.mlp.act_fn.alpha_n": "model-00003-of-00004.safetensors",
222
+ "model.layers.22.mlp.act_fn.alpha_p": "model-00003-of-00004.safetensors",
223
+ "model.layers.22.mlp.act_fn.beta": "model-00003-of-00004.safetensors",
224
+ "model.layers.22.mlp.act_fn.eps": "model-00003-of-00004.safetensors",
225
+ "model.layers.22.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
226
+ "model.layers.22.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
227
+ "model.layers.22.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
228
+ "model.layers.22.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
229
+ "model.layers.22.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
230
+ "model.layers.22.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
231
+ "model.layers.22.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
232
+ "model.layers.22.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
233
+ "model.layers.23.attention_layernorm.weight": "model-00003-of-00004.safetensors",
234
+ "model.layers.23.feedforward_layernorm.weight": "model-00003-of-00004.safetensors",
235
+ "model.layers.23.mlp.act_fn.alpha_n": "model-00003-of-00004.safetensors",
236
+ "model.layers.23.mlp.act_fn.alpha_p": "model-00003-of-00004.safetensors",
237
+ "model.layers.23.mlp.act_fn.beta": "model-00003-of-00004.safetensors",
238
+ "model.layers.23.mlp.act_fn.eps": "model-00003-of-00004.safetensors",
239
+ "model.layers.23.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
240
+ "model.layers.23.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
241
+ "model.layers.23.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
242
+ "model.layers.23.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
243
+ "model.layers.23.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
244
+ "model.layers.23.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
245
+ "model.layers.23.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
246
+ "model.layers.23.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
247
+ "model.layers.24.attention_layernorm.weight": "model-00003-of-00004.safetensors",
248
+ "model.layers.24.feedforward_layernorm.weight": "model-00003-of-00004.safetensors",
249
+ "model.layers.24.mlp.act_fn.alpha_n": "model-00003-of-00004.safetensors",
250
+ "model.layers.24.mlp.act_fn.alpha_p": "model-00003-of-00004.safetensors",
251
+ "model.layers.24.mlp.act_fn.beta": "model-00003-of-00004.safetensors",
252
+ "model.layers.24.mlp.act_fn.eps": "model-00003-of-00004.safetensors",
253
+ "model.layers.24.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
254
+ "model.layers.24.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
255
+ "model.layers.24.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
256
+ "model.layers.24.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
257
+ "model.layers.24.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
258
+ "model.layers.24.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
259
+ "model.layers.24.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
260
+ "model.layers.24.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
261
+ "model.layers.25.attention_layernorm.weight": "model-00003-of-00004.safetensors",
262
+ "model.layers.25.feedforward_layernorm.weight": "model-00003-of-00004.safetensors",
263
+ "model.layers.25.mlp.act_fn.alpha_n": "model-00003-of-00004.safetensors",
264
+ "model.layers.25.mlp.act_fn.alpha_p": "model-00003-of-00004.safetensors",
265
+ "model.layers.25.mlp.act_fn.beta": "model-00003-of-00004.safetensors",
266
+ "model.layers.25.mlp.act_fn.eps": "model-00003-of-00004.safetensors",
267
+ "model.layers.25.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
268
+ "model.layers.25.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
269
+ "model.layers.25.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
270
+ "model.layers.25.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
271
+ "model.layers.25.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
272
+ "model.layers.25.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
273
+ "model.layers.25.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
274
+ "model.layers.25.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
275
+ "model.layers.26.attention_layernorm.weight": "model-00003-of-00004.safetensors",
276
+ "model.layers.26.feedforward_layernorm.weight": "model-00003-of-00004.safetensors",
277
+ "model.layers.26.mlp.act_fn.alpha_n": "model-00003-of-00004.safetensors",
278
+ "model.layers.26.mlp.act_fn.alpha_p": "model-00003-of-00004.safetensors",
279
+ "model.layers.26.mlp.act_fn.beta": "model-00003-of-00004.safetensors",
280
+ "model.layers.26.mlp.act_fn.eps": "model-00003-of-00004.safetensors",
281
+ "model.layers.26.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
282
+ "model.layers.26.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
283
+ "model.layers.26.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
284
+ "model.layers.26.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
285
+ "model.layers.26.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
286
+ "model.layers.26.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
287
+ "model.layers.26.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
288
+ "model.layers.26.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
289
+ "model.layers.27.attention_layernorm.weight": "model-00003-of-00004.safetensors",
290
+ "model.layers.27.feedforward_layernorm.weight": "model-00003-of-00004.safetensors",
291
+ "model.layers.27.mlp.act_fn.alpha_n": "model-00003-of-00004.safetensors",
292
+ "model.layers.27.mlp.act_fn.alpha_p": "model-00003-of-00004.safetensors",
293
+ "model.layers.27.mlp.act_fn.beta": "model-00003-of-00004.safetensors",
294
+ "model.layers.27.mlp.act_fn.eps": "model-00003-of-00004.safetensors",
295
+ "model.layers.27.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
296
+ "model.layers.27.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
297
+ "model.layers.27.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
298
+ "model.layers.27.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
299
+ "model.layers.27.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
300
+ "model.layers.27.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
301
+ "model.layers.27.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
302
+ "model.layers.27.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
303
+ "model.layers.28.attention_layernorm.weight": "model-00003-of-00004.safetensors",
304
+ "model.layers.28.feedforward_layernorm.weight": "model-00003-of-00004.safetensors",
305
+ "model.layers.28.mlp.act_fn.alpha_n": "model-00003-of-00004.safetensors",
306
+ "model.layers.28.mlp.act_fn.alpha_p": "model-00003-of-00004.safetensors",
307
+ "model.layers.28.mlp.act_fn.beta": "model-00003-of-00004.safetensors",
308
+ "model.layers.28.mlp.act_fn.eps": "model-00003-of-00004.safetensors",
309
+ "model.layers.28.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
310
+ "model.layers.28.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
311
+ "model.layers.28.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
312
+ "model.layers.28.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
313
+ "model.layers.28.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
314
+ "model.layers.28.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
315
+ "model.layers.28.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
316
+ "model.layers.28.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
317
+ "model.layers.29.attention_layernorm.weight": "model-00003-of-00004.safetensors",
318
+ "model.layers.29.feedforward_layernorm.weight": "model-00003-of-00004.safetensors",
319
+ "model.layers.29.mlp.act_fn.alpha_n": "model-00003-of-00004.safetensors",
320
+ "model.layers.29.mlp.act_fn.alpha_p": "model-00003-of-00004.safetensors",
321
+ "model.layers.29.mlp.act_fn.beta": "model-00003-of-00004.safetensors",
322
+ "model.layers.29.mlp.act_fn.eps": "model-00003-of-00004.safetensors",
323
+ "model.layers.29.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
324
+ "model.layers.29.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
325
+ "model.layers.29.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
326
+ "model.layers.29.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
327
+ "model.layers.29.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
328
+ "model.layers.29.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
329
+ "model.layers.29.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
330
+ "model.layers.29.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
331
+ "model.layers.3.attention_layernorm.weight": "model-00001-of-00004.safetensors",
332
+ "model.layers.3.feedforward_layernorm.weight": "model-00001-of-00004.safetensors",
333
+ "model.layers.3.mlp.act_fn.alpha_n": "model-00001-of-00004.safetensors",
334
+ "model.layers.3.mlp.act_fn.alpha_p": "model-00001-of-00004.safetensors",
335
+ "model.layers.3.mlp.act_fn.beta": "model-00001-of-00004.safetensors",
336
+ "model.layers.3.mlp.act_fn.eps": "model-00001-of-00004.safetensors",
337
+ "model.layers.3.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
338
+ "model.layers.3.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
339
+ "model.layers.3.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
340
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
341
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
342
+ "model.layers.3.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
343
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
344
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
345
+ "model.layers.30.attention_layernorm.weight": "model-00003-of-00004.safetensors",
346
+ "model.layers.30.feedforward_layernorm.weight": "model-00003-of-00004.safetensors",
347
+ "model.layers.30.mlp.act_fn.alpha_n": "model-00003-of-00004.safetensors",
348
+ "model.layers.30.mlp.act_fn.alpha_p": "model-00003-of-00004.safetensors",
349
+ "model.layers.30.mlp.act_fn.beta": "model-00003-of-00004.safetensors",
350
+ "model.layers.30.mlp.act_fn.eps": "model-00003-of-00004.safetensors",
351
+ "model.layers.30.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
352
+ "model.layers.30.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
353
+ "model.layers.30.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
354
+ "model.layers.30.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
355
+ "model.layers.30.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
356
+ "model.layers.30.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
357
+ "model.layers.30.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
358
+ "model.layers.30.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
359
+ "model.layers.31.attention_layernorm.weight": "model-00004-of-00004.safetensors",
360
+ "model.layers.31.feedforward_layernorm.weight": "model-00004-of-00004.safetensors",
361
+ "model.layers.31.mlp.act_fn.alpha_n": "model-00004-of-00004.safetensors",
362
+ "model.layers.31.mlp.act_fn.alpha_p": "model-00004-of-00004.safetensors",
363
+ "model.layers.31.mlp.act_fn.beta": "model-00004-of-00004.safetensors",
364
+ "model.layers.31.mlp.act_fn.eps": "model-00004-of-00004.safetensors",
365
+ "model.layers.31.mlp.down_proj.weight": "model-00004-of-00004.safetensors",
366
+ "model.layers.31.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
367
+ "model.layers.31.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
368
+ "model.layers.31.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
369
+ "model.layers.31.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
370
+ "model.layers.31.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
371
+ "model.layers.31.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
372
+ "model.layers.31.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
373
+ "model.layers.4.attention_layernorm.weight": "model-00001-of-00004.safetensors",
374
+ "model.layers.4.feedforward_layernorm.weight": "model-00001-of-00004.safetensors",
375
+ "model.layers.4.mlp.act_fn.alpha_n": "model-00001-of-00004.safetensors",
376
+ "model.layers.4.mlp.act_fn.alpha_p": "model-00001-of-00004.safetensors",
377
+ "model.layers.4.mlp.act_fn.beta": "model-00001-of-00004.safetensors",
378
+ "model.layers.4.mlp.act_fn.eps": "model-00001-of-00004.safetensors",
379
+ "model.layers.4.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
380
+ "model.layers.4.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
381
+ "model.layers.4.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
382
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
383
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
384
+ "model.layers.4.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
385
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
386
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
387
+ "model.layers.5.attention_layernorm.weight": "model-00001-of-00004.safetensors",
388
+ "model.layers.5.feedforward_layernorm.weight": "model-00001-of-00004.safetensors",
389
+ "model.layers.5.mlp.act_fn.alpha_n": "model-00001-of-00004.safetensors",
390
+ "model.layers.5.mlp.act_fn.alpha_p": "model-00001-of-00004.safetensors",
391
+ "model.layers.5.mlp.act_fn.beta": "model-00001-of-00004.safetensors",
392
+ "model.layers.5.mlp.act_fn.eps": "model-00001-of-00004.safetensors",
393
+ "model.layers.5.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
394
+ "model.layers.5.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
395
+ "model.layers.5.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
396
+ "model.layers.5.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
397
+ "model.layers.5.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
398
+ "model.layers.5.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
399
+ "model.layers.5.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
400
+ "model.layers.5.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
401
+ "model.layers.6.attention_layernorm.weight": "model-00001-of-00004.safetensors",
402
+ "model.layers.6.feedforward_layernorm.weight": "model-00001-of-00004.safetensors",
403
+ "model.layers.6.mlp.act_fn.alpha_n": "model-00001-of-00004.safetensors",
404
+ "model.layers.6.mlp.act_fn.alpha_p": "model-00001-of-00004.safetensors",
405
+ "model.layers.6.mlp.act_fn.beta": "model-00001-of-00004.safetensors",
406
+ "model.layers.6.mlp.act_fn.eps": "model-00001-of-00004.safetensors",
407
+ "model.layers.6.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
408
+ "model.layers.6.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
409
+ "model.layers.6.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
410
+ "model.layers.6.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
411
+ "model.layers.6.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
412
+ "model.layers.6.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
413
+ "model.layers.6.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
414
+ "model.layers.6.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
415
+ "model.layers.7.attention_layernorm.weight": "model-00001-of-00004.safetensors",
416
+ "model.layers.7.feedforward_layernorm.weight": "model-00001-of-00004.safetensors",
417
+ "model.layers.7.mlp.act_fn.alpha_n": "model-00001-of-00004.safetensors",
418
+ "model.layers.7.mlp.act_fn.alpha_p": "model-00001-of-00004.safetensors",
419
+ "model.layers.7.mlp.act_fn.beta": "model-00001-of-00004.safetensors",
420
+ "model.layers.7.mlp.act_fn.eps": "model-00001-of-00004.safetensors",
421
+ "model.layers.7.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
422
+ "model.layers.7.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
423
+ "model.layers.7.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
424
+ "model.layers.7.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
425
+ "model.layers.7.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
426
+ "model.layers.7.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
427
+ "model.layers.7.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
428
+ "model.layers.7.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
429
+ "model.layers.8.attention_layernorm.weight": "model-00001-of-00004.safetensors",
430
+ "model.layers.8.feedforward_layernorm.weight": "model-00001-of-00004.safetensors",
431
+ "model.layers.8.mlp.act_fn.alpha_n": "model-00001-of-00004.safetensors",
432
+ "model.layers.8.mlp.act_fn.alpha_p": "model-00001-of-00004.safetensors",
433
+ "model.layers.8.mlp.act_fn.beta": "model-00001-of-00004.safetensors",
434
+ "model.layers.8.mlp.act_fn.eps": "model-00001-of-00004.safetensors",
435
+ "model.layers.8.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
436
+ "model.layers.8.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
437
+ "model.layers.8.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
438
+ "model.layers.8.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
439
+ "model.layers.8.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
440
+ "model.layers.8.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
441
+ "model.layers.8.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
442
+ "model.layers.8.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
443
+ "model.layers.9.attention_layernorm.weight": "model-00002-of-00004.safetensors",
444
+ "model.layers.9.feedforward_layernorm.weight": "model-00002-of-00004.safetensors",
445
+ "model.layers.9.mlp.act_fn.alpha_n": "model-00002-of-00004.safetensors",
446
+ "model.layers.9.mlp.act_fn.alpha_p": "model-00002-of-00004.safetensors",
447
+ "model.layers.9.mlp.act_fn.beta": "model-00002-of-00004.safetensors",
448
+ "model.layers.9.mlp.act_fn.eps": "model-00002-of-00004.safetensors",
449
+ "model.layers.9.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
450
+ "model.layers.9.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
451
+ "model.layers.9.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
452
+ "model.layers.9.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
453
+ "model.layers.9.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
454
+ "model.layers.9.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
455
+ "model.layers.9.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
456
+ "model.layers.9.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
457
+ "model.norm.weight": "model-00004-of-00004.safetensors"
458
+ }
459
+ }
rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5f469fb6a869fe76761e1194ed0a7948ca397689bbc8ac0a9ea85a077fd50929
3
+ size 16389
rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:77e31efd49e7c2510fff79f966c879db58740a4187714c13003ffa53d0d441c5
3
+ size 16389
rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:755aba68d004de8b7239e4451f96d8aaad4274ed7f03ec57d204f73d7b768a54
3
+ size 16389
rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c1e57948798e97ec4bd65e4f2bab0090fd58ab95e9d421be20702021446d2636
3
+ size 16389
rng_state_4.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d7930f1c6dd64fe161f166b710675bea007029bf2a54e835287c8517c8d61b7e
3
+ size 16389
rng_state_5.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c098b3d19df4c6a4261105183eb9357e2715d784d681c1426e4bb88c847c317
3
+ size 16389
rng_state_6.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c914eacfcdfa6cf1a18175490235b8bf14f4521cc8ebda28a827fb8611e2958d
3
+ size 16389
rng_state_7.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad02907448ab52a0de6407d8cc85b4523850947654c14a8ca1a3772f6c8c9cf8
3
+ size 16389
scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2b9980531e9a03282132d1ab3a420f8e27db73f249236d9aacc098905b0d50b
3
+ size 1465
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|im_end|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<pad>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<unk>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1723037d658a5b5900e4c836ba27c5af3a06ddf6ad73c74bd76e425a91fccd58
3
+ size 17078476
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff
 
trainer_state.json ADDED
@@ -0,0 +1,1178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 1.9714285714285715,
6
+ "eval_steps": 500,
7
+ "global_step": 104,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.01904761904761905,
14
+ "grad_norm": 1710495.2036469786,
15
+ "learning_rate": 0.0,
16
+ "loss": 1.3566,
17
+ "memory/device_reserved (GiB)": 126.71,
18
+ "memory/max_active (GiB)": 124.13,
19
+ "memory/max_allocated (GiB)": 122.77,
20
+ "step": 1,
21
+ "tokens_per_second_per_gpu": 3497.88
22
+ },
23
+ {
24
+ "epoch": 0.0380952380952381,
25
+ "grad_norm": 1558119.299961758,
26
+ "learning_rate": 8e-07,
27
+ "loss": 1.3538,
28
+ "memory/device_reserved (GiB)": 126.73,
29
+ "memory/max_active (GiB)": 124.18,
30
+ "memory/max_allocated (GiB)": 122.82,
31
+ "step": 2,
32
+ "tokens_per_second_per_gpu": 3711.34
33
+ },
34
+ {
35
+ "epoch": 0.05714285714285714,
36
+ "grad_norm": 4186.518498313145,
37
+ "learning_rate": 1.6e-06,
38
+ "loss": 1.3529,
39
+ "memory/device_reserved (GiB)": 126.73,
40
+ "memory/max_active (GiB)": 124.18,
41
+ "memory/max_allocated (GiB)": 122.82,
42
+ "step": 3,
43
+ "tokens_per_second_per_gpu": 3869.09
44
+ },
45
+ {
46
+ "epoch": 0.0761904761904762,
47
+ "grad_norm": 1230.1393406412694,
48
+ "learning_rate": 2.4e-06,
49
+ "loss": 1.3622,
50
+ "memory/device_reserved (GiB)": 127.34,
51
+ "memory/max_active (GiB)": 124.96,
52
+ "memory/max_allocated (GiB)": 122.82,
53
+ "step": 4,
54
+ "tokens_per_second_per_gpu": 3629.53
55
+ },
56
+ {
57
+ "epoch": 0.09523809523809523,
58
+ "grad_norm": 1035.6723923215748,
59
+ "learning_rate": 3.2e-06,
60
+ "loss": 1.3487,
61
+ "memory/device_reserved (GiB)": 127.34,
62
+ "memory/max_active (GiB)": 124.99,
63
+ "memory/max_allocated (GiB)": 122.82,
64
+ "step": 5,
65
+ "tokens_per_second_per_gpu": 3634.6
66
+ },
67
+ {
68
+ "epoch": 0.11428571428571428,
69
+ "grad_norm": 432.5460621726683,
70
+ "learning_rate": 4e-06,
71
+ "loss": 1.3432,
72
+ "memory/device_reserved (GiB)": 127.34,
73
+ "memory/max_active (GiB)": 124.99,
74
+ "memory/max_allocated (GiB)": 122.82,
75
+ "step": 6,
76
+ "tokens_per_second_per_gpu": 3776.49
77
+ },
78
+ {
79
+ "epoch": 0.13333333333333333,
80
+ "grad_norm": 1638.0331848931094,
81
+ "learning_rate": 4.8e-06,
82
+ "loss": 1.3677,
83
+ "memory/device_reserved (GiB)": 127.34,
84
+ "memory/max_active (GiB)": 124.99,
85
+ "memory/max_allocated (GiB)": 122.82,
86
+ "step": 7,
87
+ "tokens_per_second_per_gpu": 3647.88
88
+ },
89
+ {
90
+ "epoch": 0.1523809523809524,
91
+ "grad_norm": 2883.046779503214,
92
+ "learning_rate": 5.6e-06,
93
+ "loss": 1.3444,
94
+ "memory/device_reserved (GiB)": 127.34,
95
+ "memory/max_active (GiB)": 124.99,
96
+ "memory/max_allocated (GiB)": 122.82,
97
+ "step": 8,
98
+ "tokens_per_second_per_gpu": 3677.14
99
+ },
100
+ {
101
+ "epoch": 0.17142857142857143,
102
+ "grad_norm": 478.1216745871938,
103
+ "learning_rate": 6.4e-06,
104
+ "loss": 1.3305,
105
+ "memory/device_reserved (GiB)": 127.34,
106
+ "memory/max_active (GiB)": 124.18,
107
+ "memory/max_allocated (GiB)": 122.82,
108
+ "step": 9,
109
+ "tokens_per_second_per_gpu": 3739.63
110
+ },
111
+ {
112
+ "epoch": 0.19047619047619047,
113
+ "grad_norm": 1025.7505155071237,
114
+ "learning_rate": 7.2e-06,
115
+ "loss": 1.3362,
116
+ "memory/device_reserved (GiB)": 127.34,
117
+ "memory/max_active (GiB)": 124.18,
118
+ "memory/max_allocated (GiB)": 122.82,
119
+ "step": 10,
120
+ "tokens_per_second_per_gpu": 3730.56
121
+ },
122
+ {
123
+ "epoch": 0.20952380952380953,
124
+ "grad_norm": 1209.6274892436668,
125
+ "learning_rate": 8e-06,
126
+ "loss": 1.3325,
127
+ "memory/device_reserved (GiB)": 127.34,
128
+ "memory/max_active (GiB)": 124.99,
129
+ "memory/max_allocated (GiB)": 122.82,
130
+ "step": 11,
131
+ "tokens_per_second_per_gpu": 3661.21
132
+ },
133
+ {
134
+ "epoch": 0.22857142857142856,
135
+ "grad_norm": 1213.936189837833,
136
+ "learning_rate": 7.997766254921018e-06,
137
+ "loss": 1.3575,
138
+ "memory/device_reserved (GiB)": 127.34,
139
+ "memory/max_active (GiB)": 124.99,
140
+ "memory/max_allocated (GiB)": 122.82,
141
+ "step": 12,
142
+ "tokens_per_second_per_gpu": 3716.18
143
+ },
144
+ {
145
+ "epoch": 0.24761904761904763,
146
+ "grad_norm": 942.8786617202861,
147
+ "learning_rate": 7.991067514492613e-06,
148
+ "loss": 1.3145,
149
+ "memory/device_reserved (GiB)": 127.34,
150
+ "memory/max_active (GiB)": 124.99,
151
+ "memory/max_allocated (GiB)": 122.82,
152
+ "step": 13,
153
+ "tokens_per_second_per_gpu": 3587.32
154
+ },
155
+ {
156
+ "epoch": 0.26666666666666666,
157
+ "grad_norm": 3603.68277269405,
158
+ "learning_rate": 7.979911260354016e-06,
159
+ "loss": 1.3402,
160
+ "memory/device_reserved (GiB)": 127.34,
161
+ "memory/max_active (GiB)": 124.99,
162
+ "memory/max_allocated (GiB)": 122.82,
163
+ "step": 14,
164
+ "tokens_per_second_per_gpu": 3712.99
165
+ },
166
+ {
167
+ "epoch": 0.2857142857142857,
168
+ "grad_norm": 2487.402838754216,
169
+ "learning_rate": 7.96430995261912e-06,
170
+ "loss": 1.2956,
171
+ "memory/device_reserved (GiB)": 127.34,
172
+ "memory/max_active (GiB)": 124.18,
173
+ "memory/max_allocated (GiB)": 122.82,
174
+ "step": 15,
175
+ "tokens_per_second_per_gpu": 3762.61
176
+ },
177
+ {
178
+ "epoch": 0.3047619047619048,
179
+ "grad_norm": 667.5903281250161,
180
+ "learning_rate": 7.944281015960114e-06,
181
+ "loss": 1.2992,
182
+ "memory/device_reserved (GiB)": 127.34,
183
+ "memory/max_active (GiB)": 124.99,
184
+ "memory/max_allocated (GiB)": 122.82,
185
+ "step": 16,
186
+ "tokens_per_second_per_gpu": 3358.5
187
+ },
188
+ {
189
+ "epoch": 0.3238095238095238,
190
+ "grad_norm": 167.9027323688511,
191
+ "learning_rate": 7.919846820146347e-06,
192
+ "loss": 1.3119,
193
+ "memory/device_reserved (GiB)": 127.34,
194
+ "memory/max_active (GiB)": 124.18,
195
+ "memory/max_allocated (GiB)": 122.82,
196
+ "step": 17,
197
+ "tokens_per_second_per_gpu": 3675.6
198
+ },
199
+ {
200
+ "epoch": 0.34285714285714286,
201
+ "grad_norm": 47.46189855084341,
202
+ "learning_rate": 7.891034655060149e-06,
203
+ "loss": 1.302,
204
+ "memory/device_reserved (GiB)": 127.34,
205
+ "memory/max_active (GiB)": 124.18,
206
+ "memory/max_allocated (GiB)": 122.82,
207
+ "step": 18,
208
+ "tokens_per_second_per_gpu": 3754.58
209
+ },
210
+ {
211
+ "epoch": 0.3619047619047619,
212
+ "grad_norm": 115.37054783431222,
213
+ "learning_rate": 7.857876700217507e-06,
214
+ "loss": 1.3066,
215
+ "memory/device_reserved (GiB)": 127.34,
216
+ "memory/max_active (GiB)": 124.18,
217
+ "memory/max_allocated (GiB)": 122.82,
218
+ "step": 19,
219
+ "tokens_per_second_per_gpu": 3763.17
220
+ },
221
+ {
222
+ "epoch": 0.38095238095238093,
223
+ "grad_norm": 72.03472195336599,
224
+ "learning_rate": 7.820409988827649e-06,
225
+ "loss": 1.2876,
226
+ "memory/device_reserved (GiB)": 127.34,
227
+ "memory/max_active (GiB)": 124.99,
228
+ "memory/max_allocated (GiB)": 122.82,
229
+ "step": 20,
230
+ "tokens_per_second_per_gpu": 3750.15
231
+ },
232
+ {
233
+ "epoch": 0.4,
234
+ "grad_norm": 123.88987560365385,
235
+ "learning_rate": 7.778676366431674e-06,
236
+ "loss": 1.2854,
237
+ "memory/device_reserved (GiB)": 127.34,
238
+ "memory/max_active (GiB)": 124.99,
239
+ "memory/max_allocated (GiB)": 122.82,
240
+ "step": 21,
241
+ "tokens_per_second_per_gpu": 3556.91
242
+ },
243
+ {
244
+ "epoch": 0.41904761904761906,
245
+ "grad_norm": 36.51030416393311,
246
+ "learning_rate": 7.73272244416641e-06,
247
+ "loss": 1.2799,
248
+ "memory/device_reserved (GiB)": 127.34,
249
+ "memory/max_active (GiB)": 124.18,
250
+ "memory/max_allocated (GiB)": 122.82,
251
+ "step": 22,
252
+ "tokens_per_second_per_gpu": 3627.03
253
+ },
254
+ {
255
+ "epoch": 0.4380952380952381,
256
+ "grad_norm": 37.445205147197846,
257
+ "learning_rate": 7.682599546705715e-06,
258
+ "loss": 1.2835,
259
+ "memory/device_reserved (GiB)": 127.34,
260
+ "memory/max_active (GiB)": 124.18,
261
+ "memory/max_allocated (GiB)": 122.82,
262
+ "step": 23,
263
+ "tokens_per_second_per_gpu": 3604.91
264
+ },
265
+ {
266
+ "epoch": 0.45714285714285713,
267
+ "grad_norm": 39.93974794828826,
268
+ "learning_rate": 7.628363654937363e-06,
269
+ "loss": 1.2947,
270
+ "memory/device_reserved (GiB)": 127.34,
271
+ "memory/max_active (GiB)": 124.18,
272
+ "memory/max_allocated (GiB)": 122.82,
273
+ "step": 24,
274
+ "tokens_per_second_per_gpu": 3782.86
275
+ },
276
+ {
277
+ "epoch": 0.47619047619047616,
278
+ "grad_norm": 59.41355630536809,
279
+ "learning_rate": 7.570075343439524e-06,
280
+ "loss": 1.2702,
281
+ "memory/device_reserved (GiB)": 127.34,
282
+ "memory/max_active (GiB)": 124.99,
283
+ "memory/max_allocated (GiB)": 122.82,
284
+ "step": 25,
285
+ "tokens_per_second_per_gpu": 3694.52
286
+ },
287
+ {
288
+ "epoch": 0.49523809523809526,
289
+ "grad_norm": 34.32373819297229,
290
+ "learning_rate": 7.507799712826686e-06,
291
+ "loss": 1.2984,
292
+ "memory/device_reserved (GiB)": 127.34,
293
+ "memory/max_active (GiB)": 124.18,
294
+ "memory/max_allocated (GiB)": 122.82,
295
+ "step": 26,
296
+ "tokens_per_second_per_gpu": 3613.01
297
+ },
298
+ {
299
+ "epoch": 0.5142857142857142,
300
+ "grad_norm": 21.68779916764309,
301
+ "learning_rate": 7.441606317040558e-06,
302
+ "loss": 1.2827,
303
+ "memory/device_reserved (GiB)": 127.34,
304
+ "memory/max_active (GiB)": 124.99,
305
+ "memory/max_allocated (GiB)": 122.82,
306
+ "step": 27,
307
+ "tokens_per_second_per_gpu": 3616.18
308
+ },
309
+ {
310
+ "epoch": 0.5333333333333333,
311
+ "grad_norm": 30.472648556953168,
312
+ "learning_rate": 7.371569085667188e-06,
313
+ "loss": 1.2801,
314
+ "memory/device_reserved (GiB)": 127.34,
315
+ "memory/max_active (GiB)": 124.18,
316
+ "memory/max_allocated (GiB)": 122.82,
317
+ "step": 28,
318
+ "tokens_per_second_per_gpu": 3754.99
319
+ },
320
+ {
321
+ "epoch": 0.5523809523809524,
322
+ "grad_norm": 19.319274693345776,
323
+ "learning_rate": 7.297766241367041e-06,
324
+ "loss": 1.2693,
325
+ "memory/device_reserved (GiB)": 127.34,
326
+ "memory/max_active (GiB)": 124.99,
327
+ "memory/max_allocated (GiB)": 122.82,
328
+ "step": 29,
329
+ "tokens_per_second_per_gpu": 3677.68
330
+ },
331
+ {
332
+ "epoch": 0.5714285714285714,
333
+ "grad_norm": 34.31430237097932,
334
+ "learning_rate": 7.220280212510252e-06,
335
+ "loss": 1.2581,
336
+ "memory/device_reserved (GiB)": 127.34,
337
+ "memory/max_active (GiB)": 124.18,
338
+ "memory/max_allocated (GiB)": 122.82,
339
+ "step": 30,
340
+ "tokens_per_second_per_gpu": 3730.31
341
+ },
342
+ {
343
+ "epoch": 0.5904761904761905,
344
+ "grad_norm": 82.8518096206661,
345
+ "learning_rate": 7.139197541114644e-06,
346
+ "loss": 1.2687,
347
+ "memory/device_reserved (GiB)": 127.34,
348
+ "memory/max_active (GiB)": 124.18,
349
+ "memory/max_allocated (GiB)": 122.82,
350
+ "step": 31,
351
+ "tokens_per_second_per_gpu": 3650.37
352
+ },
353
+ {
354
+ "epoch": 0.6095238095238096,
355
+ "grad_norm": 36.99675013730897,
356
+ "learning_rate": 7.0546087861893285e-06,
357
+ "loss": 1.2809,
358
+ "memory/device_reserved (GiB)": 127.34,
359
+ "memory/max_active (GiB)": 124.18,
360
+ "memory/max_allocated (GiB)": 122.82,
361
+ "step": 32,
362
+ "tokens_per_second_per_gpu": 3785.35
363
+ },
364
+ {
365
+ "epoch": 0.6285714285714286,
366
+ "grad_norm": 10.853195813384238,
367
+ "learning_rate": 6.96660842259183e-06,
368
+ "loss": 1.253,
369
+ "memory/device_reserved (GiB)": 127.34,
370
+ "memory/max_active (GiB)": 124.18,
371
+ "memory/max_allocated (GiB)": 122.82,
372
+ "step": 33,
373
+ "tokens_per_second_per_gpu": 3666.64
374
+ },
375
+ {
376
+ "epoch": 0.6476190476190476,
377
+ "grad_norm": 27.05353511161411,
378
+ "learning_rate": 6.875294735511717e-06,
379
+ "loss": 1.2601,
380
+ "memory/device_reserved (GiB)": 127.34,
381
+ "memory/max_active (GiB)": 124.18,
382
+ "memory/max_allocated (GiB)": 122.82,
383
+ "step": 34,
384
+ "tokens_per_second_per_gpu": 3808.86
385
+ },
386
+ {
387
+ "epoch": 0.6666666666666666,
388
+ "grad_norm": 11.079685605370564,
389
+ "learning_rate": 6.780769710698569e-06,
390
+ "loss": 1.2539,
391
+ "memory/device_reserved (GiB)": 127.34,
392
+ "memory/max_active (GiB)": 124.99,
393
+ "memory/max_allocated (GiB)": 122.82,
394
+ "step": 35,
395
+ "tokens_per_second_per_gpu": 3708.96
396
+ },
397
+ {
398
+ "epoch": 0.6857142857142857,
399
+ "grad_norm": 35.34021537624741,
400
+ "learning_rate": 6.683138920556894e-06,
401
+ "loss": 1.2362,
402
+ "memory/device_reserved (GiB)": 127.34,
403
+ "memory/max_active (GiB)": 124.18,
404
+ "memory/max_allocated (GiB)": 122.82,
405
+ "step": 36,
406
+ "tokens_per_second_per_gpu": 3819.32
407
+ },
408
+ {
409
+ "epoch": 0.7047619047619048,
410
+ "grad_norm": 47.246402607795154,
411
+ "learning_rate": 6.582511406235209e-06,
412
+ "loss": 1.2429,
413
+ "memory/device_reserved (GiB)": 127.34,
414
+ "memory/max_active (GiB)": 124.18,
415
+ "memory/max_allocated (GiB)": 122.82,
416
+ "step": 37,
417
+ "tokens_per_second_per_gpu": 3762.22
418
+ },
419
+ {
420
+ "epoch": 0.7238095238095238,
421
+ "grad_norm": 35.65219209343969,
422
+ "learning_rate": 6.4789995558409795e-06,
423
+ "loss": 1.2535,
424
+ "memory/device_reserved (GiB)": 127.34,
425
+ "memory/max_active (GiB)": 124.18,
426
+ "memory/max_allocated (GiB)": 122.82,
427
+ "step": 38,
428
+ "tokens_per_second_per_gpu": 3496.79
429
+ },
430
+ {
431
+ "epoch": 0.7428571428571429,
432
+ "grad_norm": 13.147263166038922,
433
+ "learning_rate": 6.3727189789174205e-06,
434
+ "loss": 1.2421,
435
+ "memory/device_reserved (GiB)": 127.34,
436
+ "memory/max_active (GiB)": 124.99,
437
+ "memory/max_allocated (GiB)": 122.82,
438
+ "step": 39,
439
+ "tokens_per_second_per_gpu": 3471.55
440
+ },
441
+ {
442
+ "epoch": 0.7619047619047619,
443
+ "grad_norm": 8.92693366901581,
444
+ "learning_rate": 6.263788377322381e-06,
445
+ "loss": 1.2587,
446
+ "memory/device_reserved (GiB)": 127.34,
447
+ "memory/max_active (GiB)": 124.18,
448
+ "memory/max_allocated (GiB)": 122.82,
449
+ "step": 40,
450
+ "tokens_per_second_per_gpu": 3700.61
451
+ },
452
+ {
453
+ "epoch": 0.780952380952381,
454
+ "grad_norm": 25.621463437533773,
455
+ "learning_rate": 6.152329412653491e-06,
456
+ "loss": 1.2535,
457
+ "memory/device_reserved (GiB)": 127.34,
458
+ "memory/max_active (GiB)": 124.18,
459
+ "memory/max_allocated (GiB)": 122.82,
460
+ "step": 41,
461
+ "tokens_per_second_per_gpu": 3696.17
462
+ },
463
+ {
464
+ "epoch": 0.8,
465
+ "grad_norm": 21.356947105637357,
466
+ "learning_rate": 6.038466570367669e-06,
467
+ "loss": 1.2437,
468
+ "memory/device_reserved (GiB)": 127.34,
469
+ "memory/max_active (GiB)": 124.18,
470
+ "memory/max_allocated (GiB)": 122.82,
471
+ "step": 42,
472
+ "tokens_per_second_per_gpu": 3679.52
473
+ },
474
+ {
475
+ "epoch": 0.819047619047619,
476
+ "grad_norm": 21.528748134497796,
477
+ "learning_rate": 5.922327020746735e-06,
478
+ "loss": 1.2243,
479
+ "memory/device_reserved (GiB)": 127.34,
480
+ "memory/max_active (GiB)": 124.99,
481
+ "memory/max_allocated (GiB)": 122.82,
482
+ "step": 43,
483
+ "tokens_per_second_per_gpu": 3654.06
484
+ },
485
+ {
486
+ "epoch": 0.8380952380952381,
487
+ "grad_norm": 14.734257530424147,
488
+ "learning_rate": 5.804040476864407e-06,
489
+ "loss": 1.2326,
490
+ "memory/device_reserved (GiB)": 127.34,
491
+ "memory/max_active (GiB)": 124.99,
492
+ "memory/max_allocated (GiB)": 122.82,
493
+ "step": 44,
494
+ "tokens_per_second_per_gpu": 3581.66
495
+ },
496
+ {
497
+ "epoch": 0.8571428571428571,
498
+ "grad_norm": 13.129280834101875,
499
+ "learning_rate": 5.68373904971334e-06,
500
+ "loss": 1.2442,
501
+ "memory/device_reserved (GiB)": 127.34,
502
+ "memory/max_active (GiB)": 124.18,
503
+ "memory/max_allocated (GiB)": 122.82,
504
+ "step": 45,
505
+ "tokens_per_second_per_gpu": 3788.2
506
+ },
507
+ {
508
+ "epoch": 0.8761904761904762,
509
+ "grad_norm": 14.976302382446457,
510
+ "learning_rate": 5.561557100653979e-06,
511
+ "loss": 1.2486,
512
+ "memory/device_reserved (GiB)": 127.34,
513
+ "memory/max_active (GiB)": 124.18,
514
+ "memory/max_allocated (GiB)": 122.82,
515
+ "step": 46,
516
+ "tokens_per_second_per_gpu": 3636.88
517
+ },
518
+ {
519
+ "epoch": 0.8952380952380953,
520
+ "grad_norm": 15.967232506668388,
521
+ "learning_rate": 5.43763109135005e-06,
522
+ "loss": 1.2338,
523
+ "memory/device_reserved (GiB)": 127.34,
524
+ "memory/max_active (GiB)": 124.18,
525
+ "memory/max_allocated (GiB)": 122.82,
526
+ "step": 47,
527
+ "tokens_per_second_per_gpu": 3759.31
528
+ },
529
+ {
530
+ "epoch": 0.9142857142857143,
531
+ "grad_norm": 16.354797247719976,
532
+ "learning_rate": 5.312099431358276e-06,
533
+ "loss": 1.2413,
534
+ "memory/device_reserved (GiB)": 127.34,
535
+ "memory/max_active (GiB)": 124.18,
536
+ "memory/max_allocated (GiB)": 122.82,
537
+ "step": 48,
538
+ "tokens_per_second_per_gpu": 3663.89
539
+ },
540
+ {
541
+ "epoch": 0.9333333333333333,
542
+ "grad_norm": 6.665663198954394,
543
+ "learning_rate": 5.185102323542536e-06,
544
+ "loss": 1.2395,
545
+ "memory/device_reserved (GiB)": 127.34,
546
+ "memory/max_active (GiB)": 124.18,
547
+ "memory/max_allocated (GiB)": 122.82,
548
+ "step": 49,
549
+ "tokens_per_second_per_gpu": 3727.2
550
+ },
551
+ {
552
+ "epoch": 0.9523809523809523,
553
+ "grad_norm": 9.1334624753648,
554
+ "learning_rate": 5.056781607485144e-06,
555
+ "loss": 1.2268,
556
+ "memory/device_reserved (GiB)": 127.34,
557
+ "memory/max_active (GiB)": 124.18,
558
+ "memory/max_allocated (GiB)": 122.82,
559
+ "step": 50,
560
+ "tokens_per_second_per_gpu": 3870.66
561
+ },
562
+ {
563
+ "epoch": 0.9714285714285714,
564
+ "grad_norm": 17.527340590112377,
565
+ "learning_rate": 4.927280601070113e-06,
566
+ "loss": 1.2248,
567
+ "memory/device_reserved (GiB)": 127.34,
568
+ "memory/max_active (GiB)": 124.99,
569
+ "memory/max_allocated (GiB)": 122.82,
570
+ "step": 51,
571
+ "tokens_per_second_per_gpu": 3582.22
572
+ },
573
+ {
574
+ "epoch": 0.9904761904761905,
575
+ "grad_norm": 19.222165420352905,
576
+ "learning_rate": 4.796743940415344e-06,
577
+ "loss": 1.2254,
578
+ "memory/device_reserved (GiB)": 127.34,
579
+ "memory/max_active (GiB)": 124.18,
580
+ "memory/max_allocated (GiB)": 122.82,
581
+ "step": 52,
582
+ "tokens_per_second_per_gpu": 3727.73
583
+ },
584
+ {
585
+ "epoch": 1.0,
586
+ "grad_norm": 16.84364160949164,
587
+ "learning_rate": 4.66531741833252e-06,
588
+ "loss": 1.242,
589
+ "memory/device_reserved (GiB)": 127.34,
590
+ "memory/max_active (GiB)": 124.17,
591
+ "memory/max_allocated (GiB)": 122.81,
592
+ "step": 53,
593
+ "tokens_per_second_per_gpu": 3750.91
594
+ },
595
+ {
596
+ "epoch": 1.019047619047619,
597
+ "grad_norm": 25.10526965511846,
598
+ "learning_rate": 4.533147821495116e-06,
599
+ "loss": 1.2426,
600
+ "memory/device_reserved (GiB)": 127.34,
601
+ "memory/max_active (GiB)": 124.18,
602
+ "memory/max_allocated (GiB)": 122.82,
603
+ "step": 54,
604
+ "tokens_per_second_per_gpu": 3667.97
605
+ },
606
+ {
607
+ "epoch": 1.0380952380952382,
608
+ "grad_norm": 24.822314802816855,
609
+ "learning_rate": 4.400382766496394e-06,
610
+ "loss": 1.2394,
611
+ "memory/device_reserved (GiB)": 127.34,
612
+ "memory/max_active (GiB)": 124.18,
613
+ "memory/max_allocated (GiB)": 122.82,
614
+ "step": 55,
615
+ "tokens_per_second_per_gpu": 3712.75
616
+ },
617
+ {
618
+ "epoch": 1.0571428571428572,
619
+ "grad_norm": 19.222938204469422,
620
+ "learning_rate": 4.267170534980487e-06,
621
+ "loss": 1.2269,
622
+ "memory/device_reserved (GiB)": 127.34,
623
+ "memory/max_active (GiB)": 124.18,
624
+ "memory/max_allocated (GiB)": 122.82,
625
+ "step": 56,
626
+ "tokens_per_second_per_gpu": 3874.53
627
+ },
628
+ {
629
+ "epoch": 1.0761904761904761,
630
+ "grad_norm": 14.962813195503772,
631
+ "learning_rate": 4.133659908030698e-06,
632
+ "loss": 1.233,
633
+ "memory/device_reserved (GiB)": 127.34,
634
+ "memory/max_active (GiB)": 124.99,
635
+ "memory/max_allocated (GiB)": 122.82,
636
+ "step": 57,
637
+ "tokens_per_second_per_gpu": 3626.61
638
+ },
639
+ {
640
+ "epoch": 1.0952380952380953,
641
+ "grad_norm": 23.099619927044888,
642
+ "learning_rate": 4e-06,
643
+ "loss": 1.2353,
644
+ "memory/device_reserved (GiB)": 127.34,
645
+ "memory/max_active (GiB)": 124.99,
646
+ "memory/max_allocated (GiB)": 122.82,
647
+ "step": 58,
648
+ "tokens_per_second_per_gpu": 3631.82
649
+ },
650
+ {
651
+ "epoch": 1.1142857142857143,
652
+ "grad_norm": 14.683578827379744,
653
+ "learning_rate": 3.8663400919693026e-06,
654
+ "loss": 1.2261,
655
+ "memory/device_reserved (GiB)": 127.34,
656
+ "memory/max_active (GiB)": 124.99,
657
+ "memory/max_allocated (GiB)": 122.82,
658
+ "step": 59,
659
+ "tokens_per_second_per_gpu": 3778.88
660
+ },
661
+ {
662
+ "epoch": 1.1333333333333333,
663
+ "grad_norm": 1363.244724375689,
664
+ "learning_rate": 3.7328294650195136e-06,
665
+ "loss": 1.2448,
666
+ "memory/device_reserved (GiB)": 127.34,
667
+ "memory/max_active (GiB)": 124.99,
668
+ "memory/max_allocated (GiB)": 122.82,
669
+ "step": 60,
670
+ "tokens_per_second_per_gpu": 3648.86
671
+ },
672
+ {
673
+ "epoch": 1.1523809523809523,
674
+ "grad_norm": 37.56736283967858,
675
+ "learning_rate": 3.5996172335036064e-06,
676
+ "loss": 1.2134,
677
+ "memory/device_reserved (GiB)": 127.34,
678
+ "memory/max_active (GiB)": 124.18,
679
+ "memory/max_allocated (GiB)": 122.82,
680
+ "step": 61,
681
+ "tokens_per_second_per_gpu": 3680.45
682
+ },
683
+ {
684
+ "epoch": 1.1714285714285715,
685
+ "grad_norm": 24.14759116678243,
686
+ "learning_rate": 3.4668521785048856e-06,
687
+ "loss": 1.2201,
688
+ "memory/device_reserved (GiB)": 127.34,
689
+ "memory/max_active (GiB)": 124.18,
690
+ "memory/max_allocated (GiB)": 122.82,
691
+ "step": 62,
692
+ "tokens_per_second_per_gpu": 3742.93
693
+ },
694
+ {
695
+ "epoch": 1.1904761904761905,
696
+ "grad_norm": 20.895518933622306,
697
+ "learning_rate": 3.3346825816674796e-06,
698
+ "loss": 1.2248,
699
+ "memory/device_reserved (GiB)": 127.34,
700
+ "memory/max_active (GiB)": 124.18,
701
+ "memory/max_allocated (GiB)": 122.82,
702
+ "step": 63,
703
+ "tokens_per_second_per_gpu": 3729.87
704
+ },
705
+ {
706
+ "epoch": 1.2095238095238094,
707
+ "grad_norm": 20.07417789192824,
708
+ "learning_rate": 3.2032560595846563e-06,
709
+ "loss": 1.2253,
710
+ "memory/device_reserved (GiB)": 127.34,
711
+ "memory/max_active (GiB)": 124.99,
712
+ "memory/max_allocated (GiB)": 122.82,
713
+ "step": 64,
714
+ "tokens_per_second_per_gpu": 3664.34
715
+ },
716
+ {
717
+ "epoch": 1.2285714285714286,
718
+ "grad_norm": 14.61511907498168,
719
+ "learning_rate": 3.0727193989298864e-06,
720
+ "loss": 1.241,
721
+ "memory/device_reserved (GiB)": 127.34,
722
+ "memory/max_active (GiB)": 124.99,
723
+ "memory/max_allocated (GiB)": 122.82,
724
+ "step": 65,
725
+ "tokens_per_second_per_gpu": 3721.56
726
+ },
727
+ {
728
+ "epoch": 1.2476190476190476,
729
+ "grad_norm": 18.1080641996899,
730
+ "learning_rate": 2.943218392514856e-06,
731
+ "loss": 1.2027,
732
+ "memory/device_reserved (GiB)": 127.34,
733
+ "memory/max_active (GiB)": 124.99,
734
+ "memory/max_allocated (GiB)": 122.82,
735
+ "step": 66,
736
+ "tokens_per_second_per_gpu": 3589.14
737
+ },
738
+ {
739
+ "epoch": 1.2666666666666666,
740
+ "grad_norm": 88.35410261817876,
741
+ "learning_rate": 2.8148976764574643e-06,
742
+ "loss": 1.221,
743
+ "memory/device_reserved (GiB)": 127.42,
744
+ "memory/max_active (GiB)": 124.99,
745
+ "memory/max_allocated (GiB)": 122.82,
746
+ "step": 67,
747
+ "tokens_per_second_per_gpu": 3718.05
748
+ },
749
+ {
750
+ "epoch": 1.2857142857142856,
751
+ "grad_norm": 23.72041286077318,
752
+ "learning_rate": 2.6879005686417232e-06,
753
+ "loss": 1.2172,
754
+ "memory/device_reserved (GiB)": 127.42,
755
+ "memory/max_active (GiB)": 124.18,
756
+ "memory/max_allocated (GiB)": 122.82,
757
+ "step": 68,
758
+ "tokens_per_second_per_gpu": 3764.91
759
+ },
760
+ {
761
+ "epoch": 1.3047619047619048,
762
+ "grad_norm": 43.54234028579835,
763
+ "learning_rate": 2.5623689086499492e-06,
764
+ "loss": 1.2326,
765
+ "memory/device_reserved (GiB)": 127.42,
766
+ "memory/max_active (GiB)": 124.99,
767
+ "memory/max_allocated (GiB)": 122.82,
768
+ "step": 69,
769
+ "tokens_per_second_per_gpu": 3359.73
770
+ },
771
+ {
772
+ "epoch": 1.3238095238095238,
773
+ "grad_norm": 6.104685395227184,
774
+ "learning_rate": 2.4384428993460207e-06,
775
+ "loss": 1.2427,
776
+ "memory/device_reserved (GiB)": 127.42,
777
+ "memory/max_active (GiB)": 124.18,
778
+ "memory/max_allocated (GiB)": 122.82,
779
+ "step": 70,
780
+ "tokens_per_second_per_gpu": 3681.16
781
+ },
782
+ {
783
+ "epoch": 1.342857142857143,
784
+ "grad_norm": 9.963394838549585,
785
+ "learning_rate": 2.3162609502866607e-06,
786
+ "loss": 1.2322,
787
+ "memory/device_reserved (GiB)": 127.42,
788
+ "memory/max_active (GiB)": 124.18,
789
+ "memory/max_allocated (GiB)": 122.82,
790
+ "step": 71,
791
+ "tokens_per_second_per_gpu": 3753.07
792
+ },
793
+ {
794
+ "epoch": 1.361904761904762,
795
+ "grad_norm": 43.43949979845249,
796
+ "learning_rate": 2.195959523135592e-06,
797
+ "loss": 1.2383,
798
+ "memory/device_reserved (GiB)": 127.42,
799
+ "memory/max_active (GiB)": 124.18,
800
+ "memory/max_allocated (GiB)": 122.82,
801
+ "step": 72,
802
+ "tokens_per_second_per_gpu": 3764.97
803
+ },
804
+ {
805
+ "epoch": 1.380952380952381,
806
+ "grad_norm": 14.107017331391786,
807
+ "learning_rate": 2.077672979253265e-06,
808
+ "loss": 1.2225,
809
+ "memory/device_reserved (GiB)": 127.42,
810
+ "memory/max_active (GiB)": 124.99,
811
+ "memory/max_allocated (GiB)": 122.82,
812
+ "step": 73,
813
+ "tokens_per_second_per_gpu": 3751.34
814
+ },
815
+ {
816
+ "epoch": 1.4,
817
+ "grad_norm": 10.549323906590455,
818
+ "learning_rate": 1.96153342963233e-06,
819
+ "loss": 1.2214,
820
+ "memory/device_reserved (GiB)": 127.42,
821
+ "memory/max_active (GiB)": 124.99,
822
+ "memory/max_allocated (GiB)": 122.82,
823
+ "step": 74,
824
+ "tokens_per_second_per_gpu": 3559.51
825
+ },
826
+ {
827
+ "epoch": 1.4190476190476191,
828
+ "grad_norm": 18.592940657981064,
829
+ "learning_rate": 1.8476705873465096e-06,
830
+ "loss": 1.2171,
831
+ "memory/device_reserved (GiB)": 127.42,
832
+ "memory/max_active (GiB)": 124.18,
833
+ "memory/max_allocated (GiB)": 122.82,
834
+ "step": 75,
835
+ "tokens_per_second_per_gpu": 3629.78
836
+ },
837
+ {
838
+ "epoch": 1.438095238095238,
839
+ "grad_norm": 11.120257290964485,
840
+ "learning_rate": 1.7362116226776187e-06,
841
+ "loss": 1.2226,
842
+ "memory/device_reserved (GiB)": 127.42,
843
+ "memory/max_active (GiB)": 124.18,
844
+ "memory/max_allocated (GiB)": 122.82,
845
+ "step": 76,
846
+ "tokens_per_second_per_gpu": 3603.12
847
+ },
848
+ {
849
+ "epoch": 1.457142857142857,
850
+ "grad_norm": 7.078043688121306,
851
+ "learning_rate": 1.627281021082579e-06,
852
+ "loss": 1.2345,
853
+ "memory/device_reserved (GiB)": 127.42,
854
+ "memory/max_active (GiB)": 124.18,
855
+ "memory/max_allocated (GiB)": 122.82,
856
+ "step": 77,
857
+ "tokens_per_second_per_gpu": 3780.85
858
+ },
859
+ {
860
+ "epoch": 1.4761904761904763,
861
+ "grad_norm": 5.000285151965608,
862
+ "learning_rate": 1.521000444159021e-06,
863
+ "loss": 1.2116,
864
+ "memory/device_reserved (GiB)": 127.42,
865
+ "memory/max_active (GiB)": 124.99,
866
+ "memory/max_allocated (GiB)": 122.82,
867
+ "step": 78,
868
+ "tokens_per_second_per_gpu": 3695.41
869
+ },
870
+ {
871
+ "epoch": 1.4952380952380953,
872
+ "grad_norm": 47.84624251792891,
873
+ "learning_rate": 1.4174885937647903e-06,
874
+ "loss": 1.2405,
875
+ "memory/device_reserved (GiB)": 127.42,
876
+ "memory/max_active (GiB)": 124.18,
877
+ "memory/max_allocated (GiB)": 122.82,
878
+ "step": 79,
879
+ "tokens_per_second_per_gpu": 3605.95
880
+ },
881
+ {
882
+ "epoch": 1.5142857142857142,
883
+ "grad_norm": 12.461343395029726,
884
+ "learning_rate": 1.316861079443107e-06,
885
+ "loss": 1.2272,
886
+ "memory/device_reserved (GiB)": 127.42,
887
+ "memory/max_active (GiB)": 124.99,
888
+ "memory/max_allocated (GiB)": 122.82,
889
+ "step": 80,
890
+ "tokens_per_second_per_gpu": 3613.63
891
+ },
892
+ {
893
+ "epoch": 1.5333333333333332,
894
+ "grad_norm": 7.656217867750634,
895
+ "learning_rate": 1.2192302893014308e-06,
896
+ "loss": 1.2265,
897
+ "memory/device_reserved (GiB)": 127.42,
898
+ "memory/max_active (GiB)": 124.99,
899
+ "memory/max_allocated (GiB)": 122.82,
900
+ "step": 81,
901
+ "tokens_per_second_per_gpu": 3752.87
902
+ },
903
+ {
904
+ "epoch": 1.5523809523809524,
905
+ "grad_norm": 15.082668616044355,
906
+ "learning_rate": 1.1247052644882832e-06,
907
+ "loss": 1.2183,
908
+ "memory/device_reserved (GiB)": 127.42,
909
+ "memory/max_active (GiB)": 124.99,
910
+ "memory/max_allocated (GiB)": 122.82,
911
+ "step": 82,
912
+ "tokens_per_second_per_gpu": 3677.86
913
+ },
914
+ {
915
+ "epoch": 1.5714285714285714,
916
+ "grad_norm": 16.44949015042616,
917
+ "learning_rate": 1.0333915774081697e-06,
918
+ "loss": 1.2099,
919
+ "memory/device_reserved (GiB)": 127.42,
920
+ "memory/max_active (GiB)": 124.83,
921
+ "memory/max_allocated (GiB)": 122.82,
922
+ "step": 83,
923
+ "tokens_per_second_per_gpu": 3729.01
924
+ },
925
+ {
926
+ "epoch": 1.5904761904761906,
927
+ "grad_norm": 12.211227945509856,
928
+ "learning_rate": 9.453912138106721e-07,
929
+ "loss": 1.2231,
930
+ "memory/device_reserved (GiB)": 127.42,
931
+ "memory/max_active (GiB)": 124.18,
932
+ "memory/max_allocated (GiB)": 122.82,
933
+ "step": 84,
934
+ "tokens_per_second_per_gpu": 3649.49
935
+ },
936
+ {
937
+ "epoch": 1.6095238095238096,
938
+ "grad_norm": 7.074192518964132,
939
+ "learning_rate": 8.60802458885356e-07,
940
+ "loss": 1.237,
941
+ "memory/device_reserved (GiB)": 127.42,
942
+ "memory/max_active (GiB)": 124.18,
943
+ "memory/max_allocated (GiB)": 122.82,
944
+ "step": 85,
945
+ "tokens_per_second_per_gpu": 3783.87
946
+ },
947
+ {
948
+ "epoch": 1.6285714285714286,
949
+ "grad_norm": 13.131068251165631,
950
+ "learning_rate": 7.797197874897485e-07,
951
+ "loss": 1.2116,
952
+ "memory/device_reserved (GiB)": 127.42,
953
+ "memory/max_active (GiB)": 124.18,
954
+ "memory/max_allocated (GiB)": 122.82,
955
+ "step": 86,
956
+ "tokens_per_second_per_gpu": 3671.48
957
+ },
958
+ {
959
+ "epoch": 1.6476190476190475,
960
+ "grad_norm": 15.417850715738988,
961
+ "learning_rate": 7.022337586329596e-07,
962
+ "loss": 1.2209,
963
+ "memory/device_reserved (GiB)": 127.42,
964
+ "memory/max_active (GiB)": 124.18,
965
+ "memory/max_allocated (GiB)": 122.82,
966
+ "step": 87,
967
+ "tokens_per_second_per_gpu": 3805.45
968
+ },
969
+ {
970
+ "epoch": 1.6666666666666665,
971
+ "grad_norm": 24.13403904325753,
972
+ "learning_rate": 6.28430914332812e-07,
973
+ "loss": 1.217,
974
+ "memory/device_reserved (GiB)": 127.42,
975
+ "memory/max_active (GiB)": 124.99,
976
+ "memory/max_allocated (GiB)": 122.82,
977
+ "step": 88,
978
+ "tokens_per_second_per_gpu": 3706.88
979
+ },
980
+ {
981
+ "epoch": 1.6857142857142857,
982
+ "grad_norm": 13.576166990616798,
983
+ "learning_rate": 5.583936829594433e-07,
984
+ "loss": 1.2017,
985
+ "memory/device_reserved (GiB)": 127.42,
986
+ "memory/max_active (GiB)": 124.18,
987
+ "memory/max_allocated (GiB)": 122.82,
988
+ "step": 89,
989
+ "tokens_per_second_per_gpu": 3820.7
990
+ },
991
+ {
992
+ "epoch": 1.704761904761905,
993
+ "grad_norm": 8.573005189398867,
994
+ "learning_rate": 4.92200287173314e-07,
995
+ "loss": 1.2096,
996
+ "memory/device_reserved (GiB)": 127.42,
997
+ "memory/max_active (GiB)": 124.18,
998
+ "memory/max_allocated (GiB)": 122.82,
999
+ "step": 90,
1000
+ "tokens_per_second_per_gpu": 3759.45
1001
+ },
1002
+ {
1003
+ "epoch": 1.723809523809524,
1004
+ "grad_norm": 5.5800010726124025,
1005
+ "learning_rate": 4.299246565604755e-07,
1006
+ "loss": 1.2218,
1007
+ "memory/device_reserved (GiB)": 127.42,
1008
+ "memory/max_active (GiB)": 124.18,
1009
+ "memory/max_allocated (GiB)": 122.82,
1010
+ "step": 91,
1011
+ "tokens_per_second_per_gpu": 3499.8
1012
+ },
1013
+ {
1014
+ "epoch": 1.7428571428571429,
1015
+ "grad_norm": 6.765368030458938,
1016
+ "learning_rate": 3.716363450626372e-07,
1017
+ "loss": 1.2117,
1018
+ "memory/device_reserved (GiB)": 127.42,
1019
+ "memory/max_active (GiB)": 124.99,
1020
+ "memory/max_allocated (GiB)": 122.82,
1021
+ "step": 92,
1022
+ "tokens_per_second_per_gpu": 3468.37
1023
+ },
1024
+ {
1025
+ "epoch": 1.7619047619047619,
1026
+ "grad_norm": 7.504548685452772,
1027
+ "learning_rate": 3.174004532942844e-07,
1028
+ "loss": 1.2299,
1029
+ "memory/device_reserved (GiB)": 127.42,
1030
+ "memory/max_active (GiB)": 124.18,
1031
+ "memory/max_allocated (GiB)": 122.82,
1032
+ "step": 93,
1033
+ "tokens_per_second_per_gpu": 3700.98
1034
+ },
1035
+ {
1036
+ "epoch": 1.7809523809523808,
1037
+ "grad_norm": 8.649122371866438,
1038
+ "learning_rate": 2.672775558335898e-07,
1039
+ "loss": 1.2265,
1040
+ "memory/device_reserved (GiB)": 127.42,
1041
+ "memory/max_active (GiB)": 124.18,
1042
+ "memory/max_allocated (GiB)": 122.82,
1043
+ "step": 94,
1044
+ "tokens_per_second_per_gpu": 3700.55
1045
+ },
1046
+ {
1047
+ "epoch": 1.8,
1048
+ "grad_norm": 11.91832294221251,
1049
+ "learning_rate": 2.2132363356832528e-07,
1050
+ "loss": 1.2185,
1051
+ "memory/device_reserved (GiB)": 127.42,
1052
+ "memory/max_active (GiB)": 124.18,
1053
+ "memory/max_allocated (GiB)": 122.82,
1054
+ "step": 95,
1055
+ "tokens_per_second_per_gpu": 3680.96
1056
+ },
1057
+ {
1058
+ "epoch": 1.819047619047619,
1059
+ "grad_norm": 9.186156818821193,
1060
+ "learning_rate": 1.795900111723503e-07,
1061
+ "loss": 1.2008,
1062
+ "memory/device_reserved (GiB)": 127.42,
1063
+ "memory/max_active (GiB)": 124.99,
1064
+ "memory/max_allocated (GiB)": 122.82,
1065
+ "step": 96,
1066
+ "tokens_per_second_per_gpu": 3658.84
1067
+ },
1068
+ {
1069
+ "epoch": 1.8380952380952382,
1070
+ "grad_norm": 13.72977541399496,
1071
+ "learning_rate": 1.4212329978249415e-07,
1072
+ "loss": 1.2104,
1073
+ "memory/device_reserved (GiB)": 127.42,
1074
+ "memory/max_active (GiB)": 124.99,
1075
+ "memory/max_allocated (GiB)": 122.82,
1076
+ "step": 97,
1077
+ "tokens_per_second_per_gpu": 3581.27
1078
+ },
1079
+ {
1080
+ "epoch": 1.8571428571428572,
1081
+ "grad_norm": 6.290457692715211,
1082
+ "learning_rate": 1.0896534493985177e-07,
1083
+ "loss": 1.223,
1084
+ "memory/device_reserved (GiB)": 127.42,
1085
+ "memory/max_active (GiB)": 124.18,
1086
+ "memory/max_allocated (GiB)": 122.82,
1087
+ "step": 98,
1088
+ "tokens_per_second_per_gpu": 3791.37
1089
+ },
1090
+ {
1091
+ "epoch": 1.8761904761904762,
1092
+ "grad_norm": 9.702798624165407,
1093
+ "learning_rate": 8.0153179853653e-08,
1094
+ "loss": 1.2285,
1095
+ "memory/device_reserved (GiB)": 127.42,
1096
+ "memory/max_active (GiB)": 124.18,
1097
+ "memory/max_allocated (GiB)": 122.82,
1098
+ "step": 99,
1099
+ "tokens_per_second_per_gpu": 3639.09
1100
+ },
1101
+ {
1102
+ "epoch": 1.8952380952380952,
1103
+ "grad_norm": 11.005975725667684,
1104
+ "learning_rate": 5.571898403988573e-08,
1105
+ "loss": 1.2151,
1106
+ "memory/device_reserved (GiB)": 127.42,
1107
+ "memory/max_active (GiB)": 124.18,
1108
+ "memory/max_allocated (GiB)": 122.82,
1109
+ "step": 100,
1110
+ "tokens_per_second_per_gpu": 3757.98
1111
+ },
1112
+ {
1113
+ "epoch": 1.9142857142857141,
1114
+ "grad_norm": 8.44842365055977,
1115
+ "learning_rate": 3.569004738087988e-08,
1116
+ "loss": 1.2238,
1117
+ "memory/device_reserved (GiB)": 127.42,
1118
+ "memory/max_active (GiB)": 124.18,
1119
+ "memory/max_allocated (GiB)": 122.82,
1120
+ "step": 101,
1121
+ "tokens_per_second_per_gpu": 3661.88
1122
+ },
1123
+ {
1124
+ "epoch": 1.9333333333333333,
1125
+ "grad_norm": 4.816542675360639,
1126
+ "learning_rate": 2.0088739645983455e-08,
1127
+ "loss": 1.2232,
1128
+ "memory/device_reserved (GiB)": 127.42,
1129
+ "memory/max_active (GiB)": 124.18,
1130
+ "memory/max_allocated (GiB)": 122.82,
1131
+ "step": 102,
1132
+ "tokens_per_second_per_gpu": 3730.52
1133
+ },
1134
+ {
1135
+ "epoch": 1.9523809523809523,
1136
+ "grad_norm": 11.749396247795026,
1137
+ "learning_rate": 8.932485507387344e-09,
1138
+ "loss": 1.2118,
1139
+ "memory/device_reserved (GiB)": 127.42,
1140
+ "memory/max_active (GiB)": 124.18,
1141
+ "memory/max_allocated (GiB)": 122.82,
1142
+ "step": 103,
1143
+ "tokens_per_second_per_gpu": 3871.77
1144
+ },
1145
+ {
1146
+ "epoch": 1.9714285714285715,
1147
+ "grad_norm": 7.9532371124526104,
1148
+ "learning_rate": 2.2337450789815526e-09,
1149
+ "loss": 1.2109,
1150
+ "memory/device_reserved (GiB)": 127.42,
1151
+ "memory/max_active (GiB)": 124.18,
1152
+ "memory/max_allocated (GiB)": 122.82,
1153
+ "step": 104,
1154
+ "tokens_per_second_per_gpu": 3582.44
1155
+ }
1156
+ ],
1157
+ "logging_steps": 1,
1158
+ "max_steps": 104,
1159
+ "num_input_tokens_seen": 0,
1160
+ "num_train_epochs": 2,
1161
+ "save_steps": 13,
1162
+ "stateful_callbacks": {
1163
+ "TrainerControl": {
1164
+ "args": {
1165
+ "should_epoch_stop": false,
1166
+ "should_evaluate": false,
1167
+ "should_log": false,
1168
+ "should_save": true,
1169
+ "should_training_stop": true
1170
+ },
1171
+ "attributes": {}
1172
+ }
1173
+ },
1174
+ "total_flos": 1428859668922368.0,
1175
+ "train_batch_size": 2,
1176
+ "trial_name": null,
1177
+ "trial_params": null
1178
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:75728d1f222de640ed232302fa9ccb9af4d5b61b86d229500c0faae54317cbd9
3
+ size 9169
zero_to_fp32.py ADDED
@@ -0,0 +1,760 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example:
14
+ # python zero_to_fp32.py . output_dir/
15
+ # or
16
+ # python zero_to_fp32.py . output_dir/ --safe_serialization
17
+
18
+ import argparse
19
+ import torch
20
+ import glob
21
+ import math
22
+ import os
23
+ import re
24
+ import gc
25
+ import json
26
+ import numpy as np
27
+ from tqdm import tqdm
28
+ from collections import OrderedDict
29
+ from dataclasses import dataclass
30
+
31
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
32
+ # DeepSpeed data structures it has to be available in the current python environment.
33
+ from deepspeed.utils import logger
34
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
35
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
36
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
37
+
38
+
39
+ @dataclass
40
+ class zero_model_state:
41
+ buffers: dict()
42
+ param_shapes: dict()
43
+ shared_params: list
44
+ ds_version: int
45
+ frozen_param_shapes: dict()
46
+ frozen_param_fragments: dict()
47
+
48
+
49
+ debug = 0
50
+
51
+ # load to cpu
52
+ device = torch.device('cpu')
53
+
54
+
55
+ def atoi(text):
56
+ return int(text) if text.isdigit() else text
57
+
58
+
59
+ def natural_keys(text):
60
+ '''
61
+ alist.sort(key=natural_keys) sorts in human order
62
+ http://nedbatchelder.com/blog/200712/human_sorting.html
63
+ (See Toothy's implementation in the comments)
64
+ '''
65
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
66
+
67
+
68
+ def get_model_state_file(checkpoint_dir, zero_stage):
69
+ if not os.path.isdir(checkpoint_dir):
70
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
71
+
72
+ # there should be only one file
73
+ if zero_stage <= 2:
74
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
75
+ elif zero_stage == 3:
76
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
77
+
78
+ if not os.path.exists(file):
79
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
80
+
81
+ return file
82
+
83
+
84
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
85
+ # XXX: need to test that this simple glob rule works for multi-node setup too
86
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
87
+
88
+ if len(ckpt_files) == 0:
89
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
90
+
91
+ return ckpt_files
92
+
93
+
94
+ def get_optim_files(checkpoint_dir):
95
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
96
+
97
+
98
+ def get_model_state_files(checkpoint_dir):
99
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
100
+
101
+
102
+ def parse_model_states(files):
103
+ zero_model_states = []
104
+ for file in files:
105
+ state_dict = torch.load(file, map_location=device, weights_only=False)
106
+
107
+ if BUFFER_NAMES not in state_dict:
108
+ raise ValueError(f"{file} is not a model state checkpoint")
109
+ buffer_names = state_dict[BUFFER_NAMES]
110
+ if debug:
111
+ print("Found buffers:", buffer_names)
112
+
113
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
114
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
115
+ param_shapes = state_dict[PARAM_SHAPES]
116
+
117
+ # collect parameters that are included in param_shapes
118
+ param_names = []
119
+ for s in param_shapes:
120
+ for name in s.keys():
121
+ param_names.append(name)
122
+
123
+ # update with frozen parameters
124
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
125
+ if frozen_param_shapes is not None:
126
+ if debug:
127
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
128
+ param_names += list(frozen_param_shapes.keys())
129
+
130
+ # handle shared params
131
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
132
+
133
+ ds_version = state_dict.get(DS_VERSION, None)
134
+
135
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
136
+
137
+ z_model_state = zero_model_state(buffers=buffers,
138
+ param_shapes=param_shapes,
139
+ shared_params=shared_params,
140
+ ds_version=ds_version,
141
+ frozen_param_shapes=frozen_param_shapes,
142
+ frozen_param_fragments=frozen_param_fragments)
143
+ zero_model_states.append(z_model_state)
144
+
145
+ return zero_model_states
146
+
147
+
148
+ def parse_optim_states(files, ds_checkpoint_dir):
149
+ total_files = len(files)
150
+ state_dicts = []
151
+ for f in tqdm(files, desc='Loading checkpoint shards'):
152
+ state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
153
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
154
+ # and also handle the case where it was already removed by another helper script
155
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
156
+ state_dicts.append(state_dict)
157
+
158
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
159
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
160
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
161
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
162
+
163
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
164
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
165
+ # use the max of the partition_count to get the dp world_size.
166
+
167
+ if type(world_size) is list:
168
+ world_size = max(world_size)
169
+
170
+ if world_size != total_files:
171
+ raise ValueError(
172
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
173
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
174
+ )
175
+
176
+ # the groups are named differently in each stage
177
+ if zero_stage <= 2:
178
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
179
+ elif zero_stage == 3:
180
+ fp32_groups_key = FP32_FLAT_GROUPS
181
+ else:
182
+ raise ValueError(f"unknown zero stage {zero_stage}")
183
+
184
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
185
+ return zero_stage, world_size, fp32_flat_groups
186
+
187
+
188
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
189
+ """
190
+ Returns fp32 state_dict reconstructed from ds checkpoint
191
+
192
+ Args:
193
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
194
+
195
+ """
196
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
197
+
198
+ optim_files = get_optim_files(ds_checkpoint_dir)
199
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
200
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
201
+
202
+ model_files = get_model_state_files(ds_checkpoint_dir)
203
+
204
+ zero_model_states = parse_model_states(model_files)
205
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
206
+
207
+ if zero_stage <= 2:
208
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
209
+ exclude_frozen_parameters)
210
+ elif zero_stage == 3:
211
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
212
+ exclude_frozen_parameters)
213
+
214
+
215
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
216
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
217
+ return
218
+
219
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
220
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
221
+
222
+ if debug:
223
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
224
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
225
+
226
+ wanted_params = len(frozen_param_shapes)
227
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
228
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
229
+ print(f'Frozen params: Have {avail_numel} numels to process.')
230
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
231
+
232
+ total_params = 0
233
+ total_numel = 0
234
+ for name, shape in frozen_param_shapes.items():
235
+ total_params += 1
236
+ unpartitioned_numel = shape.numel()
237
+ total_numel += unpartitioned_numel
238
+
239
+ state_dict[name] = frozen_param_fragments[name]
240
+
241
+ if debug:
242
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
243
+
244
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
245
+
246
+
247
+ def _has_callable(obj, fn):
248
+ attr = getattr(obj, fn, None)
249
+ return callable(attr)
250
+
251
+
252
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
253
+ param_shapes = zero_model_states[0].param_shapes
254
+
255
+ # Reconstruction protocol:
256
+ #
257
+ # XXX: document this
258
+
259
+ if debug:
260
+ for i in range(world_size):
261
+ for j in range(len(fp32_flat_groups[0])):
262
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
263
+
264
+ # XXX: memory usage doubles here (zero2)
265
+ num_param_groups = len(fp32_flat_groups[0])
266
+ merged_single_partition_of_fp32_groups = []
267
+ for i in range(num_param_groups):
268
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
269
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
270
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
271
+ avail_numel = sum(
272
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
273
+
274
+ if debug:
275
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
276
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
277
+ # not asserting if there is a mismatch due to possible padding
278
+ print(f"Have {avail_numel} numels to process.")
279
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
280
+
281
+ # params
282
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
283
+ # out-of-core computing solution
284
+ total_numel = 0
285
+ total_params = 0
286
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
287
+ offset = 0
288
+ avail_numel = full_single_fp32_vector.numel()
289
+ for name, shape in shapes.items():
290
+
291
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
292
+ total_numel += unpartitioned_numel
293
+ total_params += 1
294
+
295
+ if debug:
296
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
297
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
298
+ offset += unpartitioned_numel
299
+
300
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
301
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
302
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
303
+ # live optimizer object, so we are checking that the numbers are within the right range
304
+ align_to = 2 * world_size
305
+
306
+ def zero2_align(x):
307
+ return align_to * math.ceil(x / align_to)
308
+
309
+ if debug:
310
+ print(f"original offset={offset}, avail_numel={avail_numel}")
311
+
312
+ offset = zero2_align(offset)
313
+ avail_numel = zero2_align(avail_numel)
314
+
315
+ if debug:
316
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
317
+
318
+ # Sanity check
319
+ if offset != avail_numel:
320
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
321
+
322
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
323
+
324
+
325
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
326
+ exclude_frozen_parameters):
327
+ state_dict = OrderedDict()
328
+
329
+ # buffers
330
+ buffers = zero_model_states[0].buffers
331
+ state_dict.update(buffers)
332
+ if debug:
333
+ print(f"added {len(buffers)} buffers")
334
+
335
+ if not exclude_frozen_parameters:
336
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
337
+
338
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
339
+
340
+ # recover shared parameters
341
+ for pair in zero_model_states[0].shared_params:
342
+ if pair[1] in state_dict:
343
+ state_dict[pair[0]] = state_dict[pair[1]]
344
+
345
+ return state_dict
346
+
347
+
348
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
349
+ remainder = unpartitioned_numel % world_size
350
+ padding_numel = (world_size - remainder) if remainder else 0
351
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
352
+ return partitioned_numel, padding_numel
353
+
354
+
355
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
356
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
357
+ return
358
+
359
+ if debug:
360
+ for i in range(world_size):
361
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
362
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
363
+
364
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
365
+ wanted_params = len(frozen_param_shapes)
366
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
367
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
368
+ print(f'Frozen params: Have {avail_numel} numels to process.')
369
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
370
+
371
+ total_params = 0
372
+ total_numel = 0
373
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
374
+ total_params += 1
375
+ unpartitioned_numel = shape.numel()
376
+ total_numel += unpartitioned_numel
377
+
378
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
379
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
380
+
381
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
382
+
383
+ if debug:
384
+ print(
385
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
386
+ )
387
+
388
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
389
+
390
+
391
+ class GatheredTensor:
392
+ """
393
+ A pseudo tensor that collects partitioned weights.
394
+ It is more memory efficient when there are multiple groups.
395
+ """
396
+
397
+ def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
398
+ self.flat_groups = flat_groups
399
+ self.flat_groups_offset = flat_groups_offset
400
+ self.offset = offset
401
+ self.partitioned_numel = partitioned_numel
402
+ self.shape = shape
403
+ self.dtype = self.flat_groups[0][0].dtype
404
+
405
+ def contiguous(self):
406
+ """
407
+ Merge partitioned weights from flat_groups into a single tensor.
408
+ """
409
+ end_idx = self.offset + self.partitioned_numel
410
+ world_size = len(self.flat_groups)
411
+ pad_flat_param_chunks = []
412
+
413
+ for rank_i in range(world_size):
414
+ # for each rank, we need to collect weights from related group/groups
415
+ flat_groups_at_rank_i = self.flat_groups[rank_i]
416
+ start_group_id = None
417
+ end_group_id = None
418
+ for group_id in range(len(self.flat_groups_offset)):
419
+ if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
420
+ start_group_id = group_id
421
+ if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
422
+ end_group_id = group_id
423
+ break
424
+ # collect weights from related group/groups
425
+ for group_id in range(start_group_id, end_group_id + 1):
426
+ flat_tensor = flat_groups_at_rank_i[group_id]
427
+ start_offset = self.offset - self.flat_groups_offset[group_id]
428
+ end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
429
+ pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
430
+
431
+ # collect weights from all ranks
432
+ pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
433
+ param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
434
+ return param
435
+
436
+
437
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
438
+ param_shapes = zero_model_states[0].param_shapes
439
+ avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
440
+
441
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
442
+ # param, re-consolidating each param, while dealing with padding if any
443
+
444
+ # merge list of dicts, preserving order
445
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
446
+
447
+ if debug:
448
+ for i in range(world_size):
449
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
450
+
451
+ wanted_params = len(param_shapes)
452
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
453
+ # not asserting if there is a mismatch due to possible padding
454
+ avail_numel = fp32_flat_groups[0].numel() * world_size
455
+ print(f"Trainable params: Have {avail_numel} numels to process.")
456
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
457
+
458
+ # params
459
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
460
+ # out-of-core computing solution
461
+ offset = 0
462
+ total_numel = 0
463
+ total_params = 0
464
+ flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
465
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
466
+ unpartitioned_numel = shape.numel()
467
+ total_numel += unpartitioned_numel
468
+ total_params += 1
469
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
470
+
471
+ if debug:
472
+ print(
473
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
474
+ )
475
+
476
+ # memory efficient tensor
477
+ tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
478
+ state_dict[name] = tensor
479
+ offset += partitioned_numel
480
+
481
+ offset *= world_size
482
+
483
+ # Sanity check
484
+ if offset != avail_numel:
485
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
486
+
487
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
488
+
489
+
490
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
491
+ exclude_frozen_parameters):
492
+ state_dict = OrderedDict()
493
+
494
+ # buffers
495
+ buffers = zero_model_states[0].buffers
496
+ state_dict.update(buffers)
497
+ if debug:
498
+ print(f"added {len(buffers)} buffers")
499
+
500
+ if not exclude_frozen_parameters:
501
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
502
+
503
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
504
+
505
+ # recover shared parameters
506
+ for pair in zero_model_states[0].shared_params:
507
+ if pair[1] in state_dict:
508
+ state_dict[pair[0]] = state_dict[pair[1]]
509
+
510
+ return state_dict
511
+
512
+
513
+ def to_torch_tensor(state_dict, return_empty_tensor=False):
514
+ """
515
+ Convert state_dict of GatheredTensor to torch tensor
516
+ """
517
+ torch_state_dict = {}
518
+ converted_tensors = {}
519
+ for name, tensor in state_dict.items():
520
+ tensor_id = id(tensor)
521
+ if tensor_id in converted_tensors: # shared tensors
522
+ shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
523
+ torch_state_dict[name] = shared_tensor
524
+ else:
525
+ converted_tensors[tensor_id] = name
526
+ if return_empty_tensor:
527
+ torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
528
+ else:
529
+ torch_state_dict[name] = tensor.contiguous()
530
+ return torch_state_dict
531
+
532
+
533
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
534
+ tag=None,
535
+ exclude_frozen_parameters=False,
536
+ lazy_mode=False):
537
+ """
538
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
539
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
540
+ via a model hub.
541
+
542
+ Args:
543
+ - ``checkpoint_dir``: path to the desired checkpoint folder
544
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
545
+ - ``exclude_frozen_parameters``: exclude frozen parameters
546
+ - ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
547
+ Convert the pesduo tensor to torch tensor by ``.contiguous()``
548
+
549
+ Returns:
550
+ - pytorch ``state_dict``
551
+
552
+ A typical usage might be ::
553
+
554
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
555
+ # do the training and checkpoint saving
556
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
557
+ model = model.cpu() # move to cpu
558
+ model.load_state_dict(state_dict)
559
+ # submit to model hub or save the model to share with others
560
+
561
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
562
+ application. i.e. you will need to re-initialize the deepspeed engine, since
563
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
564
+
565
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
566
+
567
+ Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
568
+ You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
569
+ the checkpoint. Or you can load state_dict in lazy mode ::
570
+
571
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
572
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
573
+ for name, lazy_tensor in state_dict.item():
574
+ tensor = lazy_tensor.contiguous() # to cpu
575
+ print(name, tensor)
576
+ # del tensor to release memory if it no longer in use
577
+ """
578
+ if tag is None:
579
+ latest_path = os.path.join(checkpoint_dir, 'latest')
580
+ if os.path.isfile(latest_path):
581
+ with open(latest_path, 'r') as fd:
582
+ tag = fd.read().strip()
583
+ else:
584
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
585
+
586
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
587
+
588
+ if not os.path.isdir(ds_checkpoint_dir):
589
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
590
+
591
+ state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
592
+ if lazy_mode:
593
+ return state_dict
594
+ else:
595
+ return to_torch_tensor(state_dict)
596
+
597
+
598
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
599
+ output_dir,
600
+ max_shard_size="5GB",
601
+ safe_serialization=False,
602
+ tag=None,
603
+ exclude_frozen_parameters=False):
604
+ """
605
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
606
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
607
+
608
+ Args:
609
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
610
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
611
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
612
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
613
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
614
+ - ``exclude_frozen_parameters``: exclude frozen parameters
615
+ """
616
+
617
+ # Dependency pre-check
618
+ if safe_serialization:
619
+ try:
620
+ from safetensors.torch import save_file
621
+ except ImportError:
622
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
623
+ raise
624
+ if max_shard_size is not None:
625
+ try:
626
+ from huggingface_hub import split_torch_state_dict_into_shards
627
+ except ImportError:
628
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
629
+ raise
630
+
631
+ # Convert zero checkpoint to state_dict
632
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
633
+ tag,
634
+ exclude_frozen_parameters,
635
+ lazy_mode=True)
636
+
637
+ # Shard the model if it is too big.
638
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
639
+ if max_shard_size is not None:
640
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
641
+ # an memory-efficient approach for sharding
642
+ empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
643
+ state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
644
+ filename_pattern=filename_pattern,
645
+ max_shard_size=max_shard_size)
646
+ else:
647
+ from collections import namedtuple
648
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
649
+ state_dict_split = StateDictSplit(is_sharded=False,
650
+ filename_to_tensors={weights_name: list(state_dict.keys())})
651
+
652
+ # Save the model by shard
653
+ os.makedirs(output_dir, exist_ok=True)
654
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
655
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
656
+ shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
657
+ shard_state_dict = to_torch_tensor(shard_state_dict)
658
+ output_path = os.path.join(output_dir, shard_file)
659
+ if safe_serialization:
660
+ save_file(shard_state_dict, output_path, metadata={"format": "pt"})
661
+ else:
662
+ torch.save(shard_state_dict, output_path)
663
+ # release the memory of current shard
664
+ for tensor_name in list(shard_state_dict.keys()):
665
+ del state_dict[tensor_name]
666
+ del shard_state_dict[tensor_name]
667
+ del shard_state_dict
668
+ gc.collect()
669
+
670
+ # Save index if sharded
671
+ if state_dict_split.is_sharded:
672
+ index = {
673
+ "metadata": state_dict_split.metadata,
674
+ "weight_map": state_dict_split.tensor_to_filename,
675
+ }
676
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
677
+ save_index_file = os.path.join(output_dir, save_index_file)
678
+ with open(save_index_file, "w", encoding="utf-8") as f:
679
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
680
+ f.write(content)
681
+
682
+
683
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
684
+ """
685
+ 1. Put the provided model to cpu
686
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
687
+ 3. Load it into the provided model
688
+
689
+ Args:
690
+ - ``model``: the model object to update
691
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
692
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
693
+
694
+ Returns:
695
+ - ``model`: modified model
696
+
697
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
698
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
699
+ conveniently placed for you in the checkpoint folder.
700
+
701
+ A typical usage might be ::
702
+
703
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
704
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
705
+ # submit to model hub or save the model to share with others
706
+
707
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
708
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
709
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
710
+
711
+ """
712
+ logger.info(f"Extracting fp32 weights")
713
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
714
+
715
+ logger.info(f"Overwriting model with fp32 weights")
716
+ model = model.cpu()
717
+ model.load_state_dict(state_dict, strict=False)
718
+
719
+ return model
720
+
721
+
722
+ if __name__ == "__main__":
723
+ parser = argparse.ArgumentParser()
724
+ parser.add_argument("checkpoint_dir",
725
+ type=str,
726
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
727
+ parser.add_argument("output_dir",
728
+ type=str,
729
+ help="directory to the pytorch fp32 state_dict output files"
730
+ "(e.g. path/checkpoint-12-output/)")
731
+ parser.add_argument(
732
+ "--max_shard_size",
733
+ type=str,
734
+ default="5GB",
735
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
736
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
737
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
738
+ "without CPU OOM issues.")
739
+ parser.add_argument(
740
+ "--safe_serialization",
741
+ default=False,
742
+ action='store_true',
743
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
744
+ parser.add_argument("-t",
745
+ "--tag",
746
+ type=str,
747
+ default=None,
748
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
749
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
750
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
751
+ args = parser.parse_args()
752
+
753
+ debug = args.debug
754
+
755
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
756
+ args.output_dir,
757
+ max_shard_size=args.max_shard_size,
758
+ safe_serialization=args.safe_serialization,
759
+ tag=args.tag,
760
+ exclude_frozen_parameters=args.exclude_frozen_parameters)