Pranay17 commited on
Commit
fd5251f
·
verified ·
1 Parent(s): 266d9ee

Training in progress, step 10000, checkpoint

Browse files
last-checkpoint/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: meta-llama/Meta-Llama-3-8B-Instruct
3
+ library_name: peft
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.12.0
last-checkpoint/adapter_config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "meta-llama/Meta-Llama-3-8B-Instruct",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": true,
9
+ "layer_replication": null,
10
+ "layers_pattern": null,
11
+ "layers_to_transform": null,
12
+ "loftq_config": {},
13
+ "lora_alpha": 32,
14
+ "lora_dropout": 0.1,
15
+ "megatron_config": null,
16
+ "megatron_core": "megatron.core",
17
+ "modules_to_save": null,
18
+ "peft_type": "LORA",
19
+ "r": 8,
20
+ "rank_pattern": {},
21
+ "revision": null,
22
+ "target_modules": [
23
+ "gate_proj",
24
+ "o_proj",
25
+ "up_proj",
26
+ "down_proj",
27
+ "k_proj",
28
+ "v_proj",
29
+ "q_proj"
30
+ ],
31
+ "task_type": "CAUSAL_LM",
32
+ "use_dora": false,
33
+ "use_rslora": false
34
+ }
last-checkpoint/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1474cf437e6fcee5d794193be670d628b5ab5c1f0fd155eca54aae05745396f0
3
+ size 42002584
last-checkpoint/global_step10000/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d9aa83cd559642330de39ef0589c699f240311dfbf19742ae25c68194f121e3f
3
+ size 251710672
last-checkpoint/global_step10000/mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e491c98b4c6ae85bbc78fee7bbb1120024331b8b6556148937b423b5555c662d
3
+ size 153747385
last-checkpoint/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step10000
last-checkpoint/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72c3a70cd1bd8ddf95e5dbee237f75f88a88c828d3ba3a83a9ec614b92f4bae4
3
+ size 14244
last-checkpoint/trainer_state.json ADDED
@@ -0,0 +1,1440 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.29856985041650497,
5
+ "eval_steps": 1000,
6
+ "global_step": 10000,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 2.9856985041650495e-05,
13
+ "grad_norm": 8.064935684204102,
14
+ "learning_rate": 0.0,
15
+ "loss": 3.4849,
16
+ "step": 1
17
+ },
18
+ {
19
+ "epoch": 0.0014928492520825246,
20
+ "grad_norm": 3.3433420658111572,
21
+ "learning_rate": 0.00019998742849959144,
22
+ "loss": 1.9038,
23
+ "step": 50
24
+ },
25
+ {
26
+ "epoch": 0.0029856985041650493,
27
+ "grad_norm": 2.907883405685425,
28
+ "learning_rate": 0.0001999731427036726,
29
+ "loss": 1.608,
30
+ "step": 100
31
+ },
32
+ {
33
+ "epoch": 0.004478547756247574,
34
+ "grad_norm": 3.2614288330078125,
35
+ "learning_rate": 0.00019995885690775376,
36
+ "loss": 1.5505,
37
+ "step": 150
38
+ },
39
+ {
40
+ "epoch": 0.005971397008330099,
41
+ "grad_norm": 3.8400654792785645,
42
+ "learning_rate": 0.00019994457111183493,
43
+ "loss": 1.5737,
44
+ "step": 200
45
+ },
46
+ {
47
+ "epoch": 0.007464246260412624,
48
+ "grad_norm": 3.3358442783355713,
49
+ "learning_rate": 0.00019993028531591612,
50
+ "loss": 1.567,
51
+ "step": 250
52
+ },
53
+ {
54
+ "epoch": 0.008957095512495149,
55
+ "grad_norm": 2.131911277770996,
56
+ "learning_rate": 0.00019991599951999726,
57
+ "loss": 1.5208,
58
+ "step": 300
59
+ },
60
+ {
61
+ "epoch": 0.010449944764577673,
62
+ "grad_norm": 3.180992364883423,
63
+ "learning_rate": 0.00019990171372407845,
64
+ "loss": 1.5586,
65
+ "step": 350
66
+ },
67
+ {
68
+ "epoch": 0.011942794016660197,
69
+ "grad_norm": 3.024989128112793,
70
+ "learning_rate": 0.0001998874279281596,
71
+ "loss": 1.5267,
72
+ "step": 400
73
+ },
74
+ {
75
+ "epoch": 0.013435643268742723,
76
+ "grad_norm": 3.4935102462768555,
77
+ "learning_rate": 0.00019987314213224078,
78
+ "loss": 1.5609,
79
+ "step": 450
80
+ },
81
+ {
82
+ "epoch": 0.014928492520825247,
83
+ "grad_norm": 3.565504550933838,
84
+ "learning_rate": 0.00019985885633632194,
85
+ "loss": 1.5112,
86
+ "step": 500
87
+ },
88
+ {
89
+ "epoch": 0.01642134177290777,
90
+ "grad_norm": 2.0692882537841797,
91
+ "learning_rate": 0.00019984457054040308,
92
+ "loss": 1.5087,
93
+ "step": 550
94
+ },
95
+ {
96
+ "epoch": 0.017914191024990297,
97
+ "grad_norm": 4.110323905944824,
98
+ "learning_rate": 0.00019983028474448427,
99
+ "loss": 1.5073,
100
+ "step": 600
101
+ },
102
+ {
103
+ "epoch": 0.01940704027707282,
104
+ "grad_norm": 2.8632736206054688,
105
+ "learning_rate": 0.0001998159989485654,
106
+ "loss": 1.472,
107
+ "step": 650
108
+ },
109
+ {
110
+ "epoch": 0.020899889529155346,
111
+ "grad_norm": 2.629347324371338,
112
+ "learning_rate": 0.0001998017131526466,
113
+ "loss": 1.5236,
114
+ "step": 700
115
+ },
116
+ {
117
+ "epoch": 0.022392738781237872,
118
+ "grad_norm": 3.696873188018799,
119
+ "learning_rate": 0.00019978742735672774,
120
+ "loss": 1.5216,
121
+ "step": 750
122
+ },
123
+ {
124
+ "epoch": 0.023885588033320394,
125
+ "grad_norm": 3.253305435180664,
126
+ "learning_rate": 0.00019977314156080893,
127
+ "loss": 1.5915,
128
+ "step": 800
129
+ },
130
+ {
131
+ "epoch": 0.02537843728540292,
132
+ "grad_norm": 2.9587886333465576,
133
+ "learning_rate": 0.0001997588557648901,
134
+ "loss": 1.4862,
135
+ "step": 850
136
+ },
137
+ {
138
+ "epoch": 0.026871286537485446,
139
+ "grad_norm": 3.3311073780059814,
140
+ "learning_rate": 0.00019974456996897126,
141
+ "loss": 1.4703,
142
+ "step": 900
143
+ },
144
+ {
145
+ "epoch": 0.02836413578956797,
146
+ "grad_norm": 2.5960264205932617,
147
+ "learning_rate": 0.00019973028417305243,
148
+ "loss": 1.4818,
149
+ "step": 950
150
+ },
151
+ {
152
+ "epoch": 0.029856985041650495,
153
+ "grad_norm": 3.3142144680023193,
154
+ "learning_rate": 0.0001997159983771336,
155
+ "loss": 1.4746,
156
+ "step": 1000
157
+ },
158
+ {
159
+ "epoch": 0.03134983429373302,
160
+ "grad_norm": 3.5049827098846436,
161
+ "learning_rate": 0.00019970171258121476,
162
+ "loss": 1.442,
163
+ "step": 1050
164
+ },
165
+ {
166
+ "epoch": 0.03284268354581554,
167
+ "grad_norm": 3.0218605995178223,
168
+ "learning_rate": 0.00019968742678529592,
169
+ "loss": 1.5265,
170
+ "step": 1100
171
+ },
172
+ {
173
+ "epoch": 0.03433553279789807,
174
+ "grad_norm": 2.936182975769043,
175
+ "learning_rate": 0.00019967314098937709,
176
+ "loss": 1.5174,
177
+ "step": 1150
178
+ },
179
+ {
180
+ "epoch": 0.035828382049980595,
181
+ "grad_norm": 2.877253293991089,
182
+ "learning_rate": 0.00019965885519345825,
183
+ "loss": 1.4499,
184
+ "step": 1200
185
+ },
186
+ {
187
+ "epoch": 0.03732123130206312,
188
+ "grad_norm": 6.07016658782959,
189
+ "learning_rate": 0.00019964456939753941,
190
+ "loss": 1.4542,
191
+ "step": 1250
192
+ },
193
+ {
194
+ "epoch": 0.03881408055414564,
195
+ "grad_norm": 2.1618189811706543,
196
+ "learning_rate": 0.0001996302836016206,
197
+ "loss": 1.4343,
198
+ "step": 1300
199
+ },
200
+ {
201
+ "epoch": 0.040306929806228166,
202
+ "grad_norm": 2.8267719745635986,
203
+ "learning_rate": 0.00019961599780570174,
204
+ "loss": 1.463,
205
+ "step": 1350
206
+ },
207
+ {
208
+ "epoch": 0.04179977905831069,
209
+ "grad_norm": 2.6036462783813477,
210
+ "learning_rate": 0.00019960171200978294,
211
+ "loss": 1.4557,
212
+ "step": 1400
213
+ },
214
+ {
215
+ "epoch": 0.04329262831039322,
216
+ "grad_norm": 3.0187127590179443,
217
+ "learning_rate": 0.00019958742621386407,
218
+ "loss": 1.4472,
219
+ "step": 1450
220
+ },
221
+ {
222
+ "epoch": 0.044785477562475744,
223
+ "grad_norm": 3.9822633266448975,
224
+ "learning_rate": 0.00019957314041794526,
225
+ "loss": 1.4384,
226
+ "step": 1500
227
+ },
228
+ {
229
+ "epoch": 0.04627832681455826,
230
+ "grad_norm": 2.919654607772827,
231
+ "learning_rate": 0.0001995588546220264,
232
+ "loss": 1.4969,
233
+ "step": 1550
234
+ },
235
+ {
236
+ "epoch": 0.04777117606664079,
237
+ "grad_norm": 2.922963857650757,
238
+ "learning_rate": 0.0001995445688261076,
239
+ "loss": 1.4987,
240
+ "step": 1600
241
+ },
242
+ {
243
+ "epoch": 0.049264025318723315,
244
+ "grad_norm": 2.9638512134552,
245
+ "learning_rate": 0.00019953028303018876,
246
+ "loss": 1.4722,
247
+ "step": 1650
248
+ },
249
+ {
250
+ "epoch": 0.05075687457080584,
251
+ "grad_norm": 3.408391237258911,
252
+ "learning_rate": 0.00019951599723426992,
253
+ "loss": 1.4723,
254
+ "step": 1700
255
+ },
256
+ {
257
+ "epoch": 0.052249723822888366,
258
+ "grad_norm": 3.023597240447998,
259
+ "learning_rate": 0.0001995017114383511,
260
+ "loss": 1.4478,
261
+ "step": 1750
262
+ },
263
+ {
264
+ "epoch": 0.05374257307497089,
265
+ "grad_norm": 2.1655213832855225,
266
+ "learning_rate": 0.00019948742564243225,
267
+ "loss": 1.4071,
268
+ "step": 1800
269
+ },
270
+ {
271
+ "epoch": 0.05523542232705341,
272
+ "grad_norm": 3.796663999557495,
273
+ "learning_rate": 0.00019947313984651342,
274
+ "loss": 1.446,
275
+ "step": 1850
276
+ },
277
+ {
278
+ "epoch": 0.05672827157913594,
279
+ "grad_norm": 3.0415594577789307,
280
+ "learning_rate": 0.00019945885405059458,
281
+ "loss": 1.4324,
282
+ "step": 1900
283
+ },
284
+ {
285
+ "epoch": 0.05822112083121846,
286
+ "grad_norm": 2.524627685546875,
287
+ "learning_rate": 0.00019944456825467575,
288
+ "loss": 1.3963,
289
+ "step": 1950
290
+ },
291
+ {
292
+ "epoch": 0.05971397008330099,
293
+ "grad_norm": 3.2881991863250732,
294
+ "learning_rate": 0.0001994302824587569,
295
+ "loss": 1.4522,
296
+ "step": 2000
297
+ },
298
+ {
299
+ "epoch": 0.061206819335383515,
300
+ "grad_norm": 3.392430067062378,
301
+ "learning_rate": 0.00019941599666283808,
302
+ "loss": 1.4329,
303
+ "step": 2050
304
+ },
305
+ {
306
+ "epoch": 0.06269966858746603,
307
+ "grad_norm": 3.9426393508911133,
308
+ "learning_rate": 0.00019940171086691927,
309
+ "loss": 1.5203,
310
+ "step": 2100
311
+ },
312
+ {
313
+ "epoch": 0.06419251783954856,
314
+ "grad_norm": 3.3737235069274902,
315
+ "learning_rate": 0.0001993874250710004,
316
+ "loss": 1.3674,
317
+ "step": 2150
318
+ },
319
+ {
320
+ "epoch": 0.06568536709163109,
321
+ "grad_norm": 3.783085346221924,
322
+ "learning_rate": 0.0001993731392750816,
323
+ "loss": 1.4339,
324
+ "step": 2200
325
+ },
326
+ {
327
+ "epoch": 0.06717821634371361,
328
+ "grad_norm": 3.4819202423095703,
329
+ "learning_rate": 0.00019935885347916273,
330
+ "loss": 1.4436,
331
+ "step": 2250
332
+ },
333
+ {
334
+ "epoch": 0.06867106559579614,
335
+ "grad_norm": 3.141775608062744,
336
+ "learning_rate": 0.00019934456768324393,
337
+ "loss": 1.4683,
338
+ "step": 2300
339
+ },
340
+ {
341
+ "epoch": 0.07016391484787866,
342
+ "grad_norm": 3.2881035804748535,
343
+ "learning_rate": 0.00019933028188732506,
344
+ "loss": 1.4395,
345
+ "step": 2350
346
+ },
347
+ {
348
+ "epoch": 0.07165676409996119,
349
+ "grad_norm": 3.718122959136963,
350
+ "learning_rate": 0.00019931599609140626,
351
+ "loss": 1.4396,
352
+ "step": 2400
353
+ },
354
+ {
355
+ "epoch": 0.07314961335204372,
356
+ "grad_norm": 4.3829474449157715,
357
+ "learning_rate": 0.00019930171029548742,
358
+ "loss": 1.4477,
359
+ "step": 2450
360
+ },
361
+ {
362
+ "epoch": 0.07464246260412624,
363
+ "grad_norm": 3.3698525428771973,
364
+ "learning_rate": 0.00019928742449956858,
365
+ "loss": 1.3529,
366
+ "step": 2500
367
+ },
368
+ {
369
+ "epoch": 0.07613531185620875,
370
+ "grad_norm": 3.7569565773010254,
371
+ "learning_rate": 0.00019927313870364975,
372
+ "loss": 1.4246,
373
+ "step": 2550
374
+ },
375
+ {
376
+ "epoch": 0.07762816110829128,
377
+ "grad_norm": 3.1486406326293945,
378
+ "learning_rate": 0.00019925885290773091,
379
+ "loss": 1.3813,
380
+ "step": 2600
381
+ },
382
+ {
383
+ "epoch": 0.0791210103603738,
384
+ "grad_norm": 4.0635480880737305,
385
+ "learning_rate": 0.00019924456711181208,
386
+ "loss": 1.4259,
387
+ "step": 2650
388
+ },
389
+ {
390
+ "epoch": 0.08061385961245633,
391
+ "grad_norm": 3.2710611820220947,
392
+ "learning_rate": 0.00019923028131589324,
393
+ "loss": 1.3747,
394
+ "step": 2700
395
+ },
396
+ {
397
+ "epoch": 0.08210670886453886,
398
+ "grad_norm": 3.4968345165252686,
399
+ "learning_rate": 0.0001992159955199744,
400
+ "loss": 1.4721,
401
+ "step": 2750
402
+ },
403
+ {
404
+ "epoch": 0.08359955811662138,
405
+ "grad_norm": 4.274214267730713,
406
+ "learning_rate": 0.00019920170972405557,
407
+ "loss": 1.437,
408
+ "step": 2800
409
+ },
410
+ {
411
+ "epoch": 0.08509240736870391,
412
+ "grad_norm": 2.970602512359619,
413
+ "learning_rate": 0.00019918742392813674,
414
+ "loss": 1.3336,
415
+ "step": 2850
416
+ },
417
+ {
418
+ "epoch": 0.08658525662078644,
419
+ "grad_norm": 4.143342971801758,
420
+ "learning_rate": 0.00019917313813221793,
421
+ "loss": 1.4264,
422
+ "step": 2900
423
+ },
424
+ {
425
+ "epoch": 0.08807810587286896,
426
+ "grad_norm": 3.7546920776367188,
427
+ "learning_rate": 0.00019915885233629907,
428
+ "loss": 1.441,
429
+ "step": 2950
430
+ },
431
+ {
432
+ "epoch": 0.08957095512495149,
433
+ "grad_norm": 3.9160516262054443,
434
+ "learning_rate": 0.00019914456654038026,
435
+ "loss": 1.4261,
436
+ "step": 3000
437
+ },
438
+ {
439
+ "epoch": 0.09106380437703401,
440
+ "grad_norm": 3.842073917388916,
441
+ "learning_rate": 0.0001991302807444614,
442
+ "loss": 1.4076,
443
+ "step": 3050
444
+ },
445
+ {
446
+ "epoch": 0.09255665362911653,
447
+ "grad_norm": 4.392395496368408,
448
+ "learning_rate": 0.0001991159949485426,
449
+ "loss": 1.3789,
450
+ "step": 3100
451
+ },
452
+ {
453
+ "epoch": 0.09404950288119905,
454
+ "grad_norm": 3.822425603866577,
455
+ "learning_rate": 0.00019910170915262373,
456
+ "loss": 1.3877,
457
+ "step": 3150
458
+ },
459
+ {
460
+ "epoch": 0.09554235213328158,
461
+ "grad_norm": 3.1348562240600586,
462
+ "learning_rate": 0.0001990874233567049,
463
+ "loss": 1.4081,
464
+ "step": 3200
465
+ },
466
+ {
467
+ "epoch": 0.0970352013853641,
468
+ "grad_norm": 3.453887939453125,
469
+ "learning_rate": 0.00019907313756078608,
470
+ "loss": 1.4143,
471
+ "step": 3250
472
+ },
473
+ {
474
+ "epoch": 0.09852805063744663,
475
+ "grad_norm": 3.5057384967803955,
476
+ "learning_rate": 0.00019905885176486722,
477
+ "loss": 1.4264,
478
+ "step": 3300
479
+ },
480
+ {
481
+ "epoch": 0.10002089988952916,
482
+ "grad_norm": 3.145796060562134,
483
+ "learning_rate": 0.0001990445659689484,
484
+ "loss": 1.4368,
485
+ "step": 3350
486
+ },
487
+ {
488
+ "epoch": 0.10151374914161168,
489
+ "grad_norm": 3.4077043533325195,
490
+ "learning_rate": 0.00019903028017302955,
491
+ "loss": 1.388,
492
+ "step": 3400
493
+ },
494
+ {
495
+ "epoch": 0.10300659839369421,
496
+ "grad_norm": 3.65567946434021,
497
+ "learning_rate": 0.00019901599437711074,
498
+ "loss": 1.42,
499
+ "step": 3450
500
+ },
501
+ {
502
+ "epoch": 0.10449944764577673,
503
+ "grad_norm": 4.460702419281006,
504
+ "learning_rate": 0.0001990017085811919,
505
+ "loss": 1.3991,
506
+ "step": 3500
507
+ },
508
+ {
509
+ "epoch": 0.10599229689785926,
510
+ "grad_norm": 4.155653476715088,
511
+ "learning_rate": 0.00019898742278527307,
512
+ "loss": 1.371,
513
+ "step": 3550
514
+ },
515
+ {
516
+ "epoch": 0.10748514614994178,
517
+ "grad_norm": 3.8904318809509277,
518
+ "learning_rate": 0.00019897313698935423,
519
+ "loss": 1.4378,
520
+ "step": 3600
521
+ },
522
+ {
523
+ "epoch": 0.1089779954020243,
524
+ "grad_norm": 4.0509233474731445,
525
+ "learning_rate": 0.0001989588511934354,
526
+ "loss": 1.3945,
527
+ "step": 3650
528
+ },
529
+ {
530
+ "epoch": 0.11047084465410682,
531
+ "grad_norm": 3.785123109817505,
532
+ "learning_rate": 0.00019894456539751656,
533
+ "loss": 1.436,
534
+ "step": 3700
535
+ },
536
+ {
537
+ "epoch": 0.11196369390618935,
538
+ "grad_norm": 3.4556167125701904,
539
+ "learning_rate": 0.00019893027960159773,
540
+ "loss": 1.3794,
541
+ "step": 3750
542
+ },
543
+ {
544
+ "epoch": 0.11345654315827187,
545
+ "grad_norm": 4.0479559898376465,
546
+ "learning_rate": 0.0001989159938056789,
547
+ "loss": 1.4734,
548
+ "step": 3800
549
+ },
550
+ {
551
+ "epoch": 0.1149493924103544,
552
+ "grad_norm": 3.890805721282959,
553
+ "learning_rate": 0.00019890170800976006,
554
+ "loss": 1.4341,
555
+ "step": 3850
556
+ },
557
+ {
558
+ "epoch": 0.11644224166243693,
559
+ "grad_norm": 3.8178727626800537,
560
+ "learning_rate": 0.00019888742221384122,
561
+ "loss": 1.4754,
562
+ "step": 3900
563
+ },
564
+ {
565
+ "epoch": 0.11793509091451945,
566
+ "grad_norm": 2.456165075302124,
567
+ "learning_rate": 0.00019887313641792241,
568
+ "loss": 1.3887,
569
+ "step": 3950
570
+ },
571
+ {
572
+ "epoch": 0.11942794016660198,
573
+ "grad_norm": 3.5763051509857178,
574
+ "learning_rate": 0.00019885885062200355,
575
+ "loss": 1.3901,
576
+ "step": 4000
577
+ },
578
+ {
579
+ "epoch": 0.1209207894186845,
580
+ "grad_norm": 3.885662317276001,
581
+ "learning_rate": 0.00019884456482608474,
582
+ "loss": 1.3856,
583
+ "step": 4050
584
+ },
585
+ {
586
+ "epoch": 0.12241363867076703,
587
+ "grad_norm": 3.6095409393310547,
588
+ "learning_rate": 0.00019883027903016588,
589
+ "loss": 1.448,
590
+ "step": 4100
591
+ },
592
+ {
593
+ "epoch": 0.12390648792284956,
594
+ "grad_norm": 3.7112534046173096,
595
+ "learning_rate": 0.00019881599323424707,
596
+ "loss": 1.3537,
597
+ "step": 4150
598
+ },
599
+ {
600
+ "epoch": 0.12539933717493207,
601
+ "grad_norm": 3.3566672801971436,
602
+ "learning_rate": 0.0001988017074383282,
603
+ "loss": 1.4389,
604
+ "step": 4200
605
+ },
606
+ {
607
+ "epoch": 0.1268921864270146,
608
+ "grad_norm": 4.570401191711426,
609
+ "learning_rate": 0.0001987874216424094,
610
+ "loss": 1.4191,
611
+ "step": 4250
612
+ },
613
+ {
614
+ "epoch": 0.12838503567909712,
615
+ "grad_norm": 4.455029010772705,
616
+ "learning_rate": 0.00019877313584649057,
617
+ "loss": 1.3677,
618
+ "step": 4300
619
+ },
620
+ {
621
+ "epoch": 0.12987788493117966,
622
+ "grad_norm": 3.0861828327178955,
623
+ "learning_rate": 0.00019875885005057173,
624
+ "loss": 1.3677,
625
+ "step": 4350
626
+ },
627
+ {
628
+ "epoch": 0.13137073418326217,
629
+ "grad_norm": 4.419896602630615,
630
+ "learning_rate": 0.0001987445642546529,
631
+ "loss": 1.4524,
632
+ "step": 4400
633
+ },
634
+ {
635
+ "epoch": 0.1328635834353447,
636
+ "grad_norm": 5.187576770782471,
637
+ "learning_rate": 0.00019873027845873406,
638
+ "loss": 1.3868,
639
+ "step": 4450
640
+ },
641
+ {
642
+ "epoch": 0.13435643268742722,
643
+ "grad_norm": 5.111696243286133,
644
+ "learning_rate": 0.00019871599266281523,
645
+ "loss": 1.4458,
646
+ "step": 4500
647
+ },
648
+ {
649
+ "epoch": 0.13584928193950974,
650
+ "grad_norm": 3.2652997970581055,
651
+ "learning_rate": 0.0001987017068668964,
652
+ "loss": 1.4529,
653
+ "step": 4550
654
+ },
655
+ {
656
+ "epoch": 0.13734213119159228,
657
+ "grad_norm": 4.190273761749268,
658
+ "learning_rate": 0.00019868742107097755,
659
+ "loss": 1.3991,
660
+ "step": 4600
661
+ },
662
+ {
663
+ "epoch": 0.1388349804436748,
664
+ "grad_norm": 4.85620641708374,
665
+ "learning_rate": 0.00019867313527505872,
666
+ "loss": 1.3916,
667
+ "step": 4650
668
+ },
669
+ {
670
+ "epoch": 0.14032782969575733,
671
+ "grad_norm": 3.030954360961914,
672
+ "learning_rate": 0.00019865884947913988,
673
+ "loss": 1.3805,
674
+ "step": 4700
675
+ },
676
+ {
677
+ "epoch": 0.14182067894783984,
678
+ "grad_norm": 3.264406681060791,
679
+ "learning_rate": 0.00019864456368322108,
680
+ "loss": 1.4048,
681
+ "step": 4750
682
+ },
683
+ {
684
+ "epoch": 0.14331352819992238,
685
+ "grad_norm": 3.2138588428497314,
686
+ "learning_rate": 0.0001986302778873022,
687
+ "loss": 1.4092,
688
+ "step": 4800
689
+ },
690
+ {
691
+ "epoch": 0.1448063774520049,
692
+ "grad_norm": 3.847222328186035,
693
+ "learning_rate": 0.0001986159920913834,
694
+ "loss": 1.3871,
695
+ "step": 4850
696
+ },
697
+ {
698
+ "epoch": 0.14629922670408743,
699
+ "grad_norm": 4.004987716674805,
700
+ "learning_rate": 0.00019860170629546454,
701
+ "loss": 1.3845,
702
+ "step": 4900
703
+ },
704
+ {
705
+ "epoch": 0.14779207595616994,
706
+ "grad_norm": 3.5088725090026855,
707
+ "learning_rate": 0.00019858742049954573,
708
+ "loss": 1.379,
709
+ "step": 4950
710
+ },
711
+ {
712
+ "epoch": 0.14928492520825248,
713
+ "grad_norm": 3.275099277496338,
714
+ "learning_rate": 0.00019857313470362687,
715
+ "loss": 1.3628,
716
+ "step": 5000
717
+ },
718
+ {
719
+ "epoch": 0.150777774460335,
720
+ "grad_norm": 3.7903060913085938,
721
+ "learning_rate": 0.00019855884890770806,
722
+ "loss": 1.3804,
723
+ "step": 5050
724
+ },
725
+ {
726
+ "epoch": 0.1522706237124175,
727
+ "grad_norm": 4.294798374176025,
728
+ "learning_rate": 0.00019854456311178923,
729
+ "loss": 1.3988,
730
+ "step": 5100
731
+ },
732
+ {
733
+ "epoch": 0.15376347296450005,
734
+ "grad_norm": 3.2719295024871826,
735
+ "learning_rate": 0.0001985302773158704,
736
+ "loss": 1.387,
737
+ "step": 5150
738
+ },
739
+ {
740
+ "epoch": 0.15525632221658256,
741
+ "grad_norm": 4.143224239349365,
742
+ "learning_rate": 0.00019851599151995156,
743
+ "loss": 1.393,
744
+ "step": 5200
745
+ },
746
+ {
747
+ "epoch": 0.1567491714686651,
748
+ "grad_norm": 3.404754638671875,
749
+ "learning_rate": 0.00019850170572403272,
750
+ "loss": 1.4205,
751
+ "step": 5250
752
+ },
753
+ {
754
+ "epoch": 0.1582420207207476,
755
+ "grad_norm": 3.607126474380493,
756
+ "learning_rate": 0.0001984874199281139,
757
+ "loss": 1.4239,
758
+ "step": 5300
759
+ },
760
+ {
761
+ "epoch": 0.15973486997283015,
762
+ "grad_norm": 4.140823841094971,
763
+ "learning_rate": 0.00019847313413219505,
764
+ "loss": 1.4204,
765
+ "step": 5350
766
+ },
767
+ {
768
+ "epoch": 0.16122771922491266,
769
+ "grad_norm": 3.893251419067383,
770
+ "learning_rate": 0.00019845884833627622,
771
+ "loss": 1.392,
772
+ "step": 5400
773
+ },
774
+ {
775
+ "epoch": 0.1627205684769952,
776
+ "grad_norm": 4.304211139678955,
777
+ "learning_rate": 0.00019844456254035738,
778
+ "loss": 1.44,
779
+ "step": 5450
780
+ },
781
+ {
782
+ "epoch": 0.16421341772907772,
783
+ "grad_norm": 5.273501873016357,
784
+ "learning_rate": 0.00019843027674443855,
785
+ "loss": 1.445,
786
+ "step": 5500
787
+ },
788
+ {
789
+ "epoch": 0.16570626698116026,
790
+ "grad_norm": 4.787700176239014,
791
+ "learning_rate": 0.00019841599094851974,
792
+ "loss": 1.3668,
793
+ "step": 5550
794
+ },
795
+ {
796
+ "epoch": 0.16719911623324277,
797
+ "grad_norm": 3.7984108924865723,
798
+ "learning_rate": 0.00019840170515260087,
799
+ "loss": 1.3523,
800
+ "step": 5600
801
+ },
802
+ {
803
+ "epoch": 0.16869196548532528,
804
+ "grad_norm": 3.885608673095703,
805
+ "learning_rate": 0.00019838741935668207,
806
+ "loss": 1.3917,
807
+ "step": 5650
808
+ },
809
+ {
810
+ "epoch": 0.17018481473740782,
811
+ "grad_norm": 3.459803342819214,
812
+ "learning_rate": 0.0001983731335607632,
813
+ "loss": 1.3833,
814
+ "step": 5700
815
+ },
816
+ {
817
+ "epoch": 0.17167766398949033,
818
+ "grad_norm": 3.7103006839752197,
819
+ "learning_rate": 0.0001983588477648444,
820
+ "loss": 1.4473,
821
+ "step": 5750
822
+ },
823
+ {
824
+ "epoch": 0.17317051324157287,
825
+ "grad_norm": 6.645928382873535,
826
+ "learning_rate": 0.00019834456196892553,
827
+ "loss": 1.3706,
828
+ "step": 5800
829
+ },
830
+ {
831
+ "epoch": 0.17466336249365538,
832
+ "grad_norm": 3.7201037406921387,
833
+ "learning_rate": 0.0001983302761730067,
834
+ "loss": 1.3733,
835
+ "step": 5850
836
+ },
837
+ {
838
+ "epoch": 0.17615621174573792,
839
+ "grad_norm": 4.050106048583984,
840
+ "learning_rate": 0.0001983159903770879,
841
+ "loss": 1.4096,
842
+ "step": 5900
843
+ },
844
+ {
845
+ "epoch": 0.17764906099782043,
846
+ "grad_norm": 4.190842628479004,
847
+ "learning_rate": 0.00019830170458116903,
848
+ "loss": 1.4404,
849
+ "step": 5950
850
+ },
851
+ {
852
+ "epoch": 0.17914191024990297,
853
+ "grad_norm": 4.393162727355957,
854
+ "learning_rate": 0.00019828741878525022,
855
+ "loss": 1.4443,
856
+ "step": 6000
857
+ },
858
+ {
859
+ "epoch": 0.1806347595019855,
860
+ "grad_norm": 3.597520351409912,
861
+ "learning_rate": 0.00019827313298933136,
862
+ "loss": 1.4063,
863
+ "step": 6050
864
+ },
865
+ {
866
+ "epoch": 0.18212760875406803,
867
+ "grad_norm": 3.608085870742798,
868
+ "learning_rate": 0.00019825884719341255,
869
+ "loss": 1.3857,
870
+ "step": 6100
871
+ },
872
+ {
873
+ "epoch": 0.18362045800615054,
874
+ "grad_norm": 3.7055492401123047,
875
+ "learning_rate": 0.0001982445613974937,
876
+ "loss": 1.3997,
877
+ "step": 6150
878
+ },
879
+ {
880
+ "epoch": 0.18511330725823305,
881
+ "grad_norm": 3.875457763671875,
882
+ "learning_rate": 0.00019823027560157488,
883
+ "loss": 1.4296,
884
+ "step": 6200
885
+ },
886
+ {
887
+ "epoch": 0.1866061565103156,
888
+ "grad_norm": 5.074592590332031,
889
+ "learning_rate": 0.00019821598980565604,
890
+ "loss": 1.3785,
891
+ "step": 6250
892
+ },
893
+ {
894
+ "epoch": 0.1880990057623981,
895
+ "grad_norm": 6.013392448425293,
896
+ "learning_rate": 0.0001982017040097372,
897
+ "loss": 1.4391,
898
+ "step": 6300
899
+ },
900
+ {
901
+ "epoch": 0.18959185501448064,
902
+ "grad_norm": 5.679958820343018,
903
+ "learning_rate": 0.00019818741821381837,
904
+ "loss": 1.367,
905
+ "step": 6350
906
+ },
907
+ {
908
+ "epoch": 0.19108470426656315,
909
+ "grad_norm": 3.6182546615600586,
910
+ "learning_rate": 0.00019817313241789954,
911
+ "loss": 1.4508,
912
+ "step": 6400
913
+ },
914
+ {
915
+ "epoch": 0.1925775535186457,
916
+ "grad_norm": 5.209213733673096,
917
+ "learning_rate": 0.0001981588466219807,
918
+ "loss": 1.3878,
919
+ "step": 6450
920
+ },
921
+ {
922
+ "epoch": 0.1940704027707282,
923
+ "grad_norm": 3.0043230056762695,
924
+ "learning_rate": 0.00019814456082606187,
925
+ "loss": 1.4248,
926
+ "step": 6500
927
+ },
928
+ {
929
+ "epoch": 0.19556325202281075,
930
+ "grad_norm": 3.157851219177246,
931
+ "learning_rate": 0.00019813027503014303,
932
+ "loss": 1.3725,
933
+ "step": 6550
934
+ },
935
+ {
936
+ "epoch": 0.19705610127489326,
937
+ "grad_norm": 3.5292418003082275,
938
+ "learning_rate": 0.0001981159892342242,
939
+ "loss": 1.3932,
940
+ "step": 6600
941
+ },
942
+ {
943
+ "epoch": 0.1985489505269758,
944
+ "grad_norm": 3.2819600105285645,
945
+ "learning_rate": 0.00019810170343830536,
946
+ "loss": 1.3495,
947
+ "step": 6650
948
+ },
949
+ {
950
+ "epoch": 0.2000417997790583,
951
+ "grad_norm": 3.0243399143218994,
952
+ "learning_rate": 0.00019808741764238655,
953
+ "loss": 1.3689,
954
+ "step": 6700
955
+ },
956
+ {
957
+ "epoch": 0.20153464903114082,
958
+ "grad_norm": 3.4495368003845215,
959
+ "learning_rate": 0.0001980731318464677,
960
+ "loss": 1.3725,
961
+ "step": 6750
962
+ },
963
+ {
964
+ "epoch": 0.20302749828322336,
965
+ "grad_norm": 3.538259744644165,
966
+ "learning_rate": 0.00019805884605054888,
967
+ "loss": 1.3905,
968
+ "step": 6800
969
+ },
970
+ {
971
+ "epoch": 0.20452034753530587,
972
+ "grad_norm": 4.162181377410889,
973
+ "learning_rate": 0.00019804456025463002,
974
+ "loss": 1.4129,
975
+ "step": 6850
976
+ },
977
+ {
978
+ "epoch": 0.20601319678738841,
979
+ "grad_norm": 4.592432022094727,
980
+ "learning_rate": 0.0001980302744587112,
981
+ "loss": 1.3634,
982
+ "step": 6900
983
+ },
984
+ {
985
+ "epoch": 0.20750604603947093,
986
+ "grad_norm": 3.45967960357666,
987
+ "learning_rate": 0.00019801598866279237,
988
+ "loss": 1.416,
989
+ "step": 6950
990
+ },
991
+ {
992
+ "epoch": 0.20899889529155347,
993
+ "grad_norm": 4.221930503845215,
994
+ "learning_rate": 0.00019800170286687354,
995
+ "loss": 1.4051,
996
+ "step": 7000
997
+ },
998
+ {
999
+ "epoch": 0.21049174454363598,
1000
+ "grad_norm": 4.144239902496338,
1001
+ "learning_rate": 0.0001979874170709547,
1002
+ "loss": 1.4219,
1003
+ "step": 7050
1004
+ },
1005
+ {
1006
+ "epoch": 0.21198459379571852,
1007
+ "grad_norm": 4.7492570877075195,
1008
+ "learning_rate": 0.00019797313127503587,
1009
+ "loss": 1.4028,
1010
+ "step": 7100
1011
+ },
1012
+ {
1013
+ "epoch": 0.21347744304780103,
1014
+ "grad_norm": 3.5841355323791504,
1015
+ "learning_rate": 0.00019795884547911703,
1016
+ "loss": 1.4361,
1017
+ "step": 7150
1018
+ },
1019
+ {
1020
+ "epoch": 0.21497029229988357,
1021
+ "grad_norm": 4.662593364715576,
1022
+ "learning_rate": 0.0001979445596831982,
1023
+ "loss": 1.3816,
1024
+ "step": 7200
1025
+ },
1026
+ {
1027
+ "epoch": 0.21646314155196608,
1028
+ "grad_norm": 4.700701713562012,
1029
+ "learning_rate": 0.00019793027388727936,
1030
+ "loss": 1.4226,
1031
+ "step": 7250
1032
+ },
1033
+ {
1034
+ "epoch": 0.2179559908040486,
1035
+ "grad_norm": 4.025181293487549,
1036
+ "learning_rate": 0.00019791598809136053,
1037
+ "loss": 1.4291,
1038
+ "step": 7300
1039
+ },
1040
+ {
1041
+ "epoch": 0.21944884005613113,
1042
+ "grad_norm": 3.064573049545288,
1043
+ "learning_rate": 0.0001979017022954417,
1044
+ "loss": 1.4293,
1045
+ "step": 7350
1046
+ },
1047
+ {
1048
+ "epoch": 0.22094168930821365,
1049
+ "grad_norm": 6.342152118682861,
1050
+ "learning_rate": 0.00019788741649952288,
1051
+ "loss": 1.4173,
1052
+ "step": 7400
1053
+ },
1054
+ {
1055
+ "epoch": 0.22243453856029619,
1056
+ "grad_norm": 5.89996337890625,
1057
+ "learning_rate": 0.00019787313070360402,
1058
+ "loss": 1.396,
1059
+ "step": 7450
1060
+ },
1061
+ {
1062
+ "epoch": 0.2239273878123787,
1063
+ "grad_norm": 4.462945938110352,
1064
+ "learning_rate": 0.0001978588449076852,
1065
+ "loss": 1.3868,
1066
+ "step": 7500
1067
+ },
1068
+ {
1069
+ "epoch": 0.22542023706446124,
1070
+ "grad_norm": 3.6449055671691895,
1071
+ "learning_rate": 0.00019784455911176635,
1072
+ "loss": 1.396,
1073
+ "step": 7550
1074
+ },
1075
+ {
1076
+ "epoch": 0.22691308631654375,
1077
+ "grad_norm": 4.674243927001953,
1078
+ "learning_rate": 0.00019783027331584754,
1079
+ "loss": 1.395,
1080
+ "step": 7600
1081
+ },
1082
+ {
1083
+ "epoch": 0.2284059355686263,
1084
+ "grad_norm": 3.6160385608673096,
1085
+ "learning_rate": 0.00019781598751992868,
1086
+ "loss": 1.3918,
1087
+ "step": 7650
1088
+ },
1089
+ {
1090
+ "epoch": 0.2298987848207088,
1091
+ "grad_norm": 4.326193332672119,
1092
+ "learning_rate": 0.00019780170172400987,
1093
+ "loss": 1.3947,
1094
+ "step": 7700
1095
+ },
1096
+ {
1097
+ "epoch": 0.23139163407279134,
1098
+ "grad_norm": 5.4003777503967285,
1099
+ "learning_rate": 0.00019778741592809104,
1100
+ "loss": 1.344,
1101
+ "step": 7750
1102
+ },
1103
+ {
1104
+ "epoch": 0.23288448332487385,
1105
+ "grad_norm": 4.711580753326416,
1106
+ "learning_rate": 0.0001977731301321722,
1107
+ "loss": 1.3959,
1108
+ "step": 7800
1109
+ },
1110
+ {
1111
+ "epoch": 0.23437733257695637,
1112
+ "grad_norm": 3.4752814769744873,
1113
+ "learning_rate": 0.00019775884433625337,
1114
+ "loss": 1.3722,
1115
+ "step": 7850
1116
+ },
1117
+ {
1118
+ "epoch": 0.2358701818290389,
1119
+ "grad_norm": 4.028527736663818,
1120
+ "learning_rate": 0.00019774455854033453,
1121
+ "loss": 1.3683,
1122
+ "step": 7900
1123
+ },
1124
+ {
1125
+ "epoch": 0.23736303108112142,
1126
+ "grad_norm": 4.094334602355957,
1127
+ "learning_rate": 0.0001977302727444157,
1128
+ "loss": 1.3607,
1129
+ "step": 7950
1130
+ },
1131
+ {
1132
+ "epoch": 0.23885588033320396,
1133
+ "grad_norm": 5.232580661773682,
1134
+ "learning_rate": 0.00019771598694849686,
1135
+ "loss": 1.4354,
1136
+ "step": 8000
1137
+ },
1138
+ {
1139
+ "epoch": 0.24034872958528647,
1140
+ "grad_norm": 4.269852161407471,
1141
+ "learning_rate": 0.00019770170115257802,
1142
+ "loss": 1.4372,
1143
+ "step": 8050
1144
+ },
1145
+ {
1146
+ "epoch": 0.241841578837369,
1147
+ "grad_norm": 3.312541961669922,
1148
+ "learning_rate": 0.0001976874153566592,
1149
+ "loss": 1.3826,
1150
+ "step": 8100
1151
+ },
1152
+ {
1153
+ "epoch": 0.24333442808945152,
1154
+ "grad_norm": 3.8900692462921143,
1155
+ "learning_rate": 0.00019767312956074035,
1156
+ "loss": 1.4189,
1157
+ "step": 8150
1158
+ },
1159
+ {
1160
+ "epoch": 0.24482727734153406,
1161
+ "grad_norm": 3.894512414932251,
1162
+ "learning_rate": 0.00019765884376482155,
1163
+ "loss": 1.3365,
1164
+ "step": 8200
1165
+ },
1166
+ {
1167
+ "epoch": 0.24632012659361657,
1168
+ "grad_norm": 4.644411563873291,
1169
+ "learning_rate": 0.00019764455796890268,
1170
+ "loss": 1.4311,
1171
+ "step": 8250
1172
+ },
1173
+ {
1174
+ "epoch": 0.2478129758456991,
1175
+ "grad_norm": 8.174029350280762,
1176
+ "learning_rate": 0.00019763027217298387,
1177
+ "loss": 1.361,
1178
+ "step": 8300
1179
+ },
1180
+ {
1181
+ "epoch": 0.24930582509778162,
1182
+ "grad_norm": 4.615732192993164,
1183
+ "learning_rate": 0.000197615986377065,
1184
+ "loss": 1.4552,
1185
+ "step": 8350
1186
+ },
1187
+ {
1188
+ "epoch": 0.25079867434986414,
1189
+ "grad_norm": 4.421249866485596,
1190
+ "learning_rate": 0.0001976017005811462,
1191
+ "loss": 1.3463,
1192
+ "step": 8400
1193
+ },
1194
+ {
1195
+ "epoch": 0.2522915236019467,
1196
+ "grad_norm": 2.8386716842651367,
1197
+ "learning_rate": 0.00019758741478522734,
1198
+ "loss": 1.348,
1199
+ "step": 8450
1200
+ },
1201
+ {
1202
+ "epoch": 0.2537843728540292,
1203
+ "grad_norm": 4.3141703605651855,
1204
+ "learning_rate": 0.0001975731289893085,
1205
+ "loss": 1.4306,
1206
+ "step": 8500
1207
+ },
1208
+ {
1209
+ "epoch": 0.2552772221061117,
1210
+ "grad_norm": 3.947331428527832,
1211
+ "learning_rate": 0.0001975588431933897,
1212
+ "loss": 1.3823,
1213
+ "step": 8550
1214
+ },
1215
+ {
1216
+ "epoch": 0.25677007135819424,
1217
+ "grad_norm": 3.2268636226654053,
1218
+ "learning_rate": 0.00019754455739747084,
1219
+ "loss": 1.4199,
1220
+ "step": 8600
1221
+ },
1222
+ {
1223
+ "epoch": 0.2582629206102768,
1224
+ "grad_norm": 4.0353102684021,
1225
+ "learning_rate": 0.00019753027160155203,
1226
+ "loss": 1.3927,
1227
+ "step": 8650
1228
+ },
1229
+ {
1230
+ "epoch": 0.2597557698623593,
1231
+ "grad_norm": 3.490560293197632,
1232
+ "learning_rate": 0.00019751598580563316,
1233
+ "loss": 1.401,
1234
+ "step": 8700
1235
+ },
1236
+ {
1237
+ "epoch": 0.2612486191144418,
1238
+ "grad_norm": 5.577207088470459,
1239
+ "learning_rate": 0.00019750170000971436,
1240
+ "loss": 1.3586,
1241
+ "step": 8750
1242
+ },
1243
+ {
1244
+ "epoch": 0.26274146836652434,
1245
+ "grad_norm": 4.168467998504639,
1246
+ "learning_rate": 0.0001974874142137955,
1247
+ "loss": 1.3303,
1248
+ "step": 8800
1249
+ },
1250
+ {
1251
+ "epoch": 0.2642343176186069,
1252
+ "grad_norm": 3.812627077102661,
1253
+ "learning_rate": 0.00019747312841787669,
1254
+ "loss": 1.3717,
1255
+ "step": 8850
1256
+ },
1257
+ {
1258
+ "epoch": 0.2657271668706894,
1259
+ "grad_norm": 4.875237464904785,
1260
+ "learning_rate": 0.00019745884262195785,
1261
+ "loss": 1.3873,
1262
+ "step": 8900
1263
+ },
1264
+ {
1265
+ "epoch": 0.2672200161227719,
1266
+ "grad_norm": 4.048189163208008,
1267
+ "learning_rate": 0.00019744455682603902,
1268
+ "loss": 1.3775,
1269
+ "step": 8950
1270
+ },
1271
+ {
1272
+ "epoch": 0.26871286537485445,
1273
+ "grad_norm": 3.9090261459350586,
1274
+ "learning_rate": 0.00019743027103012018,
1275
+ "loss": 1.4296,
1276
+ "step": 9000
1277
+ },
1278
+ {
1279
+ "epoch": 0.270205714626937,
1280
+ "grad_norm": 2.8476953506469727,
1281
+ "learning_rate": 0.00019741598523420134,
1282
+ "loss": 1.4175,
1283
+ "step": 9050
1284
+ },
1285
+ {
1286
+ "epoch": 0.2716985638790195,
1287
+ "grad_norm": 5.782102584838867,
1288
+ "learning_rate": 0.0001974016994382825,
1289
+ "loss": 1.3835,
1290
+ "step": 9100
1291
+ },
1292
+ {
1293
+ "epoch": 0.273191413131102,
1294
+ "grad_norm": 4.640264987945557,
1295
+ "learning_rate": 0.00019738741364236367,
1296
+ "loss": 1.4524,
1297
+ "step": 9150
1298
+ },
1299
+ {
1300
+ "epoch": 0.27468426238318455,
1301
+ "grad_norm": 4.81790828704834,
1302
+ "learning_rate": 0.00019737312784644484,
1303
+ "loss": 1.3183,
1304
+ "step": 9200
1305
+ },
1306
+ {
1307
+ "epoch": 0.2761771116352671,
1308
+ "grad_norm": 2.685009717941284,
1309
+ "learning_rate": 0.000197358842050526,
1310
+ "loss": 1.3243,
1311
+ "step": 9250
1312
+ },
1313
+ {
1314
+ "epoch": 0.2776699608873496,
1315
+ "grad_norm": 5.321321487426758,
1316
+ "learning_rate": 0.00019734455625460717,
1317
+ "loss": 1.4086,
1318
+ "step": 9300
1319
+ },
1320
+ {
1321
+ "epoch": 0.2791628101394321,
1322
+ "grad_norm": 3.065791368484497,
1323
+ "learning_rate": 0.00019733027045868836,
1324
+ "loss": 1.337,
1325
+ "step": 9350
1326
+ },
1327
+ {
1328
+ "epoch": 0.28065565939151466,
1329
+ "grad_norm": 4.3569817543029785,
1330
+ "learning_rate": 0.0001973159846627695,
1331
+ "loss": 1.4082,
1332
+ "step": 9400
1333
+ },
1334
+ {
1335
+ "epoch": 0.2821485086435972,
1336
+ "grad_norm": 4.67582368850708,
1337
+ "learning_rate": 0.0001973016988668507,
1338
+ "loss": 1.3832,
1339
+ "step": 9450
1340
+ },
1341
+ {
1342
+ "epoch": 0.2836413578956797,
1343
+ "grad_norm": 4.942144870758057,
1344
+ "learning_rate": 0.00019728741307093183,
1345
+ "loss": 1.3734,
1346
+ "step": 9500
1347
+ },
1348
+ {
1349
+ "epoch": 0.2851342071477622,
1350
+ "grad_norm": 4.853246688842773,
1351
+ "learning_rate": 0.00019727312727501302,
1352
+ "loss": 1.4111,
1353
+ "step": 9550
1354
+ },
1355
+ {
1356
+ "epoch": 0.28662705639984476,
1357
+ "grad_norm": 3.071237325668335,
1358
+ "learning_rate": 0.00019725884147909418,
1359
+ "loss": 1.3746,
1360
+ "step": 9600
1361
+ },
1362
+ {
1363
+ "epoch": 0.28811990565192724,
1364
+ "grad_norm": 4.844615459442139,
1365
+ "learning_rate": 0.00019724455568317535,
1366
+ "loss": 1.3051,
1367
+ "step": 9650
1368
+ },
1369
+ {
1370
+ "epoch": 0.2896127549040098,
1371
+ "grad_norm": 5.954223155975342,
1372
+ "learning_rate": 0.0001972302698872565,
1373
+ "loss": 1.4131,
1374
+ "step": 9700
1375
+ },
1376
+ {
1377
+ "epoch": 0.2911056041560923,
1378
+ "grad_norm": 3.6717801094055176,
1379
+ "learning_rate": 0.00019721598409133768,
1380
+ "loss": 1.4166,
1381
+ "step": 9750
1382
+ },
1383
+ {
1384
+ "epoch": 0.29259845340817486,
1385
+ "grad_norm": 3.6257095336914062,
1386
+ "learning_rate": 0.00019720169829541884,
1387
+ "loss": 1.3679,
1388
+ "step": 9800
1389
+ },
1390
+ {
1391
+ "epoch": 0.29409130266025735,
1392
+ "grad_norm": 4.245635032653809,
1393
+ "learning_rate": 0.0001971874124995,
1394
+ "loss": 1.3171,
1395
+ "step": 9850
1396
+ },
1397
+ {
1398
+ "epoch": 0.2955841519123399,
1399
+ "grad_norm": 5.362602710723877,
1400
+ "learning_rate": 0.00019717312670358117,
1401
+ "loss": 1.3932,
1402
+ "step": 9900
1403
+ },
1404
+ {
1405
+ "epoch": 0.2970770011644224,
1406
+ "grad_norm": 4.6283721923828125,
1407
+ "learning_rate": 0.00019715884090766234,
1408
+ "loss": 1.3757,
1409
+ "step": 9950
1410
+ },
1411
+ {
1412
+ "epoch": 0.29856985041650497,
1413
+ "grad_norm": 4.299574851989746,
1414
+ "learning_rate": 0.0001971445551117435,
1415
+ "loss": 1.4018,
1416
+ "step": 10000
1417
+ }
1418
+ ],
1419
+ "logging_steps": 50,
1420
+ "max_steps": 700001,
1421
+ "num_input_tokens_seen": 0,
1422
+ "num_train_epochs": 21,
1423
+ "save_steps": 10000,
1424
+ "stateful_callbacks": {
1425
+ "TrainerControl": {
1426
+ "args": {
1427
+ "should_epoch_stop": false,
1428
+ "should_evaluate": false,
1429
+ "should_log": false,
1430
+ "should_save": true,
1431
+ "should_training_stop": false
1432
+ },
1433
+ "attributes": {}
1434
+ }
1435
+ },
1436
+ "total_flos": 2.535695686786089e+17,
1437
+ "train_batch_size": 2,
1438
+ "trial_name": null,
1439
+ "trial_params": null
1440
+ }
last-checkpoint/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0f04c18880a48291999c17738bf0f62f2b6e23d1307ab6d608fabd8b061c2af
3
+ size 6968
last-checkpoint/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)