dreamerdeo
commited on
Commit
•
399b48d
1
Parent(s):
e56f33a
inwit
Browse files- config.json +30 -0
- latest +1 -0
- pytorch_model.bin +3 -0
- rng_state_0.pth +3 -0
- rng_state_1.pth +3 -0
- rng_state_2.pth +3 -0
- rng_state_3.pth +3 -0
- special_tokens_map.json +1 -0
- tokenizer.json +0 -0
- tokenizer_config.json +1 -0
- trainer_state.json +944 -0
- training_args.bin +3 -0
- zero_to_fp32.py +348 -0
config.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "google/t5-xl-lm-adapt",
|
3 |
+
"architectures": [
|
4 |
+
"T5ForConditionalGeneration"
|
5 |
+
],
|
6 |
+
"d_ff": 5120,
|
7 |
+
"d_kv": 64,
|
8 |
+
"d_model": 2048,
|
9 |
+
"decoder_start_token_id": 0,
|
10 |
+
"dropout_rate": 0.1,
|
11 |
+
"eos_token_id": 1,
|
12 |
+
"feed_forward_proj": "gated-gelu",
|
13 |
+
"gradient_checkpointing": true,
|
14 |
+
"initializer_factor": 1.0,
|
15 |
+
"is_encoder_decoder": true,
|
16 |
+
"layer_norm_epsilon": 1e-06,
|
17 |
+
"max_length": 512,
|
18 |
+
"model_type": "t5",
|
19 |
+
"num_decoder_layers": 24,
|
20 |
+
"num_heads": 32,
|
21 |
+
"num_layers": 24,
|
22 |
+
"output_past": true,
|
23 |
+
"pad_token_id": 0,
|
24 |
+
"relative_attention_num_buckets": 32,
|
25 |
+
"tie_word_embeddings": false,
|
26 |
+
"torch_dtype": "float16",
|
27 |
+
"transformers_version": "4.9.1",
|
28 |
+
"use_cache": false,
|
29 |
+
"vocab_size": 32128
|
30 |
+
}
|
latest
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
global_step1335
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9bdbd622b49608641ce70036489106a835e03342686028c1686c5987fa1e00f9
|
3 |
+
size 5699709115
|
rng_state_0.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:879b3d44968be70784fb13d5e18ff98a9044e7d9d20da97ee1347d0ca11d4376
|
3 |
+
size 14654
|
rng_state_1.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ceadd58a1b326b4481eac4a5ea8dcc47f3859a8196c57df16720076976b2a9e7
|
3 |
+
size 14654
|
rng_state_2.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:22412da0ce046caaade62bf68fa7a4bee9643a441b80dc0009133b3997dcc1bd
|
3 |
+
size 14654
|
rng_state_3.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:54f6cf989efd1cb00d28079e567953eea428deda220c8b710a0a654777b56834
|
3 |
+
size 14654
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"eos_token": "</s>", "unk_token": "<unk>", "pad_token": "<pad>", "additional_special_tokens": ["<extra_id_0>", "<extra_id_1>", "<extra_id_2>", "<extra_id_3>", "<extra_id_4>", "<extra_id_5>", "<extra_id_6>", "<extra_id_7>", "<extra_id_8>", "<extra_id_9>", "<extra_id_10>", "<extra_id_11>", "<extra_id_12>", "<extra_id_13>", "<extra_id_14>", "<extra_id_15>", "<extra_id_16>", "<extra_id_17>", "<extra_id_18>", "<extra_id_19>", "<extra_id_20>", "<extra_id_21>", "<extra_id_22>", "<extra_id_23>", "<extra_id_24>", "<extra_id_25>", "<extra_id_26>", "<extra_id_27>", "<extra_id_28>", "<extra_id_29>", "<extra_id_30>", "<extra_id_31>", "<extra_id_32>", "<extra_id_33>", "<extra_id_34>", "<extra_id_35>", "<extra_id_36>", "<extra_id_37>", "<extra_id_38>", "<extra_id_39>", "<extra_id_40>", "<extra_id_41>", "<extra_id_42>", "<extra_id_43>", "<extra_id_44>", "<extra_id_45>", "<extra_id_46>", "<extra_id_47>", "<extra_id_48>", "<extra_id_49>", "<extra_id_50>", "<extra_id_51>", "<extra_id_52>", "<extra_id_53>", "<extra_id_54>", "<extra_id_55>", "<extra_id_56>", "<extra_id_57>", "<extra_id_58>", "<extra_id_59>", "<extra_id_60>", "<extra_id_61>", "<extra_id_62>", "<extra_id_63>", "<extra_id_64>", "<extra_id_65>", "<extra_id_66>", "<extra_id_67>", "<extra_id_68>", "<extra_id_69>", "<extra_id_70>", "<extra_id_71>", "<extra_id_72>", "<extra_id_73>", "<extra_id_74>", "<extra_id_75>", "<extra_id_76>", "<extra_id_77>", "<extra_id_78>", "<extra_id_79>", "<extra_id_80>", "<extra_id_81>", "<extra_id_82>", "<extra_id_83>", "<extra_id_84>", "<extra_id_85>", "<extra_id_86>", "<extra_id_87>", "<extra_id_88>", "<extra_id_89>", "<extra_id_90>", "<extra_id_91>", "<extra_id_92>", "<extra_id_93>", "<extra_id_94>", "<extra_id_95>", "<extra_id_96>", "<extra_id_97>", "<extra_id_98>", "<extra_id_99>"]}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"eos_token": "</s>", "unk_token": "<unk>", "pad_token": "<pad>", "extra_ids": 100, "additional_special_tokens": ["<extra_id_0>", "<extra_id_1>", "<extra_id_2>", "<extra_id_3>", "<extra_id_4>", "<extra_id_5>", "<extra_id_6>", "<extra_id_7>", "<extra_id_8>", "<extra_id_9>", "<extra_id_10>", "<extra_id_11>", "<extra_id_12>", "<extra_id_13>", "<extra_id_14>", "<extra_id_15>", "<extra_id_16>", "<extra_id_17>", "<extra_id_18>", "<extra_id_19>", "<extra_id_20>", "<extra_id_21>", "<extra_id_22>", "<extra_id_23>", "<extra_id_24>", "<extra_id_25>", "<extra_id_26>", "<extra_id_27>", "<extra_id_28>", "<extra_id_29>", "<extra_id_30>", "<extra_id_31>", "<extra_id_32>", "<extra_id_33>", "<extra_id_34>", "<extra_id_35>", "<extra_id_36>", "<extra_id_37>", "<extra_id_38>", "<extra_id_39>", "<extra_id_40>", "<extra_id_41>", "<extra_id_42>", "<extra_id_43>", "<extra_id_44>", "<extra_id_45>", "<extra_id_46>", "<extra_id_47>", "<extra_id_48>", "<extra_id_49>", "<extra_id_50>", "<extra_id_51>", "<extra_id_52>", "<extra_id_53>", "<extra_id_54>", "<extra_id_55>", "<extra_id_56>", "<extra_id_57>", "<extra_id_58>", "<extra_id_59>", "<extra_id_60>", "<extra_id_61>", "<extra_id_62>", "<extra_id_63>", "<extra_id_64>", "<extra_id_65>", "<extra_id_66>", "<extra_id_67>", "<extra_id_68>", "<extra_id_69>", "<extra_id_70>", "<extra_id_71>", "<extra_id_72>", "<extra_id_73>", "<extra_id_74>", "<extra_id_75>", "<extra_id_76>", "<extra_id_77>", "<extra_id_78>", "<extra_id_79>", "<extra_id_80>", "<extra_id_81>", "<extra_id_82>", "<extra_id_83>", "<extra_id_84>", "<extra_id_85>", "<extra_id_86>", "<extra_id_87>", "<extra_id_88>", "<extra_id_89>", "<extra_id_90>", "<extra_id_91>", "<extra_id_92>", "<extra_id_93>", "<extra_id_94>", "<extra_id_95>", "<extra_id_96>", "<extra_id_97>", "<extra_id_98>", "<extra_id_99>"], "sp_model_kwargs": {}, "model_max_length": 512, "name_or_path": "google/t5-xl-lm-adapt", "special_tokens_map_file": "/home/patrick/.cache/huggingface/transformers/e88f2448cc299b3d5844700ccb67f86e37caa0873ebab334ad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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"best_metric": null,
|
3 |
+
"best_model_checkpoint": null,
|
4 |
+
"epoch": 106.63897763578275,
|
5 |
+
"global_step": 1280,
|
6 |
+
"is_hyper_param_search": false,
|
7 |
+
"is_local_process_zero": true,
|
8 |
+
"is_world_process_zero": true,
|
9 |
+
"log_history": [
|
10 |
+
{
|
11 |
+
"epoch": 0.8,
|
12 |
+
"learning_rate": 9.99969999399988e-05,
|
13 |
+
"loss": 3.2772,
|
14 |
+
"step": 10
|
15 |
+
},
|
16 |
+
{
|
17 |
+
"epoch": 1.64,
|
18 |
+
"learning_rate": 9.99869997399948e-05,
|
19 |
+
"loss": 0.587,
|
20 |
+
"step": 20
|
21 |
+
},
|
22 |
+
{
|
23 |
+
"epoch": 2.48,
|
24 |
+
"learning_rate": 9.99759995199904e-05,
|
25 |
+
"loss": 0.2432,
|
26 |
+
"step": 30
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"epoch": 3.32,
|
30 |
+
"learning_rate": 9.99659993199864e-05,
|
31 |
+
"loss": 0.1511,
|
32 |
+
"step": 40
|
33 |
+
},
|
34 |
+
{
|
35 |
+
"epoch": 4.16,
|
36 |
+
"learning_rate": 9.9954999099982e-05,
|
37 |
+
"loss": 0.1104,
|
38 |
+
"step": 50
|
39 |
+
},
|
40 |
+
{
|
41 |
+
"epoch": 4.96,
|
42 |
+
"learning_rate": 9.994499889997801e-05,
|
43 |
+
"loss": 0.0839,
|
44 |
+
"step": 60
|
45 |
+
},
|
46 |
+
{
|
47 |
+
"epoch": 5.32,
|
48 |
+
"eval_loss": 0.116455078125,
|
49 |
+
"eval_runtime": 85.2162,
|
50 |
+
"eval_samples_per_second": 38.044,
|
51 |
+
"eval_steps_per_second": 0.481,
|
52 |
+
"step": 64
|
53 |
+
},
|
54 |
+
{
|
55 |
+
"epoch": 5.8,
|
56 |
+
"learning_rate": 9.9934998699974e-05,
|
57 |
+
"loss": 0.0716,
|
58 |
+
"step": 70
|
59 |
+
},
|
60 |
+
{
|
61 |
+
"epoch": 6.64,
|
62 |
+
"learning_rate": 9.99239984799696e-05,
|
63 |
+
"loss": 0.0665,
|
64 |
+
"step": 80
|
65 |
+
},
|
66 |
+
{
|
67 |
+
"epoch": 7.48,
|
68 |
+
"learning_rate": 9.99139982799656e-05,
|
69 |
+
"loss": 0.057,
|
70 |
+
"step": 90
|
71 |
+
},
|
72 |
+
{
|
73 |
+
"epoch": 8.32,
|
74 |
+
"learning_rate": 9.990299805996121e-05,
|
75 |
+
"loss": 0.0521,
|
76 |
+
"step": 100
|
77 |
+
},
|
78 |
+
{
|
79 |
+
"epoch": 9.16,
|
80 |
+
"learning_rate": 9.98929978599572e-05,
|
81 |
+
"loss": 0.0466,
|
82 |
+
"step": 110
|
83 |
+
},
|
84 |
+
{
|
85 |
+
"epoch": 9.96,
|
86 |
+
"learning_rate": 9.98829976599532e-05,
|
87 |
+
"loss": 0.0417,
|
88 |
+
"step": 120
|
89 |
+
},
|
90 |
+
{
|
91 |
+
"epoch": 10.64,
|
92 |
+
"eval_loss": 0.12420654296875,
|
93 |
+
"eval_runtime": 85.7837,
|
94 |
+
"eval_samples_per_second": 37.793,
|
95 |
+
"eval_steps_per_second": 0.478,
|
96 |
+
"step": 128
|
97 |
+
},
|
98 |
+
{
|
99 |
+
"epoch": 10.8,
|
100 |
+
"learning_rate": 9.987199743994881e-05,
|
101 |
+
"loss": 0.0388,
|
102 |
+
"step": 130
|
103 |
+
},
|
104 |
+
{
|
105 |
+
"epoch": 11.64,
|
106 |
+
"learning_rate": 9.986199723994481e-05,
|
107 |
+
"loss": 0.0371,
|
108 |
+
"step": 140
|
109 |
+
},
|
110 |
+
{
|
111 |
+
"epoch": 12.48,
|
112 |
+
"learning_rate": 9.98509970199404e-05,
|
113 |
+
"loss": 0.0342,
|
114 |
+
"step": 150
|
115 |
+
},
|
116 |
+
{
|
117 |
+
"epoch": 13.32,
|
118 |
+
"learning_rate": 9.98409968199364e-05,
|
119 |
+
"loss": 0.0303,
|
120 |
+
"step": 160
|
121 |
+
},
|
122 |
+
{
|
123 |
+
"epoch": 14.16,
|
124 |
+
"learning_rate": 9.982999659993201e-05,
|
125 |
+
"loss": 0.0287,
|
126 |
+
"step": 170
|
127 |
+
},
|
128 |
+
{
|
129 |
+
"epoch": 14.96,
|
130 |
+
"learning_rate": 9.981999639992801e-05,
|
131 |
+
"loss": 0.0262,
|
132 |
+
"step": 180
|
133 |
+
},
|
134 |
+
{
|
135 |
+
"epoch": 15.8,
|
136 |
+
"learning_rate": 9.9809996199924e-05,
|
137 |
+
"loss": 0.0242,
|
138 |
+
"step": 190
|
139 |
+
},
|
140 |
+
{
|
141 |
+
"epoch": 15.96,
|
142 |
+
"eval_loss": 0.13671875,
|
143 |
+
"eval_runtime": 71.3468,
|
144 |
+
"eval_samples_per_second": 45.44,
|
145 |
+
"eval_steps_per_second": 0.575,
|
146 |
+
"step": 192
|
147 |
+
},
|
148 |
+
{
|
149 |
+
"epoch": 16.64,
|
150 |
+
"learning_rate": 9.979899597991961e-05,
|
151 |
+
"loss": 0.0239,
|
152 |
+
"step": 200
|
153 |
+
},
|
154 |
+
{
|
155 |
+
"epoch": 17.48,
|
156 |
+
"learning_rate": 9.978899577991561e-05,
|
157 |
+
"loss": 0.0216,
|
158 |
+
"step": 210
|
159 |
+
},
|
160 |
+
{
|
161 |
+
"epoch": 18.32,
|
162 |
+
"learning_rate": 9.97779955599112e-05,
|
163 |
+
"loss": 0.0204,
|
164 |
+
"step": 220
|
165 |
+
},
|
166 |
+
{
|
167 |
+
"epoch": 19.16,
|
168 |
+
"learning_rate": 9.97679953599072e-05,
|
169 |
+
"loss": 0.0194,
|
170 |
+
"step": 230
|
171 |
+
},
|
172 |
+
{
|
173 |
+
"epoch": 19.96,
|
174 |
+
"learning_rate": 9.97579951599032e-05,
|
175 |
+
"loss": 0.0167,
|
176 |
+
"step": 240
|
177 |
+
},
|
178 |
+
{
|
179 |
+
"epoch": 20.8,
|
180 |
+
"learning_rate": 9.974699493989881e-05,
|
181 |
+
"loss": 0.0177,
|
182 |
+
"step": 250
|
183 |
+
},
|
184 |
+
{
|
185 |
+
"epoch": 21.32,
|
186 |
+
"eval_loss": 0.15576171875,
|
187 |
+
"eval_runtime": 73.465,
|
188 |
+
"eval_samples_per_second": 44.13,
|
189 |
+
"eval_steps_per_second": 0.558,
|
190 |
+
"step": 256
|
191 |
+
},
|
192 |
+
{
|
193 |
+
"epoch": 21.64,
|
194 |
+
"learning_rate": 9.973699473989481e-05,
|
195 |
+
"loss": 0.0155,
|
196 |
+
"step": 260
|
197 |
+
},
|
198 |
+
{
|
199 |
+
"epoch": 22.48,
|
200 |
+
"learning_rate": 9.97259945198904e-05,
|
201 |
+
"loss": 0.015,
|
202 |
+
"step": 270
|
203 |
+
},
|
204 |
+
{
|
205 |
+
"epoch": 23.32,
|
206 |
+
"learning_rate": 9.971599431988641e-05,
|
207 |
+
"loss": 0.0148,
|
208 |
+
"step": 280
|
209 |
+
},
|
210 |
+
{
|
211 |
+
"epoch": 24.16,
|
212 |
+
"learning_rate": 9.9704994099882e-05,
|
213 |
+
"loss": 0.0137,
|
214 |
+
"step": 290
|
215 |
+
},
|
216 |
+
{
|
217 |
+
"epoch": 24.96,
|
218 |
+
"learning_rate": 9.969499389987799e-05,
|
219 |
+
"loss": 0.0117,
|
220 |
+
"step": 300
|
221 |
+
},
|
222 |
+
{
|
223 |
+
"epoch": 25.8,
|
224 |
+
"learning_rate": 9.96839936798736e-05,
|
225 |
+
"loss": 0.0118,
|
226 |
+
"step": 310
|
227 |
+
},
|
228 |
+
{
|
229 |
+
"epoch": 26.64,
|
230 |
+
"learning_rate": 9.96739934798696e-05,
|
231 |
+
"loss": 0.0111,
|
232 |
+
"step": 320
|
233 |
+
},
|
234 |
+
{
|
235 |
+
"epoch": 26.64,
|
236 |
+
"eval_loss": 0.1729736328125,
|
237 |
+
"eval_runtime": 73.6,
|
238 |
+
"eval_samples_per_second": 44.049,
|
239 |
+
"eval_steps_per_second": 0.557,
|
240 |
+
"step": 320
|
241 |
+
},
|
242 |
+
{
|
243 |
+
"epoch": 27.48,
|
244 |
+
"learning_rate": 9.96629932598652e-05,
|
245 |
+
"loss": 0.0109,
|
246 |
+
"step": 330
|
247 |
+
},
|
248 |
+
{
|
249 |
+
"epoch": 28.32,
|
250 |
+
"learning_rate": 9.96529930598612e-05,
|
251 |
+
"loss": 0.0102,
|
252 |
+
"step": 340
|
253 |
+
},
|
254 |
+
{
|
255 |
+
"epoch": 29.16,
|
256 |
+
"learning_rate": 9.96419928398568e-05,
|
257 |
+
"loss": 0.0094,
|
258 |
+
"step": 350
|
259 |
+
},
|
260 |
+
{
|
261 |
+
"epoch": 29.96,
|
262 |
+
"learning_rate": 9.96319926398528e-05,
|
263 |
+
"loss": 0.0088,
|
264 |
+
"step": 360
|
265 |
+
},
|
266 |
+
{
|
267 |
+
"epoch": 30.8,
|
268 |
+
"learning_rate": 9.96219924398488e-05,
|
269 |
+
"loss": 0.0084,
|
270 |
+
"step": 370
|
271 |
+
},
|
272 |
+
{
|
273 |
+
"epoch": 31.64,
|
274 |
+
"learning_rate": 9.96109922198444e-05,
|
275 |
+
"loss": 0.0082,
|
276 |
+
"step": 380
|
277 |
+
},
|
278 |
+
{
|
279 |
+
"epoch": 31.96,
|
280 |
+
"eval_loss": 0.1884765625,
|
281 |
+
"eval_runtime": 72.563,
|
282 |
+
"eval_samples_per_second": 44.678,
|
283 |
+
"eval_steps_per_second": 0.565,
|
284 |
+
"step": 384
|
285 |
+
},
|
286 |
+
{
|
287 |
+
"epoch": 32.48,
|
288 |
+
"learning_rate": 9.96009920198404e-05,
|
289 |
+
"loss": 0.0082,
|
290 |
+
"step": 390
|
291 |
+
},
|
292 |
+
{
|
293 |
+
"epoch": 33.32,
|
294 |
+
"learning_rate": 9.9589991799836e-05,
|
295 |
+
"loss": 0.0078,
|
296 |
+
"step": 400
|
297 |
+
},
|
298 |
+
{
|
299 |
+
"epoch": 34.16,
|
300 |
+
"learning_rate": 9.9579991599832e-05,
|
301 |
+
"loss": 0.0068,
|
302 |
+
"step": 410
|
303 |
+
},
|
304 |
+
{
|
305 |
+
"epoch": 34.96,
|
306 |
+
"learning_rate": 9.9569991399828e-05,
|
307 |
+
"loss": 0.0063,
|
308 |
+
"step": 420
|
309 |
+
},
|
310 |
+
{
|
311 |
+
"epoch": 35.8,
|
312 |
+
"learning_rate": 9.95589911798236e-05,
|
313 |
+
"loss": 0.0061,
|
314 |
+
"step": 430
|
315 |
+
},
|
316 |
+
{
|
317 |
+
"epoch": 36.64,
|
318 |
+
"learning_rate": 9.95489909798196e-05,
|
319 |
+
"loss": 0.0064,
|
320 |
+
"step": 440
|
321 |
+
},
|
322 |
+
{
|
323 |
+
"epoch": 37.32,
|
324 |
+
"eval_loss": 0.191162109375,
|
325 |
+
"eval_runtime": 72.3445,
|
326 |
+
"eval_samples_per_second": 44.813,
|
327 |
+
"eval_steps_per_second": 0.567,
|
328 |
+
"step": 448
|
329 |
+
},
|
330 |
+
{
|
331 |
+
"epoch": 37.48,
|
332 |
+
"learning_rate": 9.95379907598152e-05,
|
333 |
+
"loss": 0.0058,
|
334 |
+
"step": 450
|
335 |
+
},
|
336 |
+
{
|
337 |
+
"epoch": 38.32,
|
338 |
+
"learning_rate": 9.95279905598112e-05,
|
339 |
+
"loss": 0.0051,
|
340 |
+
"step": 460
|
341 |
+
},
|
342 |
+
{
|
343 |
+
"epoch": 39.16,
|
344 |
+
"learning_rate": 9.95169903398068e-05,
|
345 |
+
"loss": 0.0053,
|
346 |
+
"step": 470
|
347 |
+
},
|
348 |
+
{
|
349 |
+
"epoch": 39.96,
|
350 |
+
"learning_rate": 9.950699013980281e-05,
|
351 |
+
"loss": 0.0049,
|
352 |
+
"step": 480
|
353 |
+
},
|
354 |
+
{
|
355 |
+
"epoch": 40.8,
|
356 |
+
"learning_rate": 9.94969899397988e-05,
|
357 |
+
"loss": 0.0048,
|
358 |
+
"step": 490
|
359 |
+
},
|
360 |
+
{
|
361 |
+
"epoch": 41.64,
|
362 |
+
"learning_rate": 9.94859897197944e-05,
|
363 |
+
"loss": 0.0047,
|
364 |
+
"step": 500
|
365 |
+
},
|
366 |
+
{
|
367 |
+
"epoch": 42.48,
|
368 |
+
"learning_rate": 9.94759895197904e-05,
|
369 |
+
"loss": 0.0047,
|
370 |
+
"step": 510
|
371 |
+
},
|
372 |
+
{
|
373 |
+
"epoch": 42.64,
|
374 |
+
"eval_loss": 0.195556640625,
|
375 |
+
"eval_runtime": 71.2606,
|
376 |
+
"eval_samples_per_second": 45.495,
|
377 |
+
"eval_steps_per_second": 0.575,
|
378 |
+
"step": 512
|
379 |
+
},
|
380 |
+
{
|
381 |
+
"epoch": 43.32,
|
382 |
+
"learning_rate": 9.946498929978601e-05,
|
383 |
+
"loss": 0.0044,
|
384 |
+
"step": 520
|
385 |
+
},
|
386 |
+
{
|
387 |
+
"epoch": 44.16,
|
388 |
+
"learning_rate": 9.9454989099782e-05,
|
389 |
+
"loss": 0.0044,
|
390 |
+
"step": 530
|
391 |
+
},
|
392 |
+
{
|
393 |
+
"epoch": 44.96,
|
394 |
+
"learning_rate": 9.9444988899778e-05,
|
395 |
+
"loss": 0.0039,
|
396 |
+
"step": 540
|
397 |
+
},
|
398 |
+
{
|
399 |
+
"epoch": 45.8,
|
400 |
+
"learning_rate": 9.943398867977361e-05,
|
401 |
+
"loss": 0.0036,
|
402 |
+
"step": 550
|
403 |
+
},
|
404 |
+
{
|
405 |
+
"epoch": 46.64,
|
406 |
+
"learning_rate": 9.942398847976961e-05,
|
407 |
+
"loss": 0.0037,
|
408 |
+
"step": 560
|
409 |
+
},
|
410 |
+
{
|
411 |
+
"epoch": 47.48,
|
412 |
+
"learning_rate": 9.94129882597652e-05,
|
413 |
+
"loss": 0.0034,
|
414 |
+
"step": 570
|
415 |
+
},
|
416 |
+
{
|
417 |
+
"epoch": 47.96,
|
418 |
+
"eval_loss": 0.2215576171875,
|
419 |
+
"eval_runtime": 71.3132,
|
420 |
+
"eval_samples_per_second": 45.461,
|
421 |
+
"eval_steps_per_second": 0.575,
|
422 |
+
"step": 576
|
423 |
+
},
|
424 |
+
{
|
425 |
+
"epoch": 48.32,
|
426 |
+
"learning_rate": 9.94029880597612e-05,
|
427 |
+
"loss": 0.0032,
|
428 |
+
"step": 580
|
429 |
+
},
|
430 |
+
{
|
431 |
+
"epoch": 49.16,
|
432 |
+
"learning_rate": 9.93919878397568e-05,
|
433 |
+
"loss": 0.0035,
|
434 |
+
"step": 590
|
435 |
+
},
|
436 |
+
{
|
437 |
+
"epoch": 49.96,
|
438 |
+
"learning_rate": 9.938198763975281e-05,
|
439 |
+
"loss": 0.0032,
|
440 |
+
"step": 600
|
441 |
+
},
|
442 |
+
{
|
443 |
+
"epoch": 50.8,
|
444 |
+
"learning_rate": 9.93709874197484e-05,
|
445 |
+
"loss": 0.003,
|
446 |
+
"step": 610
|
447 |
+
},
|
448 |
+
{
|
449 |
+
"epoch": 51.64,
|
450 |
+
"learning_rate": 9.93609872197444e-05,
|
451 |
+
"loss": 0.0031,
|
452 |
+
"step": 620
|
453 |
+
},
|
454 |
+
{
|
455 |
+
"epoch": 52.48,
|
456 |
+
"learning_rate": 9.934998699974e-05,
|
457 |
+
"loss": 0.0029,
|
458 |
+
"step": 630
|
459 |
+
},
|
460 |
+
{
|
461 |
+
"epoch": 53.32,
|
462 |
+
"learning_rate": 9.933998679973599e-05,
|
463 |
+
"loss": 0.0029,
|
464 |
+
"step": 640
|
465 |
+
},
|
466 |
+
{
|
467 |
+
"epoch": 53.32,
|
468 |
+
"eval_loss": 0.221923828125,
|
469 |
+
"eval_runtime": 71.4852,
|
470 |
+
"eval_samples_per_second": 45.352,
|
471 |
+
"eval_steps_per_second": 0.574,
|
472 |
+
"step": 640
|
473 |
+
},
|
474 |
+
{
|
475 |
+
"epoch": 54.16,
|
476 |
+
"learning_rate": 9.93289865797316e-05,
|
477 |
+
"loss": 0.0028,
|
478 |
+
"step": 650
|
479 |
+
},
|
480 |
+
{
|
481 |
+
"epoch": 54.96,
|
482 |
+
"learning_rate": 9.93189863797276e-05,
|
483 |
+
"loss": 0.0027,
|
484 |
+
"step": 660
|
485 |
+
},
|
486 |
+
{
|
487 |
+
"epoch": 55.8,
|
488 |
+
"learning_rate": 9.93089861797236e-05,
|
489 |
+
"loss": 0.0026,
|
490 |
+
"step": 670
|
491 |
+
},
|
492 |
+
{
|
493 |
+
"epoch": 56.64,
|
494 |
+
"learning_rate": 9.929798595971919e-05,
|
495 |
+
"loss": 0.0022,
|
496 |
+
"step": 680
|
497 |
+
},
|
498 |
+
{
|
499 |
+
"epoch": 57.48,
|
500 |
+
"learning_rate": 9.92879857597152e-05,
|
501 |
+
"loss": 0.0022,
|
502 |
+
"step": 690
|
503 |
+
},
|
504 |
+
{
|
505 |
+
"epoch": 58.32,
|
506 |
+
"learning_rate": 9.92769855397108e-05,
|
507 |
+
"loss": 0.0022,
|
508 |
+
"step": 700
|
509 |
+
},
|
510 |
+
{
|
511 |
+
"epoch": 58.64,
|
512 |
+
"eval_loss": 0.2276611328125,
|
513 |
+
"eval_runtime": 71.4916,
|
514 |
+
"eval_samples_per_second": 45.348,
|
515 |
+
"eval_steps_per_second": 0.573,
|
516 |
+
"step": 704
|
517 |
+
},
|
518 |
+
{
|
519 |
+
"epoch": 59.16,
|
520 |
+
"learning_rate": 9.92669853397068e-05,
|
521 |
+
"loss": 0.0025,
|
522 |
+
"step": 710
|
523 |
+
},
|
524 |
+
{
|
525 |
+
"epoch": 59.96,
|
526 |
+
"learning_rate": 9.925698513970279e-05,
|
527 |
+
"loss": 0.0021,
|
528 |
+
"step": 720
|
529 |
+
},
|
530 |
+
{
|
531 |
+
"epoch": 60.8,
|
532 |
+
"learning_rate": 9.92459849196984e-05,
|
533 |
+
"loss": 0.0024,
|
534 |
+
"step": 730
|
535 |
+
},
|
536 |
+
{
|
537 |
+
"epoch": 61.64,
|
538 |
+
"learning_rate": 9.92359847196944e-05,
|
539 |
+
"loss": 0.0022,
|
540 |
+
"step": 740
|
541 |
+
},
|
542 |
+
{
|
543 |
+
"epoch": 62.48,
|
544 |
+
"learning_rate": 9.922498449968999e-05,
|
545 |
+
"loss": 0.0018,
|
546 |
+
"step": 750
|
547 |
+
},
|
548 |
+
{
|
549 |
+
"epoch": 63.32,
|
550 |
+
"learning_rate": 9.9214984299686e-05,
|
551 |
+
"loss": 0.0017,
|
552 |
+
"step": 760
|
553 |
+
},
|
554 |
+
{
|
555 |
+
"epoch": 63.96,
|
556 |
+
"eval_loss": 0.24072265625,
|
557 |
+
"eval_runtime": 72.0268,
|
558 |
+
"eval_samples_per_second": 45.011,
|
559 |
+
"eval_steps_per_second": 0.569,
|
560 |
+
"step": 768
|
561 |
+
},
|
562 |
+
{
|
563 |
+
"epoch": 64.16,
|
564 |
+
"learning_rate": 9.92039840796816e-05,
|
565 |
+
"loss": 0.0021,
|
566 |
+
"step": 770
|
567 |
+
},
|
568 |
+
{
|
569 |
+
"epoch": 64.96,
|
570 |
+
"learning_rate": 9.91939838796776e-05,
|
571 |
+
"loss": 0.0017,
|
572 |
+
"step": 780
|
573 |
+
},
|
574 |
+
{
|
575 |
+
"epoch": 65.8,
|
576 |
+
"learning_rate": 9.91839836796736e-05,
|
577 |
+
"loss": 0.0022,
|
578 |
+
"step": 790
|
579 |
+
},
|
580 |
+
{
|
581 |
+
"epoch": 66.64,
|
582 |
+
"learning_rate": 9.91729834596692e-05,
|
583 |
+
"loss": 0.0019,
|
584 |
+
"step": 800
|
585 |
+
},
|
586 |
+
{
|
587 |
+
"epoch": 67.48,
|
588 |
+
"learning_rate": 9.91629832596652e-05,
|
589 |
+
"loss": 0.0017,
|
590 |
+
"step": 810
|
591 |
+
},
|
592 |
+
{
|
593 |
+
"epoch": 68.32,
|
594 |
+
"learning_rate": 9.91519830396608e-05,
|
595 |
+
"loss": 0.0017,
|
596 |
+
"step": 820
|
597 |
+
},
|
598 |
+
{
|
599 |
+
"epoch": 69.16,
|
600 |
+
"learning_rate": 9.91419828396568e-05,
|
601 |
+
"loss": 0.0018,
|
602 |
+
"step": 830
|
603 |
+
},
|
604 |
+
{
|
605 |
+
"epoch": 69.32,
|
606 |
+
"eval_loss": 0.24853515625,
|
607 |
+
"eval_runtime": 73.1565,
|
608 |
+
"eval_samples_per_second": 44.316,
|
609 |
+
"eval_steps_per_second": 0.56,
|
610 |
+
"step": 832
|
611 |
+
},
|
612 |
+
{
|
613 |
+
"epoch": 69.96,
|
614 |
+
"learning_rate": 9.91319826396528e-05,
|
615 |
+
"loss": 0.0018,
|
616 |
+
"step": 840
|
617 |
+
},
|
618 |
+
{
|
619 |
+
"epoch": 70.8,
|
620 |
+
"learning_rate": 9.91209824196484e-05,
|
621 |
+
"loss": 0.0016,
|
622 |
+
"step": 850
|
623 |
+
},
|
624 |
+
{
|
625 |
+
"epoch": 71.64,
|
626 |
+
"learning_rate": 9.91109822196444e-05,
|
627 |
+
"loss": 0.0015,
|
628 |
+
"step": 860
|
629 |
+
},
|
630 |
+
{
|
631 |
+
"epoch": 72.48,
|
632 |
+
"learning_rate": 9.909998199964e-05,
|
633 |
+
"loss": 0.0016,
|
634 |
+
"step": 870
|
635 |
+
},
|
636 |
+
{
|
637 |
+
"epoch": 73.32,
|
638 |
+
"learning_rate": 9.9089981799636e-05,
|
639 |
+
"loss": 0.0016,
|
640 |
+
"step": 880
|
641 |
+
},
|
642 |
+
{
|
643 |
+
"epoch": 74.16,
|
644 |
+
"learning_rate": 9.90789815796316e-05,
|
645 |
+
"loss": 0.0015,
|
646 |
+
"step": 890
|
647 |
+
},
|
648 |
+
{
|
649 |
+
"epoch": 74.64,
|
650 |
+
"eval_loss": 0.23681640625,
|
651 |
+
"eval_runtime": 71.4778,
|
652 |
+
"eval_samples_per_second": 45.357,
|
653 |
+
"eval_steps_per_second": 0.574,
|
654 |
+
"step": 896
|
655 |
+
},
|
656 |
+
{
|
657 |
+
"epoch": 74.96,
|
658 |
+
"learning_rate": 9.90689813796276e-05,
|
659 |
+
"loss": 0.0016,
|
660 |
+
"step": 900
|
661 |
+
},
|
662 |
+
{
|
663 |
+
"epoch": 75.8,
|
664 |
+
"learning_rate": 9.905798115962319e-05,
|
665 |
+
"loss": 0.0016,
|
666 |
+
"step": 910
|
667 |
+
},
|
668 |
+
{
|
669 |
+
"epoch": 76.64,
|
670 |
+
"learning_rate": 9.90479809596192e-05,
|
671 |
+
"loss": 0.0016,
|
672 |
+
"step": 920
|
673 |
+
},
|
674 |
+
{
|
675 |
+
"epoch": 77.48,
|
676 |
+
"learning_rate": 9.90369807396148e-05,
|
677 |
+
"loss": 0.0014,
|
678 |
+
"step": 930
|
679 |
+
},
|
680 |
+
{
|
681 |
+
"epoch": 78.32,
|
682 |
+
"learning_rate": 9.90269805396108e-05,
|
683 |
+
"loss": 0.0011,
|
684 |
+
"step": 940
|
685 |
+
},
|
686 |
+
{
|
687 |
+
"epoch": 79.16,
|
688 |
+
"learning_rate": 9.901598031960639e-05,
|
689 |
+
"loss": 0.0015,
|
690 |
+
"step": 950
|
691 |
+
},
|
692 |
+
{
|
693 |
+
"epoch": 79.96,
|
694 |
+
"learning_rate": 9.900598011960239e-05,
|
695 |
+
"loss": 0.0012,
|
696 |
+
"step": 960
|
697 |
+
},
|
698 |
+
{
|
699 |
+
"epoch": 79.96,
|
700 |
+
"eval_loss": 0.254150390625,
|
701 |
+
"eval_runtime": 76.7721,
|
702 |
+
"eval_samples_per_second": 42.229,
|
703 |
+
"eval_steps_per_second": 0.534,
|
704 |
+
"step": 960
|
705 |
+
},
|
706 |
+
{
|
707 |
+
"epoch": 80.8,
|
708 |
+
"learning_rate": 9.89959799195984e-05,
|
709 |
+
"loss": 0.0013,
|
710 |
+
"step": 970
|
711 |
+
},
|
712 |
+
{
|
713 |
+
"epoch": 81.64,
|
714 |
+
"learning_rate": 9.898497969959399e-05,
|
715 |
+
"loss": 0.0014,
|
716 |
+
"step": 980
|
717 |
+
},
|
718 |
+
{
|
719 |
+
"epoch": 82.48,
|
720 |
+
"learning_rate": 9.897497949958999e-05,
|
721 |
+
"loss": 0.0015,
|
722 |
+
"step": 990
|
723 |
+
},
|
724 |
+
{
|
725 |
+
"epoch": 83.32,
|
726 |
+
"learning_rate": 9.89639792795856e-05,
|
727 |
+
"loss": 0.0013,
|
728 |
+
"step": 1000
|
729 |
+
},
|
730 |
+
{
|
731 |
+
"epoch": 84.16,
|
732 |
+
"learning_rate": 9.89539790795816e-05,
|
733 |
+
"loss": 0.0014,
|
734 |
+
"step": 1010
|
735 |
+
},
|
736 |
+
{
|
737 |
+
"epoch": 84.96,
|
738 |
+
"learning_rate": 9.894397887957759e-05,
|
739 |
+
"loss": 0.0012,
|
740 |
+
"step": 1020
|
741 |
+
},
|
742 |
+
{
|
743 |
+
"epoch": 85.32,
|
744 |
+
"eval_loss": 0.253662109375,
|
745 |
+
"eval_runtime": 76.0139,
|
746 |
+
"eval_samples_per_second": 42.65,
|
747 |
+
"eval_steps_per_second": 0.539,
|
748 |
+
"step": 1024
|
749 |
+
},
|
750 |
+
{
|
751 |
+
"epoch": 85.8,
|
752 |
+
"learning_rate": 9.893297865957319e-05,
|
753 |
+
"loss": 0.0014,
|
754 |
+
"step": 1030
|
755 |
+
},
|
756 |
+
{
|
757 |
+
"epoch": 86.64,
|
758 |
+
"learning_rate": 9.89229784595692e-05,
|
759 |
+
"loss": 0.0011,
|
760 |
+
"step": 1040
|
761 |
+
},
|
762 |
+
{
|
763 |
+
"epoch": 87.48,
|
764 |
+
"learning_rate": 9.89119782395648e-05,
|
765 |
+
"loss": 0.0012,
|
766 |
+
"step": 1050
|
767 |
+
},
|
768 |
+
{
|
769 |
+
"epoch": 88.32,
|
770 |
+
"learning_rate": 9.890197803956079e-05,
|
771 |
+
"loss": 0.0012,
|
772 |
+
"step": 1060
|
773 |
+
},
|
774 |
+
{
|
775 |
+
"epoch": 89.16,
|
776 |
+
"learning_rate": 9.88909778195564e-05,
|
777 |
+
"loss": 0.0013,
|
778 |
+
"step": 1070
|
779 |
+
},
|
780 |
+
{
|
781 |
+
"epoch": 89.96,
|
782 |
+
"learning_rate": 9.88809776195524e-05,
|
783 |
+
"loss": 0.0011,
|
784 |
+
"step": 1080
|
785 |
+
},
|
786 |
+
{
|
787 |
+
"epoch": 90.64,
|
788 |
+
"eval_loss": 0.268798828125,
|
789 |
+
"eval_runtime": 75.8685,
|
790 |
+
"eval_samples_per_second": 42.732,
|
791 |
+
"eval_steps_per_second": 0.54,
|
792 |
+
"step": 1088
|
793 |
+
},
|
794 |
+
{
|
795 |
+
"epoch": 90.8,
|
796 |
+
"learning_rate": 9.88709774195484e-05,
|
797 |
+
"loss": 0.0011,
|
798 |
+
"step": 1090
|
799 |
+
},
|
800 |
+
{
|
801 |
+
"epoch": 91.64,
|
802 |
+
"learning_rate": 9.885997719954399e-05,
|
803 |
+
"loss": 0.0013,
|
804 |
+
"step": 1100
|
805 |
+
},
|
806 |
+
{
|
807 |
+
"epoch": 92.48,
|
808 |
+
"learning_rate": 9.884997699954e-05,
|
809 |
+
"loss": 0.001,
|
810 |
+
"step": 1110
|
811 |
+
},
|
812 |
+
{
|
813 |
+
"epoch": 93.32,
|
814 |
+
"learning_rate": 9.88389767795356e-05,
|
815 |
+
"loss": 0.0011,
|
816 |
+
"step": 1120
|
817 |
+
},
|
818 |
+
{
|
819 |
+
"epoch": 94.16,
|
820 |
+
"learning_rate": 9.88289765795316e-05,
|
821 |
+
"loss": 0.0013,
|
822 |
+
"step": 1130
|
823 |
+
},
|
824 |
+
{
|
825 |
+
"epoch": 94.96,
|
826 |
+
"learning_rate": 9.881897637952759e-05,
|
827 |
+
"loss": 0.001,
|
828 |
+
"step": 1140
|
829 |
+
},
|
830 |
+
{
|
831 |
+
"epoch": 95.8,
|
832 |
+
"learning_rate": 9.88079761595232e-05,
|
833 |
+
"loss": 0.0016,
|
834 |
+
"step": 1150
|
835 |
+
},
|
836 |
+
{
|
837 |
+
"epoch": 95.96,
|
838 |
+
"eval_loss": 0.24560546875,
|
839 |
+
"eval_runtime": 75.5498,
|
840 |
+
"eval_samples_per_second": 42.912,
|
841 |
+
"eval_steps_per_second": 0.543,
|
842 |
+
"step": 1152
|
843 |
+
},
|
844 |
+
{
|
845 |
+
"epoch": 96.64,
|
846 |
+
"learning_rate": 9.87979759595192e-05,
|
847 |
+
"loss": 0.0011,
|
848 |
+
"step": 1160
|
849 |
+
},
|
850 |
+
{
|
851 |
+
"epoch": 97.48,
|
852 |
+
"learning_rate": 9.878697573951479e-05,
|
853 |
+
"loss": 0.0011,
|
854 |
+
"step": 1170
|
855 |
+
},
|
856 |
+
{
|
857 |
+
"epoch": 98.32,
|
858 |
+
"learning_rate": 9.87769755395108e-05,
|
859 |
+
"loss": 0.0013,
|
860 |
+
"step": 1180
|
861 |
+
},
|
862 |
+
{
|
863 |
+
"epoch": 99.16,
|
864 |
+
"learning_rate": 9.87659753195064e-05,
|
865 |
+
"loss": 0.0011,
|
866 |
+
"step": 1190
|
867 |
+
},
|
868 |
+
{
|
869 |
+
"epoch": 99.96,
|
870 |
+
"learning_rate": 9.87559751195024e-05,
|
871 |
+
"loss": 0.0011,
|
872 |
+
"step": 1200
|
873 |
+
},
|
874 |
+
{
|
875 |
+
"epoch": 100.8,
|
876 |
+
"learning_rate": 9.8744974899498e-05,
|
877 |
+
"loss": 0.0008,
|
878 |
+
"step": 1210
|
879 |
+
},
|
880 |
+
{
|
881 |
+
"epoch": 101.32,
|
882 |
+
"eval_loss": 0.278076171875,
|
883 |
+
"eval_runtime": 74.8396,
|
884 |
+
"eval_samples_per_second": 43.319,
|
885 |
+
"eval_steps_per_second": 0.548,
|
886 |
+
"step": 1216
|
887 |
+
},
|
888 |
+
{
|
889 |
+
"epoch": 101.64,
|
890 |
+
"learning_rate": 9.8734974699494e-05,
|
891 |
+
"loss": 0.001,
|
892 |
+
"step": 1220
|
893 |
+
},
|
894 |
+
{
|
895 |
+
"epoch": 102.48,
|
896 |
+
"learning_rate": 9.872397447948958e-05,
|
897 |
+
"loss": 0.0008,
|
898 |
+
"step": 1230
|
899 |
+
},
|
900 |
+
{
|
901 |
+
"epoch": 103.32,
|
902 |
+
"learning_rate": 9.87139742794856e-05,
|
903 |
+
"loss": 0.0009,
|
904 |
+
"step": 1240
|
905 |
+
},
|
906 |
+
{
|
907 |
+
"epoch": 104.16,
|
908 |
+
"learning_rate": 9.870297405948119e-05,
|
909 |
+
"loss": 0.0008,
|
910 |
+
"step": 1250
|
911 |
+
},
|
912 |
+
{
|
913 |
+
"epoch": 104.96,
|
914 |
+
"learning_rate": 9.869297385947719e-05,
|
915 |
+
"loss": 0.0008,
|
916 |
+
"step": 1260
|
917 |
+
},
|
918 |
+
{
|
919 |
+
"epoch": 105.8,
|
920 |
+
"learning_rate": 9.86829736594732e-05,
|
921 |
+
"loss": 0.0011,
|
922 |
+
"step": 1270
|
923 |
+
},
|
924 |
+
{
|
925 |
+
"epoch": 106.64,
|
926 |
+
"learning_rate": 9.86719734394688e-05,
|
927 |
+
"loss": 0.0009,
|
928 |
+
"step": 1280
|
929 |
+
},
|
930 |
+
{
|
931 |
+
"epoch": 106.64,
|
932 |
+
"eval_loss": 0.2666015625,
|
933 |
+
"eval_runtime": 75.7897,
|
934 |
+
"eval_samples_per_second": 42.776,
|
935 |
+
"eval_steps_per_second": 0.541,
|
936 |
+
"step": 1280
|
937 |
+
}
|
938 |
+
],
|
939 |
+
"max_steps": 100000,
|
940 |
+
"num_train_epochs": 8334,
|
941 |
+
"total_flos": 6810132464640.0,
|
942 |
+
"trial_name": null,
|
943 |
+
"trial_params": null
|
944 |
+
}
|
training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1063828ba2e9ddcd06c922117754b55edeba8f0e5dbe1457111b25089b27d900
|
3 |
+
size 4207
|
zero_to_fp32.py
ADDED
@@ -0,0 +1,348 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
|
3 |
+
# This script extracts fp32 consolidated weights from a zero 2 and 3 DeepSpeed checkpoints. It gets
|
4 |
+
# copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
|
5 |
+
# the future. Once extracted, the weights don't require DeepSpeed and can be used in any
|
6 |
+
# application.
|
7 |
+
#
|
8 |
+
# example: python zero_to_fp32.py . pytorch_model.bin
|
9 |
+
|
10 |
+
import argparse
|
11 |
+
import torch
|
12 |
+
import glob
|
13 |
+
import os
|
14 |
+
from collections import OrderedDict
|
15 |
+
|
16 |
+
# while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
|
17 |
+
# DeepSpeed data structures it has to be available in the current python environment.
|
18 |
+
import deepspeed
|
19 |
+
from deepspeed.utils import logger
|
20 |
+
|
21 |
+
debug = 0
|
22 |
+
|
23 |
+
# load to cpu
|
24 |
+
device = torch.device('cpu')
|
25 |
+
|
26 |
+
|
27 |
+
def get_model_state_file(checkpoint_dir, zero_stage):
|
28 |
+
if not os.path.isdir(checkpoint_dir):
|
29 |
+
raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
|
30 |
+
|
31 |
+
# there should be only one file
|
32 |
+
if zero_stage == 2:
|
33 |
+
file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
|
34 |
+
elif zero_stage == 3:
|
35 |
+
file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
|
36 |
+
|
37 |
+
if not os.path.exists(file):
|
38 |
+
raise FileNotFoundError(f"can't find model states file at '{file}'")
|
39 |
+
|
40 |
+
return file
|
41 |
+
|
42 |
+
|
43 |
+
def get_optim_files(checkpoint_dir):
|
44 |
+
# XXX: need to test that this simple glob rule works for multi-node setup too
|
45 |
+
optim_files = sorted(glob.glob(os.path.join(checkpoint_dir, "*_optim_states.pt")))
|
46 |
+
|
47 |
+
if len(optim_files) == 0:
|
48 |
+
raise FileNotFoundError(
|
49 |
+
f"can't find '*_optim_states.pt' files in directory '{checkpoint_dir}'")
|
50 |
+
|
51 |
+
return optim_files
|
52 |
+
|
53 |
+
|
54 |
+
def parse_model_state(file):
|
55 |
+
state_dict = torch.load(file, map_location=device)
|
56 |
+
|
57 |
+
if "buffer_names" not in state_dict:
|
58 |
+
raise ValueError(f"{file} is not a model state checkpoint")
|
59 |
+
buffer_names = state_dict["buffer_names"]
|
60 |
+
if debug:
|
61 |
+
print("Found buffers:", buffer_names)
|
62 |
+
|
63 |
+
# recover just the buffers while restoring them to fp32 if they were saved in fp16
|
64 |
+
buffers = {
|
65 |
+
k: v.float()
|
66 |
+
for k,
|
67 |
+
v in state_dict["module"].items() if k in buffer_names
|
68 |
+
}
|
69 |
+
return buffers
|
70 |
+
|
71 |
+
|
72 |
+
def parse_optim_states(files, ds_checkpoint_dir):
|
73 |
+
|
74 |
+
total_files = len(files)
|
75 |
+
state_dicts = []
|
76 |
+
for f in files:
|
77 |
+
state_dicts.append(torch.load(f, map_location=device))
|
78 |
+
|
79 |
+
if not "zero_stage" in state_dicts[0]['optimizer_state_dict']:
|
80 |
+
raise ValueError(f"{files[0]} is not a zero checkpoint")
|
81 |
+
zero_stage = state_dicts[0]['optimizer_state_dict']["zero_stage"]
|
82 |
+
world_size = state_dicts[0]['optimizer_state_dict']["partition_count"]
|
83 |
+
param_shapes = state_dicts[0]["param_shapes"]
|
84 |
+
|
85 |
+
if world_size != total_files:
|
86 |
+
raise ValueError(
|
87 |
+
f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
|
88 |
+
"Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
|
89 |
+
)
|
90 |
+
|
91 |
+
# the groups are named differently in each stage
|
92 |
+
if zero_stage == 2:
|
93 |
+
fp32_groups_key = "single_partition_of_fp32_groups"
|
94 |
+
elif zero_stage == 3:
|
95 |
+
fp32_groups_key = "fp32_flat_groups"
|
96 |
+
else:
|
97 |
+
raise ValueError(f"unknown zero stage {zero_stage}")
|
98 |
+
|
99 |
+
# if there is more than one param group, there will be multiple flattened tensors - one
|
100 |
+
# flattened tensor per group - for simplicity merge them into a single tensor
|
101 |
+
#
|
102 |
+
# XXX: could make the script more memory efficient for when there are multiple groups - it
|
103 |
+
# will require matching the sub-lists of param_shapes for each param group flattened tensor
|
104 |
+
fp32_flat_groups = [
|
105 |
+
torch.cat(state_dicts[i]['optimizer_state_dict'][fp32_groups_key],
|
106 |
+
0) for i in range(len(state_dicts))
|
107 |
+
]
|
108 |
+
|
109 |
+
return zero_stage, world_size, param_shapes, fp32_flat_groups
|
110 |
+
|
111 |
+
|
112 |
+
def zero3_partitioned_param_info(unpartitioned_numel, world_size):
|
113 |
+
remainder = unpartitioned_numel % world_size
|
114 |
+
padding_numel = (world_size - remainder) if remainder else 0
|
115 |
+
partitioned_numel = int(unpartitioned_numel / world_size)
|
116 |
+
return partitioned_numel, padding_numel
|
117 |
+
|
118 |
+
|
119 |
+
def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir):
|
120 |
+
"""
|
121 |
+
Returns fp32 state_dict reconstructed from ds checkpoint
|
122 |
+
|
123 |
+
Args:
|
124 |
+
- ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
|
125 |
+
|
126 |
+
"""
|
127 |
+
print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
|
128 |
+
|
129 |
+
optim_files = get_optim_files(ds_checkpoint_dir)
|
130 |
+
zero_stage, world_size, param_shapes, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
|
131 |
+
print(
|
132 |
+
f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
|
133 |
+
|
134 |
+
model_file = get_model_state_file(ds_checkpoint_dir, zero_stage)
|
135 |
+
buffers = parse_model_state(model_file)
|
136 |
+
|
137 |
+
# Reconstruction protocol:
|
138 |
+
#
|
139 |
+
# - for zero2 we just need to concat the partitions back to back and reconsolidate over one huge
|
140 |
+
# flat buffer - no need to deal with padding since if there is any it will be only in the tail
|
141 |
+
# of the last partition so there it will be just left out
|
142 |
+
#
|
143 |
+
# - for zero3 we need to zip the partitions together at boundary of each param, re-consolidating
|
144 |
+
# each param, while dealing with padding if any
|
145 |
+
|
146 |
+
if debug:
|
147 |
+
for i in range(world_size):
|
148 |
+
print(f"fp32_flat_groups[i].shape={fp32_flat_groups[i].shape}")
|
149 |
+
|
150 |
+
if zero_stage == 2:
|
151 |
+
# XXX: memory usage doubles here (zero2)
|
152 |
+
full_single_fp32_vector = torch.cat(fp32_flat_groups, 0)
|
153 |
+
avail_numel = full_single_fp32_vector.numel()
|
154 |
+
elif zero_stage == 3:
|
155 |
+
avail_numel = fp32_flat_groups[0].numel() * world_size
|
156 |
+
|
157 |
+
if debug:
|
158 |
+
wanted_params = len(param_shapes)
|
159 |
+
wanted_numel = sum(shape.numel() for shape in param_shapes.values())
|
160 |
+
# not asserting if there is a mismatch due to possible padding
|
161 |
+
print(f"Have {avail_numel} numels to process.")
|
162 |
+
print(f"Need {wanted_numel} numels in {wanted_params} params.")
|
163 |
+
|
164 |
+
state_dict = OrderedDict()
|
165 |
+
|
166 |
+
# buffers
|
167 |
+
state_dict.update(buffers)
|
168 |
+
if debug:
|
169 |
+
print(f"added {len(buffers)} buffers")
|
170 |
+
|
171 |
+
# params
|
172 |
+
# XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
|
173 |
+
# out-of-core computing solution
|
174 |
+
offset = 0
|
175 |
+
total_numel = 0
|
176 |
+
total_params = 0
|
177 |
+
for name, shape in param_shapes.items():
|
178 |
+
|
179 |
+
unpartitioned_numel = shape.numel()
|
180 |
+
total_numel += unpartitioned_numel
|
181 |
+
total_params += 1
|
182 |
+
|
183 |
+
if zero_stage == 2:
|
184 |
+
if debug:
|
185 |
+
print(
|
186 |
+
f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} "
|
187 |
+
)
|
188 |
+
state_dict[name] = full_single_fp32_vector.narrow(
|
189 |
+
0,
|
190 |
+
offset,
|
191 |
+
unpartitioned_numel).view(shape)
|
192 |
+
offset += unpartitioned_numel
|
193 |
+
|
194 |
+
elif zero_stage == 3:
|
195 |
+
partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
|
196 |
+
|
197 |
+
if debug:
|
198 |
+
print(
|
199 |
+
f"{total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
|
200 |
+
)
|
201 |
+
|
202 |
+
# XXX: memory usage doubles here (zero3)
|
203 |
+
state_dict[name] = torch.cat(
|
204 |
+
tuple(fp32_flat_groups[i].narrow(0,
|
205 |
+
offset,
|
206 |
+
partitioned_numel)
|
207 |
+
for i in range(world_size)),
|
208 |
+
0).view(shape)
|
209 |
+
offset += partitioned_numel + partitioned_padding_numel
|
210 |
+
|
211 |
+
if zero_stage == 3:
|
212 |
+
offset *= world_size
|
213 |
+
|
214 |
+
# Sanity check
|
215 |
+
if offset != avail_numel:
|
216 |
+
raise ValueError(
|
217 |
+
f"consumed {offset} numels out of {avail_numel} - something is wrong")
|
218 |
+
|
219 |
+
print(
|
220 |
+
f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements"
|
221 |
+
)
|
222 |
+
|
223 |
+
return state_dict
|
224 |
+
|
225 |
+
|
226 |
+
def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None):
|
227 |
+
"""
|
228 |
+
Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
|
229 |
+
``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
|
230 |
+
via a model hub.
|
231 |
+
|
232 |
+
Args:
|
233 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder
|
234 |
+
- ``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``
|
235 |
+
|
236 |
+
Returns:
|
237 |
+
- pytorch ``state_dict``
|
238 |
+
|
239 |
+
Note: this approach may not work if your application doesn't have sufficient free CPU memory and
|
240 |
+
you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
|
241 |
+
the checkpoint.
|
242 |
+
|
243 |
+
A typical usage might be ::
|
244 |
+
|
245 |
+
from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
|
246 |
+
# do the training and checkpoint saving
|
247 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
|
248 |
+
model = model.cpu() # move to cpu
|
249 |
+
model.load_state_dict(state_dict)
|
250 |
+
# submit to model hub or save the model to share with others
|
251 |
+
|
252 |
+
In this example the ``model`` will no longer be useable in the deepspeed context of the same
|
253 |
+
application. i.e. you will need to re-initialize the deepspeed engine, since
|
254 |
+
``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
|
255 |
+
|
256 |
+
If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
|
257 |
+
|
258 |
+
"""
|
259 |
+
if tag is None:
|
260 |
+
latest_path = os.path.join(checkpoint_dir, 'latest')
|
261 |
+
if os.path.isfile(latest_path):
|
262 |
+
with open(latest_path, 'r') as fd:
|
263 |
+
tag = fd.read().strip()
|
264 |
+
else:
|
265 |
+
raise ValueError(f"Unable to find 'latest' file at {latest_path}")
|
266 |
+
|
267 |
+
ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
|
268 |
+
|
269 |
+
if not os.path.isdir(ds_checkpoint_dir):
|
270 |
+
raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
|
271 |
+
|
272 |
+
return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir)
|
273 |
+
|
274 |
+
|
275 |
+
def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None):
|
276 |
+
"""
|
277 |
+
Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
|
278 |
+
loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
|
279 |
+
|
280 |
+
Args:
|
281 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
|
282 |
+
- ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
|
283 |
+
- ``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``
|
284 |
+
"""
|
285 |
+
|
286 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
|
287 |
+
print(f"Saving fp32 state dict to {output_file}")
|
288 |
+
torch.save(state_dict, output_file)
|
289 |
+
|
290 |
+
|
291 |
+
def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
|
292 |
+
"""
|
293 |
+
1. Put the provided model to cpu
|
294 |
+
2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
|
295 |
+
3. Load it into the provided model
|
296 |
+
|
297 |
+
Args:
|
298 |
+
- ``model``: the model object to update
|
299 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
|
300 |
+
- ``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``
|
301 |
+
|
302 |
+
Returns:
|
303 |
+
- ``model`: modified model
|
304 |
+
|
305 |
+
Make sure you have plenty of CPU memory available before you call this function. If you don't
|
306 |
+
have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
|
307 |
+
conveniently placed for you in the checkpoint folder.
|
308 |
+
|
309 |
+
A typical usage might be ::
|
310 |
+
|
311 |
+
from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
|
312 |
+
model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
|
313 |
+
# submit to model hub or save the model to share with others
|
314 |
+
|
315 |
+
Note, that once this was run, the ``model`` will no longer be useable in the deepspeed context
|
316 |
+
of the same application. i.e. you will need to re-initialize the deepspeed engine, since
|
317 |
+
``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
|
318 |
+
|
319 |
+
"""
|
320 |
+
logger.info(f"Extracting fp32 weights")
|
321 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
|
322 |
+
|
323 |
+
logger.info(f"Overwriting model with fp32 weights")
|
324 |
+
model = model.cpu()
|
325 |
+
model.load_state_dict(state_dict, strict=False)
|
326 |
+
|
327 |
+
return model
|
328 |
+
|
329 |
+
|
330 |
+
if __name__ == "__main__":
|
331 |
+
|
332 |
+
parser = argparse.ArgumentParser()
|
333 |
+
parser.add_argument(
|
334 |
+
"checkpoint_dir",
|
335 |
+
type=str,
|
336 |
+
help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
|
337 |
+
parser.add_argument(
|
338 |
+
"output_file",
|
339 |
+
type=str,
|
340 |
+
help=
|
341 |
+
"path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)"
|
342 |
+
)
|
343 |
+
parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
|
344 |
+
args = parser.parse_args()
|
345 |
+
|
346 |
+
debug = args.debug
|
347 |
+
|
348 |
+
convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir, args.output_file)
|