pszemraj commited on
Commit
9232bf9
1 Parent(s): f991de1

load model from drive and convert

Browse files
README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # README - long-t5-tglobal-base-16384-booksum-V11-big_patent-V2
2
+ - this README was added because there wasn't one
3
+ - created 2022-07-31_12-14-50
config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "pszemraj/long-t5-tglobal-base-16384-booksum-V11-big_patent-V1",
3
+ "architectures": [
4
+ "LongT5ForConditionalGeneration"
5
+ ],
6
+ "d_ff": 2048,
7
+ "d_kv": 64,
8
+ "d_model": 768,
9
+ "decoder_start_token_id": 0,
10
+ "dense_act_fn": "gelu_new",
11
+ "dropout_rate": 0.1,
12
+ "early_stopping": true,
13
+ "encoder_attention_type": "transient-global",
14
+ "encoder_no_repeat_ngram_size": 4,
15
+ "eos_token_id": 1,
16
+ "feed_forward_proj": "gated-gelu",
17
+ "global_block_size": 16,
18
+ "initializer_factor": 1.0,
19
+ "is_encoder_decoder": true,
20
+ "is_gated_act": true,
21
+ "layer_norm_epsilon": 1e-06,
22
+ "length_penalty": 0.8,
23
+ "local_radius": 127,
24
+ "max_length": 512,
25
+ "min_length": 8,
26
+ "model_type": "longt5",
27
+ "n_positions": 4096,
28
+ "no_repeat_ngram_size": 3,
29
+ "num_beams": 2,
30
+ "num_decoder_layers": 12,
31
+ "num_heads": 12,
32
+ "num_layers": 12,
33
+ "output_past": true,
34
+ "pad_token_id": 0,
35
+ "relative_attention_max_distance": 128,
36
+ "relative_attention_num_buckets": 32,
37
+ "repetition_penalty": 3.5,
38
+ "tie_word_embeddings": false,
39
+ "torch_dtype": "float32",
40
+ "transformers_version": "4.21.0",
41
+ "use_cache": false,
42
+ "vocab_size": 32128
43
+ }
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step325
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1620415284b0de710de1a9af0ea4045a771f6b5f27a79294dddee9b09b068ad2
3
+ size 990388907
rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bcbda4b624bb1ed1b6c0fa22fb8bb1555261527dfbe1629fef4820faae0bffa4
3
+ size 14503
special_tokens_map.json ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<extra_id_0>",
4
+ "<extra_id_1>",
5
+ "<extra_id_2>",
6
+ "<extra_id_3>",
7
+ "<extra_id_4>",
8
+ "<extra_id_5>",
9
+ "<extra_id_6>",
10
+ "<extra_id_7>",
11
+ "<extra_id_8>",
12
+ "<extra_id_9>",
13
+ "<extra_id_10>",
14
+ "<extra_id_11>",
15
+ "<extra_id_12>",
16
+ "<extra_id_13>",
17
+ "<extra_id_14>",
18
+ "<extra_id_15>",
19
+ "<extra_id_16>",
20
+ "<extra_id_17>",
21
+ "<extra_id_18>",
22
+ "<extra_id_19>",
23
+ "<extra_id_20>",
24
+ "<extra_id_21>",
25
+ "<extra_id_22>",
26
+ "<extra_id_23>",
27
+ "<extra_id_24>",
28
+ "<extra_id_25>",
29
+ "<extra_id_26>",
30
+ "<extra_id_27>",
31
+ "<extra_id_28>",
32
+ "<extra_id_29>",
33
+ "<extra_id_30>",
34
+ "<extra_id_31>",
35
+ "<extra_id_32>",
36
+ "<extra_id_33>",
37
+ "<extra_id_34>",
38
+ "<extra_id_35>",
39
+ "<extra_id_36>",
40
+ "<extra_id_37>",
41
+ "<extra_id_38>",
42
+ "<extra_id_39>",
43
+ "<extra_id_40>",
44
+ "<extra_id_41>",
45
+ "<extra_id_42>",
46
+ "<extra_id_43>",
47
+ "<extra_id_44>",
48
+ "<extra_id_45>",
49
+ "<extra_id_46>",
50
+ "<extra_id_47>",
51
+ "<extra_id_48>",
52
+ "<extra_id_49>",
53
+ "<extra_id_50>",
54
+ "<extra_id_51>",
55
+ "<extra_id_52>",
56
+ "<extra_id_53>",
57
+ "<extra_id_54>",
58
+ "<extra_id_55>",
59
+ "<extra_id_56>",
60
+ "<extra_id_57>",
61
+ "<extra_id_58>",
62
+ "<extra_id_59>",
63
+ "<extra_id_60>",
64
+ "<extra_id_61>",
65
+ "<extra_id_62>",
66
+ "<extra_id_63>",
67
+ "<extra_id_64>",
68
+ "<extra_id_65>",
69
+ "<extra_id_66>",
70
+ "<extra_id_67>",
71
+ "<extra_id_68>",
72
+ "<extra_id_69>",
73
+ "<extra_id_70>",
74
+ "<extra_id_71>",
75
+ "<extra_id_72>",
76
+ "<extra_id_73>",
77
+ "<extra_id_74>",
78
+ "<extra_id_75>",
79
+ "<extra_id_76>",
80
+ "<extra_id_77>",
81
+ "<extra_id_78>",
82
+ "<extra_id_79>",
83
+ "<extra_id_80>",
84
+ "<extra_id_81>",
85
+ "<extra_id_82>",
86
+ "<extra_id_83>",
87
+ "<extra_id_84>",
88
+ "<extra_id_85>",
89
+ "<extra_id_86>",
90
+ "<extra_id_87>",
91
+ "<extra_id_88>",
92
+ "<extra_id_89>",
93
+ "<extra_id_90>",
94
+ "<extra_id_91>",
95
+ "<extra_id_92>",
96
+ "<extra_id_93>",
97
+ "<extra_id_94>",
98
+ "<extra_id_95>",
99
+ "<extra_id_96>",
100
+ "<extra_id_97>",
101
+ "<extra_id_98>",
102
+ "<extra_id_99>"
103
+ ],
104
+ "eos_token": "</s>",
105
+ "pad_token": "<pad>",
106
+ "unk_token": "<unk>"
107
+ }
spiece.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d60acb128cf7b7f2536e8f38a5b18a05535c9e14c7a355904270e15b0945ea86
3
+ size 791656
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<extra_id_0>",
4
+ "<extra_id_1>",
5
+ "<extra_id_2>",
6
+ "<extra_id_3>",
7
+ "<extra_id_4>",
8
+ "<extra_id_5>",
9
+ "<extra_id_6>",
10
+ "<extra_id_7>",
11
+ "<extra_id_8>",
12
+ "<extra_id_9>",
13
+ "<extra_id_10>",
14
+ "<extra_id_11>",
15
+ "<extra_id_12>",
16
+ "<extra_id_13>",
17
+ "<extra_id_14>",
18
+ "<extra_id_15>",
19
+ "<extra_id_16>",
20
+ "<extra_id_17>",
21
+ "<extra_id_18>",
22
+ "<extra_id_19>",
23
+ "<extra_id_20>",
24
+ "<extra_id_21>",
25
+ "<extra_id_22>",
26
+ "<extra_id_23>",
27
+ "<extra_id_24>",
28
+ "<extra_id_25>",
29
+ "<extra_id_26>",
30
+ "<extra_id_27>",
31
+ "<extra_id_28>",
32
+ "<extra_id_29>",
33
+ "<extra_id_30>",
34
+ "<extra_id_31>",
35
+ "<extra_id_32>",
36
+ "<extra_id_33>",
37
+ "<extra_id_34>",
38
+ "<extra_id_35>",
39
+ "<extra_id_36>",
40
+ "<extra_id_37>",
41
+ "<extra_id_38>",
42
+ "<extra_id_39>",
43
+ "<extra_id_40>",
44
+ "<extra_id_41>",
45
+ "<extra_id_42>",
46
+ "<extra_id_43>",
47
+ "<extra_id_44>",
48
+ "<extra_id_45>",
49
+ "<extra_id_46>",
50
+ "<extra_id_47>",
51
+ "<extra_id_48>",
52
+ "<extra_id_49>",
53
+ "<extra_id_50>",
54
+ "<extra_id_51>",
55
+ "<extra_id_52>",
56
+ "<extra_id_53>",
57
+ "<extra_id_54>",
58
+ "<extra_id_55>",
59
+ "<extra_id_56>",
60
+ "<extra_id_57>",
61
+ "<extra_id_58>",
62
+ "<extra_id_59>",
63
+ "<extra_id_60>",
64
+ "<extra_id_61>",
65
+ "<extra_id_62>",
66
+ "<extra_id_63>",
67
+ "<extra_id_64>",
68
+ "<extra_id_65>",
69
+ "<extra_id_66>",
70
+ "<extra_id_67>",
71
+ "<extra_id_68>",
72
+ "<extra_id_69>",
73
+ "<extra_id_70>",
74
+ "<extra_id_71>",
75
+ "<extra_id_72>",
76
+ "<extra_id_73>",
77
+ "<extra_id_74>",
78
+ "<extra_id_75>",
79
+ "<extra_id_76>",
80
+ "<extra_id_77>",
81
+ "<extra_id_78>",
82
+ "<extra_id_79>",
83
+ "<extra_id_80>",
84
+ "<extra_id_81>",
85
+ "<extra_id_82>",
86
+ "<extra_id_83>",
87
+ "<extra_id_84>",
88
+ "<extra_id_85>",
89
+ "<extra_id_86>",
90
+ "<extra_id_87>",
91
+ "<extra_id_88>",
92
+ "<extra_id_89>",
93
+ "<extra_id_90>",
94
+ "<extra_id_91>",
95
+ "<extra_id_92>",
96
+ "<extra_id_93>",
97
+ "<extra_id_94>",
98
+ "<extra_id_95>",
99
+ "<extra_id_96>",
100
+ "<extra_id_97>",
101
+ "<extra_id_98>",
102
+ "<extra_id_99>"
103
+ ],
104
+ "eos_token": "</s>",
105
+ "extra_ids": 100,
106
+ "name_or_path": "pszemraj/long-t5-tglobal-base-16384-booksum-V11-big_patent-V1",
107
+ "pad_token": "<pad>",
108
+ "special_tokens_map_file": null,
109
+ "tokenizer_class": "T5Tokenizer",
110
+ "unk_token": "<unk>"
111
+ }
trainer_state.json ADDED
@@ -0,0 +1,988 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.15840619002650258,
5
+ "global_step": 325,
6
+ "is_hyper_param_search": false,
7
+ "is_local_process_zero": true,
8
+ "is_world_process_zero": true,
9
+ "log_history": [
10
+ {
11
+ "epoch": 0.0,
12
+ "learning_rate": 5.7142857142857135e-05,
13
+ "loss": 1.9649,
14
+ "step": 2
15
+ },
16
+ {
17
+ "epoch": 0.0,
18
+ "learning_rate": 0.00011428571428571427,
19
+ "loss": 2.0221,
20
+ "step": 4
21
+ },
22
+ {
23
+ "epoch": 0.0,
24
+ "learning_rate": 0.0001714285714285714,
25
+ "loss": 1.9956,
26
+ "step": 6
27
+ },
28
+ {
29
+ "epoch": 0.0,
30
+ "learning_rate": 0.00022857142857142854,
31
+ "loss": 1.9373,
32
+ "step": 8
33
+ },
34
+ {
35
+ "epoch": 0.0,
36
+ "learning_rate": 0.0002857142857142857,
37
+ "loss": 2.0042,
38
+ "step": 10
39
+ },
40
+ {
41
+ "epoch": 0.01,
42
+ "learning_rate": 0.0003428571428571428,
43
+ "loss": 1.9593,
44
+ "step": 12
45
+ },
46
+ {
47
+ "epoch": 0.01,
48
+ "learning_rate": 0.00039999999999999996,
49
+ "loss": 2.031,
50
+ "step": 14
51
+ },
52
+ {
53
+ "epoch": 0.01,
54
+ "learning_rate": 0.0004571428571428571,
55
+ "loss": 1.9644,
56
+ "step": 16
57
+ },
58
+ {
59
+ "epoch": 0.01,
60
+ "learning_rate": 0.0005142857142857142,
61
+ "loss": 1.9968,
62
+ "step": 18
63
+ },
64
+ {
65
+ "epoch": 0.01,
66
+ "learning_rate": 0.0005714285714285714,
67
+ "loss": 1.9694,
68
+ "step": 20
69
+ },
70
+ {
71
+ "epoch": 0.01,
72
+ "learning_rate": 0.0005999996407482917,
73
+ "loss": 1.9885,
74
+ "step": 22
75
+ },
76
+ {
77
+ "epoch": 0.01,
78
+ "learning_rate": 0.0005999967667397879,
79
+ "loss": 1.9295,
80
+ "step": 24
81
+ },
82
+ {
83
+ "epoch": 0.01,
84
+ "learning_rate": 0.0005999910187503132,
85
+ "loss": 1.9646,
86
+ "step": 26
87
+ },
88
+ {
89
+ "epoch": 0.01,
90
+ "learning_rate": 0.0005999823968349338,
91
+ "loss": 1.9615,
92
+ "step": 28
93
+ },
94
+ {
95
+ "epoch": 0.01,
96
+ "learning_rate": 0.000599970901076248,
97
+ "loss": 1.9456,
98
+ "step": 30
99
+ },
100
+ {
101
+ "epoch": 0.02,
102
+ "learning_rate": 0.0005999565315843857,
103
+ "loss": 2.014,
104
+ "step": 32
105
+ },
106
+ {
107
+ "epoch": 0.02,
108
+ "learning_rate": 0.0005999392884970068,
109
+ "loss": 1.9118,
110
+ "step": 34
111
+ },
112
+ {
113
+ "epoch": 0.02,
114
+ "learning_rate": 0.0005999191719793011,
115
+ "loss": 1.944,
116
+ "step": 36
117
+ },
118
+ {
119
+ "epoch": 0.02,
120
+ "learning_rate": 0.0005998961822239856,
121
+ "loss": 1.9475,
122
+ "step": 38
123
+ },
124
+ {
125
+ "epoch": 0.02,
126
+ "learning_rate": 0.000599870319451303,
127
+ "loss": 2.038,
128
+ "step": 40
129
+ },
130
+ {
131
+ "epoch": 0.02,
132
+ "learning_rate": 0.0005998415839090198,
133
+ "loss": 1.9438,
134
+ "step": 42
135
+ },
136
+ {
137
+ "epoch": 0.02,
138
+ "learning_rate": 0.0005998099758724235,
139
+ "loss": 2.0804,
140
+ "step": 44
141
+ },
142
+ {
143
+ "epoch": 0.02,
144
+ "learning_rate": 0.0005997754956443205,
145
+ "loss": 1.9767,
146
+ "step": 46
147
+ },
148
+ {
149
+ "epoch": 0.02,
150
+ "learning_rate": 0.0005997381435550326,
151
+ "loss": 1.9322,
152
+ "step": 48
153
+ },
154
+ {
155
+ "epoch": 0.02,
156
+ "learning_rate": 0.0005996979199623944,
157
+ "loss": 1.9276,
158
+ "step": 50
159
+ },
160
+ {
161
+ "epoch": 0.03,
162
+ "learning_rate": 0.0005996548252517495,
163
+ "loss": 1.9933,
164
+ "step": 52
165
+ },
166
+ {
167
+ "epoch": 0.03,
168
+ "learning_rate": 0.0005996088598359469,
169
+ "loss": 1.8901,
170
+ "step": 54
171
+ },
172
+ {
173
+ "epoch": 0.03,
174
+ "learning_rate": 0.0005995600241553371,
175
+ "loss": 1.9472,
176
+ "step": 56
177
+ },
178
+ {
179
+ "epoch": 0.03,
180
+ "learning_rate": 0.000599508318677768,
181
+ "loss": 1.9855,
182
+ "step": 58
183
+ },
184
+ {
185
+ "epoch": 0.03,
186
+ "learning_rate": 0.00059945374389858,
187
+ "loss": 1.9887,
188
+ "step": 60
189
+ },
190
+ {
191
+ "epoch": 0.03,
192
+ "learning_rate": 0.0005993963003406018,
193
+ "loss": 1.9798,
194
+ "step": 62
195
+ },
196
+ {
197
+ "epoch": 0.03,
198
+ "learning_rate": 0.0005993359885541448,
199
+ "loss": 1.9956,
200
+ "step": 64
201
+ },
202
+ {
203
+ "epoch": 0.03,
204
+ "learning_rate": 0.0005992728091169984,
205
+ "loss": 1.9411,
206
+ "step": 66
207
+ },
208
+ {
209
+ "epoch": 0.03,
210
+ "learning_rate": 0.0005992067626344242,
211
+ "loss": 1.9722,
212
+ "step": 68
213
+ },
214
+ {
215
+ "epoch": 0.03,
216
+ "learning_rate": 0.00059913784973915,
217
+ "loss": 1.97,
218
+ "step": 70
219
+ },
220
+ {
221
+ "epoch": 0.04,
222
+ "learning_rate": 0.0005990660710913641,
223
+ "loss": 1.9612,
224
+ "step": 72
225
+ },
226
+ {
227
+ "epoch": 0.04,
228
+ "learning_rate": 0.0005989914273787089,
229
+ "loss": 1.8503,
230
+ "step": 74
231
+ },
232
+ {
233
+ "epoch": 0.04,
234
+ "learning_rate": 0.0005989139193162741,
235
+ "loss": 1.992,
236
+ "step": 76
237
+ },
238
+ {
239
+ "epoch": 0.04,
240
+ "learning_rate": 0.00059883354764659,
241
+ "loss": 1.9675,
242
+ "step": 78
243
+ },
244
+ {
245
+ "epoch": 0.04,
246
+ "learning_rate": 0.0005987503131396204,
247
+ "loss": 1.9609,
248
+ "step": 80
249
+ },
250
+ {
251
+ "epoch": 0.04,
252
+ "learning_rate": 0.0005986642165927551,
253
+ "loss": 2.0349,
254
+ "step": 82
255
+ },
256
+ {
257
+ "epoch": 0.04,
258
+ "learning_rate": 0.0005985752588308026,
259
+ "loss": 1.9824,
260
+ "step": 84
261
+ },
262
+ {
263
+ "epoch": 0.04,
264
+ "learning_rate": 0.0005984834407059817,
265
+ "loss": 1.9017,
266
+ "step": 86
267
+ },
268
+ {
269
+ "epoch": 0.04,
270
+ "learning_rate": 0.0005983887630979137,
271
+ "loss": 1.903,
272
+ "step": 88
273
+ },
274
+ {
275
+ "epoch": 0.04,
276
+ "learning_rate": 0.000598291226913614,
277
+ "loss": 1.9067,
278
+ "step": 90
279
+ },
280
+ {
281
+ "epoch": 0.04,
282
+ "learning_rate": 0.000598190833087483,
283
+ "loss": 1.941,
284
+ "step": 92
285
+ },
286
+ {
287
+ "epoch": 0.05,
288
+ "learning_rate": 0.0005980875825812974,
289
+ "loss": 1.9856,
290
+ "step": 94
291
+ },
292
+ {
293
+ "epoch": 0.05,
294
+ "learning_rate": 0.0005979814763842014,
295
+ "loss": 1.9555,
296
+ "step": 96
297
+ },
298
+ {
299
+ "epoch": 0.05,
300
+ "learning_rate": 0.0005978725155126967,
301
+ "loss": 1.9408,
302
+ "step": 98
303
+ },
304
+ {
305
+ "epoch": 0.05,
306
+ "learning_rate": 0.0005977607010106324,
307
+ "loss": 2.0131,
308
+ "step": 100
309
+ },
310
+ {
311
+ "epoch": 0.05,
312
+ "learning_rate": 0.0005976460339491963,
313
+ "loss": 1.9499,
314
+ "step": 102
315
+ },
316
+ {
317
+ "epoch": 0.05,
318
+ "learning_rate": 0.000597528515426903,
319
+ "loss": 1.9381,
320
+ "step": 104
321
+ },
322
+ {
323
+ "epoch": 0.05,
324
+ "learning_rate": 0.0005974081465695849,
325
+ "loss": 1.9805,
326
+ "step": 106
327
+ },
328
+ {
329
+ "epoch": 0.05,
330
+ "learning_rate": 0.0005972849285303804,
331
+ "loss": 1.8787,
332
+ "step": 108
333
+ },
334
+ {
335
+ "epoch": 0.05,
336
+ "learning_rate": 0.0005971588624897232,
337
+ "loss": 1.8912,
338
+ "step": 110
339
+ },
340
+ {
341
+ "epoch": 0.05,
342
+ "learning_rate": 0.0005970299496553309,
343
+ "loss": 1.9536,
344
+ "step": 112
345
+ },
346
+ {
347
+ "epoch": 0.06,
348
+ "learning_rate": 0.0005968981912621937,
349
+ "loss": 1.9388,
350
+ "step": 114
351
+ },
352
+ {
353
+ "epoch": 0.06,
354
+ "learning_rate": 0.0005967635885725623,
355
+ "loss": 2.0041,
356
+ "step": 116
357
+ },
358
+ {
359
+ "epoch": 0.06,
360
+ "learning_rate": 0.0005966261428759357,
361
+ "loss": 1.9447,
362
+ "step": 118
363
+ },
364
+ {
365
+ "epoch": 0.06,
366
+ "learning_rate": 0.0005964858554890492,
367
+ "loss": 2.0031,
368
+ "step": 120
369
+ },
370
+ {
371
+ "epoch": 0.06,
372
+ "learning_rate": 0.0005963427277558616,
373
+ "loss": 1.9063,
374
+ "step": 122
375
+ },
376
+ {
377
+ "epoch": 0.06,
378
+ "learning_rate": 0.0005961967610475422,
379
+ "loss": 1.9492,
380
+ "step": 124
381
+ },
382
+ {
383
+ "epoch": 0.06,
384
+ "learning_rate": 0.0005960479567624578,
385
+ "loss": 1.9956,
386
+ "step": 126
387
+ },
388
+ {
389
+ "epoch": 0.06,
390
+ "learning_rate": 0.0005958963163261595,
391
+ "loss": 1.9329,
392
+ "step": 128
393
+ },
394
+ {
395
+ "epoch": 0.06,
396
+ "learning_rate": 0.0005957418411913688,
397
+ "loss": 1.9424,
398
+ "step": 130
399
+ },
400
+ {
401
+ "epoch": 0.06,
402
+ "learning_rate": 0.0005955845328379636,
403
+ "loss": 1.9105,
404
+ "step": 132
405
+ },
406
+ {
407
+ "epoch": 0.07,
408
+ "learning_rate": 0.000595424392772964,
409
+ "loss": 1.9439,
410
+ "step": 134
411
+ },
412
+ {
413
+ "epoch": 0.07,
414
+ "learning_rate": 0.0005952614225305184,
415
+ "loss": 1.9586,
416
+ "step": 136
417
+ },
418
+ {
419
+ "epoch": 0.07,
420
+ "learning_rate": 0.0005950956236718882,
421
+ "loss": 1.8851,
422
+ "step": 138
423
+ },
424
+ {
425
+ "epoch": 0.07,
426
+ "learning_rate": 0.0005949269977854329,
427
+ "loss": 1.9031,
428
+ "step": 140
429
+ },
430
+ {
431
+ "epoch": 0.07,
432
+ "learning_rate": 0.0005947555464865954,
433
+ "loss": 1.9294,
434
+ "step": 142
435
+ },
436
+ {
437
+ "epoch": 0.07,
438
+ "learning_rate": 0.000594581271417886,
439
+ "loss": 1.9779,
440
+ "step": 144
441
+ },
442
+ {
443
+ "epoch": 0.07,
444
+ "learning_rate": 0.0005944041742488665,
445
+ "loss": 1.9515,
446
+ "step": 146
447
+ },
448
+ {
449
+ "epoch": 0.07,
450
+ "learning_rate": 0.0005942242566761351,
451
+ "loss": 1.9249,
452
+ "step": 148
453
+ },
454
+ {
455
+ "epoch": 0.07,
456
+ "learning_rate": 0.0005940415204233092,
457
+ "loss": 1.9104,
458
+ "step": 150
459
+ },
460
+ {
461
+ "epoch": 0.07,
462
+ "learning_rate": 0.0005938559672410093,
463
+ "loss": 1.9548,
464
+ "step": 152
465
+ },
466
+ {
467
+ "epoch": 0.08,
468
+ "learning_rate": 0.0005936675989068425,
469
+ "loss": 1.9314,
470
+ "step": 154
471
+ },
472
+ {
473
+ "epoch": 0.08,
474
+ "learning_rate": 0.0005934764172253849,
475
+ "loss": 1.9468,
476
+ "step": 156
477
+ },
478
+ {
479
+ "epoch": 0.08,
480
+ "learning_rate": 0.0005932824240281645,
481
+ "loss": 1.9821,
482
+ "step": 158
483
+ },
484
+ {
485
+ "epoch": 0.08,
486
+ "learning_rate": 0.0005930856211736438,
487
+ "loss": 1.9609,
488
+ "step": 160
489
+ },
490
+ {
491
+ "epoch": 0.08,
492
+ "learning_rate": 0.0005928860105472022,
493
+ "loss": 1.9261,
494
+ "step": 162
495
+ },
496
+ {
497
+ "epoch": 0.08,
498
+ "learning_rate": 0.0005926835940611172,
499
+ "loss": 1.9594,
500
+ "step": 164
501
+ },
502
+ {
503
+ "epoch": 0.08,
504
+ "learning_rate": 0.000592478373654547,
505
+ "loss": 1.8914,
506
+ "step": 166
507
+ },
508
+ {
509
+ "epoch": 0.08,
510
+ "learning_rate": 0.0005922703512935113,
511
+ "loss": 1.9509,
512
+ "step": 168
513
+ },
514
+ {
515
+ "epoch": 0.08,
516
+ "learning_rate": 0.0005920595289708723,
517
+ "loss": 1.9988,
518
+ "step": 170
519
+ },
520
+ {
521
+ "epoch": 0.08,
522
+ "learning_rate": 0.0005918459087063165,
523
+ "loss": 1.9886,
524
+ "step": 172
525
+ },
526
+ {
527
+ "epoch": 0.08,
528
+ "learning_rate": 0.0005916294925463346,
529
+ "loss": 2.0024,
530
+ "step": 174
531
+ },
532
+ {
533
+ "epoch": 0.09,
534
+ "learning_rate": 0.0005914102825642018,
535
+ "loss": 1.859,
536
+ "step": 176
537
+ },
538
+ {
539
+ "epoch": 0.09,
540
+ "learning_rate": 0.0005911882808599586,
541
+ "loss": 1.9439,
542
+ "step": 178
543
+ },
544
+ {
545
+ "epoch": 0.09,
546
+ "learning_rate": 0.0005909634895603902,
547
+ "loss": 1.9823,
548
+ "step": 180
549
+ },
550
+ {
551
+ "epoch": 0.09,
552
+ "learning_rate": 0.000590735910819006,
553
+ "loss": 1.9308,
554
+ "step": 182
555
+ },
556
+ {
557
+ "epoch": 0.09,
558
+ "learning_rate": 0.0005905055468160197,
559
+ "loss": 1.9459,
560
+ "step": 184
561
+ },
562
+ {
563
+ "epoch": 0.09,
564
+ "learning_rate": 0.0005902723997583274,
565
+ "loss": 1.9146,
566
+ "step": 186
567
+ },
568
+ {
569
+ "epoch": 0.09,
570
+ "learning_rate": 0.0005900364718794873,
571
+ "loss": 1.9036,
572
+ "step": 188
573
+ },
574
+ {
575
+ "epoch": 0.09,
576
+ "learning_rate": 0.0005897977654396977,
577
+ "loss": 1.9035,
578
+ "step": 190
579
+ },
580
+ {
581
+ "epoch": 0.09,
582
+ "learning_rate": 0.000589556282725776,
583
+ "loss": 1.9607,
584
+ "step": 192
585
+ },
586
+ {
587
+ "epoch": 0.09,
588
+ "learning_rate": 0.0005893120260511362,
589
+ "loss": 2.0468,
590
+ "step": 194
591
+ },
592
+ {
593
+ "epoch": 0.1,
594
+ "learning_rate": 0.0005890649977557668,
595
+ "loss": 1.9687,
596
+ "step": 196
597
+ },
598
+ {
599
+ "epoch": 0.1,
600
+ "learning_rate": 0.0005888152002062089,
601
+ "loss": 1.9958,
602
+ "step": 198
603
+ },
604
+ {
605
+ "epoch": 0.1,
606
+ "learning_rate": 0.0005885626357955329,
607
+ "loss": 1.9025,
608
+ "step": 200
609
+ },
610
+ {
611
+ "epoch": 0.1,
612
+ "learning_rate": 0.0005883073069433159,
613
+ "loss": 1.9077,
614
+ "step": 202
615
+ },
616
+ {
617
+ "epoch": 0.1,
618
+ "learning_rate": 0.0005880492160956185,
619
+ "loss": 1.9494,
620
+ "step": 204
621
+ },
622
+ {
623
+ "epoch": 0.1,
624
+ "learning_rate": 0.0005877883657249612,
625
+ "loss": 1.8716,
626
+ "step": 206
627
+ },
628
+ {
629
+ "epoch": 0.1,
630
+ "learning_rate": 0.000587524758330301,
631
+ "loss": 1.9075,
632
+ "step": 208
633
+ },
634
+ {
635
+ "epoch": 0.1,
636
+ "learning_rate": 0.0005872583964370073,
637
+ "loss": 1.9406,
638
+ "step": 210
639
+ },
640
+ {
641
+ "epoch": 0.1,
642
+ "learning_rate": 0.0005869892825968375,
643
+ "loss": 1.9179,
644
+ "step": 212
645
+ },
646
+ {
647
+ "epoch": 0.1,
648
+ "learning_rate": 0.0005867174193879131,
649
+ "loss": 1.9702,
650
+ "step": 214
651
+ },
652
+ {
653
+ "epoch": 0.11,
654
+ "learning_rate": 0.0005864428094146943,
655
+ "loss": 1.9297,
656
+ "step": 216
657
+ },
658
+ {
659
+ "epoch": 0.11,
660
+ "learning_rate": 0.0005861654553079557,
661
+ "loss": 1.8467,
662
+ "step": 218
663
+ },
664
+ {
665
+ "epoch": 0.11,
666
+ "learning_rate": 0.0005858853597247606,
667
+ "loss": 1.9145,
668
+ "step": 220
669
+ },
670
+ {
671
+ "epoch": 0.11,
672
+ "learning_rate": 0.0005856025253484358,
673
+ "loss": 1.944,
674
+ "step": 222
675
+ },
676
+ {
677
+ "epoch": 0.11,
678
+ "learning_rate": 0.0005853169548885461,
679
+ "loss": 1.9321,
680
+ "step": 224
681
+ },
682
+ {
683
+ "epoch": 0.11,
684
+ "learning_rate": 0.0005850286510808675,
685
+ "loss": 1.9838,
686
+ "step": 226
687
+ },
688
+ {
689
+ "epoch": 0.11,
690
+ "learning_rate": 0.0005847376166873624,
691
+ "loss": 1.9891,
692
+ "step": 228
693
+ },
694
+ {
695
+ "epoch": 0.11,
696
+ "learning_rate": 0.0005844438544961515,
697
+ "loss": 1.9384,
698
+ "step": 230
699
+ },
700
+ {
701
+ "epoch": 0.11,
702
+ "learning_rate": 0.0005841473673214886,
703
+ "loss": 1.8826,
704
+ "step": 232
705
+ },
706
+ {
707
+ "epoch": 0.11,
708
+ "learning_rate": 0.0005838481580037324,
709
+ "loss": 1.8983,
710
+ "step": 234
711
+ },
712
+ {
713
+ "epoch": 0.12,
714
+ "learning_rate": 0.0005835462294093202,
715
+ "loss": 1.8804,
716
+ "step": 236
717
+ },
718
+ {
719
+ "epoch": 0.12,
720
+ "learning_rate": 0.00058324158443074,
721
+ "loss": 1.8997,
722
+ "step": 238
723
+ },
724
+ {
725
+ "epoch": 0.12,
726
+ "learning_rate": 0.0005829342259865026,
727
+ "loss": 1.9478,
728
+ "step": 240
729
+ },
730
+ {
731
+ "epoch": 0.12,
732
+ "learning_rate": 0.0005826241570211144,
733
+ "loss": 1.9727,
734
+ "step": 242
735
+ },
736
+ {
737
+ "epoch": 0.12,
738
+ "learning_rate": 0.0005823113805050482,
739
+ "loss": 1.9216,
740
+ "step": 244
741
+ },
742
+ {
743
+ "epoch": 0.12,
744
+ "learning_rate": 0.0005819958994347157,
745
+ "loss": 1.9208,
746
+ "step": 246
747
+ },
748
+ {
749
+ "epoch": 0.12,
750
+ "learning_rate": 0.000581677716832438,
751
+ "loss": 1.9201,
752
+ "step": 248
753
+ },
754
+ {
755
+ "epoch": 0.12,
756
+ "learning_rate": 0.0005813568357464172,
757
+ "loss": 1.869,
758
+ "step": 250
759
+ },
760
+ {
761
+ "epoch": 0.12,
762
+ "learning_rate": 0.0005810332592507066,
763
+ "loss": 1.9111,
764
+ "step": 252
765
+ },
766
+ {
767
+ "epoch": 0.12,
768
+ "learning_rate": 0.0005807069904451822,
769
+ "loss": 1.8696,
770
+ "step": 254
771
+ },
772
+ {
773
+ "epoch": 0.12,
774
+ "learning_rate": 0.0005803780324555121,
775
+ "loss": 1.8946,
776
+ "step": 256
777
+ },
778
+ {
779
+ "epoch": 0.13,
780
+ "learning_rate": 0.0005800463884331269,
781
+ "loss": 1.9641,
782
+ "step": 258
783
+ },
784
+ {
785
+ "epoch": 0.13,
786
+ "learning_rate": 0.0005797120615551896,
787
+ "loss": 1.8923,
788
+ "step": 260
789
+ },
790
+ {
791
+ "epoch": 0.13,
792
+ "learning_rate": 0.0005793750550245648,
793
+ "loss": 1.8612,
794
+ "step": 262
795
+ },
796
+ {
797
+ "epoch": 0.13,
798
+ "learning_rate": 0.0005790353720697887,
799
+ "loss": 1.927,
800
+ "step": 264
801
+ },
802
+ {
803
+ "epoch": 0.13,
804
+ "learning_rate": 0.0005786930159450374,
805
+ "loss": 1.9709,
806
+ "step": 266
807
+ },
808
+ {
809
+ "epoch": 0.13,
810
+ "learning_rate": 0.0005783479899300962,
811
+ "loss": 1.9665,
812
+ "step": 268
813
+ },
814
+ {
815
+ "epoch": 0.13,
816
+ "learning_rate": 0.0005780002973303283,
817
+ "loss": 1.8657,
818
+ "step": 270
819
+ },
820
+ {
821
+ "epoch": 0.13,
822
+ "learning_rate": 0.0005776499414766424,
823
+ "loss": 2.0055,
824
+ "step": 272
825
+ },
826
+ {
827
+ "epoch": 0.13,
828
+ "learning_rate": 0.0005772969257254615,
829
+ "loss": 1.9147,
830
+ "step": 274
831
+ },
832
+ {
833
+ "epoch": 0.13,
834
+ "learning_rate": 0.0005769412534586908,
835
+ "loss": 1.9383,
836
+ "step": 276
837
+ },
838
+ {
839
+ "epoch": 0.14,
840
+ "learning_rate": 0.0005765829280836846,
841
+ "loss": 1.9575,
842
+ "step": 278
843
+ },
844
+ {
845
+ "epoch": 0.14,
846
+ "learning_rate": 0.0005762219530332142,
847
+ "loss": 1.9192,
848
+ "step": 280
849
+ },
850
+ {
851
+ "epoch": 0.14,
852
+ "learning_rate": 0.0005758583317654352,
853
+ "loss": 1.8842,
854
+ "step": 282
855
+ },
856
+ {
857
+ "epoch": 0.14,
858
+ "learning_rate": 0.0005754920677638535,
859
+ "loss": 1.9905,
860
+ "step": 284
861
+ },
862
+ {
863
+ "epoch": 0.14,
864
+ "learning_rate": 0.000575123164537293,
865
+ "loss": 1.9686,
866
+ "step": 286
867
+ },
868
+ {
869
+ "epoch": 0.14,
870
+ "learning_rate": 0.0005747516256198616,
871
+ "loss": 2.0003,
872
+ "step": 288
873
+ },
874
+ {
875
+ "epoch": 0.14,
876
+ "learning_rate": 0.0005743774545709163,
877
+ "loss": 1.9195,
878
+ "step": 290
879
+ },
880
+ {
881
+ "epoch": 0.14,
882
+ "learning_rate": 0.000574000654975031,
883
+ "loss": 1.8899,
884
+ "step": 292
885
+ },
886
+ {
887
+ "epoch": 0.14,
888
+ "learning_rate": 0.0005736212304419609,
889
+ "loss": 1.9143,
890
+ "step": 294
891
+ },
892
+ {
893
+ "epoch": 0.14,
894
+ "learning_rate": 0.000573239184606608,
895
+ "loss": 1.8431,
896
+ "step": 296
897
+ },
898
+ {
899
+ "epoch": 0.15,
900
+ "learning_rate": 0.0005728545211289866,
901
+ "loss": 1.8978,
902
+ "step": 298
903
+ },
904
+ {
905
+ "epoch": 0.15,
906
+ "learning_rate": 0.0005724672436941882,
907
+ "loss": 1.9017,
908
+ "step": 300
909
+ },
910
+ {
911
+ "epoch": 0.15,
912
+ "learning_rate": 0.0005720773560123461,
913
+ "loss": 1.8912,
914
+ "step": 302
915
+ },
916
+ {
917
+ "epoch": 0.15,
918
+ "learning_rate": 0.0005716848618185996,
919
+ "loss": 1.9412,
920
+ "step": 304
921
+ },
922
+ {
923
+ "epoch": 0.15,
924
+ "learning_rate": 0.000571289764873059,
925
+ "loss": 1.8843,
926
+ "step": 306
927
+ },
928
+ {
929
+ "epoch": 0.15,
930
+ "learning_rate": 0.0005708920689607684,
931
+ "loss": 1.8971,
932
+ "step": 308
933
+ },
934
+ {
935
+ "epoch": 0.15,
936
+ "learning_rate": 0.0005704917778916709,
937
+ "loss": 1.9243,
938
+ "step": 310
939
+ },
940
+ {
941
+ "epoch": 0.15,
942
+ "learning_rate": 0.0005700888955005706,
943
+ "loss": 1.8342,
944
+ "step": 312
945
+ },
946
+ {
947
+ "epoch": 0.15,
948
+ "learning_rate": 0.000569683425647097,
949
+ "loss": 1.8725,
950
+ "step": 314
951
+ },
952
+ {
953
+ "epoch": 0.15,
954
+ "learning_rate": 0.0005692753722156673,
955
+ "loss": 1.8597,
956
+ "step": 316
957
+ },
958
+ {
959
+ "epoch": 0.15,
960
+ "learning_rate": 0.0005688647391154496,
961
+ "loss": 1.954,
962
+ "step": 318
963
+ },
964
+ {
965
+ "epoch": 0.16,
966
+ "learning_rate": 0.0005684515302803256,
967
+ "loss": 1.9454,
968
+ "step": 320
969
+ },
970
+ {
971
+ "epoch": 0.16,
972
+ "learning_rate": 0.000568035749668852,
973
+ "loss": 1.9336,
974
+ "step": 322
975
+ },
976
+ {
977
+ "epoch": 0.16,
978
+ "learning_rate": 0.000567617401264224,
979
+ "loss": 1.96,
980
+ "step": 324
981
+ }
982
+ ],
983
+ "max_steps": 2051,
984
+ "num_train_epochs": 1,
985
+ "total_flos": 4.557933379584e+17,
986
+ "trial_name": null,
987
+ "trial_params": null
988
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5163391d1b5a17f8e9a16e3191f7ee53c40429fe20ca10e4a048ce91e34dc316
3
+ size 4591
zero_to_fp32.py ADDED
@@ -0,0 +1,484 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # This script extracts fp32 consolidated weights from a zero 2 and 3 DeepSpeed checkpoints. It gets
4
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
5
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
6
+ # application.
7
+ #
8
+ # example: python zero_to_fp32.py . pytorch_model.bin
9
+
10
+ import argparse
11
+ import torch
12
+ import glob
13
+ import math
14
+ import os
15
+ import re
16
+ from collections import OrderedDict
17
+
18
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
19
+ # DeepSpeed data structures it has to be available in the current python environment.
20
+ import deepspeed
21
+ from deepspeed.utils import logger
22
+ from deepspeed.checkpoint.constants import (DS_VERSION,
23
+ OPTIMIZER_STATE_DICT,
24
+ PARAM_SHAPES,
25
+ SINGLE_PARTITION_OF_FP32_GROUPS,
26
+ FP32_FLAT_GROUPS,
27
+ ZERO_STAGE,
28
+ PARTITION_COUNT,
29
+ PARAM_SHAPES,
30
+ BUFFER_NAMES)
31
+
32
+ debug = 0
33
+
34
+ # load to cpu
35
+ device = torch.device('cpu')
36
+
37
+
38
+ def atoi(text):
39
+ return int(text) if text.isdigit() else text
40
+
41
+
42
+ def natural_keys(text):
43
+ '''
44
+ alist.sort(key=natural_keys) sorts in human order
45
+ http://nedbatchelder.com/blog/200712/human_sorting.html
46
+ (See Toothy's implementation in the comments)
47
+ '''
48
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
49
+
50
+
51
+ def get_model_state_file(checkpoint_dir, zero_stage):
52
+ if not os.path.isdir(checkpoint_dir):
53
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
54
+
55
+ # there should be only one file
56
+ if zero_stage == 2:
57
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
58
+ elif zero_stage == 3:
59
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
60
+
61
+ if not os.path.exists(file):
62
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
63
+
64
+ return file
65
+
66
+
67
+ def get_optim_files(checkpoint_dir):
68
+ # XXX: need to test that this simple glob rule works for multi-node setup too
69
+ optim_files = sorted(glob.glob(os.path.join(checkpoint_dir,
70
+ "*_optim_states.pt")),
71
+ key=natural_keys)
72
+
73
+ if len(optim_files) == 0:
74
+ raise FileNotFoundError(
75
+ f"can't find '*_optim_states.pt' files in directory '{checkpoint_dir}'")
76
+
77
+ return optim_files
78
+
79
+
80
+ def parse_model_state(file):
81
+ state_dict = torch.load(file, map_location=device)
82
+
83
+ if BUFFER_NAMES not in state_dict:
84
+ raise ValueError(f"{file} is not a model state checkpoint")
85
+ buffer_names = state_dict[BUFFER_NAMES]
86
+ if debug:
87
+ print("Found buffers:", buffer_names)
88
+
89
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
90
+ buffers = {
91
+ k: v.float()
92
+ for k,
93
+ v in state_dict["module"].items() if k in buffer_names
94
+ }
95
+ param_shapes = state_dict[PARAM_SHAPES]
96
+
97
+ ds_version = state_dict.get(DS_VERSION, None)
98
+
99
+ return buffers, param_shapes, ds_version
100
+
101
+
102
+ def parse_optim_states(files, ds_checkpoint_dir):
103
+
104
+ total_files = len(files)
105
+ state_dicts = []
106
+ for f in files:
107
+ state_dicts.append(torch.load(f, map_location=device))
108
+
109
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
110
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
111
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
112
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
113
+
114
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
115
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
116
+ # use the max of the partition_count to get the dp world_size.
117
+
118
+ if type(world_size) is list:
119
+ world_size = max(world_size)
120
+
121
+ if world_size != total_files:
122
+ raise ValueError(
123
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
124
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
125
+ )
126
+
127
+ # the groups are named differently in each stage
128
+ if zero_stage == 2:
129
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
130
+ elif zero_stage == 3:
131
+ fp32_groups_key = FP32_FLAT_GROUPS
132
+ else:
133
+ raise ValueError(f"unknown zero stage {zero_stage}")
134
+
135
+ if zero_stage == 2:
136
+ fp32_flat_groups = [
137
+ state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key]
138
+ for i in range(len(state_dicts))
139
+ ]
140
+ elif zero_stage == 3:
141
+ # if there is more than one param group, there will be multiple flattened tensors - one
142
+ # flattened tensor per group - for simplicity merge them into a single tensor
143
+ #
144
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
145
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
146
+
147
+ fp32_flat_groups = [
148
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key],
149
+ 0) for i in range(len(state_dicts))
150
+ ]
151
+
152
+ return zero_stage, world_size, fp32_flat_groups
153
+
154
+
155
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir):
156
+ """
157
+ Returns fp32 state_dict reconstructed from ds checkpoint
158
+
159
+ Args:
160
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
161
+
162
+ """
163
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
164
+
165
+ optim_files = get_optim_files(ds_checkpoint_dir)
166
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
167
+ print(
168
+ f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
169
+
170
+ model_file = get_model_state_file(ds_checkpoint_dir, zero_stage)
171
+ buffers, param_shapes, ds_version = parse_model_state(model_file)
172
+ print(f'Parsing checkpoint created by deepspeed=={ds_version}')
173
+
174
+ if zero_stage == 2:
175
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size,
176
+ param_shapes,
177
+ fp32_flat_groups,
178
+ buffers)
179
+ elif zero_stage == 3:
180
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size,
181
+ param_shapes,
182
+ fp32_flat_groups,
183
+ buffers)
184
+
185
+
186
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size,
187
+ param_shapes,
188
+ fp32_flat_groups,
189
+ buffers):
190
+
191
+ # Reconstruction protocol:
192
+ #
193
+ # XXX: document this
194
+
195
+ if debug:
196
+ for i in range(world_size):
197
+ for j in range(len(fp32_flat_groups[0])):
198
+ print(
199
+ f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
200
+
201
+ # XXX: memory usage doubles here (zero2)
202
+ num_param_groups = len(fp32_flat_groups[0])
203
+ merged_single_partition_of_fp32_groups = []
204
+ for i in range(num_param_groups):
205
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
206
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
207
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
208
+ avail_numel = sum([
209
+ full_single_fp32_vector.numel()
210
+ for full_single_fp32_vector in merged_single_partition_of_fp32_groups
211
+ ])
212
+
213
+ if debug:
214
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
215
+ wanted_numel = sum(
216
+ [sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
217
+ # not asserting if there is a mismatch due to possible padding
218
+ print(f"Have {avail_numel} numels to process.")
219
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
220
+
221
+ state_dict = OrderedDict()
222
+
223
+ # buffers
224
+ state_dict.update(buffers)
225
+ if debug:
226
+ print(f"added {len(buffers)} buffers")
227
+
228
+ # params
229
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
230
+ # out-of-core computing solution
231
+ total_numel = 0
232
+ total_params = 0
233
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
234
+ offset = 0
235
+ avail_numel = full_single_fp32_vector.numel()
236
+ for name, shape in shapes.items():
237
+
238
+ unpartitioned_numel = shape.numel()
239
+ total_numel += unpartitioned_numel
240
+ total_params += 1
241
+
242
+ if debug:
243
+ print(
244
+ f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} "
245
+ )
246
+ state_dict[name] = full_single_fp32_vector.narrow(
247
+ 0,
248
+ offset,
249
+ unpartitioned_numel).view(shape)
250
+ offset += unpartitioned_numel
251
+
252
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
253
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
254
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
255
+ # live optimizer object, so we are checking that the numbers are within the right range
256
+ align_to = 2 * world_size
257
+
258
+ def zero2_align(x):
259
+ return align_to * math.ceil(x / align_to)
260
+
261
+ if debug:
262
+ print(f"original offset={offset}, avail_numel={avail_numel}")
263
+
264
+ offset = zero2_align(offset)
265
+ avail_numel = zero2_align(avail_numel)
266
+
267
+ if debug:
268
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
269
+
270
+ # Sanity check
271
+ if offset != avail_numel:
272
+ raise ValueError(
273
+ f"consumed {offset} numels out of {avail_numel} - something is wrong")
274
+
275
+ print(
276
+ f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements"
277
+ )
278
+
279
+ return state_dict
280
+
281
+
282
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
283
+ remainder = unpartitioned_numel % world_size
284
+ padding_numel = (world_size - remainder) if remainder else 0
285
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
286
+ return partitioned_numel, padding_numel
287
+
288
+
289
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size,
290
+ param_shapes,
291
+ fp32_flat_groups,
292
+ buffers):
293
+
294
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
295
+ # param, re-consolidating each param, while dealing with padding if any
296
+
297
+ avail_numel = fp32_flat_groups[0].numel() * world_size
298
+ # merge list of dicts, preserving order
299
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
300
+
301
+ if debug:
302
+ for i in range(world_size):
303
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
304
+
305
+ wanted_params = len(param_shapes)
306
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
307
+ # not asserting if there is a mismatch due to possible padding
308
+ print(f"Have {avail_numel} numels to process.")
309
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
310
+
311
+ state_dict = OrderedDict()
312
+
313
+ # buffers
314
+ state_dict.update(buffers)
315
+ if debug:
316
+ print(f"added {len(buffers)} buffers")
317
+
318
+ # params
319
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
320
+ # out-of-core computing solution
321
+ offset = 0
322
+ total_numel = 0
323
+ total_params = 0
324
+ for name, shape in param_shapes.items():
325
+
326
+ unpartitioned_numel = shape.numel()
327
+ total_numel += unpartitioned_numel
328
+ total_params += 1
329
+
330
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
331
+
332
+ if debug:
333
+ print(
334
+ f"{total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
335
+ )
336
+
337
+ # XXX: memory usage doubles here
338
+ state_dict[name] = torch.cat(
339
+ tuple(fp32_flat_groups[i].narrow(0,
340
+ offset,
341
+ partitioned_numel)
342
+ for i in range(world_size)),
343
+ 0).narrow(0,
344
+ 0,
345
+ unpartitioned_numel).view(shape)
346
+ offset += partitioned_numel
347
+
348
+ offset *= world_size
349
+
350
+ # Sanity check
351
+ if offset != avail_numel:
352
+ raise ValueError(
353
+ f"consumed {offset} numels out of {avail_numel} - something is wrong")
354
+
355
+ print(
356
+ f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements"
357
+ )
358
+
359
+ return state_dict
360
+
361
+
362
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None):
363
+ """
364
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
365
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
366
+ via a model hub.
367
+
368
+ Args:
369
+ - ``checkpoint_dir``: path to the desired checkpoint folder
370
+ - ``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``
371
+
372
+ Returns:
373
+ - pytorch ``state_dict``
374
+
375
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
376
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
377
+ the checkpoint.
378
+
379
+ A typical usage might be ::
380
+
381
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
382
+ # do the training and checkpoint saving
383
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
384
+ model = model.cpu() # move to cpu
385
+ model.load_state_dict(state_dict)
386
+ # submit to model hub or save the model to share with others
387
+
388
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
389
+ application. i.e. you will need to re-initialize the deepspeed engine, since
390
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
391
+
392
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
393
+
394
+ """
395
+ if tag is None:
396
+ latest_path = os.path.join(checkpoint_dir, 'latest')
397
+ if os.path.isfile(latest_path):
398
+ with open(latest_path, 'r') as fd:
399
+ tag = fd.read().strip()
400
+ else:
401
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
402
+
403
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
404
+
405
+ if not os.path.isdir(ds_checkpoint_dir):
406
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
407
+
408
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir)
409
+
410
+
411
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None):
412
+ """
413
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
414
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
415
+
416
+ Args:
417
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
418
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
419
+ - ``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``
420
+ """
421
+
422
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
423
+ print(f"Saving fp32 state dict to {output_file}")
424
+ torch.save(state_dict, output_file)
425
+
426
+
427
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
428
+ """
429
+ 1. Put the provided model to cpu
430
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
431
+ 3. Load it into the provided model
432
+
433
+ Args:
434
+ - ``model``: the model object to update
435
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
436
+ - ``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``
437
+
438
+ Returns:
439
+ - ``model`: modified model
440
+
441
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
442
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
443
+ conveniently placed for you in the checkpoint folder.
444
+
445
+ A typical usage might be ::
446
+
447
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
448
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
449
+ # submit to model hub or save the model to share with others
450
+
451
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
452
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
453
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
454
+
455
+ """
456
+ logger.info(f"Extracting fp32 weights")
457
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
458
+
459
+ logger.info(f"Overwriting model with fp32 weights")
460
+ model = model.cpu()
461
+ model.load_state_dict(state_dict, strict=False)
462
+
463
+ return model
464
+
465
+
466
+ if __name__ == "__main__":
467
+
468
+ parser = argparse.ArgumentParser()
469
+ parser.add_argument(
470
+ "checkpoint_dir",
471
+ type=str,
472
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
473
+ parser.add_argument(
474
+ "output_file",
475
+ type=str,
476
+ help=
477
+ "path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)"
478
+ )
479
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
480
+ args = parser.parse_args()
481
+
482
+ debug = args.debug
483
+
484
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir, args.output_file)