Upload folder using huggingface_hub
Browse files- config.json +61 -0
- latest +1 -0
- model.safetensors +3 -0
- rng_state_0.pth +3 -0
- rng_state_1.pth +3 -0
- trainer_state.json +1434 -0
- training_args.bin +3 -0
- zero_to_fp32.py +760 -0
config.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3Model"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 151643,
|
| 8 |
+
"dtype": "bfloat16",
|
| 9 |
+
"eos_token_id": 151643,
|
| 10 |
+
"head_dim": 128,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 1024,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 3072,
|
| 15 |
+
"layer_types": [
|
| 16 |
+
"full_attention",
|
| 17 |
+
"full_attention",
|
| 18 |
+
"full_attention",
|
| 19 |
+
"full_attention",
|
| 20 |
+
"full_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"full_attention"
|
| 44 |
+
],
|
| 45 |
+
"max_position_embeddings": 32768,
|
| 46 |
+
"max_window_layers": 28,
|
| 47 |
+
"model_type": "qwen3",
|
| 48 |
+
"num_attention_heads": 16,
|
| 49 |
+
"num_hidden_layers": 28,
|
| 50 |
+
"num_key_value_heads": 8,
|
| 51 |
+
"pad_token_id": 0,
|
| 52 |
+
"rms_norm_eps": 1e-06,
|
| 53 |
+
"rope_scaling": null,
|
| 54 |
+
"rope_theta": 1000000,
|
| 55 |
+
"sliding_window": null,
|
| 56 |
+
"tie_word_embeddings": true,
|
| 57 |
+
"transformers_version": "4.56.2",
|
| 58 |
+
"use_cache": true,
|
| 59 |
+
"use_sliding_window": false,
|
| 60 |
+
"vocab_size": 151669
|
| 61 |
+
}
|
latest
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
global_step2000
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:281e4c4a547e18d5363f12b1fd0a5822fb8e8ebfbed10ad3acba11fadd3f97b6
|
| 3 |
+
size 1191586416
|
rng_state_0.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:33fe1a45c0111b18df213058c73c3a4e717295b975e92faf7b2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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"best_global_step": null,
|
| 3 |
+
"best_metric": null,
|
| 4 |
+
"best_model_checkpoint": null,
|
| 5 |
+
"epoch": 1.273117937291103,
|
| 6 |
+
"eval_steps": 500,
|
| 7 |
+
"global_step": 2000,
|
| 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.006366385484641095,
|
| 14 |
+
"grad_norm": 28.7295833201599,
|
| 15 |
+
"learning_rate": 0.00011219390703061137,
|
| 16 |
+
"loss": 6.6223,
|
| 17 |
+
"step": 10
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"epoch": 0.01273277096928219,
|
| 21 |
+
"grad_norm": 15.081303427956621,
|
| 22 |
+
"learning_rate": 0.00014596763837756142,
|
| 23 |
+
"loss": 2.7812,
|
| 24 |
+
"step": 20
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"epoch": 0.019099156453923283,
|
| 28 |
+
"grad_norm": 17.081283324526982,
|
| 29 |
+
"learning_rate": 0.00016572400472495783,
|
| 30 |
+
"loss": 2.6574,
|
| 31 |
+
"step": 30
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"epoch": 0.02546554193856438,
|
| 35 |
+
"grad_norm": 15.201762160364256,
|
| 36 |
+
"learning_rate": 0.00017974136972451145,
|
| 37 |
+
"loss": 2.9039,
|
| 38 |
+
"step": 40
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"epoch": 0.031831927423205474,
|
| 42 |
+
"grad_norm": 11.557044296106628,
|
| 43 |
+
"learning_rate": 0.0001906140827142727,
|
| 44 |
+
"loss": 2.9066,
|
| 45 |
+
"step": 50
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"epoch": 0.03819831290784657,
|
| 49 |
+
"grad_norm": 14.915432761425704,
|
| 50 |
+
"learning_rate": 0.00019949773607190786,
|
| 51 |
+
"loss": 2.8914,
|
| 52 |
+
"step": 60
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"epoch": 0.04456469839248767,
|
| 56 |
+
"grad_norm": 8.745902020340656,
|
| 57 |
+
"learning_rate": 0.0002070087579637228,
|
| 58 |
+
"loss": 2.9014,
|
| 59 |
+
"step": 70
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"epoch": 0.05093108387712876,
|
| 63 |
+
"grad_norm": 8.857658675771324,
|
| 64 |
+
"learning_rate": 0.0002135151010714615,
|
| 65 |
+
"loss": 2.9293,
|
| 66 |
+
"step": 80
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"epoch": 0.057297469361769854,
|
| 70 |
+
"grad_norm": 11.48593285000581,
|
| 71 |
+
"learning_rate": 0.0002192541024193043,
|
| 72 |
+
"loss": 2.8625,
|
| 73 |
+
"step": 90
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"epoch": 0.06366385484641095,
|
| 77 |
+
"grad_norm": 7.815960040918993,
|
| 78 |
+
"learning_rate": 0.00022438781406122275,
|
| 79 |
+
"loss": 3.0063,
|
| 80 |
+
"step": 100
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"epoch": 0.07003024033105204,
|
| 84 |
+
"grad_norm": 8.632620514774269,
|
| 85 |
+
"learning_rate": 0.00022903182113161202,
|
| 86 |
+
"loss": 2.9527,
|
| 87 |
+
"step": 110
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"epoch": 0.07639662581569313,
|
| 91 |
+
"grad_norm": 7.955348207734164,
|
| 92 |
+
"learning_rate": 0.00023327146741885792,
|
| 93 |
+
"loss": 3.0082,
|
| 94 |
+
"step": 120
|
| 95 |
+
},
|
| 96 |
+
{
|
| 97 |
+
"epoch": 0.08276301130033424,
|
| 98 |
+
"grad_norm": 7.216941061016277,
|
| 99 |
+
"learning_rate": 0.00023717156393669215,
|
| 100 |
+
"loss": 2.7871,
|
| 101 |
+
"step": 130
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"epoch": 0.08912939678497533,
|
| 105 |
+
"grad_norm": 5.822424121539524,
|
| 106 |
+
"learning_rate": 0.00024078248931067283,
|
| 107 |
+
"loss": 2.7844,
|
| 108 |
+
"step": 140
|
| 109 |
+
},
|
| 110 |
+
{
|
| 111 |
+
"epoch": 0.09549578226961643,
|
| 112 |
+
"grad_norm": 7.906464628684026,
|
| 113 |
+
"learning_rate": 0.00024414418040861915,
|
| 114 |
+
"loss": 2.8514,
|
| 115 |
+
"step": 150
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"epoch": 0.10186216775425752,
|
| 119 |
+
"grad_norm": 7.514192904534888,
|
| 120 |
+
"learning_rate": 0.00024728883241841157,
|
| 121 |
+
"loss": 3.0086,
|
| 122 |
+
"step": 160
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"epoch": 0.10822855323889861,
|
| 126 |
+
"grad_norm": 6.425203024033055,
|
| 127 |
+
"learning_rate": 0.0002502427789216415,
|
| 128 |
+
"loss": 2.8754,
|
| 129 |
+
"step": 170
|
| 130 |
+
},
|
| 131 |
+
{
|
| 132 |
+
"epoch": 0.11459493872353971,
|
| 133 |
+
"grad_norm": 7.088171053123606,
|
| 134 |
+
"learning_rate": 0.00025302783376625435,
|
| 135 |
+
"loss": 2.9094,
|
| 136 |
+
"step": 180
|
| 137 |
+
},
|
| 138 |
+
{
|
| 139 |
+
"epoch": 0.1209613242081808,
|
| 140 |
+
"grad_norm": 6.538392044337595,
|
| 141 |
+
"learning_rate": 0.00025566226965097254,
|
| 142 |
+
"loss": 2.9262,
|
| 143 |
+
"step": 190
|
| 144 |
+
},
|
| 145 |
+
{
|
| 146 |
+
"epoch": 0.1273277096928219,
|
| 147 |
+
"grad_norm": 8.672338929603391,
|
| 148 |
+
"learning_rate": 0.0002581615454081728,
|
| 149 |
+
"loss": 2.8391,
|
| 150 |
+
"step": 200
|
| 151 |
+
},
|
| 152 |
+
{
|
| 153 |
+
"epoch": 0.133694095177463,
|
| 154 |
+
"grad_norm": 7.204443295582082,
|
| 155 |
+
"learning_rate": 0.00026053885565806924,
|
| 156 |
+
"loss": 2.9121,
|
| 157 |
+
"step": 210
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"epoch": 0.14006048066210408,
|
| 161 |
+
"grad_norm": 6.463760927732387,
|
| 162 |
+
"learning_rate": 0.0002628055524785621,
|
| 163 |
+
"loss": 2.9268,
|
| 164 |
+
"step": 220
|
| 165 |
+
},
|
| 166 |
+
{
|
| 167 |
+
"epoch": 0.1464268661467452,
|
| 168 |
+
"grad_norm": 6.869739493367925,
|
| 169 |
+
"learning_rate": 0.0002649714732657648,
|
| 170 |
+
"loss": 2.8965,
|
| 171 |
+
"step": 230
|
| 172 |
+
},
|
| 173 |
+
{
|
| 174 |
+
"epoch": 0.15279325163138627,
|
| 175 |
+
"grad_norm": 5.613452359830457,
|
| 176 |
+
"learning_rate": 0.00026704519876580795,
|
| 177 |
+
"loss": 2.9688,
|
| 178 |
+
"step": 240
|
| 179 |
+
},
|
| 180 |
+
{
|
| 181 |
+
"epoch": 0.15915963711602737,
|
| 182 |
+
"grad_norm": 5.7575322101372866,
|
| 183 |
+
"learning_rate": 0.000269034258397934,
|
| 184 |
+
"loss": 2.9008,
|
| 185 |
+
"step": 250
|
| 186 |
+
},
|
| 187 |
+
{
|
| 188 |
+
"epoch": 0.16552602260066848,
|
| 189 |
+
"grad_norm": 7.337481922102622,
|
| 190 |
+
"learning_rate": 0.00027094529528364224,
|
| 191 |
+
"loss": 2.9398,
|
| 192 |
+
"step": 260
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"epoch": 0.17189240808530956,
|
| 196 |
+
"grad_norm": 6.95242288679829,
|
| 197 |
+
"learning_rate": 0.00027278420011365073,
|
| 198 |
+
"loss": 2.8973,
|
| 199 |
+
"step": 270
|
| 200 |
+
},
|
| 201 |
+
{
|
| 202 |
+
"epoch": 0.17825879356995067,
|
| 203 |
+
"grad_norm": 4.554710482953035,
|
| 204 |
+
"learning_rate": 0.00027455622065762283,
|
| 205 |
+
"loss": 2.9867,
|
| 206 |
+
"step": 280
|
| 207 |
+
},
|
| 208 |
+
{
|
| 209 |
+
"epoch": 0.18462517905459175,
|
| 210 |
+
"grad_norm": 7.670629856220385,
|
| 211 |
+
"learning_rate": 0.00027626605204863905,
|
| 212 |
+
"loss": 2.9191,
|
| 213 |
+
"step": 290
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"epoch": 0.19099156453923286,
|
| 217 |
+
"grad_norm": 6.140158435864239,
|
| 218 |
+
"learning_rate": 0.0002779179117555692,
|
| 219 |
+
"loss": 2.8199,
|
| 220 |
+
"step": 300
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"epoch": 0.19735795002387393,
|
| 224 |
+
"grad_norm": 6.06880330501044,
|
| 225 |
+
"learning_rate": 0.00027951560225766885,
|
| 226 |
+
"loss": 2.959,
|
| 227 |
+
"step": 310
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
"epoch": 0.20372433550851504,
|
| 231 |
+
"grad_norm": 5.932458703590213,
|
| 232 |
+
"learning_rate": 0.0002810625637653616,
|
| 233 |
+
"loss": 2.9984,
|
| 234 |
+
"step": 320
|
| 235 |
+
},
|
| 236 |
+
{
|
| 237 |
+
"epoch": 0.21009072099315615,
|
| 238 |
+
"grad_norm": 5.413884214713577,
|
| 239 |
+
"learning_rate": 0.0002825619188259585,
|
| 240 |
+
"loss": 2.8937,
|
| 241 |
+
"step": 330
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"epoch": 0.21645710647779723,
|
| 245 |
+
"grad_norm": 5.6133458231383315,
|
| 246 |
+
"learning_rate": 0.00028401651026859154,
|
| 247 |
+
"loss": 2.8844,
|
| 248 |
+
"step": 340
|
| 249 |
+
},
|
| 250 |
+
{
|
| 251 |
+
"epoch": 0.22282349196243834,
|
| 252 |
+
"grad_norm": 6.157515185075721,
|
| 253 |
+
"learning_rate": 0.00028542893364738413,
|
| 254 |
+
"loss": 2.9137,
|
| 255 |
+
"step": 350
|
| 256 |
+
},
|
| 257 |
+
{
|
| 258 |
+
"epoch": 0.22918987744707942,
|
| 259 |
+
"grad_norm": 6.150435968994946,
|
| 260 |
+
"learning_rate": 0.0002868015651132044,
|
| 261 |
+
"loss": 2.8086,
|
| 262 |
+
"step": 360
|
| 263 |
+
},
|
| 264 |
+
{
|
| 265 |
+
"epoch": 0.23555626293172052,
|
| 266 |
+
"grad_norm": 6.1391865377467205,
|
| 267 |
+
"learning_rate": 0.00028813658546582825,
|
| 268 |
+
"loss": 2.9246,
|
| 269 |
+
"step": 370
|
| 270 |
+
},
|
| 271 |
+
{
|
| 272 |
+
"epoch": 0.2419226484163616,
|
| 273 |
+
"grad_norm": 4.720212170517568,
|
| 274 |
+
"learning_rate": 0.0002894360009979226,
|
| 275 |
+
"loss": 2.7273,
|
| 276 |
+
"step": 380
|
| 277 |
+
},
|
| 278 |
+
{
|
| 279 |
+
"epoch": 0.2482890339010027,
|
| 280 |
+
"grad_norm": 5.221438084968306,
|
| 281 |
+
"learning_rate": 0.0002907016616310386,
|
| 282 |
+
"loss": 2.8332,
|
| 283 |
+
"step": 390
|
| 284 |
+
},
|
| 285 |
+
{
|
| 286 |
+
"epoch": 0.2546554193856438,
|
| 287 |
+
"grad_norm": 5.397389581466363,
|
| 288 |
+
"learning_rate": 0.00029193527675512284,
|
| 289 |
+
"loss": 2.776,
|
| 290 |
+
"step": 400
|
| 291 |
+
},
|
| 292 |
+
{
|
| 293 |
+
"epoch": 0.26102180487028487,
|
| 294 |
+
"grad_norm": 7.525981812223918,
|
| 295 |
+
"learning_rate": 0.0002931384291118962,
|
| 296 |
+
"loss": 2.8727,
|
| 297 |
+
"step": 410
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"epoch": 0.267388190354926,
|
| 301 |
+
"grad_norm": 5.7116155190893805,
|
| 302 |
+
"learning_rate": 0.00029431258700501927,
|
| 303 |
+
"loss": 2.9766,
|
| 304 |
+
"step": 420
|
| 305 |
+
},
|
| 306 |
+
{
|
| 307 |
+
"epoch": 0.2737545758395671,
|
| 308 |
+
"grad_norm": 7.012023587035556,
|
| 309 |
+
"learning_rate": 0.00029545911507334384,
|
| 310 |
+
"loss": 2.7902,
|
| 311 |
+
"step": 430
|
| 312 |
+
},
|
| 313 |
+
{
|
| 314 |
+
"epoch": 0.28012096132420816,
|
| 315 |
+
"grad_norm": 4.8865448559050435,
|
| 316 |
+
"learning_rate": 0.0002965792838255121,
|
| 317 |
+
"loss": 2.6873,
|
| 318 |
+
"step": 440
|
| 319 |
+
},
|
| 320 |
+
{
|
| 321 |
+
"epoch": 0.2864873468088493,
|
| 322 |
+
"grad_norm": 4.682656054807096,
|
| 323 |
+
"learning_rate": 0.0002976742781029656,
|
| 324 |
+
"loss": 2.8498,
|
| 325 |
+
"step": 450
|
| 326 |
+
},
|
| 327 |
+
{
|
| 328 |
+
"epoch": 0.2928537322934904,
|
| 329 |
+
"grad_norm": 4.114956894922335,
|
| 330 |
+
"learning_rate": 0.00029874520461271485,
|
| 331 |
+
"loss": 2.7461,
|
| 332 |
+
"step": 460
|
| 333 |
+
},
|
| 334 |
+
{
|
| 335 |
+
"epoch": 0.29922011777813146,
|
| 336 |
+
"grad_norm": 4.388435500348782,
|
| 337 |
+
"learning_rate": 0.0002997930986499357,
|
| 338 |
+
"loss": 2.9004,
|
| 339 |
+
"step": 470
|
| 340 |
+
},
|
| 341 |
+
{
|
| 342 |
+
"epoch": 0.30558650326277254,
|
| 343 |
+
"grad_norm": 4.06992963685517,
|
| 344 |
+
"learning_rate": 0.0002995048337656213,
|
| 345 |
+
"loss": 2.8203,
|
| 346 |
+
"step": 480
|
| 347 |
+
},
|
| 348 |
+
{
|
| 349 |
+
"epoch": 0.31195288874741367,
|
| 350 |
+
"grad_norm": 5.7122354924160375,
|
| 351 |
+
"learning_rate": 0.0002987974534307946,
|
| 352 |
+
"loss": 2.8477,
|
| 353 |
+
"step": 490
|
| 354 |
+
},
|
| 355 |
+
{
|
| 356 |
+
"epoch": 0.31831927423205475,
|
| 357 |
+
"grad_norm": 4.543743759310822,
|
| 358 |
+
"learning_rate": 0.0002980900730959679,
|
| 359 |
+
"loss": 2.8168,
|
| 360 |
+
"step": 500
|
| 361 |
+
},
|
| 362 |
+
{
|
| 363 |
+
"epoch": 0.32468565971669583,
|
| 364 |
+
"grad_norm": 5.2449822235737384,
|
| 365 |
+
"learning_rate": 0.0002973826927611412,
|
| 366 |
+
"loss": 2.7021,
|
| 367 |
+
"step": 510
|
| 368 |
+
},
|
| 369 |
+
{
|
| 370 |
+
"epoch": 0.33105204520133696,
|
| 371 |
+
"grad_norm": 6.42302117474529,
|
| 372 |
+
"learning_rate": 0.0002966753124263145,
|
| 373 |
+
"loss": 2.8545,
|
| 374 |
+
"step": 520
|
| 375 |
+
},
|
| 376 |
+
{
|
| 377 |
+
"epoch": 0.33741843068597804,
|
| 378 |
+
"grad_norm": 6.4116258183908945,
|
| 379 |
+
"learning_rate": 0.0002959679320914878,
|
| 380 |
+
"loss": 2.8436,
|
| 381 |
+
"step": 530
|
| 382 |
+
},
|
| 383 |
+
{
|
| 384 |
+
"epoch": 0.3437848161706191,
|
| 385 |
+
"grad_norm": 4.982523320381435,
|
| 386 |
+
"learning_rate": 0.00029526055175666113,
|
| 387 |
+
"loss": 2.7607,
|
| 388 |
+
"step": 540
|
| 389 |
+
},
|
| 390 |
+
{
|
| 391 |
+
"epoch": 0.3501512016552602,
|
| 392 |
+
"grad_norm": 4.815920229901925,
|
| 393 |
+
"learning_rate": 0.00029455317142183443,
|
| 394 |
+
"loss": 2.734,
|
| 395 |
+
"step": 550
|
| 396 |
+
},
|
| 397 |
+
{
|
| 398 |
+
"epoch": 0.35651758713990134,
|
| 399 |
+
"grad_norm": 9.300484207985622,
|
| 400 |
+
"learning_rate": 0.00029384579108700774,
|
| 401 |
+
"loss": 2.7889,
|
| 402 |
+
"step": 560
|
| 403 |
+
},
|
| 404 |
+
{
|
| 405 |
+
"epoch": 0.3628839726245424,
|
| 406 |
+
"grad_norm": 4.5559522343853285,
|
| 407 |
+
"learning_rate": 0.00029313841075218105,
|
| 408 |
+
"loss": 2.7531,
|
| 409 |
+
"step": 570
|
| 410 |
+
},
|
| 411 |
+
{
|
| 412 |
+
"epoch": 0.3692503581091835,
|
| 413 |
+
"grad_norm": 5.351641807589207,
|
| 414 |
+
"learning_rate": 0.0002924310304173544,
|
| 415 |
+
"loss": 2.7451,
|
| 416 |
+
"step": 580
|
| 417 |
+
},
|
| 418 |
+
{
|
| 419 |
+
"epoch": 0.37561674359382463,
|
| 420 |
+
"grad_norm": 5.696588702079196,
|
| 421 |
+
"learning_rate": 0.00029172365008252766,
|
| 422 |
+
"loss": 2.7189,
|
| 423 |
+
"step": 590
|
| 424 |
+
},
|
| 425 |
+
{
|
| 426 |
+
"epoch": 0.3819831290784657,
|
| 427 |
+
"grad_norm": 4.694068773418385,
|
| 428 |
+
"learning_rate": 0.00029101626974770096,
|
| 429 |
+
"loss": 2.6096,
|
| 430 |
+
"step": 600
|
| 431 |
+
},
|
| 432 |
+
{
|
| 433 |
+
"epoch": 0.3883495145631068,
|
| 434 |
+
"grad_norm": 9.013555425033168,
|
| 435 |
+
"learning_rate": 0.0002903088894128743,
|
| 436 |
+
"loss": 2.6605,
|
| 437 |
+
"step": 610
|
| 438 |
+
},
|
| 439 |
+
{
|
| 440 |
+
"epoch": 0.39471590004774787,
|
| 441 |
+
"grad_norm": 10.964569620769009,
|
| 442 |
+
"learning_rate": 0.00028960150907804763,
|
| 443 |
+
"loss": 2.7258,
|
| 444 |
+
"step": 620
|
| 445 |
+
},
|
| 446 |
+
{
|
| 447 |
+
"epoch": 0.401082285532389,
|
| 448 |
+
"grad_norm": 8.94321766980447,
|
| 449 |
+
"learning_rate": 0.00028889412874322093,
|
| 450 |
+
"loss": 2.6688,
|
| 451 |
+
"step": 630
|
| 452 |
+
},
|
| 453 |
+
{
|
| 454 |
+
"epoch": 0.4074486710170301,
|
| 455 |
+
"grad_norm": 10.742420289850541,
|
| 456 |
+
"learning_rate": 0.0002881867484083942,
|
| 457 |
+
"loss": 2.573,
|
| 458 |
+
"step": 640
|
| 459 |
+
},
|
| 460 |
+
{
|
| 461 |
+
"epoch": 0.41381505650167116,
|
| 462 |
+
"grad_norm": 8.890111021830462,
|
| 463 |
+
"learning_rate": 0.00028747936807356755,
|
| 464 |
+
"loss": 2.5846,
|
| 465 |
+
"step": 650
|
| 466 |
+
},
|
| 467 |
+
{
|
| 468 |
+
"epoch": 0.4201814419863123,
|
| 469 |
+
"grad_norm": 27.744833393643688,
|
| 470 |
+
"learning_rate": 0.00028677198773874085,
|
| 471 |
+
"loss": 2.5406,
|
| 472 |
+
"step": 660
|
| 473 |
+
},
|
| 474 |
+
{
|
| 475 |
+
"epoch": 0.4265478274709534,
|
| 476 |
+
"grad_norm": 8.283239589638123,
|
| 477 |
+
"learning_rate": 0.00028606460740391416,
|
| 478 |
+
"loss": 2.602,
|
| 479 |
+
"step": 670
|
| 480 |
+
},
|
| 481 |
+
{
|
| 482 |
+
"epoch": 0.43291421295559446,
|
| 483 |
+
"grad_norm": 7.738262298672388,
|
| 484 |
+
"learning_rate": 0.00028535722706908746,
|
| 485 |
+
"loss": 2.6947,
|
| 486 |
+
"step": 680
|
| 487 |
+
},
|
| 488 |
+
{
|
| 489 |
+
"epoch": 0.43928059844023554,
|
| 490 |
+
"grad_norm": 11.536106786052837,
|
| 491 |
+
"learning_rate": 0.00028464984673426077,
|
| 492 |
+
"loss": 2.6422,
|
| 493 |
+
"step": 690
|
| 494 |
+
},
|
| 495 |
+
{
|
| 496 |
+
"epoch": 0.44564698392487667,
|
| 497 |
+
"grad_norm": 7.93060742031869,
|
| 498 |
+
"learning_rate": 0.0002839424663994341,
|
| 499 |
+
"loss": 2.5859,
|
| 500 |
+
"step": 700
|
| 501 |
+
},
|
| 502 |
+
{
|
| 503 |
+
"epoch": 0.45201336940951775,
|
| 504 |
+
"grad_norm": 4.031662354294752,
|
| 505 |
+
"learning_rate": 0.0002832350860646074,
|
| 506 |
+
"loss": 2.5947,
|
| 507 |
+
"step": 710
|
| 508 |
+
},
|
| 509 |
+
{
|
| 510 |
+
"epoch": 0.45837975489415883,
|
| 511 |
+
"grad_norm": 5.258278074052536,
|
| 512 |
+
"learning_rate": 0.0002825277057297807,
|
| 513 |
+
"loss": 2.64,
|
| 514 |
+
"step": 720
|
| 515 |
+
},
|
| 516 |
+
{
|
| 517 |
+
"epoch": 0.4647461403787999,
|
| 518 |
+
"grad_norm": 4.323834597980534,
|
| 519 |
+
"learning_rate": 0.000281820325394954,
|
| 520 |
+
"loss": 2.6949,
|
| 521 |
+
"step": 730
|
| 522 |
+
},
|
| 523 |
+
{
|
| 524 |
+
"epoch": 0.47111252586344105,
|
| 525 |
+
"grad_norm": 5.0167173121086135,
|
| 526 |
+
"learning_rate": 0.0002811129450601273,
|
| 527 |
+
"loss": 2.6221,
|
| 528 |
+
"step": 740
|
| 529 |
+
},
|
| 530 |
+
{
|
| 531 |
+
"epoch": 0.4774789113480821,
|
| 532 |
+
"grad_norm": 5.933856548166221,
|
| 533 |
+
"learning_rate": 0.0002804055647253006,
|
| 534 |
+
"loss": 2.632,
|
| 535 |
+
"step": 750
|
| 536 |
+
},
|
| 537 |
+
{
|
| 538 |
+
"epoch": 0.4838452968327232,
|
| 539 |
+
"grad_norm": 5.090852518324657,
|
| 540 |
+
"learning_rate": 0.0002796981843904739,
|
| 541 |
+
"loss": 2.8242,
|
| 542 |
+
"step": 760
|
| 543 |
+
},
|
| 544 |
+
{
|
| 545 |
+
"epoch": 0.49021168231736434,
|
| 546 |
+
"grad_norm": 4.60199924467046,
|
| 547 |
+
"learning_rate": 0.0002789908040556472,
|
| 548 |
+
"loss": 2.6357,
|
| 549 |
+
"step": 770
|
| 550 |
+
},
|
| 551 |
+
{
|
| 552 |
+
"epoch": 0.4965780678020054,
|
| 553 |
+
"grad_norm": 4.62334978934682,
|
| 554 |
+
"learning_rate": 0.0002782834237208206,
|
| 555 |
+
"loss": 2.6455,
|
| 556 |
+
"step": 780
|
| 557 |
+
},
|
| 558 |
+
{
|
| 559 |
+
"epoch": 0.5029444532866465,
|
| 560 |
+
"grad_norm": 5.7098868621282834,
|
| 561 |
+
"learning_rate": 0.0002775760433859938,
|
| 562 |
+
"loss": 2.7822,
|
| 563 |
+
"step": 790
|
| 564 |
+
},
|
| 565 |
+
{
|
| 566 |
+
"epoch": 0.5093108387712876,
|
| 567 |
+
"grad_norm": 5.492909395839608,
|
| 568 |
+
"learning_rate": 0.00027686866305116713,
|
| 569 |
+
"loss": 2.5965,
|
| 570 |
+
"step": 800
|
| 571 |
+
},
|
| 572 |
+
{
|
| 573 |
+
"epoch": 0.5156772242559287,
|
| 574 |
+
"grad_norm": 5.007751033932614,
|
| 575 |
+
"learning_rate": 0.00027616128271634044,
|
| 576 |
+
"loss": 2.6355,
|
| 577 |
+
"step": 810
|
| 578 |
+
},
|
| 579 |
+
{
|
| 580 |
+
"epoch": 0.5220436097405697,
|
| 581 |
+
"grad_norm": 6.170648429353342,
|
| 582 |
+
"learning_rate": 0.0002754539023815138,
|
| 583 |
+
"loss": 2.6123,
|
| 584 |
+
"step": 820
|
| 585 |
+
},
|
| 586 |
+
{
|
| 587 |
+
"epoch": 0.5284099952252109,
|
| 588 |
+
"grad_norm": 4.235113061064731,
|
| 589 |
+
"learning_rate": 0.0002747465220466871,
|
| 590 |
+
"loss": 2.6453,
|
| 591 |
+
"step": 830
|
| 592 |
+
},
|
| 593 |
+
{
|
| 594 |
+
"epoch": 0.534776380709852,
|
| 595 |
+
"grad_norm": 4.538569485793573,
|
| 596 |
+
"learning_rate": 0.00027403914171186036,
|
| 597 |
+
"loss": 2.6713,
|
| 598 |
+
"step": 840
|
| 599 |
+
},
|
| 600 |
+
{
|
| 601 |
+
"epoch": 0.5411427661944931,
|
| 602 |
+
"grad_norm": 4.019460059963649,
|
| 603 |
+
"learning_rate": 0.0002733317613770337,
|
| 604 |
+
"loss": 2.5943,
|
| 605 |
+
"step": 850
|
| 606 |
+
},
|
| 607 |
+
{
|
| 608 |
+
"epoch": 0.5475091516791342,
|
| 609 |
+
"grad_norm": 6.254490760667432,
|
| 610 |
+
"learning_rate": 0.000272624381042207,
|
| 611 |
+
"loss": 2.5418,
|
| 612 |
+
"step": 860
|
| 613 |
+
},
|
| 614 |
+
{
|
| 615 |
+
"epoch": 0.5538755371637752,
|
| 616 |
+
"grad_norm": 4.520259916472461,
|
| 617 |
+
"learning_rate": 0.0002719170007073803,
|
| 618 |
+
"loss": 2.584,
|
| 619 |
+
"step": 870
|
| 620 |
+
},
|
| 621 |
+
{
|
| 622 |
+
"epoch": 0.5602419226484163,
|
| 623 |
+
"grad_norm": 5.065731135931019,
|
| 624 |
+
"learning_rate": 0.0002712096203725536,
|
| 625 |
+
"loss": 2.6723,
|
| 626 |
+
"step": 880
|
| 627 |
+
},
|
| 628 |
+
{
|
| 629 |
+
"epoch": 0.5666083081330574,
|
| 630 |
+
"grad_norm": 3.833075034277501,
|
| 631 |
+
"learning_rate": 0.00027050224003772694,
|
| 632 |
+
"loss": 2.5248,
|
| 633 |
+
"step": 890
|
| 634 |
+
},
|
| 635 |
+
{
|
| 636 |
+
"epoch": 0.5729746936176986,
|
| 637 |
+
"grad_norm": 5.507080157861899,
|
| 638 |
+
"learning_rate": 0.00026979485970290024,
|
| 639 |
+
"loss": 2.6379,
|
| 640 |
+
"step": 900
|
| 641 |
+
},
|
| 642 |
+
{
|
| 643 |
+
"epoch": 0.5793410791023397,
|
| 644 |
+
"grad_norm": 14.128248882331409,
|
| 645 |
+
"learning_rate": 0.00026908747936807355,
|
| 646 |
+
"loss": 2.5904,
|
| 647 |
+
"step": 910
|
| 648 |
+
},
|
| 649 |
+
{
|
| 650 |
+
"epoch": 0.5857074645869808,
|
| 651 |
+
"grad_norm": 6.1778278241357265,
|
| 652 |
+
"learning_rate": 0.00026838009903324686,
|
| 653 |
+
"loss": 2.5844,
|
| 654 |
+
"step": 920
|
| 655 |
+
},
|
| 656 |
+
{
|
| 657 |
+
"epoch": 0.5920738500716218,
|
| 658 |
+
"grad_norm": 8.064848357512728,
|
| 659 |
+
"learning_rate": 0.00026767271869842016,
|
| 660 |
+
"loss": 2.6055,
|
| 661 |
+
"step": 930
|
| 662 |
+
},
|
| 663 |
+
{
|
| 664 |
+
"epoch": 0.5984402355562629,
|
| 665 |
+
"grad_norm": 6.16438539022089,
|
| 666 |
+
"learning_rate": 0.00026696533836359347,
|
| 667 |
+
"loss": 2.5506,
|
| 668 |
+
"step": 940
|
| 669 |
+
},
|
| 670 |
+
{
|
| 671 |
+
"epoch": 0.604806621040904,
|
| 672 |
+
"grad_norm": 5.882124357483614,
|
| 673 |
+
"learning_rate": 0.0002662579580287668,
|
| 674 |
+
"loss": 2.4973,
|
| 675 |
+
"step": 950
|
| 676 |
+
},
|
| 677 |
+
{
|
| 678 |
+
"epoch": 0.6111730065255451,
|
| 679 |
+
"grad_norm": 8.373991467730166,
|
| 680 |
+
"learning_rate": 0.0002655505776939401,
|
| 681 |
+
"loss": 2.5428,
|
| 682 |
+
"step": 960
|
| 683 |
+
},
|
| 684 |
+
{
|
| 685 |
+
"epoch": 0.6175393920101863,
|
| 686 |
+
"grad_norm": 6.831051520016273,
|
| 687 |
+
"learning_rate": 0.0002648431973591134,
|
| 688 |
+
"loss": 2.4982,
|
| 689 |
+
"step": 970
|
| 690 |
+
},
|
| 691 |
+
{
|
| 692 |
+
"epoch": 0.6239057774948273,
|
| 693 |
+
"grad_norm": 5.074869694709693,
|
| 694 |
+
"learning_rate": 0.0002641358170242867,
|
| 695 |
+
"loss": 2.5465,
|
| 696 |
+
"step": 980
|
| 697 |
+
},
|
| 698 |
+
{
|
| 699 |
+
"epoch": 0.6302721629794684,
|
| 700 |
+
"grad_norm": 5.503484162830985,
|
| 701 |
+
"learning_rate": 0.00026342843668946,
|
| 702 |
+
"loss": 2.324,
|
| 703 |
+
"step": 990
|
| 704 |
+
},
|
| 705 |
+
{
|
| 706 |
+
"epoch": 0.6366385484641095,
|
| 707 |
+
"grad_norm": 4.385405886090266,
|
| 708 |
+
"learning_rate": 0.0002627210563546333,
|
| 709 |
+
"loss": 2.417,
|
| 710 |
+
"step": 1000
|
| 711 |
+
},
|
| 712 |
+
{
|
| 713 |
+
"epoch": 0.6430049339487506,
|
| 714 |
+
"grad_norm": 5.034207848822367,
|
| 715 |
+
"learning_rate": 0.0002620136760198066,
|
| 716 |
+
"loss": 2.6066,
|
| 717 |
+
"step": 1010
|
| 718 |
+
},
|
| 719 |
+
{
|
| 720 |
+
"epoch": 0.6493713194333917,
|
| 721 |
+
"grad_norm": 3.696840611162144,
|
| 722 |
+
"learning_rate": 0.00026130629568497997,
|
| 723 |
+
"loss": 2.5441,
|
| 724 |
+
"step": 1020
|
| 725 |
+
},
|
| 726 |
+
{
|
| 727 |
+
"epoch": 0.6557377049180327,
|
| 728 |
+
"grad_norm": 4.6314444028768875,
|
| 729 |
+
"learning_rate": 0.0002605989153501533,
|
| 730 |
+
"loss": 2.4752,
|
| 731 |
+
"step": 1030
|
| 732 |
+
},
|
| 733 |
+
{
|
| 734 |
+
"epoch": 0.6621040904026739,
|
| 735 |
+
"grad_norm": 3.4663340841035093,
|
| 736 |
+
"learning_rate": 0.0002598915350153265,
|
| 737 |
+
"loss": 2.4637,
|
| 738 |
+
"step": 1040
|
| 739 |
+
},
|
| 740 |
+
{
|
| 741 |
+
"epoch": 0.668470475887315,
|
| 742 |
+
"grad_norm": 8.334602958229153,
|
| 743 |
+
"learning_rate": 0.00025918415468049983,
|
| 744 |
+
"loss": 2.6082,
|
| 745 |
+
"step": 1050
|
| 746 |
+
},
|
| 747 |
+
{
|
| 748 |
+
"epoch": 0.6748368613719561,
|
| 749 |
+
"grad_norm": 4.575304861734687,
|
| 750 |
+
"learning_rate": 0.0002584767743456732,
|
| 751 |
+
"loss": 2.4842,
|
| 752 |
+
"step": 1060
|
| 753 |
+
},
|
| 754 |
+
{
|
| 755 |
+
"epoch": 0.6812032468565972,
|
| 756 |
+
"grad_norm": 3.618603659881246,
|
| 757 |
+
"learning_rate": 0.0002577693940108465,
|
| 758 |
+
"loss": 2.4982,
|
| 759 |
+
"step": 1070
|
| 760 |
+
},
|
| 761 |
+
{
|
| 762 |
+
"epoch": 0.6875696323412382,
|
| 763 |
+
"grad_norm": 4.4740750234847475,
|
| 764 |
+
"learning_rate": 0.00025706201367601975,
|
| 765 |
+
"loss": 2.4029,
|
| 766 |
+
"step": 1080
|
| 767 |
+
},
|
| 768 |
+
{
|
| 769 |
+
"epoch": 0.6939360178258793,
|
| 770 |
+
"grad_norm": 4.208151138305904,
|
| 771 |
+
"learning_rate": 0.0002563546333411931,
|
| 772 |
+
"loss": 2.4836,
|
| 773 |
+
"step": 1090
|
| 774 |
+
},
|
| 775 |
+
{
|
| 776 |
+
"epoch": 0.7003024033105204,
|
| 777 |
+
"grad_norm": 5.736418133529195,
|
| 778 |
+
"learning_rate": 0.0002556472530063664,
|
| 779 |
+
"loss": 2.6402,
|
| 780 |
+
"step": 1100
|
| 781 |
+
},
|
| 782 |
+
{
|
| 783 |
+
"epoch": 0.7066687887951616,
|
| 784 |
+
"grad_norm": 3.6852138552936395,
|
| 785 |
+
"learning_rate": 0.0002549398726715397,
|
| 786 |
+
"loss": 2.4941,
|
| 787 |
+
"step": 1110
|
| 788 |
+
},
|
| 789 |
+
{
|
| 790 |
+
"epoch": 0.7130351742798027,
|
| 791 |
+
"grad_norm": 4.11339792490071,
|
| 792 |
+
"learning_rate": 0.000254232492336713,
|
| 793 |
+
"loss": 2.4641,
|
| 794 |
+
"step": 1120
|
| 795 |
+
},
|
| 796 |
+
{
|
| 797 |
+
"epoch": 0.7194015597644438,
|
| 798 |
+
"grad_norm": 3.7487169212790477,
|
| 799 |
+
"learning_rate": 0.00025352511200188633,
|
| 800 |
+
"loss": 2.3414,
|
| 801 |
+
"step": 1130
|
| 802 |
+
},
|
| 803 |
+
{
|
| 804 |
+
"epoch": 0.7257679452490848,
|
| 805 |
+
"grad_norm": 3.442251781584789,
|
| 806 |
+
"learning_rate": 0.00025281773166705964,
|
| 807 |
+
"loss": 2.3932,
|
| 808 |
+
"step": 1140
|
| 809 |
+
},
|
| 810 |
+
{
|
| 811 |
+
"epoch": 0.7321343307337259,
|
| 812 |
+
"grad_norm": 3.8470452186807846,
|
| 813 |
+
"learning_rate": 0.00025211035133223294,
|
| 814 |
+
"loss": 2.4334,
|
| 815 |
+
"step": 1150
|
| 816 |
+
},
|
| 817 |
+
{
|
| 818 |
+
"epoch": 0.738500716218367,
|
| 819 |
+
"grad_norm": 4.506628903442333,
|
| 820 |
+
"learning_rate": 0.00025140297099740625,
|
| 821 |
+
"loss": 2.3195,
|
| 822 |
+
"step": 1160
|
| 823 |
+
},
|
| 824 |
+
{
|
| 825 |
+
"epoch": 0.7448671017030081,
|
| 826 |
+
"grad_norm": 4.325389792461109,
|
| 827 |
+
"learning_rate": 0.00025069559066257955,
|
| 828 |
+
"loss": 2.4027,
|
| 829 |
+
"step": 1170
|
| 830 |
+
},
|
| 831 |
+
{
|
| 832 |
+
"epoch": 0.7512334871876493,
|
| 833 |
+
"grad_norm": 3.8669860452410445,
|
| 834 |
+
"learning_rate": 0.00024998821032775286,
|
| 835 |
+
"loss": 2.4686,
|
| 836 |
+
"step": 1180
|
| 837 |
+
},
|
| 838 |
+
{
|
| 839 |
+
"epoch": 0.7575998726722903,
|
| 840 |
+
"grad_norm": 3.561694549590622,
|
| 841 |
+
"learning_rate": 0.00024928082999292617,
|
| 842 |
+
"loss": 2.5395,
|
| 843 |
+
"step": 1190
|
| 844 |
+
},
|
| 845 |
+
{
|
| 846 |
+
"epoch": 0.7639662581569314,
|
| 847 |
+
"grad_norm": 4.156976510059248,
|
| 848 |
+
"learning_rate": 0.00024857344965809947,
|
| 849 |
+
"loss": 2.4416,
|
| 850 |
+
"step": 1200
|
| 851 |
+
},
|
| 852 |
+
{
|
| 853 |
+
"epoch": 0.7703326436415725,
|
| 854 |
+
"grad_norm": 5.616798309964706,
|
| 855 |
+
"learning_rate": 0.0002478660693232728,
|
| 856 |
+
"loss": 2.4055,
|
| 857 |
+
"step": 1210
|
| 858 |
+
},
|
| 859 |
+
{
|
| 860 |
+
"epoch": 0.7766990291262136,
|
| 861 |
+
"grad_norm": 3.149306910194074,
|
| 862 |
+
"learning_rate": 0.0002471586889884461,
|
| 863 |
+
"loss": 2.4488,
|
| 864 |
+
"step": 1220
|
| 865 |
+
},
|
| 866 |
+
{
|
| 867 |
+
"epoch": 0.7830654146108547,
|
| 868 |
+
"grad_norm": 3.0254085146949974,
|
| 869 |
+
"learning_rate": 0.00024645130865361944,
|
| 870 |
+
"loss": 2.44,
|
| 871 |
+
"step": 1230
|
| 872 |
+
},
|
| 873 |
+
{
|
| 874 |
+
"epoch": 0.7894318000954957,
|
| 875 |
+
"grad_norm": 3.3553234269170815,
|
| 876 |
+
"learning_rate": 0.0002457439283187927,
|
| 877 |
+
"loss": 2.4689,
|
| 878 |
+
"step": 1240
|
| 879 |
+
},
|
| 880 |
+
{
|
| 881 |
+
"epoch": 0.7957981855801369,
|
| 882 |
+
"grad_norm": 3.560968004340506,
|
| 883 |
+
"learning_rate": 0.000245036547983966,
|
| 884 |
+
"loss": 2.4328,
|
| 885 |
+
"step": 1250
|
| 886 |
+
},
|
| 887 |
+
{
|
| 888 |
+
"epoch": 0.802164571064778,
|
| 889 |
+
"grad_norm": 3.670143268942363,
|
| 890 |
+
"learning_rate": 0.00024432916764913936,
|
| 891 |
+
"loss": 2.357,
|
| 892 |
+
"step": 1260
|
| 893 |
+
},
|
| 894 |
+
{
|
| 895 |
+
"epoch": 0.8085309565494191,
|
| 896 |
+
"grad_norm": 4.603180595509743,
|
| 897 |
+
"learning_rate": 0.00024362178731431264,
|
| 898 |
+
"loss": 2.4336,
|
| 899 |
+
"step": 1270
|
| 900 |
+
},
|
| 901 |
+
{
|
| 902 |
+
"epoch": 0.8148973420340602,
|
| 903 |
+
"grad_norm": 3.2173958923931845,
|
| 904 |
+
"learning_rate": 0.00024291440697948595,
|
| 905 |
+
"loss": 2.3859,
|
| 906 |
+
"step": 1280
|
| 907 |
+
},
|
| 908 |
+
{
|
| 909 |
+
"epoch": 0.8212637275187012,
|
| 910 |
+
"grad_norm": 4.238015371838477,
|
| 911 |
+
"learning_rate": 0.00024220702664465925,
|
| 912 |
+
"loss": 2.4234,
|
| 913 |
+
"step": 1290
|
| 914 |
+
},
|
| 915 |
+
{
|
| 916 |
+
"epoch": 0.8276301130033423,
|
| 917 |
+
"grad_norm": 3.350821041839247,
|
| 918 |
+
"learning_rate": 0.00024149964630983258,
|
| 919 |
+
"loss": 2.34,
|
| 920 |
+
"step": 1300
|
| 921 |
+
},
|
| 922 |
+
{
|
| 923 |
+
"epoch": 0.8339964984879834,
|
| 924 |
+
"grad_norm": 3.956822835287818,
|
| 925 |
+
"learning_rate": 0.00024079226597500586,
|
| 926 |
+
"loss": 2.409,
|
| 927 |
+
"step": 1310
|
| 928 |
+
},
|
| 929 |
+
{
|
| 930 |
+
"epoch": 0.8403628839726246,
|
| 931 |
+
"grad_norm": 3.206745954274851,
|
| 932 |
+
"learning_rate": 0.00024008488564017917,
|
| 933 |
+
"loss": 2.4766,
|
| 934 |
+
"step": 1320
|
| 935 |
+
},
|
| 936 |
+
{
|
| 937 |
+
"epoch": 0.8467292694572657,
|
| 938 |
+
"grad_norm": 3.16798874537864,
|
| 939 |
+
"learning_rate": 0.0002393775053053525,
|
| 940 |
+
"loss": 2.4918,
|
| 941 |
+
"step": 1330
|
| 942 |
+
},
|
| 943 |
+
{
|
| 944 |
+
"epoch": 0.8530956549419068,
|
| 945 |
+
"grad_norm": 3.2084119932227613,
|
| 946 |
+
"learning_rate": 0.0002386701249705258,
|
| 947 |
+
"loss": 2.3279,
|
| 948 |
+
"step": 1340
|
| 949 |
+
},
|
| 950 |
+
{
|
| 951 |
+
"epoch": 0.8594620404265478,
|
| 952 |
+
"grad_norm": 2.6626163554970694,
|
| 953 |
+
"learning_rate": 0.00023796274463569909,
|
| 954 |
+
"loss": 2.3762,
|
| 955 |
+
"step": 1350
|
| 956 |
+
},
|
| 957 |
+
{
|
| 958 |
+
"epoch": 0.8658284259111889,
|
| 959 |
+
"grad_norm": 3.543568104802714,
|
| 960 |
+
"learning_rate": 0.00023725536430087242,
|
| 961 |
+
"loss": 2.4406,
|
| 962 |
+
"step": 1360
|
| 963 |
+
},
|
| 964 |
+
{
|
| 965 |
+
"epoch": 0.87219481139583,
|
| 966 |
+
"grad_norm": 3.0950338366546832,
|
| 967 |
+
"learning_rate": 0.00023654798396604572,
|
| 968 |
+
"loss": 2.4135,
|
| 969 |
+
"step": 1370
|
| 970 |
+
},
|
| 971 |
+
{
|
| 972 |
+
"epoch": 0.8785611968804711,
|
| 973 |
+
"grad_norm": 3.4459117956268583,
|
| 974 |
+
"learning_rate": 0.00023584060363121903,
|
| 975 |
+
"loss": 2.3371,
|
| 976 |
+
"step": 1380
|
| 977 |
+
},
|
| 978 |
+
{
|
| 979 |
+
"epoch": 0.8849275823651122,
|
| 980 |
+
"grad_norm": 3.3339357175581026,
|
| 981 |
+
"learning_rate": 0.00023513322329639234,
|
| 982 |
+
"loss": 2.3568,
|
| 983 |
+
"step": 1390
|
| 984 |
+
},
|
| 985 |
+
{
|
| 986 |
+
"epoch": 0.8912939678497533,
|
| 987 |
+
"grad_norm": 2.7770602679788836,
|
| 988 |
+
"learning_rate": 0.00023442584296156567,
|
| 989 |
+
"loss": 2.4703,
|
| 990 |
+
"step": 1400
|
| 991 |
+
},
|
| 992 |
+
{
|
| 993 |
+
"epoch": 0.8976603533343944,
|
| 994 |
+
"grad_norm": 3.1587359306963925,
|
| 995 |
+
"learning_rate": 0.00023371846262673895,
|
| 996 |
+
"loss": 2.3687,
|
| 997 |
+
"step": 1410
|
| 998 |
+
},
|
| 999 |
+
{
|
| 1000 |
+
"epoch": 0.9040267388190355,
|
| 1001 |
+
"grad_norm": 3.6463373041615057,
|
| 1002 |
+
"learning_rate": 0.00023301108229191225,
|
| 1003 |
+
"loss": 2.5037,
|
| 1004 |
+
"step": 1420
|
| 1005 |
+
},
|
| 1006 |
+
{
|
| 1007 |
+
"epoch": 0.9103931243036766,
|
| 1008 |
+
"grad_norm": 3.8799007179484066,
|
| 1009 |
+
"learning_rate": 0.00023230370195708559,
|
| 1010 |
+
"loss": 2.3883,
|
| 1011 |
+
"step": 1430
|
| 1012 |
+
},
|
| 1013 |
+
{
|
| 1014 |
+
"epoch": 0.9167595097883177,
|
| 1015 |
+
"grad_norm": 2.650501985473451,
|
| 1016 |
+
"learning_rate": 0.0002315963216222589,
|
| 1017 |
+
"loss": 2.3818,
|
| 1018 |
+
"step": 1440
|
| 1019 |
+
},
|
| 1020 |
+
{
|
| 1021 |
+
"epoch": 0.9231258952729587,
|
| 1022 |
+
"grad_norm": 3.3575457214628353,
|
| 1023 |
+
"learning_rate": 0.00023088894128743217,
|
| 1024 |
+
"loss": 2.2014,
|
| 1025 |
+
"step": 1450
|
| 1026 |
+
},
|
| 1027 |
+
{
|
| 1028 |
+
"epoch": 0.9294922807575998,
|
| 1029 |
+
"grad_norm": 4.160903578127555,
|
| 1030 |
+
"learning_rate": 0.00023018156095260548,
|
| 1031 |
+
"loss": 2.3586,
|
| 1032 |
+
"step": 1460
|
| 1033 |
+
},
|
| 1034 |
+
{
|
| 1035 |
+
"epoch": 0.935858666242241,
|
| 1036 |
+
"grad_norm": 3.7275531046661805,
|
| 1037 |
+
"learning_rate": 0.0002294741806177788,
|
| 1038 |
+
"loss": 2.4684,
|
| 1039 |
+
"step": 1470
|
| 1040 |
+
},
|
| 1041 |
+
{
|
| 1042 |
+
"epoch": 0.9422250517268821,
|
| 1043 |
+
"grad_norm": 3.5804971221330515,
|
| 1044 |
+
"learning_rate": 0.00022876680028295211,
|
| 1045 |
+
"loss": 2.3984,
|
| 1046 |
+
"step": 1480
|
| 1047 |
+
},
|
| 1048 |
+
{
|
| 1049 |
+
"epoch": 0.9485914372115232,
|
| 1050 |
+
"grad_norm": 2.903402028010888,
|
| 1051 |
+
"learning_rate": 0.00022805941994812542,
|
| 1052 |
+
"loss": 2.3508,
|
| 1053 |
+
"step": 1490
|
| 1054 |
+
},
|
| 1055 |
+
{
|
| 1056 |
+
"epoch": 0.9549578226961642,
|
| 1057 |
+
"grad_norm": 3.2883720153819804,
|
| 1058 |
+
"learning_rate": 0.00022735203961329875,
|
| 1059 |
+
"loss": 2.468,
|
| 1060 |
+
"step": 1500
|
| 1061 |
+
},
|
| 1062 |
+
{
|
| 1063 |
+
"epoch": 0.9613242081808053,
|
| 1064 |
+
"grad_norm": 3.165068282067837,
|
| 1065 |
+
"learning_rate": 0.00022664465927847203,
|
| 1066 |
+
"loss": 2.3387,
|
| 1067 |
+
"step": 1510
|
| 1068 |
+
},
|
| 1069 |
+
{
|
| 1070 |
+
"epoch": 0.9676905936654464,
|
| 1071 |
+
"grad_norm": 2.8318847580527895,
|
| 1072 |
+
"learning_rate": 0.00022593727894364534,
|
| 1073 |
+
"loss": 2.235,
|
| 1074 |
+
"step": 1520
|
| 1075 |
+
},
|
| 1076 |
+
{
|
| 1077 |
+
"epoch": 0.9740569791500875,
|
| 1078 |
+
"grad_norm": 3.0627223359274556,
|
| 1079 |
+
"learning_rate": 0.00022522989860881867,
|
| 1080 |
+
"loss": 2.4135,
|
| 1081 |
+
"step": 1530
|
| 1082 |
+
},
|
| 1083 |
+
{
|
| 1084 |
+
"epoch": 0.9804233646347287,
|
| 1085 |
+
"grad_norm": 4.63667156924246,
|
| 1086 |
+
"learning_rate": 0.00022452251827399198,
|
| 1087 |
+
"loss": 2.3891,
|
| 1088 |
+
"step": 1540
|
| 1089 |
+
},
|
| 1090 |
+
{
|
| 1091 |
+
"epoch": 0.9867897501193698,
|
| 1092 |
+
"grad_norm": 2.7155003830350735,
|
| 1093 |
+
"learning_rate": 0.00022381513793916526,
|
| 1094 |
+
"loss": 2.2814,
|
| 1095 |
+
"step": 1550
|
| 1096 |
+
},
|
| 1097 |
+
{
|
| 1098 |
+
"epoch": 0.9931561356040108,
|
| 1099 |
+
"grad_norm": 3.743790594304019,
|
| 1100 |
+
"learning_rate": 0.00022310775760433856,
|
| 1101 |
+
"loss": 2.1729,
|
| 1102 |
+
"step": 1560
|
| 1103 |
+
},
|
| 1104 |
+
{
|
| 1105 |
+
"epoch": 0.9995225210886519,
|
| 1106 |
+
"grad_norm": 3.0964479659673336,
|
| 1107 |
+
"learning_rate": 0.0002224003772695119,
|
| 1108 |
+
"loss": 2.3365,
|
| 1109 |
+
"step": 1570
|
| 1110 |
+
},
|
| 1111 |
+
{
|
| 1112 |
+
"epoch": 1.005729746936177,
|
| 1113 |
+
"grad_norm": 3.9150118918426307,
|
| 1114 |
+
"learning_rate": 0.0002216929969346852,
|
| 1115 |
+
"loss": 1.9852,
|
| 1116 |
+
"step": 1580
|
| 1117 |
+
},
|
| 1118 |
+
{
|
| 1119 |
+
"epoch": 1.012096132420818,
|
| 1120 |
+
"grad_norm": 3.5380613834183614,
|
| 1121 |
+
"learning_rate": 0.0002209856165998585,
|
| 1122 |
+
"loss": 2.0525,
|
| 1123 |
+
"step": 1590
|
| 1124 |
+
},
|
| 1125 |
+
{
|
| 1126 |
+
"epoch": 1.0184625179054592,
|
| 1127 |
+
"grad_norm": 3.1487817928894613,
|
| 1128 |
+
"learning_rate": 0.00022027823626503184,
|
| 1129 |
+
"loss": 1.9064,
|
| 1130 |
+
"step": 1600
|
| 1131 |
+
},
|
| 1132 |
+
{
|
| 1133 |
+
"epoch": 1.0248289033901004,
|
| 1134 |
+
"grad_norm": 3.266369156342291,
|
| 1135 |
+
"learning_rate": 0.00021957085593020512,
|
| 1136 |
+
"loss": 1.8943,
|
| 1137 |
+
"step": 1610
|
| 1138 |
+
},
|
| 1139 |
+
{
|
| 1140 |
+
"epoch": 1.0311952888747413,
|
| 1141 |
+
"grad_norm": 3.4336556947723307,
|
| 1142 |
+
"learning_rate": 0.00021886347559537842,
|
| 1143 |
+
"loss": 1.7861,
|
| 1144 |
+
"step": 1620
|
| 1145 |
+
},
|
| 1146 |
+
{
|
| 1147 |
+
"epoch": 1.0375616743593825,
|
| 1148 |
+
"grad_norm": 3.832267113304745,
|
| 1149 |
+
"learning_rate": 0.00021815609526055173,
|
| 1150 |
+
"loss": 2.0424,
|
| 1151 |
+
"step": 1630
|
| 1152 |
+
},
|
| 1153 |
+
{
|
| 1154 |
+
"epoch": 1.0439280598440235,
|
| 1155 |
+
"grad_norm": 4.130087016761162,
|
| 1156 |
+
"learning_rate": 0.00021744871492572506,
|
| 1157 |
+
"loss": 1.9139,
|
| 1158 |
+
"step": 1640
|
| 1159 |
+
},
|
| 1160 |
+
{
|
| 1161 |
+
"epoch": 1.0502944453286647,
|
| 1162 |
+
"grad_norm": 2.7335284776977886,
|
| 1163 |
+
"learning_rate": 0.00021674133459089834,
|
| 1164 |
+
"loss": 2.0488,
|
| 1165 |
+
"step": 1650
|
| 1166 |
+
},
|
| 1167 |
+
{
|
| 1168 |
+
"epoch": 1.0566608308133056,
|
| 1169 |
+
"grad_norm": 3.329599622048459,
|
| 1170 |
+
"learning_rate": 0.00021603395425607165,
|
| 1171 |
+
"loss": 1.9137,
|
| 1172 |
+
"step": 1660
|
| 1173 |
+
},
|
| 1174 |
+
{
|
| 1175 |
+
"epoch": 1.0630272162979468,
|
| 1176 |
+
"grad_norm": 3.6314777543543313,
|
| 1177 |
+
"learning_rate": 0.00021532657392124498,
|
| 1178 |
+
"loss": 1.9768,
|
| 1179 |
+
"step": 1670
|
| 1180 |
+
},
|
| 1181 |
+
{
|
| 1182 |
+
"epoch": 1.069393601782588,
|
| 1183 |
+
"grad_norm": 4.218111606262662,
|
| 1184 |
+
"learning_rate": 0.00021461919358641828,
|
| 1185 |
+
"loss": 2.0141,
|
| 1186 |
+
"step": 1680
|
| 1187 |
+
},
|
| 1188 |
+
{
|
| 1189 |
+
"epoch": 1.075759987267229,
|
| 1190 |
+
"grad_norm": 2.895306844768361,
|
| 1191 |
+
"learning_rate": 0.0002139118132515916,
|
| 1192 |
+
"loss": 1.9783,
|
| 1193 |
+
"step": 1690
|
| 1194 |
+
},
|
| 1195 |
+
{
|
| 1196 |
+
"epoch": 1.0821263727518702,
|
| 1197 |
+
"grad_norm": 3.753588342038039,
|
| 1198 |
+
"learning_rate": 0.00021320443291676492,
|
| 1199 |
+
"loss": 2.0227,
|
| 1200 |
+
"step": 1700
|
| 1201 |
+
},
|
| 1202 |
+
{
|
| 1203 |
+
"epoch": 1.0884927582365111,
|
| 1204 |
+
"grad_norm": 3.250518576003523,
|
| 1205 |
+
"learning_rate": 0.0002124970525819382,
|
| 1206 |
+
"loss": 1.8848,
|
| 1207 |
+
"step": 1710
|
| 1208 |
+
},
|
| 1209 |
+
{
|
| 1210 |
+
"epoch": 1.0948591437211523,
|
| 1211 |
+
"grad_norm": 2.980988290019129,
|
| 1212 |
+
"learning_rate": 0.0002117896722471115,
|
| 1213 |
+
"loss": 1.867,
|
| 1214 |
+
"step": 1720
|
| 1215 |
+
},
|
| 1216 |
+
{
|
| 1217 |
+
"epoch": 1.1012255292057933,
|
| 1218 |
+
"grad_norm": 3.3311589155605263,
|
| 1219 |
+
"learning_rate": 0.0002110822919122848,
|
| 1220 |
+
"loss": 1.8766,
|
| 1221 |
+
"step": 1730
|
| 1222 |
+
},
|
| 1223 |
+
{
|
| 1224 |
+
"epoch": 1.1075919146904345,
|
| 1225 |
+
"grad_norm": 3.2929109952092523,
|
| 1226 |
+
"learning_rate": 0.00021037491157745815,
|
| 1227 |
+
"loss": 2.0685,
|
| 1228 |
+
"step": 1740
|
| 1229 |
+
},
|
| 1230 |
+
{
|
| 1231 |
+
"epoch": 1.1139583001750757,
|
| 1232 |
+
"grad_norm": 3.8495434375573243,
|
| 1233 |
+
"learning_rate": 0.00020966753124263143,
|
| 1234 |
+
"loss": 1.8662,
|
| 1235 |
+
"step": 1750
|
| 1236 |
+
},
|
| 1237 |
+
{
|
| 1238 |
+
"epoch": 1.1203246856597167,
|
| 1239 |
+
"grad_norm": 3.223669203555661,
|
| 1240 |
+
"learning_rate": 0.00020896015090780473,
|
| 1241 |
+
"loss": 1.9401,
|
| 1242 |
+
"step": 1760
|
| 1243 |
+
},
|
| 1244 |
+
{
|
| 1245 |
+
"epoch": 1.1266910711443578,
|
| 1246 |
+
"grad_norm": 3.068725890159831,
|
| 1247 |
+
"learning_rate": 0.00020825277057297806,
|
| 1248 |
+
"loss": 1.9732,
|
| 1249 |
+
"step": 1770
|
| 1250 |
+
},
|
| 1251 |
+
{
|
| 1252 |
+
"epoch": 1.1330574566289988,
|
| 1253 |
+
"grad_norm": 3.7652954958158724,
|
| 1254 |
+
"learning_rate": 0.00020754539023815137,
|
| 1255 |
+
"loss": 1.9264,
|
| 1256 |
+
"step": 1780
|
| 1257 |
+
},
|
| 1258 |
+
{
|
| 1259 |
+
"epoch": 1.13942384211364,
|
| 1260 |
+
"grad_norm": 3.283263110696873,
|
| 1261 |
+
"learning_rate": 0.00020683800990332468,
|
| 1262 |
+
"loss": 1.8805,
|
| 1263 |
+
"step": 1790
|
| 1264 |
+
},
|
| 1265 |
+
{
|
| 1266 |
+
"epoch": 1.145790227598281,
|
| 1267 |
+
"grad_norm": 3.578786877708257,
|
| 1268 |
+
"learning_rate": 0.00020613062956849795,
|
| 1269 |
+
"loss": 1.8764,
|
| 1270 |
+
"step": 1800
|
| 1271 |
+
},
|
| 1272 |
+
{
|
| 1273 |
+
"epoch": 1.1521566130829222,
|
| 1274 |
+
"grad_norm": 3.2073175602979402,
|
| 1275 |
+
"learning_rate": 0.0002054232492336713,
|
| 1276 |
+
"loss": 1.9123,
|
| 1277 |
+
"step": 1810
|
| 1278 |
+
},
|
| 1279 |
+
{
|
| 1280 |
+
"epoch": 1.1585229985675634,
|
| 1281 |
+
"grad_norm": 3.960679432169151,
|
| 1282 |
+
"learning_rate": 0.0002047158688988446,
|
| 1283 |
+
"loss": 1.8938,
|
| 1284 |
+
"step": 1820
|
| 1285 |
+
},
|
| 1286 |
+
{
|
| 1287 |
+
"epoch": 1.1648893840522043,
|
| 1288 |
+
"grad_norm": 3.026836467606075,
|
| 1289 |
+
"learning_rate": 0.0002040084885640179,
|
| 1290 |
+
"loss": 1.9291,
|
| 1291 |
+
"step": 1830
|
| 1292 |
+
},
|
| 1293 |
+
{
|
| 1294 |
+
"epoch": 1.1712557695368455,
|
| 1295 |
+
"grad_norm": 3.368777784279614,
|
| 1296 |
+
"learning_rate": 0.00020330110822919123,
|
| 1297 |
+
"loss": 1.9459,
|
| 1298 |
+
"step": 1840
|
| 1299 |
+
},
|
| 1300 |
+
{
|
| 1301 |
+
"epoch": 1.1776221550214865,
|
| 1302 |
+
"grad_norm": 2.843063910159576,
|
| 1303 |
+
"learning_rate": 0.0002025937278943645,
|
| 1304 |
+
"loss": 1.9449,
|
| 1305 |
+
"step": 1850
|
| 1306 |
+
},
|
| 1307 |
+
{
|
| 1308 |
+
"epoch": 1.1839885405061277,
|
| 1309 |
+
"grad_norm": 2.9510127362455876,
|
| 1310 |
+
"learning_rate": 0.00020188634755953782,
|
| 1311 |
+
"loss": 1.9309,
|
| 1312 |
+
"step": 1860
|
| 1313 |
+
},
|
| 1314 |
+
{
|
| 1315 |
+
"epoch": 1.1903549259907686,
|
| 1316 |
+
"grad_norm": 4.545581163313047,
|
| 1317 |
+
"learning_rate": 0.00020117896722471115,
|
| 1318 |
+
"loss": 1.8869,
|
| 1319 |
+
"step": 1870
|
| 1320 |
+
},
|
| 1321 |
+
{
|
| 1322 |
+
"epoch": 1.1967213114754098,
|
| 1323 |
+
"grad_norm": 3.301260365676958,
|
| 1324 |
+
"learning_rate": 0.00020047158688988445,
|
| 1325 |
+
"loss": 1.9613,
|
| 1326 |
+
"step": 1880
|
| 1327 |
+
},
|
| 1328 |
+
{
|
| 1329 |
+
"epoch": 1.203087696960051,
|
| 1330 |
+
"grad_norm": 3.299718394999854,
|
| 1331 |
+
"learning_rate": 0.00019976420655505776,
|
| 1332 |
+
"loss": 2.0072,
|
| 1333 |
+
"step": 1890
|
| 1334 |
+
},
|
| 1335 |
+
{
|
| 1336 |
+
"epoch": 1.209454082444692,
|
| 1337 |
+
"grad_norm": 3.5617690109472444,
|
| 1338 |
+
"learning_rate": 0.00019905682622023104,
|
| 1339 |
+
"loss": 1.9713,
|
| 1340 |
+
"step": 1900
|
| 1341 |
+
},
|
| 1342 |
+
{
|
| 1343 |
+
"epoch": 1.2158204679293332,
|
| 1344 |
+
"grad_norm": 3.1359097580279767,
|
| 1345 |
+
"learning_rate": 0.00019834944588540437,
|
| 1346 |
+
"loss": 1.8154,
|
| 1347 |
+
"step": 1910
|
| 1348 |
+
},
|
| 1349 |
+
{
|
| 1350 |
+
"epoch": 1.2221868534139742,
|
| 1351 |
+
"grad_norm": 3.0984711664236206,
|
| 1352 |
+
"learning_rate": 0.00019764206555057768,
|
| 1353 |
+
"loss": 1.8568,
|
| 1354 |
+
"step": 1920
|
| 1355 |
+
},
|
| 1356 |
+
{
|
| 1357 |
+
"epoch": 1.2285532388986153,
|
| 1358 |
+
"grad_norm": 2.842733095279462,
|
| 1359 |
+
"learning_rate": 0.00019693468521575098,
|
| 1360 |
+
"loss": 1.851,
|
| 1361 |
+
"step": 1930
|
| 1362 |
+
},
|
| 1363 |
+
{
|
| 1364 |
+
"epoch": 1.2349196243832563,
|
| 1365 |
+
"grad_norm": 2.935936669675825,
|
| 1366 |
+
"learning_rate": 0.00019622730488092432,
|
| 1367 |
+
"loss": 1.9604,
|
| 1368 |
+
"step": 1940
|
| 1369 |
+
},
|
| 1370 |
+
{
|
| 1371 |
+
"epoch": 1.2412860098678975,
|
| 1372 |
+
"grad_norm": 3.3716657028276096,
|
| 1373 |
+
"learning_rate": 0.0001955199245460976,
|
| 1374 |
+
"loss": 1.9171,
|
| 1375 |
+
"step": 1950
|
| 1376 |
+
},
|
| 1377 |
+
{
|
| 1378 |
+
"epoch": 1.2476523953525387,
|
| 1379 |
+
"grad_norm": 2.9604032685493133,
|
| 1380 |
+
"learning_rate": 0.0001948125442112709,
|
| 1381 |
+
"loss": 1.8604,
|
| 1382 |
+
"step": 1960
|
| 1383 |
+
},
|
| 1384 |
+
{
|
| 1385 |
+
"epoch": 1.2540187808371797,
|
| 1386 |
+
"grad_norm": 2.7269826434015427,
|
| 1387 |
+
"learning_rate": 0.0001941051638764442,
|
| 1388 |
+
"loss": 1.9076,
|
| 1389 |
+
"step": 1970
|
| 1390 |
+
},
|
| 1391 |
+
{
|
| 1392 |
+
"epoch": 1.2603851663218208,
|
| 1393 |
+
"grad_norm": 4.046544087868519,
|
| 1394 |
+
"learning_rate": 0.00019339778354161754,
|
| 1395 |
+
"loss": 1.8299,
|
| 1396 |
+
"step": 1980
|
| 1397 |
+
},
|
| 1398 |
+
{
|
| 1399 |
+
"epoch": 1.2667515518064618,
|
| 1400 |
+
"grad_norm": 3.12579708206849,
|
| 1401 |
+
"learning_rate": 0.00019269040320679084,
|
| 1402 |
+
"loss": 1.7545,
|
| 1403 |
+
"step": 1990
|
| 1404 |
+
},
|
| 1405 |
+
{
|
| 1406 |
+
"epoch": 1.273117937291103,
|
| 1407 |
+
"grad_norm": 2.7391520471543225,
|
| 1408 |
+
"learning_rate": 0.00019198302287196412,
|
| 1409 |
+
"loss": 1.8973,
|
| 1410 |
+
"step": 2000
|
| 1411 |
+
}
|
| 1412 |
+
],
|
| 1413 |
+
"logging_steps": 10,
|
| 1414 |
+
"max_steps": 4713,
|
| 1415 |
+
"num_input_tokens_seen": 0,
|
| 1416 |
+
"num_train_epochs": 3,
|
| 1417 |
+
"save_steps": 1000,
|
| 1418 |
+
"stateful_callbacks": {
|
| 1419 |
+
"TrainerControl": {
|
| 1420 |
+
"args": {
|
| 1421 |
+
"should_epoch_stop": false,
|
| 1422 |
+
"should_evaluate": false,
|
| 1423 |
+
"should_log": false,
|
| 1424 |
+
"should_save": true,
|
| 1425 |
+
"should_training_stop": false
|
| 1426 |
+
},
|
| 1427 |
+
"attributes": {}
|
| 1428 |
+
}
|
| 1429 |
+
},
|
| 1430 |
+
"total_flos": 0.0,
|
| 1431 |
+
"train_batch_size": 8,
|
| 1432 |
+
"trial_name": null,
|
| 1433 |
+
"trial_params": null
|
| 1434 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:12c8365fe88fec2f220ca1fdad64ae61ff90d4f89e41121cd33a79940985af89
|
| 3 |
+
size 8273
|
zero_to_fp32.py
ADDED
|
@@ -0,0 +1,760 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 ZERO_STAGE not 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("Extracting fp32 weights")
|
| 713 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
|
| 714 |
+
|
| 715 |
+
logger.info("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)
|