Chrislu commited on
Commit
4ba380a
1 Parent(s): ec051f3

Upload 21 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "output_512_5_128_512_2024-09-14_00_34_39/checkpoint-1800",
3
+ "architectures": [
4
+ "XLMRobertaModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "eos_token_id": 2,
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 1024,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 4096,
15
+ "layer_norm_eps": 1e-05,
16
+ "max_position_embeddings": 8194,
17
+ "model_type": "xlm-roberta",
18
+ "num_attention_heads": 16,
19
+ "num_hidden_layers": 24,
20
+ "output_past": true,
21
+ "pad_token_id": 1,
22
+ "position_embedding_type": "absolute",
23
+ "torch_dtype": "float32",
24
+ "transformers_version": "4.44.2",
25
+ "type_vocab_size": 1,
26
+ "use_cache": true,
27
+ "vocab_size": 250002
28
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.0.1",
4
+ "transformers": "4.44.2",
5
+ "pytorch": "2.4.0+cu121"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": null
10
+ }
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step1800
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dc2a3500e68193e6a4b729099f9948784494958e3b47d445d1dc5b77e292e573
3
+ size 2271064456
modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.models.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.models.Pooling"
13
+ },
14
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.models.Normalize"
19
+ }
20
+ ]
rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b33a678e34c66e4da53e59cbd8dd47a71ae2d329209a412fb9c728f82d14ad5c
3
+ size 15920
rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a4f0546d7d1507f688beed3b4cea3bf5aeab8be5a5873319727b234f4b99591
3
+ size 15984
rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5be152bbf9a1384690b2e53d0b9225070b15ff4253005a0a00d1d84fda18a657
3
+ size 15920
rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:de500c8dc8790507d03510ab8a988161ac6b457b77ed3e7875f16cfc409c5d0c
3
+ size 15920
rng_state_4.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e77a3fa840d0c94f0fc7592dfad9acd21eef0226b2aa18b01e64db3d365c8fc
3
+ size 15920
rng_state_5.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df35156e206ea5f264395ab1c05e517ee4ed00b5349f936e8262bbfc80a3a21c
3
+ size 15920
rng_state_6.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afc5a40fb09a92400220ff44760e3a2bf7c1dedfc915d2b27adcef332442bbdc
3
+ size 15984
rng_state_7.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b50067d819f8d4ed5350b6579df557cb626480d0f9d23fe4ae343de4d1c3ba8
3
+ size 15920
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 8192,
3
+ "do_lower_case": false
4
+ }
sentencepiece.bpe.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
3
+ size 5069051
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b74659c780d49afad7a7b9799868f75cbd3014fb6c34956e85a793028d38094a
3
+ size 17098251
tokenizer_config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "250001": {
36
+ "content": "<mask>",
37
+ "lstrip": true,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "<s>",
45
+ "clean_up_tokenization_spaces": true,
46
+ "cls_token": "<s>",
47
+ "eos_token": "</s>",
48
+ "mask_token": "<mask>",
49
+ "model_max_length": 8192,
50
+ "pad_token": "<pad>",
51
+ "sep_token": "</s>",
52
+ "sp_model_kwargs": {},
53
+ "tokenizer_class": "XLMRobertaTokenizer",
54
+ "unk_token": "<unk>"
55
+ }
trainer_state.json ADDED
@@ -0,0 +1,1293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 3.098106712564544,
5
+ "eval_steps": 500,
6
+ "global_step": 1800,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.01721170395869191,
13
+ "grad_norm": 0.29955029487609863,
14
+ "learning_rate": 2.0293089116901574e-06,
15
+ "loss": 0.6322,
16
+ "step": 10
17
+ },
18
+ {
19
+ "epoch": 0.03442340791738382,
20
+ "grad_norm": 0.06169761344790459,
21
+ "learning_rate": 2.6401917645771237e-06,
22
+ "loss": 0.4697,
23
+ "step": 20
24
+ },
25
+ {
26
+ "epoch": 0.05163511187607573,
27
+ "grad_norm": 0.051926977932453156,
28
+ "learning_rate": 2.9975353258495578e-06,
29
+ "loss": 0.5617,
30
+ "step": 30
31
+ },
32
+ {
33
+ "epoch": 0.06884681583476764,
34
+ "grad_norm": 0.07096195966005325,
35
+ "learning_rate": 3.25107461746409e-06,
36
+ "loss": 0.4301,
37
+ "step": 40
38
+ },
39
+ {
40
+ "epoch": 0.08605851979345955,
41
+ "grad_norm": 0.06899057328701019,
42
+ "learning_rate": 3.4477349704933476e-06,
43
+ "loss": 0.4905,
44
+ "step": 50
45
+ },
46
+ {
47
+ "epoch": 0.10327022375215146,
48
+ "grad_norm": 0.08537387102842331,
49
+ "learning_rate": 3.6084181787365237e-06,
50
+ "loss": 0.4551,
51
+ "step": 60
52
+ },
53
+ {
54
+ "epoch": 0.12048192771084337,
55
+ "grad_norm": 0.049780745059251785,
56
+ "learning_rate": 3.7442738955429737e-06,
57
+ "loss": 0.4058,
58
+ "step": 70
59
+ },
60
+ {
61
+ "epoch": 0.13769363166953527,
62
+ "grad_norm": 0.04421038553118706,
63
+ "learning_rate": 3.861957470351056e-06,
64
+ "loss": 0.6748,
65
+ "step": 80
66
+ },
67
+ {
68
+ "epoch": 0.1549053356282272,
69
+ "grad_norm": 1.9084473848342896,
70
+ "learning_rate": 3.965761740008958e-06,
71
+ "loss": 0.8719,
72
+ "step": 90
73
+ },
74
+ {
75
+ "epoch": 0.1721170395869191,
76
+ "grad_norm": 0.08046019077301025,
77
+ "learning_rate": 4.058617823380315e-06,
78
+ "loss": 0.4635,
79
+ "step": 100
80
+ },
81
+ {
82
+ "epoch": 0.18932874354561102,
83
+ "grad_norm": 0.21439455449581146,
84
+ "learning_rate": 4.142616368250685e-06,
85
+ "loss": 0.928,
86
+ "step": 110
87
+ },
88
+ {
89
+ "epoch": 0.20654044750430292,
90
+ "grad_norm": 0.06055545434355736,
91
+ "learning_rate": 4.21930103162349e-06,
92
+ "loss": 0.3721,
93
+ "step": 120
94
+ },
95
+ {
96
+ "epoch": 0.22375215146299485,
97
+ "grad_norm": 0.08670035004615784,
98
+ "learning_rate": 4.289844083644429e-06,
99
+ "loss": 0.7536,
100
+ "step": 130
101
+ },
102
+ {
103
+ "epoch": 0.24096385542168675,
104
+ "grad_norm": 0.06118405610322952,
105
+ "learning_rate": 4.355156748429939e-06,
106
+ "loss": 0.9829,
107
+ "step": 140
108
+ },
109
+ {
110
+ "epoch": 0.25817555938037867,
111
+ "grad_norm": 0.04853704199194908,
112
+ "learning_rate": 4.415961384652748e-06,
113
+ "loss": 0.4444,
114
+ "step": 150
115
+ },
116
+ {
117
+ "epoch": 0.27538726333907054,
118
+ "grad_norm": 0.03537767753005028,
119
+ "learning_rate": 4.472840323238023e-06,
120
+ "loss": 0.5064,
121
+ "step": 160
122
+ },
123
+ {
124
+ "epoch": 0.29259896729776247,
125
+ "grad_norm": 0.06154410541057587,
126
+ "learning_rate": 4.52626987322263e-06,
127
+ "loss": 0.5456,
128
+ "step": 170
129
+ },
130
+ {
131
+ "epoch": 0.3098106712564544,
132
+ "grad_norm": 0.052560485899448395,
133
+ "learning_rate": 4.576644592895925e-06,
134
+ "loss": 0.5106,
135
+ "step": 180
136
+ },
137
+ {
138
+ "epoch": 0.3270223752151463,
139
+ "grad_norm": 0.04913010448217392,
140
+ "learning_rate": 4.6242949899596115e-06,
141
+ "loss": 0.4026,
142
+ "step": 190
143
+ },
144
+ {
145
+ "epoch": 0.3442340791738382,
146
+ "grad_norm": 0.07974158972501755,
147
+ "learning_rate": 4.66950067626728e-06,
148
+ "loss": 0.4828,
149
+ "step": 200
150
+ },
151
+ {
152
+ "epoch": 0.3614457831325301,
153
+ "grad_norm": 0.03538183122873306,
154
+ "learning_rate": 4.712500309702374e-06,
155
+ "loss": 0.3549,
156
+ "step": 210
157
+ },
158
+ {
159
+ "epoch": 0.37865748709122204,
160
+ "grad_norm": 0.21638496220111847,
161
+ "learning_rate": 4.753499221137652e-06,
162
+ "loss": 0.4912,
163
+ "step": 220
164
+ },
165
+ {
166
+ "epoch": 0.3958691910499139,
167
+ "grad_norm": 0.03895362466573715,
168
+ "learning_rate": 4.792675344617211e-06,
169
+ "loss": 0.3846,
170
+ "step": 230
171
+ },
172
+ {
173
+ "epoch": 0.41308089500860584,
174
+ "grad_norm": 0.03565879911184311,
175
+ "learning_rate": 4.830183884510456e-06,
176
+ "loss": 0.8434,
177
+ "step": 240
178
+ },
179
+ {
180
+ "epoch": 0.43029259896729777,
181
+ "grad_norm": 0.03526683151721954,
182
+ "learning_rate": 4.866161029296539e-06,
183
+ "loss": 0.3603,
184
+ "step": 250
185
+ },
186
+ {
187
+ "epoch": 0.4475043029259897,
188
+ "grad_norm": 0.064102903008461,
189
+ "learning_rate": 4.900726936531396e-06,
190
+ "loss": 0.5178,
191
+ "step": 260
192
+ },
193
+ {
194
+ "epoch": 0.46471600688468157,
195
+ "grad_norm": 0.06982860714197159,
196
+ "learning_rate": 4.9339881541683585e-06,
197
+ "loss": 0.3712,
198
+ "step": 270
199
+ },
200
+ {
201
+ "epoch": 0.4819277108433735,
202
+ "grad_norm": 0.0654272809624672,
203
+ "learning_rate": 4.966039601316906e-06,
204
+ "loss": 0.9119,
205
+ "step": 280
206
+ },
207
+ {
208
+ "epoch": 0.4991394148020654,
209
+ "grad_norm": 0.04955059662461281,
210
+ "learning_rate": 4.9969662012643525e-06,
211
+ "loss": 0.3874,
212
+ "step": 290
213
+ },
214
+ {
215
+ "epoch": 0.5163511187607573,
216
+ "grad_norm": 1.0234352350234985,
217
+ "learning_rate": 4.984697781178272e-06,
218
+ "loss": 0.8952,
219
+ "step": 300
220
+ },
221
+ {
222
+ "epoch": 0.5335628227194492,
223
+ "grad_norm": 0.03769606724381447,
224
+ "learning_rate": 4.96557000765111e-06,
225
+ "loss": 0.3347,
226
+ "step": 310
227
+ },
228
+ {
229
+ "epoch": 0.5507745266781411,
230
+ "grad_norm": 0.11739111691713333,
231
+ "learning_rate": 4.946442234123948e-06,
232
+ "loss": 0.3677,
233
+ "step": 320
234
+ },
235
+ {
236
+ "epoch": 0.5679862306368331,
237
+ "grad_norm": 0.04959660395979881,
238
+ "learning_rate": 4.927314460596787e-06,
239
+ "loss": 1.1762,
240
+ "step": 330
241
+ },
242
+ {
243
+ "epoch": 0.5851979345955249,
244
+ "grad_norm": 0.1042531356215477,
245
+ "learning_rate": 4.908186687069626e-06,
246
+ "loss": 0.4252,
247
+ "step": 340
248
+ },
249
+ {
250
+ "epoch": 0.6024096385542169,
251
+ "grad_norm": 0.05064910277724266,
252
+ "learning_rate": 4.889058913542464e-06,
253
+ "loss": 0.3836,
254
+ "step": 350
255
+ },
256
+ {
257
+ "epoch": 0.6196213425129088,
258
+ "grad_norm": 0.0689607635140419,
259
+ "learning_rate": 4.869931140015303e-06,
260
+ "loss": 0.7539,
261
+ "step": 360
262
+ },
263
+ {
264
+ "epoch": 0.6368330464716007,
265
+ "grad_norm": 0.23462702333927155,
266
+ "learning_rate": 4.850803366488141e-06,
267
+ "loss": 0.8236,
268
+ "step": 370
269
+ },
270
+ {
271
+ "epoch": 0.6540447504302926,
272
+ "grad_norm": 0.11018137633800507,
273
+ "learning_rate": 4.83167559296098e-06,
274
+ "loss": 0.4839,
275
+ "step": 380
276
+ },
277
+ {
278
+ "epoch": 0.6712564543889845,
279
+ "grad_norm": 0.0751522108912468,
280
+ "learning_rate": 4.812547819433818e-06,
281
+ "loss": 0.5791,
282
+ "step": 390
283
+ },
284
+ {
285
+ "epoch": 0.6884681583476764,
286
+ "grad_norm": 0.17227555811405182,
287
+ "learning_rate": 4.793420045906657e-06,
288
+ "loss": 0.7993,
289
+ "step": 400
290
+ },
291
+ {
292
+ "epoch": 0.7056798623063684,
293
+ "grad_norm": 0.0664035975933075,
294
+ "learning_rate": 4.7742922723794954e-06,
295
+ "loss": 0.387,
296
+ "step": 410
297
+ },
298
+ {
299
+ "epoch": 0.7228915662650602,
300
+ "grad_norm": 0.04762504622340202,
301
+ "learning_rate": 4.755164498852334e-06,
302
+ "loss": 0.5436,
303
+ "step": 420
304
+ },
305
+ {
306
+ "epoch": 0.7401032702237521,
307
+ "grad_norm": 0.03658389300107956,
308
+ "learning_rate": 4.736036725325173e-06,
309
+ "loss": 0.6715,
310
+ "step": 430
311
+ },
312
+ {
313
+ "epoch": 0.7573149741824441,
314
+ "grad_norm": 0.03955502808094025,
315
+ "learning_rate": 4.716908951798011e-06,
316
+ "loss": 0.4902,
317
+ "step": 440
318
+ },
319
+ {
320
+ "epoch": 0.774526678141136,
321
+ "grad_norm": 0.05926811322569847,
322
+ "learning_rate": 4.69778117827085e-06,
323
+ "loss": 0.7329,
324
+ "step": 450
325
+ },
326
+ {
327
+ "epoch": 0.7917383820998278,
328
+ "grad_norm": 0.26404136419296265,
329
+ "learning_rate": 4.678653404743688e-06,
330
+ "loss": 0.5748,
331
+ "step": 460
332
+ },
333
+ {
334
+ "epoch": 0.8089500860585198,
335
+ "grad_norm": 0.07195431739091873,
336
+ "learning_rate": 4.6595256312165265e-06,
337
+ "loss": 0.5501,
338
+ "step": 470
339
+ },
340
+ {
341
+ "epoch": 0.8261617900172117,
342
+ "grad_norm": 0.0486939400434494,
343
+ "learning_rate": 4.640397857689365e-06,
344
+ "loss": 0.4527,
345
+ "step": 480
346
+ },
347
+ {
348
+ "epoch": 0.8433734939759037,
349
+ "grad_norm": 0.05488497018814087,
350
+ "learning_rate": 4.621270084162204e-06,
351
+ "loss": 0.8637,
352
+ "step": 490
353
+ },
354
+ {
355
+ "epoch": 0.8605851979345955,
356
+ "grad_norm": 0.045418575406074524,
357
+ "learning_rate": 4.6021423106350425e-06,
358
+ "loss": 0.437,
359
+ "step": 500
360
+ },
361
+ {
362
+ "epoch": 0.8777969018932874,
363
+ "grad_norm": 0.04055708646774292,
364
+ "learning_rate": 4.583014537107881e-06,
365
+ "loss": 0.6466,
366
+ "step": 510
367
+ },
368
+ {
369
+ "epoch": 0.8950086058519794,
370
+ "grad_norm": 0.03856475651264191,
371
+ "learning_rate": 4.563886763580719e-06,
372
+ "loss": 0.669,
373
+ "step": 520
374
+ },
375
+ {
376
+ "epoch": 0.9122203098106713,
377
+ "grad_norm": 0.035741958767175674,
378
+ "learning_rate": 4.5447589900535585e-06,
379
+ "loss": 0.3615,
380
+ "step": 530
381
+ },
382
+ {
383
+ "epoch": 0.9294320137693631,
384
+ "grad_norm": 0.04278489947319031,
385
+ "learning_rate": 4.525631216526396e-06,
386
+ "loss": 0.3849,
387
+ "step": 540
388
+ },
389
+ {
390
+ "epoch": 0.9466437177280551,
391
+ "grad_norm": 0.031775712966918945,
392
+ "learning_rate": 4.506503442999236e-06,
393
+ "loss": 0.6446,
394
+ "step": 550
395
+ },
396
+ {
397
+ "epoch": 0.963855421686747,
398
+ "grad_norm": 0.19989252090454102,
399
+ "learning_rate": 4.487375669472074e-06,
400
+ "loss": 0.6668,
401
+ "step": 560
402
+ },
403
+ {
404
+ "epoch": 0.9810671256454389,
405
+ "grad_norm": 0.04056662693619728,
406
+ "learning_rate": 4.468247895944912e-06,
407
+ "loss": 0.4243,
408
+ "step": 570
409
+ },
410
+ {
411
+ "epoch": 0.9982788296041308,
412
+ "grad_norm": 0.06392610818147659,
413
+ "learning_rate": 4.449120122417751e-06,
414
+ "loss": 0.3431,
415
+ "step": 580
416
+ },
417
+ {
418
+ "epoch": 1.0154905335628228,
419
+ "grad_norm": 0.03935154527425766,
420
+ "learning_rate": 4.42999234889059e-06,
421
+ "loss": 0.5167,
422
+ "step": 590
423
+ },
424
+ {
425
+ "epoch": 1.0327022375215147,
426
+ "grad_norm": 0.05566889047622681,
427
+ "learning_rate": 4.410864575363428e-06,
428
+ "loss": 0.4372,
429
+ "step": 600
430
+ },
431
+ {
432
+ "epoch": 1.0499139414802066,
433
+ "grad_norm": 0.07127536088228226,
434
+ "learning_rate": 4.391736801836267e-06,
435
+ "loss": 1.4152,
436
+ "step": 610
437
+ },
438
+ {
439
+ "epoch": 1.0671256454388984,
440
+ "grad_norm": 0.04618392139673233,
441
+ "learning_rate": 4.372609028309105e-06,
442
+ "loss": 0.601,
443
+ "step": 620
444
+ },
445
+ {
446
+ "epoch": 1.0843373493975903,
447
+ "grad_norm": 0.04588570445775986,
448
+ "learning_rate": 4.3534812547819434e-06,
449
+ "loss": 0.4723,
450
+ "step": 630
451
+ },
452
+ {
453
+ "epoch": 1.1015490533562822,
454
+ "grad_norm": 0.03991321101784706,
455
+ "learning_rate": 4.334353481254782e-06,
456
+ "loss": 0.4807,
457
+ "step": 640
458
+ },
459
+ {
460
+ "epoch": 1.1187607573149743,
461
+ "grad_norm": 0.2501582205295563,
462
+ "learning_rate": 4.315225707727621e-06,
463
+ "loss": 0.8098,
464
+ "step": 650
465
+ },
466
+ {
467
+ "epoch": 1.1359724612736661,
468
+ "grad_norm": 0.042163778096437454,
469
+ "learning_rate": 4.296097934200459e-06,
470
+ "loss": 0.4158,
471
+ "step": 660
472
+ },
473
+ {
474
+ "epoch": 1.153184165232358,
475
+ "grad_norm": 0.04054609313607216,
476
+ "learning_rate": 4.276970160673298e-06,
477
+ "loss": 0.3728,
478
+ "step": 670
479
+ },
480
+ {
481
+ "epoch": 1.1703958691910499,
482
+ "grad_norm": 0.0925000011920929,
483
+ "learning_rate": 4.257842387146137e-06,
484
+ "loss": 0.4251,
485
+ "step": 680
486
+ },
487
+ {
488
+ "epoch": 1.1876075731497417,
489
+ "grad_norm": 0.06017041206359863,
490
+ "learning_rate": 4.2387146136189745e-06,
491
+ "loss": 0.4782,
492
+ "step": 690
493
+ },
494
+ {
495
+ "epoch": 1.2048192771084336,
496
+ "grad_norm": 0.040517594665288925,
497
+ "learning_rate": 4.219586840091814e-06,
498
+ "loss": 0.4354,
499
+ "step": 700
500
+ },
501
+ {
502
+ "epoch": 1.2220309810671257,
503
+ "grad_norm": 0.04731125384569168,
504
+ "learning_rate": 4.200459066564652e-06,
505
+ "loss": 0.4969,
506
+ "step": 710
507
+ },
508
+ {
509
+ "epoch": 1.2392426850258176,
510
+ "grad_norm": 0.050880610942840576,
511
+ "learning_rate": 4.1813312930374905e-06,
512
+ "loss": 0.492,
513
+ "step": 720
514
+ },
515
+ {
516
+ "epoch": 1.2564543889845095,
517
+ "grad_norm": 0.04548948258161545,
518
+ "learning_rate": 4.162203519510329e-06,
519
+ "loss": 0.3914,
520
+ "step": 730
521
+ },
522
+ {
523
+ "epoch": 1.2736660929432013,
524
+ "grad_norm": 0.03825736418366432,
525
+ "learning_rate": 4.143075745983168e-06,
526
+ "loss": 0.3921,
527
+ "step": 740
528
+ },
529
+ {
530
+ "epoch": 1.2908777969018934,
531
+ "grad_norm": 0.046227287501096725,
532
+ "learning_rate": 4.1239479724560065e-06,
533
+ "loss": 0.4632,
534
+ "step": 750
535
+ },
536
+ {
537
+ "epoch": 1.3080895008605853,
538
+ "grad_norm": 0.04002716392278671,
539
+ "learning_rate": 4.104820198928845e-06,
540
+ "loss": 0.7436,
541
+ "step": 760
542
+ },
543
+ {
544
+ "epoch": 1.3253012048192772,
545
+ "grad_norm": 0.04381329566240311,
546
+ "learning_rate": 4.085692425401683e-06,
547
+ "loss": 0.5388,
548
+ "step": 770
549
+ },
550
+ {
551
+ "epoch": 1.342512908777969,
552
+ "grad_norm": 0.09227538853883743,
553
+ "learning_rate": 4.0665646518745225e-06,
554
+ "loss": 0.7008,
555
+ "step": 780
556
+ },
557
+ {
558
+ "epoch": 1.359724612736661,
559
+ "grad_norm": 0.0453125424683094,
560
+ "learning_rate": 4.04743687834736e-06,
561
+ "loss": 0.4813,
562
+ "step": 790
563
+ },
564
+ {
565
+ "epoch": 1.3769363166953528,
566
+ "grad_norm": 0.20484060049057007,
567
+ "learning_rate": 4.0283091048202e-06,
568
+ "loss": 0.6594,
569
+ "step": 800
570
+ },
571
+ {
572
+ "epoch": 1.3941480206540446,
573
+ "grad_norm": 0.05485668033361435,
574
+ "learning_rate": 4.009181331293038e-06,
575
+ "loss": 0.6538,
576
+ "step": 810
577
+ },
578
+ {
579
+ "epoch": 1.4113597246127367,
580
+ "grad_norm": 0.04452645406126976,
581
+ "learning_rate": 3.990053557765876e-06,
582
+ "loss": 0.3713,
583
+ "step": 820
584
+ },
585
+ {
586
+ "epoch": 1.4285714285714286,
587
+ "grad_norm": 0.03632510080933571,
588
+ "learning_rate": 3.970925784238715e-06,
589
+ "loss": 0.3395,
590
+ "step": 830
591
+ },
592
+ {
593
+ "epoch": 1.4457831325301205,
594
+ "grad_norm": 0.0884113535284996,
595
+ "learning_rate": 3.951798010711554e-06,
596
+ "loss": 0.3602,
597
+ "step": 840
598
+ },
599
+ {
600
+ "epoch": 1.4629948364888123,
601
+ "grad_norm": 0.1275469958782196,
602
+ "learning_rate": 3.932670237184392e-06,
603
+ "loss": 0.4533,
604
+ "step": 850
605
+ },
606
+ {
607
+ "epoch": 1.4802065404475044,
608
+ "grad_norm": 0.03843805938959122,
609
+ "learning_rate": 3.913542463657231e-06,
610
+ "loss": 0.7519,
611
+ "step": 860
612
+ },
613
+ {
614
+ "epoch": 1.4974182444061963,
615
+ "grad_norm": 0.03635178506374359,
616
+ "learning_rate": 3.89441469013007e-06,
617
+ "loss": 0.388,
618
+ "step": 870
619
+ },
620
+ {
621
+ "epoch": 1.5146299483648882,
622
+ "grad_norm": 0.039031002670526505,
623
+ "learning_rate": 3.875286916602907e-06,
624
+ "loss": 0.4425,
625
+ "step": 880
626
+ },
627
+ {
628
+ "epoch": 1.53184165232358,
629
+ "grad_norm": 0.04110798239707947,
630
+ "learning_rate": 3.856159143075746e-06,
631
+ "loss": 0.4095,
632
+ "step": 890
633
+ },
634
+ {
635
+ "epoch": 1.549053356282272,
636
+ "grad_norm": 0.04002736508846283,
637
+ "learning_rate": 3.837031369548585e-06,
638
+ "loss": 0.6104,
639
+ "step": 900
640
+ },
641
+ {
642
+ "epoch": 1.5662650602409638,
643
+ "grad_norm": 0.03314425051212311,
644
+ "learning_rate": 3.817903596021423e-06,
645
+ "loss": 0.5594,
646
+ "step": 910
647
+ },
648
+ {
649
+ "epoch": 1.5834767641996557,
650
+ "grad_norm": 0.03947990760207176,
651
+ "learning_rate": 3.798775822494262e-06,
652
+ "loss": 0.4931,
653
+ "step": 920
654
+ },
655
+ {
656
+ "epoch": 1.6006884681583475,
657
+ "grad_norm": 0.05939627066254616,
658
+ "learning_rate": 3.7796480489671007e-06,
659
+ "loss": 0.5127,
660
+ "step": 930
661
+ },
662
+ {
663
+ "epoch": 1.6179001721170396,
664
+ "grad_norm": 0.03439631685614586,
665
+ "learning_rate": 3.760520275439939e-06,
666
+ "loss": 0.4139,
667
+ "step": 940
668
+ },
669
+ {
670
+ "epoch": 1.6351118760757315,
671
+ "grad_norm": 0.06566853076219559,
672
+ "learning_rate": 3.7413925019127776e-06,
673
+ "loss": 0.6641,
674
+ "step": 950
675
+ },
676
+ {
677
+ "epoch": 1.6523235800344234,
678
+ "grad_norm": 0.06731946766376495,
679
+ "learning_rate": 3.7222647283856163e-06,
680
+ "loss": 0.6865,
681
+ "step": 960
682
+ },
683
+ {
684
+ "epoch": 1.6695352839931155,
685
+ "grad_norm": 0.03529343381524086,
686
+ "learning_rate": 3.703136954858455e-06,
687
+ "loss": 0.6395,
688
+ "step": 970
689
+ },
690
+ {
691
+ "epoch": 1.6867469879518073,
692
+ "grad_norm": 0.09028229117393494,
693
+ "learning_rate": 3.684009181331293e-06,
694
+ "loss": 0.774,
695
+ "step": 980
696
+ },
697
+ {
698
+ "epoch": 1.7039586919104992,
699
+ "grad_norm": 0.04828124865889549,
700
+ "learning_rate": 3.664881407804132e-06,
701
+ "loss": 0.4953,
702
+ "step": 990
703
+ },
704
+ {
705
+ "epoch": 1.721170395869191,
706
+ "grad_norm": 0.050330750644207,
707
+ "learning_rate": 3.6457536342769705e-06,
708
+ "loss": 0.6435,
709
+ "step": 1000
710
+ },
711
+ {
712
+ "epoch": 1.738382099827883,
713
+ "grad_norm": 0.03781217709183693,
714
+ "learning_rate": 3.6266258607498087e-06,
715
+ "loss": 0.4538,
716
+ "step": 1010
717
+ },
718
+ {
719
+ "epoch": 1.7555938037865748,
720
+ "grad_norm": 0.053586967289447784,
721
+ "learning_rate": 3.607498087222648e-06,
722
+ "loss": 0.384,
723
+ "step": 1020
724
+ },
725
+ {
726
+ "epoch": 1.7728055077452667,
727
+ "grad_norm": 0.04280597344040871,
728
+ "learning_rate": 3.588370313695486e-06,
729
+ "loss": 0.385,
730
+ "step": 1030
731
+ },
732
+ {
733
+ "epoch": 1.7900172117039586,
734
+ "grad_norm": 0.05530484393239021,
735
+ "learning_rate": 3.5692425401683243e-06,
736
+ "loss": 0.732,
737
+ "step": 1040
738
+ },
739
+ {
740
+ "epoch": 1.8072289156626506,
741
+ "grad_norm": 0.05707624554634094,
742
+ "learning_rate": 3.5501147666411634e-06,
743
+ "loss": 0.4075,
744
+ "step": 1050
745
+ },
746
+ {
747
+ "epoch": 1.8244406196213425,
748
+ "grad_norm": 0.07795403897762299,
749
+ "learning_rate": 3.5309869931140016e-06,
750
+ "loss": 1.0486,
751
+ "step": 1060
752
+ },
753
+ {
754
+ "epoch": 1.8416523235800344,
755
+ "grad_norm": 0.08253274112939835,
756
+ "learning_rate": 3.5118592195868407e-06,
757
+ "loss": 0.7014,
758
+ "step": 1070
759
+ },
760
+ {
761
+ "epoch": 1.8588640275387265,
762
+ "grad_norm": 0.037665221840143204,
763
+ "learning_rate": 3.492731446059679e-06,
764
+ "loss": 0.5129,
765
+ "step": 1080
766
+ },
767
+ {
768
+ "epoch": 1.8760757314974184,
769
+ "grad_norm": 0.08074070513248444,
770
+ "learning_rate": 3.473603672532517e-06,
771
+ "loss": 0.6965,
772
+ "step": 1090
773
+ },
774
+ {
775
+ "epoch": 1.8932874354561102,
776
+ "grad_norm": 0.053863946348428726,
777
+ "learning_rate": 3.4544758990053563e-06,
778
+ "loss": 0.3608,
779
+ "step": 1100
780
+ },
781
+ {
782
+ "epoch": 1.910499139414802,
783
+ "grad_norm": 0.03980562463402748,
784
+ "learning_rate": 3.4353481254781945e-06,
785
+ "loss": 0.3408,
786
+ "step": 1110
787
+ },
788
+ {
789
+ "epoch": 1.927710843373494,
790
+ "grad_norm": 0.03091476857662201,
791
+ "learning_rate": 3.4162203519510336e-06,
792
+ "loss": 0.4147,
793
+ "step": 1120
794
+ },
795
+ {
796
+ "epoch": 1.9449225473321858,
797
+ "grad_norm": 0.05423520505428314,
798
+ "learning_rate": 3.399005355776588e-06,
799
+ "loss": 0.501,
800
+ "step": 1130
801
+ },
802
+ {
803
+ "epoch": 1.9621342512908777,
804
+ "grad_norm": 0.056222882121801376,
805
+ "learning_rate": 3.379877582249426e-06,
806
+ "loss": 0.6646,
807
+ "step": 1140
808
+ },
809
+ {
810
+ "epoch": 1.9793459552495696,
811
+ "grad_norm": 0.04780727997422218,
812
+ "learning_rate": 3.360749808722265e-06,
813
+ "loss": 0.4433,
814
+ "step": 1150
815
+ },
816
+ {
817
+ "epoch": 1.9965576592082617,
818
+ "grad_norm": 0.0465485118329525,
819
+ "learning_rate": 3.3416220351951034e-06,
820
+ "loss": 0.4117,
821
+ "step": 1160
822
+ },
823
+ {
824
+ "epoch": 2.0137693631669533,
825
+ "grad_norm": 0.038410015404224396,
826
+ "learning_rate": 3.3224942616679424e-06,
827
+ "loss": 0.9719,
828
+ "step": 1170
829
+ },
830
+ {
831
+ "epoch": 2.0309810671256456,
832
+ "grad_norm": 0.03839205205440521,
833
+ "learning_rate": 3.3033664881407807e-06,
834
+ "loss": 0.5383,
835
+ "step": 1180
836
+ },
837
+ {
838
+ "epoch": 2.0481927710843375,
839
+ "grad_norm": 0.05250284820795059,
840
+ "learning_rate": 3.284238714613619e-06,
841
+ "loss": 0.5573,
842
+ "step": 1190
843
+ },
844
+ {
845
+ "epoch": 2.0654044750430294,
846
+ "grad_norm": 0.05850391089916229,
847
+ "learning_rate": 3.265110941086458e-06,
848
+ "loss": 0.3652,
849
+ "step": 1200
850
+ },
851
+ {
852
+ "epoch": 2.0826161790017212,
853
+ "grad_norm": 0.03551226481795311,
854
+ "learning_rate": 3.2459831675592962e-06,
855
+ "loss": 1.1687,
856
+ "step": 1210
857
+ },
858
+ {
859
+ "epoch": 2.099827882960413,
860
+ "grad_norm": 0.035683631896972656,
861
+ "learning_rate": 3.226855394032135e-06,
862
+ "loss": 0.3377,
863
+ "step": 1220
864
+ },
865
+ {
866
+ "epoch": 2.117039586919105,
867
+ "grad_norm": 0.05406322330236435,
868
+ "learning_rate": 3.2077276205049736e-06,
869
+ "loss": 0.4614,
870
+ "step": 1230
871
+ },
872
+ {
873
+ "epoch": 2.134251290877797,
874
+ "grad_norm": 0.030787965282797813,
875
+ "learning_rate": 3.188599846977812e-06,
876
+ "loss": 0.3771,
877
+ "step": 1240
878
+ },
879
+ {
880
+ "epoch": 2.1514629948364887,
881
+ "grad_norm": 0.04496818408370018,
882
+ "learning_rate": 3.169472073450651e-06,
883
+ "loss": 0.4846,
884
+ "step": 1250
885
+ },
886
+ {
887
+ "epoch": 2.1686746987951806,
888
+ "grad_norm": 0.03633632883429527,
889
+ "learning_rate": 3.150344299923489e-06,
890
+ "loss": 0.3549,
891
+ "step": 1260
892
+ },
893
+ {
894
+ "epoch": 2.1858864027538725,
895
+ "grad_norm": 0.033117033541202545,
896
+ "learning_rate": 3.1312165263963278e-06,
897
+ "loss": 0.4224,
898
+ "step": 1270
899
+ },
900
+ {
901
+ "epoch": 2.2030981067125643,
902
+ "grad_norm": 0.04940853640437126,
903
+ "learning_rate": 3.1120887528691664e-06,
904
+ "loss": 0.6976,
905
+ "step": 1280
906
+ },
907
+ {
908
+ "epoch": 2.2203098106712567,
909
+ "grad_norm": 0.03474991396069527,
910
+ "learning_rate": 3.092960979342005e-06,
911
+ "loss": 0.5837,
912
+ "step": 1290
913
+ },
914
+ {
915
+ "epoch": 2.2375215146299485,
916
+ "grad_norm": 0.08616980165243149,
917
+ "learning_rate": 3.0738332058148433e-06,
918
+ "loss": 0.5885,
919
+ "step": 1300
920
+ },
921
+ {
922
+ "epoch": 2.2547332185886404,
923
+ "grad_norm": 0.04921899363398552,
924
+ "learning_rate": 3.054705432287682e-06,
925
+ "loss": 0.4007,
926
+ "step": 1310
927
+ },
928
+ {
929
+ "epoch": 2.2719449225473323,
930
+ "grad_norm": 0.033128101378679276,
931
+ "learning_rate": 3.0355776587605207e-06,
932
+ "loss": 0.3948,
933
+ "step": 1320
934
+ },
935
+ {
936
+ "epoch": 2.289156626506024,
937
+ "grad_norm": 0.0420563630759716,
938
+ "learning_rate": 3.016449885233359e-06,
939
+ "loss": 0.6675,
940
+ "step": 1330
941
+ },
942
+ {
943
+ "epoch": 2.306368330464716,
944
+ "grad_norm": 0.04620426893234253,
945
+ "learning_rate": 2.997322111706198e-06,
946
+ "loss": 0.3454,
947
+ "step": 1340
948
+ },
949
+ {
950
+ "epoch": 2.323580034423408,
951
+ "grad_norm": 0.031115278601646423,
952
+ "learning_rate": 2.9781943381790362e-06,
953
+ "loss": 0.4697,
954
+ "step": 1350
955
+ },
956
+ {
957
+ "epoch": 2.3407917383820998,
958
+ "grad_norm": 0.03716883435845375,
959
+ "learning_rate": 2.9590665646518745e-06,
960
+ "loss": 0.7016,
961
+ "step": 1360
962
+ },
963
+ {
964
+ "epoch": 2.3580034423407916,
965
+ "grad_norm": 0.2217116802930832,
966
+ "learning_rate": 2.9399387911247135e-06,
967
+ "loss": 0.6504,
968
+ "step": 1370
969
+ },
970
+ {
971
+ "epoch": 2.3752151462994835,
972
+ "grad_norm": 0.08799983561038971,
973
+ "learning_rate": 2.9208110175975518e-06,
974
+ "loss": 0.3518,
975
+ "step": 1380
976
+ },
977
+ {
978
+ "epoch": 2.3924268502581754,
979
+ "grad_norm": 0.03414052352309227,
980
+ "learning_rate": 2.901683244070391e-06,
981
+ "loss": 0.5522,
982
+ "step": 1390
983
+ },
984
+ {
985
+ "epoch": 2.4096385542168672,
986
+ "grad_norm": 0.14305748045444489,
987
+ "learning_rate": 2.882555470543229e-06,
988
+ "loss": 0.7692,
989
+ "step": 1400
990
+ },
991
+ {
992
+ "epoch": 2.4268502581755595,
993
+ "grad_norm": 0.04776856303215027,
994
+ "learning_rate": 2.8634276970160673e-06,
995
+ "loss": 0.4163,
996
+ "step": 1410
997
+ },
998
+ {
999
+ "epoch": 2.4440619621342514,
1000
+ "grad_norm": 0.06117096543312073,
1001
+ "learning_rate": 2.8442999234889064e-06,
1002
+ "loss": 0.3797,
1003
+ "step": 1420
1004
+ },
1005
+ {
1006
+ "epoch": 2.4612736660929433,
1007
+ "grad_norm": 0.1437849998474121,
1008
+ "learning_rate": 2.8251721499617447e-06,
1009
+ "loss": 0.3978,
1010
+ "step": 1430
1011
+ },
1012
+ {
1013
+ "epoch": 2.478485370051635,
1014
+ "grad_norm": 0.03535407409071922,
1015
+ "learning_rate": 2.8060443764345833e-06,
1016
+ "loss": 0.7543,
1017
+ "step": 1440
1018
+ },
1019
+ {
1020
+ "epoch": 2.495697074010327,
1021
+ "grad_norm": 0.034573543816804886,
1022
+ "learning_rate": 2.786916602907422e-06,
1023
+ "loss": 0.4385,
1024
+ "step": 1450
1025
+ },
1026
+ {
1027
+ "epoch": 2.512908777969019,
1028
+ "grad_norm": 0.05264075845479965,
1029
+ "learning_rate": 2.7677888293802602e-06,
1030
+ "loss": 0.5788,
1031
+ "step": 1460
1032
+ },
1033
+ {
1034
+ "epoch": 2.5301204819277108,
1035
+ "grad_norm": 0.047263339161872864,
1036
+ "learning_rate": 2.748661055853099e-06,
1037
+ "loss": 0.5397,
1038
+ "step": 1470
1039
+ },
1040
+ {
1041
+ "epoch": 2.5473321858864026,
1042
+ "grad_norm": 0.03852943331003189,
1043
+ "learning_rate": 2.7295332823259375e-06,
1044
+ "loss": 0.3995,
1045
+ "step": 1480
1046
+ },
1047
+ {
1048
+ "epoch": 2.5645438898450945,
1049
+ "grad_norm": 0.04756772890686989,
1050
+ "learning_rate": 2.710405508798776e-06,
1051
+ "loss": 0.5136,
1052
+ "step": 1490
1053
+ },
1054
+ {
1055
+ "epoch": 2.581755593803787,
1056
+ "grad_norm": 0.07750029861927032,
1057
+ "learning_rate": 2.6912777352716144e-06,
1058
+ "loss": 0.8293,
1059
+ "step": 1500
1060
+ },
1061
+ {
1062
+ "epoch": 2.5989672977624787,
1063
+ "grad_norm": 0.047012392431497574,
1064
+ "learning_rate": 2.672149961744453e-06,
1065
+ "loss": 0.5485,
1066
+ "step": 1510
1067
+ },
1068
+ {
1069
+ "epoch": 2.6161790017211706,
1070
+ "grad_norm": 0.04318179562687874,
1071
+ "learning_rate": 2.6530221882172918e-06,
1072
+ "loss": 0.4112,
1073
+ "step": 1520
1074
+ },
1075
+ {
1076
+ "epoch": 2.6333907056798624,
1077
+ "grad_norm": 0.06012555584311485,
1078
+ "learning_rate": 2.63389441469013e-06,
1079
+ "loss": 0.7031,
1080
+ "step": 1530
1081
+ },
1082
+ {
1083
+ "epoch": 2.6506024096385543,
1084
+ "grad_norm": 0.03384987264871597,
1085
+ "learning_rate": 2.614766641162969e-06,
1086
+ "loss": 0.439,
1087
+ "step": 1540
1088
+ },
1089
+ {
1090
+ "epoch": 2.667814113597246,
1091
+ "grad_norm": 0.05770883336663246,
1092
+ "learning_rate": 2.5956388676358073e-06,
1093
+ "loss": 0.3991,
1094
+ "step": 1550
1095
+ },
1096
+ {
1097
+ "epoch": 2.685025817555938,
1098
+ "grad_norm": 0.05510050430893898,
1099
+ "learning_rate": 2.5765110941086456e-06,
1100
+ "loss": 0.9784,
1101
+ "step": 1560
1102
+ },
1103
+ {
1104
+ "epoch": 2.70223752151463,
1105
+ "grad_norm": 0.055017050355672836,
1106
+ "learning_rate": 2.5573833205814846e-06,
1107
+ "loss": 0.3796,
1108
+ "step": 1570
1109
+ },
1110
+ {
1111
+ "epoch": 2.719449225473322,
1112
+ "grad_norm": 0.04332127049565315,
1113
+ "learning_rate": 2.538255547054323e-06,
1114
+ "loss": 0.433,
1115
+ "step": 1580
1116
+ },
1117
+ {
1118
+ "epoch": 2.7366609294320137,
1119
+ "grad_norm": 0.060054711997509,
1120
+ "learning_rate": 2.519127773527162e-06,
1121
+ "loss": 0.2799,
1122
+ "step": 1590
1123
+ },
1124
+ {
1125
+ "epoch": 2.7538726333907055,
1126
+ "grad_norm": 0.0340825691819191,
1127
+ "learning_rate": 2.5e-06,
1128
+ "loss": 0.6797,
1129
+ "step": 1600
1130
+ },
1131
+ {
1132
+ "epoch": 2.7710843373493974,
1133
+ "grad_norm": 0.22405555844306946,
1134
+ "learning_rate": 2.480872226472839e-06,
1135
+ "loss": 0.6071,
1136
+ "step": 1610
1137
+ },
1138
+ {
1139
+ "epoch": 2.7882960413080893,
1140
+ "grad_norm": 0.04493927210569382,
1141
+ "learning_rate": 2.4617444529456775e-06,
1142
+ "loss": 0.4004,
1143
+ "step": 1620
1144
+ },
1145
+ {
1146
+ "epoch": 2.805507745266781,
1147
+ "grad_norm": 0.06454917788505554,
1148
+ "learning_rate": 2.4426166794185158e-06,
1149
+ "loss": 0.3903,
1150
+ "step": 1630
1151
+ },
1152
+ {
1153
+ "epoch": 2.8227194492254735,
1154
+ "grad_norm": 0.07336492091417313,
1155
+ "learning_rate": 2.4234889058913544e-06,
1156
+ "loss": 0.9157,
1157
+ "step": 1640
1158
+ },
1159
+ {
1160
+ "epoch": 2.8399311531841653,
1161
+ "grad_norm": 0.08775831758975983,
1162
+ "learning_rate": 2.404361132364193e-06,
1163
+ "loss": 0.4865,
1164
+ "step": 1650
1165
+ },
1166
+ {
1167
+ "epoch": 2.857142857142857,
1168
+ "grad_norm": 0.03372660651803017,
1169
+ "learning_rate": 2.3852333588370317e-06,
1170
+ "loss": 0.3975,
1171
+ "step": 1660
1172
+ },
1173
+ {
1174
+ "epoch": 2.874354561101549,
1175
+ "grad_norm": 0.034449730068445206,
1176
+ "learning_rate": 2.3661055853098704e-06,
1177
+ "loss": 0.3927,
1178
+ "step": 1670
1179
+ },
1180
+ {
1181
+ "epoch": 2.891566265060241,
1182
+ "grad_norm": 0.02975647896528244,
1183
+ "learning_rate": 2.3469778117827086e-06,
1184
+ "loss": 0.3664,
1185
+ "step": 1680
1186
+ },
1187
+ {
1188
+ "epoch": 2.908777969018933,
1189
+ "grad_norm": 0.037901297211647034,
1190
+ "learning_rate": 2.3278500382555473e-06,
1191
+ "loss": 0.3973,
1192
+ "step": 1690
1193
+ },
1194
+ {
1195
+ "epoch": 2.9259896729776247,
1196
+ "grad_norm": 0.05662724748253822,
1197
+ "learning_rate": 2.308722264728386e-06,
1198
+ "loss": 0.4422,
1199
+ "step": 1700
1200
+ },
1201
+ {
1202
+ "epoch": 2.9432013769363166,
1203
+ "grad_norm": 0.044157788157463074,
1204
+ "learning_rate": 2.289594491201224e-06,
1205
+ "loss": 0.4324,
1206
+ "step": 1710
1207
+ },
1208
+ {
1209
+ "epoch": 2.960413080895009,
1210
+ "grad_norm": 0.04280713573098183,
1211
+ "learning_rate": 2.270466717674063e-06,
1212
+ "loss": 0.5674,
1213
+ "step": 1720
1214
+ },
1215
+ {
1216
+ "epoch": 2.9776247848537007,
1217
+ "grad_norm": 0.04871043935418129,
1218
+ "learning_rate": 2.2513389441469015e-06,
1219
+ "loss": 0.3223,
1220
+ "step": 1730
1221
+ },
1222
+ {
1223
+ "epoch": 2.9948364888123926,
1224
+ "grad_norm": 0.036149609833955765,
1225
+ "learning_rate": 2.2322111706197398e-06,
1226
+ "loss": 0.6471,
1227
+ "step": 1740
1228
+ },
1229
+ {
1230
+ "epoch": 3.0120481927710845,
1231
+ "grad_norm": 0.02951321005821228,
1232
+ "learning_rate": 2.2130833970925784e-06,
1233
+ "loss": 0.3926,
1234
+ "step": 1750
1235
+ },
1236
+ {
1237
+ "epoch": 3.0292598967297764,
1238
+ "grad_norm": 0.04006199911236763,
1239
+ "learning_rate": 2.193955623565417e-06,
1240
+ "loss": 0.6222,
1241
+ "step": 1760
1242
+ },
1243
+ {
1244
+ "epoch": 3.0464716006884682,
1245
+ "grad_norm": 0.03238508850336075,
1246
+ "learning_rate": 2.1748278500382557e-06,
1247
+ "loss": 0.4144,
1248
+ "step": 1770
1249
+ },
1250
+ {
1251
+ "epoch": 3.06368330464716,
1252
+ "grad_norm": 0.035425204783678055,
1253
+ "learning_rate": 2.1557000765110944e-06,
1254
+ "loss": 0.3745,
1255
+ "step": 1780
1256
+ },
1257
+ {
1258
+ "epoch": 3.080895008605852,
1259
+ "grad_norm": 0.08181657642126083,
1260
+ "learning_rate": 2.1365723029839326e-06,
1261
+ "loss": 0.4049,
1262
+ "step": 1790
1263
+ },
1264
+ {
1265
+ "epoch": 3.098106712564544,
1266
+ "grad_norm": 0.03448079526424408,
1267
+ "learning_rate": 2.1174445294567713e-06,
1268
+ "loss": 0.5435,
1269
+ "step": 1800
1270
+ }
1271
+ ],
1272
+ "logging_steps": 10,
1273
+ "max_steps": 2905,
1274
+ "num_input_tokens_seen": 0,
1275
+ "num_train_epochs": 5,
1276
+ "save_steps": 300,
1277
+ "stateful_callbacks": {
1278
+ "TrainerControl": {
1279
+ "args": {
1280
+ "should_epoch_stop": false,
1281
+ "should_evaluate": false,
1282
+ "should_log": false,
1283
+ "should_save": true,
1284
+ "should_training_stop": false
1285
+ },
1286
+ "attributes": {}
1287
+ }
1288
+ },
1289
+ "total_flos": 0.0,
1290
+ "train_batch_size": 1,
1291
+ "trial_name": null,
1292
+ "trial_params": null
1293
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:91116a9334865a57d085ece2efd2157dd49fc30fd2d8b9308f8a36934a61ff70
3
+ size 6968
zero_to_fp32.py ADDED
@@ -0,0 +1,604 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example: python zero_to_fp32.py . pytorch_model.bin
14
+
15
+ import argparse
16
+ import torch
17
+ import glob
18
+ import math
19
+ import os
20
+ import re
21
+ from collections import OrderedDict
22
+ from dataclasses import dataclass
23
+
24
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
25
+ # DeepSpeed data structures it has to be available in the current python environment.
26
+ from deepspeed.utils import logger
27
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
28
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
29
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
30
+
31
+
32
+ @dataclass
33
+ class zero_model_state:
34
+ buffers: dict()
35
+ param_shapes: dict()
36
+ shared_params: list
37
+ ds_version: int
38
+ frozen_param_shapes: dict()
39
+ frozen_param_fragments: dict()
40
+
41
+
42
+ debug = 0
43
+
44
+ # load to cpu
45
+ device = torch.device('cpu')
46
+
47
+
48
+ def atoi(text):
49
+ return int(text) if text.isdigit() else text
50
+
51
+
52
+ def natural_keys(text):
53
+ '''
54
+ alist.sort(key=natural_keys) sorts in human order
55
+ http://nedbatchelder.com/blog/200712/human_sorting.html
56
+ (See Toothy's implementation in the comments)
57
+ '''
58
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
59
+
60
+
61
+ def get_model_state_file(checkpoint_dir, zero_stage):
62
+ if not os.path.isdir(checkpoint_dir):
63
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
64
+
65
+ # there should be only one file
66
+ if zero_stage <= 2:
67
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
68
+ elif zero_stage == 3:
69
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
70
+
71
+ if not os.path.exists(file):
72
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
73
+
74
+ return file
75
+
76
+
77
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
78
+ # XXX: need to test that this simple glob rule works for multi-node setup too
79
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
80
+
81
+ if len(ckpt_files) == 0:
82
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
83
+
84
+ return ckpt_files
85
+
86
+
87
+ def get_optim_files(checkpoint_dir):
88
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
89
+
90
+
91
+ def get_model_state_files(checkpoint_dir):
92
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
93
+
94
+
95
+ def parse_model_states(files):
96
+ zero_model_states = []
97
+ for file in files:
98
+ state_dict = torch.load(file, map_location=device)
99
+
100
+ if BUFFER_NAMES not in state_dict:
101
+ raise ValueError(f"{file} is not a model state checkpoint")
102
+ buffer_names = state_dict[BUFFER_NAMES]
103
+ if debug:
104
+ print("Found buffers:", buffer_names)
105
+
106
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
107
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
108
+ param_shapes = state_dict[PARAM_SHAPES]
109
+
110
+ # collect parameters that are included in param_shapes
111
+ param_names = []
112
+ for s in param_shapes:
113
+ for name in s.keys():
114
+ param_names.append(name)
115
+
116
+ # update with frozen parameters
117
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
118
+ if frozen_param_shapes is not None:
119
+ if debug:
120
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
121
+ param_names += list(frozen_param_shapes.keys())
122
+
123
+ # handle shared params
124
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
125
+
126
+ ds_version = state_dict.get(DS_VERSION, None)
127
+
128
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
129
+
130
+ z_model_state = zero_model_state(buffers=buffers,
131
+ param_shapes=param_shapes,
132
+ shared_params=shared_params,
133
+ ds_version=ds_version,
134
+ frozen_param_shapes=frozen_param_shapes,
135
+ frozen_param_fragments=frozen_param_fragments)
136
+ zero_model_states.append(z_model_state)
137
+
138
+ return zero_model_states
139
+
140
+
141
+ def parse_optim_states(files, ds_checkpoint_dir):
142
+
143
+ total_files = len(files)
144
+ state_dicts = []
145
+ for f in files:
146
+ state_dict = torch.load(f, map_location=device)
147
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
148
+ # and also handle the case where it was already removed by another helper script
149
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
150
+ state_dicts.append(state_dict)
151
+
152
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
153
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
154
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
155
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
156
+
157
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
158
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
159
+ # use the max of the partition_count to get the dp world_size.
160
+
161
+ if type(world_size) is list:
162
+ world_size = max(world_size)
163
+
164
+ if world_size != total_files:
165
+ raise ValueError(
166
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
167
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
168
+ )
169
+
170
+ # the groups are named differently in each stage
171
+ if zero_stage <= 2:
172
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
173
+ elif zero_stage == 3:
174
+ fp32_groups_key = FP32_FLAT_GROUPS
175
+ else:
176
+ raise ValueError(f"unknown zero stage {zero_stage}")
177
+
178
+ if zero_stage <= 2:
179
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
180
+ elif zero_stage == 3:
181
+ # if there is more than one param group, there will be multiple flattened tensors - one
182
+ # flattened tensor per group - for simplicity merge them into a single tensor
183
+ #
184
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
185
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
186
+
187
+ fp32_flat_groups = [
188
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
189
+ ]
190
+
191
+ return zero_stage, world_size, fp32_flat_groups
192
+
193
+
194
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
195
+ """
196
+ Returns fp32 state_dict reconstructed from ds checkpoint
197
+
198
+ Args:
199
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
200
+
201
+ """
202
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
203
+
204
+ optim_files = get_optim_files(ds_checkpoint_dir)
205
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
206
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
207
+
208
+ model_files = get_model_state_files(ds_checkpoint_dir)
209
+
210
+ zero_model_states = parse_model_states(model_files)
211
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
212
+
213
+ if zero_stage <= 2:
214
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
215
+ exclude_frozen_parameters)
216
+ elif zero_stage == 3:
217
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
218
+ exclude_frozen_parameters)
219
+
220
+
221
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
222
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
223
+ return
224
+
225
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
226
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
227
+
228
+ if debug:
229
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
230
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
231
+
232
+ wanted_params = len(frozen_param_shapes)
233
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
234
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
235
+ print(f'Frozen params: Have {avail_numel} numels to process.')
236
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
237
+
238
+ total_params = 0
239
+ total_numel = 0
240
+ for name, shape in frozen_param_shapes.items():
241
+ total_params += 1
242
+ unpartitioned_numel = shape.numel()
243
+ total_numel += unpartitioned_numel
244
+
245
+ state_dict[name] = frozen_param_fragments[name]
246
+
247
+ if debug:
248
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
249
+
250
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
251
+
252
+
253
+ def _has_callable(obj, fn):
254
+ attr = getattr(obj, fn, None)
255
+ return callable(attr)
256
+
257
+
258
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
259
+ param_shapes = zero_model_states[0].param_shapes
260
+
261
+ # Reconstruction protocol:
262
+ #
263
+ # XXX: document this
264
+
265
+ if debug:
266
+ for i in range(world_size):
267
+ for j in range(len(fp32_flat_groups[0])):
268
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
269
+
270
+ # XXX: memory usage doubles here (zero2)
271
+ num_param_groups = len(fp32_flat_groups[0])
272
+ merged_single_partition_of_fp32_groups = []
273
+ for i in range(num_param_groups):
274
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
275
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
276
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
277
+ avail_numel = sum(
278
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
279
+
280
+ if debug:
281
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
282
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
283
+ # not asserting if there is a mismatch due to possible padding
284
+ print(f"Have {avail_numel} numels to process.")
285
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
286
+
287
+ # params
288
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
289
+ # out-of-core computing solution
290
+ total_numel = 0
291
+ total_params = 0
292
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
293
+ offset = 0
294
+ avail_numel = full_single_fp32_vector.numel()
295
+ for name, shape in shapes.items():
296
+
297
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
298
+ total_numel += unpartitioned_numel
299
+ total_params += 1
300
+
301
+ if debug:
302
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
303
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
304
+ offset += unpartitioned_numel
305
+
306
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
307
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
308
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
309
+ # live optimizer object, so we are checking that the numbers are within the right range
310
+ align_to = 2 * world_size
311
+
312
+ def zero2_align(x):
313
+ return align_to * math.ceil(x / align_to)
314
+
315
+ if debug:
316
+ print(f"original offset={offset}, avail_numel={avail_numel}")
317
+
318
+ offset = zero2_align(offset)
319
+ avail_numel = zero2_align(avail_numel)
320
+
321
+ if debug:
322
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
323
+
324
+ # Sanity check
325
+ if offset != avail_numel:
326
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
327
+
328
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
329
+
330
+
331
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
332
+ exclude_frozen_parameters):
333
+ state_dict = OrderedDict()
334
+
335
+ # buffers
336
+ buffers = zero_model_states[0].buffers
337
+ state_dict.update(buffers)
338
+ if debug:
339
+ print(f"added {len(buffers)} buffers")
340
+
341
+ if not exclude_frozen_parameters:
342
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
343
+
344
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
345
+
346
+ # recover shared parameters
347
+ for pair in zero_model_states[0].shared_params:
348
+ if pair[1] in state_dict:
349
+ state_dict[pair[0]] = state_dict[pair[1]]
350
+
351
+ return state_dict
352
+
353
+
354
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
355
+ remainder = unpartitioned_numel % world_size
356
+ padding_numel = (world_size - remainder) if remainder else 0
357
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
358
+ return partitioned_numel, padding_numel
359
+
360
+
361
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
362
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
363
+ return
364
+
365
+ if debug:
366
+ for i in range(world_size):
367
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
368
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
369
+
370
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
371
+ wanted_params = len(frozen_param_shapes)
372
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
373
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
374
+ print(f'Frozen params: Have {avail_numel} numels to process.')
375
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
376
+
377
+ total_params = 0
378
+ total_numel = 0
379
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
380
+ total_params += 1
381
+ unpartitioned_numel = shape.numel()
382
+ total_numel += unpartitioned_numel
383
+
384
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
385
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
386
+
387
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
388
+
389
+ if debug:
390
+ print(
391
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
392
+ )
393
+
394
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
395
+
396
+
397
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
398
+ param_shapes = zero_model_states[0].param_shapes
399
+ avail_numel = fp32_flat_groups[0].numel() * world_size
400
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
401
+ # param, re-consolidating each param, while dealing with padding if any
402
+
403
+ # merge list of dicts, preserving order
404
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
405
+
406
+ if debug:
407
+ for i in range(world_size):
408
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
409
+
410
+ wanted_params = len(param_shapes)
411
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
412
+ # not asserting if there is a mismatch due to possible padding
413
+ avail_numel = fp32_flat_groups[0].numel() * world_size
414
+ print(f"Trainable params: Have {avail_numel} numels to process.")
415
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
416
+
417
+ # params
418
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
419
+ # out-of-core computing solution
420
+ offset = 0
421
+ total_numel = 0
422
+ total_params = 0
423
+ for name, shape in param_shapes.items():
424
+
425
+ unpartitioned_numel = shape.numel()
426
+ total_numel += unpartitioned_numel
427
+ total_params += 1
428
+
429
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
430
+
431
+ if debug:
432
+ print(
433
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
434
+ )
435
+
436
+ # XXX: memory usage doubles here
437
+ state_dict[name] = torch.cat(
438
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
439
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
440
+ offset += partitioned_numel
441
+
442
+ offset *= world_size
443
+
444
+ # Sanity check
445
+ if offset != avail_numel:
446
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
447
+
448
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
449
+
450
+
451
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
452
+ exclude_frozen_parameters):
453
+ state_dict = OrderedDict()
454
+
455
+ # buffers
456
+ buffers = zero_model_states[0].buffers
457
+ state_dict.update(buffers)
458
+ if debug:
459
+ print(f"added {len(buffers)} buffers")
460
+
461
+ if not exclude_frozen_parameters:
462
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
463
+
464
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
465
+
466
+ # recover shared parameters
467
+ for pair in zero_model_states[0].shared_params:
468
+ if pair[1] in state_dict:
469
+ state_dict[pair[0]] = state_dict[pair[1]]
470
+
471
+ return state_dict
472
+
473
+
474
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None, exclude_frozen_parameters=False):
475
+ """
476
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
477
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
478
+ via a model hub.
479
+
480
+ Args:
481
+ - ``checkpoint_dir``: path to the desired checkpoint folder
482
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
483
+ - ``exclude_frozen_parameters``: exclude frozen parameters
484
+
485
+ Returns:
486
+ - pytorch ``state_dict``
487
+
488
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
489
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
490
+ the checkpoint.
491
+
492
+ A typical usage might be ::
493
+
494
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
495
+ # do the training and checkpoint saving
496
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
497
+ model = model.cpu() # move to cpu
498
+ model.load_state_dict(state_dict)
499
+ # submit to model hub or save the model to share with others
500
+
501
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
502
+ application. i.e. you will need to re-initialize the deepspeed engine, since
503
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
504
+
505
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
506
+
507
+ """
508
+ if tag is None:
509
+ latest_path = os.path.join(checkpoint_dir, 'latest')
510
+ if os.path.isfile(latest_path):
511
+ with open(latest_path, 'r') as fd:
512
+ tag = fd.read().strip()
513
+ else:
514
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
515
+
516
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
517
+
518
+ if not os.path.isdir(ds_checkpoint_dir):
519
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
520
+
521
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
522
+
523
+
524
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None, exclude_frozen_parameters=False):
525
+ """
526
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
527
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
528
+
529
+ Args:
530
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
531
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
532
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
533
+ - ``exclude_frozen_parameters``: exclude frozen parameters
534
+ """
535
+
536
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag, exclude_frozen_parameters)
537
+ print(f"Saving fp32 state dict to {output_file}")
538
+ torch.save(state_dict, output_file)
539
+
540
+
541
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
542
+ """
543
+ 1. Put the provided model to cpu
544
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
545
+ 3. Load it into the provided model
546
+
547
+ Args:
548
+ - ``model``: the model object to update
549
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
550
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
551
+
552
+ Returns:
553
+ - ``model`: modified model
554
+
555
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
556
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
557
+ conveniently placed for you in the checkpoint folder.
558
+
559
+ A typical usage might be ::
560
+
561
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
562
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
563
+ # submit to model hub or save the model to share with others
564
+
565
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
566
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
567
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
568
+
569
+ """
570
+ logger.info(f"Extracting fp32 weights")
571
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
572
+
573
+ logger.info(f"Overwriting model with fp32 weights")
574
+ model = model.cpu()
575
+ model.load_state_dict(state_dict, strict=False)
576
+
577
+ return model
578
+
579
+
580
+ if __name__ == "__main__":
581
+
582
+ parser = argparse.ArgumentParser()
583
+ parser.add_argument("checkpoint_dir",
584
+ type=str,
585
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
586
+ parser.add_argument(
587
+ "output_file",
588
+ type=str,
589
+ help="path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)")
590
+ parser.add_argument("-t",
591
+ "--tag",
592
+ type=str,
593
+ default=None,
594
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
595
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
596
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
597
+ args = parser.parse_args()
598
+
599
+ debug = args.debug
600
+
601
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
602
+ args.output_file,
603
+ tag=args.tag,
604
+ exclude_frozen_parameters=args.exclude_frozen_parameters)