hardlyworking commited on
Commit
3829c58
·
verified ·
1 Parent(s): 43385d7

Training in progress, step 179, checkpoint

Browse files
checkpoint-179/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: hardlyworking/Noodles-Merge-12B
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.15.1
checkpoint-179/adapter_config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "hardlyworking/Noodles-Merge-12B",
5
+ "bias": "none",
6
+ "corda_config": null,
7
+ "eva_config": null,
8
+ "exclude_modules": null,
9
+ "fan_in_fan_out": null,
10
+ "inference_mode": true,
11
+ "init_lora_weights": true,
12
+ "layer_replication": null,
13
+ "layers_pattern": null,
14
+ "layers_to_transform": null,
15
+ "loftq_config": {},
16
+ "lora_alpha": 16,
17
+ "lora_bias": false,
18
+ "lora_dropout": 0.05,
19
+ "megatron_config": null,
20
+ "megatron_core": "megatron.core",
21
+ "modules_to_save": [
22
+ "embed_tokens",
23
+ "lm_head"
24
+ ],
25
+ "peft_type": "LORA",
26
+ "r": 128,
27
+ "rank_pattern": {},
28
+ "revision": null,
29
+ "target_modules": [
30
+ "o_proj",
31
+ "down_proj",
32
+ "gate_proj",
33
+ "up_proj",
34
+ "k_proj",
35
+ "q_proj",
36
+ "v_proj"
37
+ ],
38
+ "task_type": "CAUSAL_LM",
39
+ "trainable_token_indices": null,
40
+ "use_dora": false,
41
+ "use_rslora": true
42
+ }
checkpoint-179/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9b292b880d04bb776b8c3167fca8ae800e642d797c3c8d01489639b6522dd85d
3
+ size 3596694008
checkpoint-179/global_step179/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:31f79bb3cdc8f199bb51c23b657b0dd377097ab7c5eb6371460f864f70b46e99
3
+ size 2712459662
checkpoint-179/global_step179/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25a5cd5370a51df03d145fbbed5b76c8779368cd5398b1cc947887a25d8a834f
3
+ size 2712459662
checkpoint-179/global_step179/bf16_zero_pp_rank_2_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:89202a61ba1c1becfdc90e59fbdb3345d983c12e2bf25d0685d5b07904fdc797
3
+ size 2712459662
checkpoint-179/global_step179/bf16_zero_pp_rank_3_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98b6ac4d2366b7784a9debfab37108c209a06092fdc5e717148ea58a7b4f0559
3
+ size 2712459662
checkpoint-179/global_step179/zero_pp_rank_0_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:18aceac870f68d7941f76cfb101bf8f200b8e03f2143e2b338191e5d46bbbbb0
3
+ size 558360
checkpoint-179/global_step179/zero_pp_rank_1_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2668fd56da0a78e07d1546ff5fc939e355559c85f7960b93ffb481ebf41353c4
3
+ size 558360
checkpoint-179/global_step179/zero_pp_rank_2_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3ffafd99e3a841cdbdd0a1475a97baeb68d388860719c4d01160e5adb235f699
3
+ size 558360
checkpoint-179/global_step179/zero_pp_rank_3_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d15193d1ce12ab20826317163f45c510db408a2c7c08c8531f1d8ac371fdbacc
3
+ size 558360
checkpoint-179/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step179
checkpoint-179/rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5b55c2673c956f8bcadf505e6f8c669a3242704c70f78654a072adc3aff9775
3
+ size 15024
checkpoint-179/rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b010356c5eb050eb79db6e5d22dd8a0ff3f866de8d2ce0103d58afbf73694ad8
3
+ size 15024
checkpoint-179/rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61d85a2b89442eb6e7d3dc16abb0f82563235ac85a5fc07ed0a2463c855c6d81
3
+ size 15024
checkpoint-179/rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c550a27f668f3d4432e465ccf1b7ca4eef2528a8a5a16b70d05021b40c41a9a
3
+ size 15024
checkpoint-179/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ecb9a5e224389470f0749774a340fad57d06dd231cbde400e43d9eddb912010
3
+ size 1064
checkpoint-179/special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|im_end|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<pad>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<unk>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
checkpoint-179/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b4c8fcd33487a449c07f423d47adb035bba8347ccf13eb074b4d1fef8acf919
3
+ size 17078288
checkpoint-179/tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-179/trainer_state.json ADDED
@@ -0,0 +1,1319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 0.499302649930265,
6
+ "eval_steps": 45,
7
+ "global_step": 179,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.002789400278940028,
14
+ "grad_norm": 2.008944315843832,
15
+ "learning_rate": 0.0,
16
+ "loss": 1.7653,
17
+ "step": 1
18
+ },
19
+ {
20
+ "epoch": 0.002789400278940028,
21
+ "eval_loss": 1.7864996194839478,
22
+ "eval_runtime": 155.6922,
23
+ "eval_samples_per_second": 2.042,
24
+ "eval_steps_per_second": 0.128,
25
+ "step": 1
26
+ },
27
+ {
28
+ "epoch": 0.005578800557880056,
29
+ "grad_norm": 1.5986956798562522,
30
+ "learning_rate": 5.000000000000001e-07,
31
+ "loss": 1.3721,
32
+ "step": 2
33
+ },
34
+ {
35
+ "epoch": 0.008368200836820083,
36
+ "grad_norm": 2.487093074085383,
37
+ "learning_rate": 1.0000000000000002e-06,
38
+ "loss": 1.4468,
39
+ "step": 3
40
+ },
41
+ {
42
+ "epoch": 0.011157601115760111,
43
+ "grad_norm": 1.9408908369837041,
44
+ "learning_rate": 1.5e-06,
45
+ "loss": 1.8555,
46
+ "step": 4
47
+ },
48
+ {
49
+ "epoch": 0.01394700139470014,
50
+ "grad_norm": 1.855397723025267,
51
+ "learning_rate": 2.0000000000000003e-06,
52
+ "loss": 1.5173,
53
+ "step": 5
54
+ },
55
+ {
56
+ "epoch": 0.016736401673640166,
57
+ "grad_norm": 1.6798170163537172,
58
+ "learning_rate": 2.5e-06,
59
+ "loss": 1.3812,
60
+ "step": 6
61
+ },
62
+ {
63
+ "epoch": 0.019525801952580194,
64
+ "grad_norm": 2.0478066370088133,
65
+ "learning_rate": 3e-06,
66
+ "loss": 1.475,
67
+ "step": 7
68
+ },
69
+ {
70
+ "epoch": 0.022315202231520222,
71
+ "grad_norm": 1.6541684745930123,
72
+ "learning_rate": 3.5e-06,
73
+ "loss": 1.6239,
74
+ "step": 8
75
+ },
76
+ {
77
+ "epoch": 0.02510460251046025,
78
+ "grad_norm": 1.5940373225900581,
79
+ "learning_rate": 4.000000000000001e-06,
80
+ "loss": 1.4474,
81
+ "step": 9
82
+ },
83
+ {
84
+ "epoch": 0.02789400278940028,
85
+ "grad_norm": 1.3436762031717087,
86
+ "learning_rate": 4.5e-06,
87
+ "loss": 1.5277,
88
+ "step": 10
89
+ },
90
+ {
91
+ "epoch": 0.030683403068340307,
92
+ "grad_norm": 1.4820988105255548,
93
+ "learning_rate": 5e-06,
94
+ "loss": 1.3905,
95
+ "step": 11
96
+ },
97
+ {
98
+ "epoch": 0.03347280334728033,
99
+ "grad_norm": 1.3026823080341792,
100
+ "learning_rate": 5.500000000000001e-06,
101
+ "loss": 1.2716,
102
+ "step": 12
103
+ },
104
+ {
105
+ "epoch": 0.03626220362622036,
106
+ "grad_norm": 1.2786618249049673,
107
+ "learning_rate": 6e-06,
108
+ "loss": 1.4357,
109
+ "step": 13
110
+ },
111
+ {
112
+ "epoch": 0.03905160390516039,
113
+ "grad_norm": 1.4401448629219828,
114
+ "learning_rate": 6.5000000000000004e-06,
115
+ "loss": 1.5418,
116
+ "step": 14
117
+ },
118
+ {
119
+ "epoch": 0.04184100418410042,
120
+ "grad_norm": 1.4108691585319235,
121
+ "learning_rate": 7e-06,
122
+ "loss": 1.419,
123
+ "step": 15
124
+ },
125
+ {
126
+ "epoch": 0.044630404463040445,
127
+ "grad_norm": 1.434665713671276,
128
+ "learning_rate": 7.500000000000001e-06,
129
+ "loss": 1.4042,
130
+ "step": 16
131
+ },
132
+ {
133
+ "epoch": 0.04741980474198047,
134
+ "grad_norm": 1.4864898541989087,
135
+ "learning_rate": 8.000000000000001e-06,
136
+ "loss": 1.4338,
137
+ "step": 17
138
+ },
139
+ {
140
+ "epoch": 0.0502092050209205,
141
+ "grad_norm": 1.7497952919365851,
142
+ "learning_rate": 8.5e-06,
143
+ "loss": 1.5988,
144
+ "step": 18
145
+ },
146
+ {
147
+ "epoch": 0.05299860529986053,
148
+ "grad_norm": 1.5825124800137,
149
+ "learning_rate": 9e-06,
150
+ "loss": 1.4817,
151
+ "step": 19
152
+ },
153
+ {
154
+ "epoch": 0.05578800557880056,
155
+ "grad_norm": 1.5639582937511203,
156
+ "learning_rate": 9.5e-06,
157
+ "loss": 1.3795,
158
+ "step": 20
159
+ },
160
+ {
161
+ "epoch": 0.058577405857740586,
162
+ "grad_norm": 1.5512627729747626,
163
+ "learning_rate": 1e-05,
164
+ "loss": 1.4833,
165
+ "step": 21
166
+ },
167
+ {
168
+ "epoch": 0.061366806136680614,
169
+ "grad_norm": 1.4462678614801439,
170
+ "learning_rate": 1.0500000000000001e-05,
171
+ "loss": 1.3781,
172
+ "step": 22
173
+ },
174
+ {
175
+ "epoch": 0.06415620641562064,
176
+ "grad_norm": 1.5995776178618928,
177
+ "learning_rate": 1.1000000000000001e-05,
178
+ "loss": 1.4862,
179
+ "step": 23
180
+ },
181
+ {
182
+ "epoch": 0.06694560669456066,
183
+ "grad_norm": 1.2623925872690254,
184
+ "learning_rate": 1.15e-05,
185
+ "loss": 1.4222,
186
+ "step": 24
187
+ },
188
+ {
189
+ "epoch": 0.0697350069735007,
190
+ "grad_norm": 1.2816346894508914,
191
+ "learning_rate": 1.2e-05,
192
+ "loss": 1.3473,
193
+ "step": 25
194
+ },
195
+ {
196
+ "epoch": 0.07252440725244072,
197
+ "grad_norm": 1.4528035335148701,
198
+ "learning_rate": 1.25e-05,
199
+ "loss": 1.5278,
200
+ "step": 26
201
+ },
202
+ {
203
+ "epoch": 0.07531380753138076,
204
+ "grad_norm": 1.3415339044507064,
205
+ "learning_rate": 1.3000000000000001e-05,
206
+ "loss": 1.3939,
207
+ "step": 27
208
+ },
209
+ {
210
+ "epoch": 0.07810320781032078,
211
+ "grad_norm": 1.6072610009319113,
212
+ "learning_rate": 1.3500000000000001e-05,
213
+ "loss": 1.5401,
214
+ "step": 28
215
+ },
216
+ {
217
+ "epoch": 0.08089260808926081,
218
+ "grad_norm": 1.5988215139386146,
219
+ "learning_rate": 1.4e-05,
220
+ "loss": 1.3995,
221
+ "step": 29
222
+ },
223
+ {
224
+ "epoch": 0.08368200836820083,
225
+ "grad_norm": 1.4507828208303803,
226
+ "learning_rate": 1.45e-05,
227
+ "loss": 1.4584,
228
+ "step": 30
229
+ },
230
+ {
231
+ "epoch": 0.08647140864714087,
232
+ "grad_norm": 1.4975002404633069,
233
+ "learning_rate": 1.5000000000000002e-05,
234
+ "loss": 1.3834,
235
+ "step": 31
236
+ },
237
+ {
238
+ "epoch": 0.08926080892608089,
239
+ "grad_norm": 1.4128570529331854,
240
+ "learning_rate": 1.55e-05,
241
+ "loss": 1.4216,
242
+ "step": 32
243
+ },
244
+ {
245
+ "epoch": 0.09205020920502092,
246
+ "grad_norm": 1.3616495178863832,
247
+ "learning_rate": 1.6000000000000003e-05,
248
+ "loss": 1.5167,
249
+ "step": 33
250
+ },
251
+ {
252
+ "epoch": 0.09483960948396095,
253
+ "grad_norm": 1.1988790310990909,
254
+ "learning_rate": 1.65e-05,
255
+ "loss": 1.4525,
256
+ "step": 34
257
+ },
258
+ {
259
+ "epoch": 0.09762900976290098,
260
+ "grad_norm": 1.4483022749153813,
261
+ "learning_rate": 1.7e-05,
262
+ "loss": 1.5741,
263
+ "step": 35
264
+ },
265
+ {
266
+ "epoch": 0.100418410041841,
267
+ "grad_norm": 1.394589777246842,
268
+ "learning_rate": 1.7500000000000002e-05,
269
+ "loss": 1.6437,
270
+ "step": 36
271
+ },
272
+ {
273
+ "epoch": 0.10320781032078104,
274
+ "grad_norm": 1.4186049044929165,
275
+ "learning_rate": 1.8e-05,
276
+ "loss": 1.5162,
277
+ "step": 37
278
+ },
279
+ {
280
+ "epoch": 0.10599721059972106,
281
+ "grad_norm": 1.4241876007622027,
282
+ "learning_rate": 1.8500000000000002e-05,
283
+ "loss": 1.2395,
284
+ "step": 38
285
+ },
286
+ {
287
+ "epoch": 0.1087866108786611,
288
+ "grad_norm": 1.3743075911034852,
289
+ "learning_rate": 1.9e-05,
290
+ "loss": 1.4631,
291
+ "step": 39
292
+ },
293
+ {
294
+ "epoch": 0.11157601115760112,
295
+ "grad_norm": 1.2863497247985725,
296
+ "learning_rate": 1.95e-05,
297
+ "loss": 1.3611,
298
+ "step": 40
299
+ },
300
+ {
301
+ "epoch": 0.11436541143654114,
302
+ "grad_norm": 1.3054075793205129,
303
+ "learning_rate": 2e-05,
304
+ "loss": 1.2375,
305
+ "step": 41
306
+ },
307
+ {
308
+ "epoch": 0.11715481171548117,
309
+ "grad_norm": 1.447249035073335,
310
+ "learning_rate": 1.9999892011980525e-05,
311
+ "loss": 1.4044,
312
+ "step": 42
313
+ },
314
+ {
315
+ "epoch": 0.1199442119944212,
316
+ "grad_norm": 1.3461748028257197,
317
+ "learning_rate": 1.9999568050254373e-05,
318
+ "loss": 1.4081,
319
+ "step": 43
320
+ },
321
+ {
322
+ "epoch": 0.12273361227336123,
323
+ "grad_norm": 1.6035229132022362,
324
+ "learning_rate": 1.999902812181835e-05,
325
+ "loss": 1.4167,
326
+ "step": 44
327
+ },
328
+ {
329
+ "epoch": 0.12552301255230125,
330
+ "grad_norm": 1.7750306011999208,
331
+ "learning_rate": 1.9998272238333606e-05,
332
+ "loss": 1.3533,
333
+ "step": 45
334
+ },
335
+ {
336
+ "epoch": 0.12552301255230125,
337
+ "eval_loss": 1.6828460693359375,
338
+ "eval_runtime": 158.4193,
339
+ "eval_samples_per_second": 2.007,
340
+ "eval_steps_per_second": 0.126,
341
+ "step": 45
342
+ },
343
+ {
344
+ "epoch": 0.12831241283124128,
345
+ "grad_norm": 1.354470787639867,
346
+ "learning_rate": 1.9997300416125426e-05,
347
+ "loss": 1.3901,
348
+ "step": 46
349
+ },
350
+ {
351
+ "epoch": 0.13110181311018132,
352
+ "grad_norm": 1.23248602443203,
353
+ "learning_rate": 1.999611267618283e-05,
354
+ "loss": 1.3485,
355
+ "step": 47
356
+ },
357
+ {
358
+ "epoch": 0.13389121338912133,
359
+ "grad_norm": 1.314827114627873,
360
+ "learning_rate": 1.9994709044158157e-05,
361
+ "loss": 1.3195,
362
+ "step": 48
363
+ },
364
+ {
365
+ "epoch": 0.13668061366806136,
366
+ "grad_norm": 1.3741001015735983,
367
+ "learning_rate": 1.99930895503665e-05,
368
+ "loss": 1.4394,
369
+ "step": 49
370
+ },
371
+ {
372
+ "epoch": 0.1394700139470014,
373
+ "grad_norm": 1.1624406309888304,
374
+ "learning_rate": 1.9991254229785043e-05,
375
+ "loss": 1.2943,
376
+ "step": 50
377
+ },
378
+ {
379
+ "epoch": 0.14225941422594143,
380
+ "grad_norm": 1.431188759221728,
381
+ "learning_rate": 1.998920312205231e-05,
382
+ "loss": 1.4614,
383
+ "step": 51
384
+ },
385
+ {
386
+ "epoch": 0.14504881450488144,
387
+ "grad_norm": 1.2513371987994648,
388
+ "learning_rate": 1.9986936271467316e-05,
389
+ "loss": 1.328,
390
+ "step": 52
391
+ },
392
+ {
393
+ "epoch": 0.14783821478382148,
394
+ "grad_norm": 1.6084481811469094,
395
+ "learning_rate": 1.99844537269886e-05,
396
+ "loss": 1.4579,
397
+ "step": 53
398
+ },
399
+ {
400
+ "epoch": 0.1506276150627615,
401
+ "grad_norm": 1.3643143080926854,
402
+ "learning_rate": 1.9981755542233175e-05,
403
+ "loss": 1.4471,
404
+ "step": 54
405
+ },
406
+ {
407
+ "epoch": 0.15341701534170155,
408
+ "grad_norm": 1.443453372098446,
409
+ "learning_rate": 1.9978841775475368e-05,
410
+ "loss": 1.3931,
411
+ "step": 55
412
+ },
413
+ {
414
+ "epoch": 0.15620641562064155,
415
+ "grad_norm": 1.186174044031903,
416
+ "learning_rate": 1.997571248964556e-05,
417
+ "loss": 1.2935,
418
+ "step": 56
419
+ },
420
+ {
421
+ "epoch": 0.1589958158995816,
422
+ "grad_norm": 1.3967845728055575,
423
+ "learning_rate": 1.9972367752328824e-05,
424
+ "loss": 1.3819,
425
+ "step": 57
426
+ },
427
+ {
428
+ "epoch": 0.16178521617852162,
429
+ "grad_norm": 1.585201984076838,
430
+ "learning_rate": 1.9968807635763472e-05,
431
+ "loss": 1.5391,
432
+ "step": 58
433
+ },
434
+ {
435
+ "epoch": 0.16457461645746166,
436
+ "grad_norm": 1.515327450581085,
437
+ "learning_rate": 1.9965032216839493e-05,
438
+ "loss": 1.3969,
439
+ "step": 59
440
+ },
441
+ {
442
+ "epoch": 0.16736401673640167,
443
+ "grad_norm": 1.3595894447160555,
444
+ "learning_rate": 1.996104157709689e-05,
445
+ "loss": 1.3598,
446
+ "step": 60
447
+ },
448
+ {
449
+ "epoch": 0.1701534170153417,
450
+ "grad_norm": 1.4252798961269173,
451
+ "learning_rate": 1.9956835802723916e-05,
452
+ "loss": 1.447,
453
+ "step": 61
454
+ },
455
+ {
456
+ "epoch": 0.17294281729428174,
457
+ "grad_norm": 1.4269613254937963,
458
+ "learning_rate": 1.9952414984555225e-05,
459
+ "loss": 1.4354,
460
+ "step": 62
461
+ },
462
+ {
463
+ "epoch": 0.17573221757322174,
464
+ "grad_norm": 1.5984564978735487,
465
+ "learning_rate": 1.994777921806989e-05,
466
+ "loss": 1.5493,
467
+ "step": 63
468
+ },
469
+ {
470
+ "epoch": 0.17852161785216178,
471
+ "grad_norm": 1.5396475514798837,
472
+ "learning_rate": 1.9942928603389366e-05,
473
+ "loss": 1.4095,
474
+ "step": 64
475
+ },
476
+ {
477
+ "epoch": 0.18131101813110181,
478
+ "grad_norm": 1.381818615640278,
479
+ "learning_rate": 1.9937863245275303e-05,
480
+ "loss": 1.381,
481
+ "step": 65
482
+ },
483
+ {
484
+ "epoch": 0.18410041841004185,
485
+ "grad_norm": 1.3411933307262995,
486
+ "learning_rate": 1.9932583253127302e-05,
487
+ "loss": 1.4514,
488
+ "step": 66
489
+ },
490
+ {
491
+ "epoch": 0.18688981868898186,
492
+ "grad_norm": 1.4666636741675445,
493
+ "learning_rate": 1.992708874098054e-05,
494
+ "loss": 1.378,
495
+ "step": 67
496
+ },
497
+ {
498
+ "epoch": 0.1896792189679219,
499
+ "grad_norm": 1.321297415086869,
500
+ "learning_rate": 1.9921379827503316e-05,
501
+ "loss": 1.3916,
502
+ "step": 68
503
+ },
504
+ {
505
+ "epoch": 0.19246861924686193,
506
+ "grad_norm": 1.3031514888132292,
507
+ "learning_rate": 1.991545663599448e-05,
508
+ "loss": 1.3568,
509
+ "step": 69
510
+ },
511
+ {
512
+ "epoch": 0.19525801952580196,
513
+ "grad_norm": 1.3252501098302665,
514
+ "learning_rate": 1.990931929438078e-05,
515
+ "loss": 1.3691,
516
+ "step": 70
517
+ },
518
+ {
519
+ "epoch": 0.19804741980474197,
520
+ "grad_norm": 1.3190300203004819,
521
+ "learning_rate": 1.990296793521408e-05,
522
+ "loss": 1.425,
523
+ "step": 71
524
+ },
525
+ {
526
+ "epoch": 0.200836820083682,
527
+ "grad_norm": 1.221728638105595,
528
+ "learning_rate": 1.989640269566853e-05,
529
+ "loss": 1.3669,
530
+ "step": 72
531
+ },
532
+ {
533
+ "epoch": 0.20362622036262204,
534
+ "grad_norm": 1.2519446160682244,
535
+ "learning_rate": 1.9889623717537564e-05,
536
+ "loss": 1.5065,
537
+ "step": 73
538
+ },
539
+ {
540
+ "epoch": 0.20641562064156208,
541
+ "grad_norm": 1.3192555240060455,
542
+ "learning_rate": 1.9882631147230874e-05,
543
+ "loss": 1.3077,
544
+ "step": 74
545
+ },
546
+ {
547
+ "epoch": 0.20920502092050208,
548
+ "grad_norm": 1.811281511932427,
549
+ "learning_rate": 1.987542513577122e-05,
550
+ "loss": 1.4737,
551
+ "step": 75
552
+ },
553
+ {
554
+ "epoch": 0.21199442119944212,
555
+ "grad_norm": 1.2107466822843787,
556
+ "learning_rate": 1.9868005838791185e-05,
557
+ "loss": 1.3632,
558
+ "step": 76
559
+ },
560
+ {
561
+ "epoch": 0.21478382147838215,
562
+ "grad_norm": 1.4506886695952612,
563
+ "learning_rate": 1.9860373416529804e-05,
564
+ "loss": 1.3707,
565
+ "step": 77
566
+ },
567
+ {
568
+ "epoch": 0.2175732217573222,
569
+ "grad_norm": 1.129475911714987,
570
+ "learning_rate": 1.985252803382911e-05,
571
+ "loss": 1.2879,
572
+ "step": 78
573
+ },
574
+ {
575
+ "epoch": 0.2203626220362622,
576
+ "grad_norm": 1.2378410441125478,
577
+ "learning_rate": 1.984446986013057e-05,
578
+ "loss": 1.4352,
579
+ "step": 79
580
+ },
581
+ {
582
+ "epoch": 0.22315202231520223,
583
+ "grad_norm": 1.2497274548196218,
584
+ "learning_rate": 1.983619906947144e-05,
585
+ "loss": 1.2929,
586
+ "step": 80
587
+ },
588
+ {
589
+ "epoch": 0.22594142259414227,
590
+ "grad_norm": 1.2860272115066647,
591
+ "learning_rate": 1.9827715840480962e-05,
592
+ "loss": 1.2595,
593
+ "step": 81
594
+ },
595
+ {
596
+ "epoch": 0.22873082287308227,
597
+ "grad_norm": 1.3259601590310435,
598
+ "learning_rate": 1.9819020356376562e-05,
599
+ "loss": 1.5421,
600
+ "step": 82
601
+ },
602
+ {
603
+ "epoch": 0.2315202231520223,
604
+ "grad_norm": 1.3823289295025785,
605
+ "learning_rate": 1.9810112804959867e-05,
606
+ "loss": 1.4379,
607
+ "step": 83
608
+ },
609
+ {
610
+ "epoch": 0.23430962343096234,
611
+ "grad_norm": 1.2790636696723037,
612
+ "learning_rate": 1.980099337861264e-05,
613
+ "loss": 1.4045,
614
+ "step": 84
615
+ },
616
+ {
617
+ "epoch": 0.23709902370990238,
618
+ "grad_norm": 1.2621634213682735,
619
+ "learning_rate": 1.9791662274292638e-05,
620
+ "loss": 1.3433,
621
+ "step": 85
622
+ },
623
+ {
624
+ "epoch": 0.2398884239888424,
625
+ "grad_norm": 1.4041226411604562,
626
+ "learning_rate": 1.9782119693529358e-05,
627
+ "loss": 1.6292,
628
+ "step": 86
629
+ },
630
+ {
631
+ "epoch": 0.24267782426778242,
632
+ "grad_norm": 1.4238393471976662,
633
+ "learning_rate": 1.977236584241968e-05,
634
+ "loss": 1.398,
635
+ "step": 87
636
+ },
637
+ {
638
+ "epoch": 0.24546722454672246,
639
+ "grad_norm": 1.3721757997449184,
640
+ "learning_rate": 1.9762400931623413e-05,
641
+ "loss": 1.372,
642
+ "step": 88
643
+ },
644
+ {
645
+ "epoch": 0.2482566248256625,
646
+ "grad_norm": 1.3049726438204359,
647
+ "learning_rate": 1.9752225176358757e-05,
648
+ "loss": 1.4366,
649
+ "step": 89
650
+ },
651
+ {
652
+ "epoch": 0.2510460251046025,
653
+ "grad_norm": 1.319316702022308,
654
+ "learning_rate": 1.9741838796397638e-05,
655
+ "loss": 1.2807,
656
+ "step": 90
657
+ },
658
+ {
659
+ "epoch": 0.2510460251046025,
660
+ "eval_loss": 1.6544907093048096,
661
+ "eval_runtime": 157.4295,
662
+ "eval_samples_per_second": 2.02,
663
+ "eval_steps_per_second": 0.127,
664
+ "step": 90
665
+ },
666
+ {
667
+ "epoch": 0.25383542538354253,
668
+ "grad_norm": 1.3259568867589984,
669
+ "learning_rate": 1.9731242016060985e-05,
670
+ "loss": 1.3566,
671
+ "step": 91
672
+ },
673
+ {
674
+ "epoch": 0.25662482566248257,
675
+ "grad_norm": 1.3318698765554446,
676
+ "learning_rate": 1.972043506421386e-05,
677
+ "loss": 1.3304,
678
+ "step": 92
679
+ },
680
+ {
681
+ "epoch": 0.2594142259414226,
682
+ "grad_norm": 1.210762982291795,
683
+ "learning_rate": 1.9709418174260523e-05,
684
+ "loss": 1.3663,
685
+ "step": 93
686
+ },
687
+ {
688
+ "epoch": 0.26220362622036264,
689
+ "grad_norm": 1.322366639833671,
690
+ "learning_rate": 1.9698191584139402e-05,
691
+ "loss": 1.4099,
692
+ "step": 94
693
+ },
694
+ {
695
+ "epoch": 0.2649930264993027,
696
+ "grad_norm": 1.286954377653034,
697
+ "learning_rate": 1.9686755536317945e-05,
698
+ "loss": 1.3539,
699
+ "step": 95
700
+ },
701
+ {
702
+ "epoch": 0.26778242677824265,
703
+ "grad_norm": 1.1590651579123286,
704
+ "learning_rate": 1.967511027778738e-05,
705
+ "loss": 1.2147,
706
+ "step": 96
707
+ },
708
+ {
709
+ "epoch": 0.2705718270571827,
710
+ "grad_norm": 1.3100829080105303,
711
+ "learning_rate": 1.9663256060057395e-05,
712
+ "loss": 1.4093,
713
+ "step": 97
714
+ },
715
+ {
716
+ "epoch": 0.2733612273361227,
717
+ "grad_norm": 1.346265752760783,
718
+ "learning_rate": 1.965119313915068e-05,
719
+ "loss": 1.491,
720
+ "step": 98
721
+ },
722
+ {
723
+ "epoch": 0.27615062761506276,
724
+ "grad_norm": 1.378168477135006,
725
+ "learning_rate": 1.9638921775597428e-05,
726
+ "loss": 1.5049,
727
+ "step": 99
728
+ },
729
+ {
730
+ "epoch": 0.2789400278940028,
731
+ "grad_norm": 1.4182107155054933,
732
+ "learning_rate": 1.9626442234429684e-05,
733
+ "loss": 1.5013,
734
+ "step": 100
735
+ },
736
+ {
737
+ "epoch": 0.28172942817294283,
738
+ "grad_norm": 1.3165711654218712,
739
+ "learning_rate": 1.961375478517564e-05,
740
+ "loss": 1.5105,
741
+ "step": 101
742
+ },
743
+ {
744
+ "epoch": 0.28451882845188287,
745
+ "grad_norm": 1.364780296172199,
746
+ "learning_rate": 1.9600859701853796e-05,
747
+ "loss": 1.5207,
748
+ "step": 102
749
+ },
750
+ {
751
+ "epoch": 0.28730822873082285,
752
+ "grad_norm": 1.2988922679076684,
753
+ "learning_rate": 1.958775726296706e-05,
754
+ "loss": 1.2881,
755
+ "step": 103
756
+ },
757
+ {
758
+ "epoch": 0.2900976290097629,
759
+ "grad_norm": 1.3450528168801636,
760
+ "learning_rate": 1.9574447751496706e-05,
761
+ "loss": 1.2877,
762
+ "step": 104
763
+ },
764
+ {
765
+ "epoch": 0.2928870292887029,
766
+ "grad_norm": 1.4142239844479165,
767
+ "learning_rate": 1.95609314548963e-05,
768
+ "loss": 1.5604,
769
+ "step": 105
770
+ },
771
+ {
772
+ "epoch": 0.29567642956764295,
773
+ "grad_norm": 1.3452993293539794,
774
+ "learning_rate": 1.954720866508546e-05,
775
+ "loss": 1.3447,
776
+ "step": 106
777
+ },
778
+ {
779
+ "epoch": 0.298465829846583,
780
+ "grad_norm": 1.4534491830895881,
781
+ "learning_rate": 1.953327967844356e-05,
782
+ "loss": 1.3643,
783
+ "step": 107
784
+ },
785
+ {
786
+ "epoch": 0.301255230125523,
787
+ "grad_norm": 1.350966370835706,
788
+ "learning_rate": 1.9519144795803342e-05,
789
+ "loss": 1.5196,
790
+ "step": 108
791
+ },
792
+ {
793
+ "epoch": 0.30404463040446306,
794
+ "grad_norm": 1.3487778511447879,
795
+ "learning_rate": 1.95048043224444e-05,
796
+ "loss": 1.4243,
797
+ "step": 109
798
+ },
799
+ {
800
+ "epoch": 0.3068340306834031,
801
+ "grad_norm": 1.3479508491141639,
802
+ "learning_rate": 1.94902585680866e-05,
803
+ "loss": 1.2869,
804
+ "step": 110
805
+ },
806
+ {
807
+ "epoch": 0.30962343096234307,
808
+ "grad_norm": 1.5555627133101146,
809
+ "learning_rate": 1.9475507846883377e-05,
810
+ "loss": 1.4626,
811
+ "step": 111
812
+ },
813
+ {
814
+ "epoch": 0.3124128312412831,
815
+ "grad_norm": 1.264890715784298,
816
+ "learning_rate": 1.9460552477414972e-05,
817
+ "loss": 1.2826,
818
+ "step": 112
819
+ },
820
+ {
821
+ "epoch": 0.31520223152022314,
822
+ "grad_norm": 1.2628748380778831,
823
+ "learning_rate": 1.9445392782681523e-05,
824
+ "loss": 1.232,
825
+ "step": 113
826
+ },
827
+ {
828
+ "epoch": 0.3179916317991632,
829
+ "grad_norm": 1.3550404859387195,
830
+ "learning_rate": 1.9430029090096118e-05,
831
+ "loss": 1.3034,
832
+ "step": 114
833
+ },
834
+ {
835
+ "epoch": 0.3207810320781032,
836
+ "grad_norm": 1.1496127251687267,
837
+ "learning_rate": 1.94144617314777e-05,
838
+ "loss": 1.3215,
839
+ "step": 115
840
+ },
841
+ {
842
+ "epoch": 0.32357043235704325,
843
+ "grad_norm": 1.3116085375581363,
844
+ "learning_rate": 1.939869104304392e-05,
845
+ "loss": 1.4154,
846
+ "step": 116
847
+ },
848
+ {
849
+ "epoch": 0.3263598326359833,
850
+ "grad_norm": 1.2589366985022925,
851
+ "learning_rate": 1.9382717365403854e-05,
852
+ "loss": 1.517,
853
+ "step": 117
854
+ },
855
+ {
856
+ "epoch": 0.3291492329149233,
857
+ "grad_norm": 1.3051575397158521,
858
+ "learning_rate": 1.9366541043550667e-05,
859
+ "loss": 1.3795,
860
+ "step": 118
861
+ },
862
+ {
863
+ "epoch": 0.3319386331938633,
864
+ "grad_norm": 1.514184766493585,
865
+ "learning_rate": 1.9350162426854152e-05,
866
+ "loss": 1.5974,
867
+ "step": 119
868
+ },
869
+ {
870
+ "epoch": 0.33472803347280333,
871
+ "grad_norm": 1.3773144705212048,
872
+ "learning_rate": 1.933358186905318e-05,
873
+ "loss": 1.3696,
874
+ "step": 120
875
+ },
876
+ {
877
+ "epoch": 0.33751743375174337,
878
+ "grad_norm": 1.070700275666401,
879
+ "learning_rate": 1.9316799728248074e-05,
880
+ "loss": 1.1661,
881
+ "step": 121
882
+ },
883
+ {
884
+ "epoch": 0.3403068340306834,
885
+ "grad_norm": 1.4181760004495874,
886
+ "learning_rate": 1.9299816366892865e-05,
887
+ "loss": 1.4376,
888
+ "step": 122
889
+ },
890
+ {
891
+ "epoch": 0.34309623430962344,
892
+ "grad_norm": 1.6034791315185046,
893
+ "learning_rate": 1.9282632151787462e-05,
894
+ "loss": 1.5891,
895
+ "step": 123
896
+ },
897
+ {
898
+ "epoch": 0.3458856345885635,
899
+ "grad_norm": 1.1884570183288778,
900
+ "learning_rate": 1.9265247454069736e-05,
901
+ "loss": 1.3432,
902
+ "step": 124
903
+ },
904
+ {
905
+ "epoch": 0.3486750348675035,
906
+ "grad_norm": 1.477555714731358,
907
+ "learning_rate": 1.924766264920751e-05,
908
+ "loss": 1.3683,
909
+ "step": 125
910
+ },
911
+ {
912
+ "epoch": 0.3514644351464435,
913
+ "grad_norm": 1.2504857458807423,
914
+ "learning_rate": 1.922987811699042e-05,
915
+ "loss": 1.2643,
916
+ "step": 126
917
+ },
918
+ {
919
+ "epoch": 0.3542538354253835,
920
+ "grad_norm": 1.3679090790056112,
921
+ "learning_rate": 1.9211894241521757e-05,
922
+ "loss": 1.5962,
923
+ "step": 127
924
+ },
925
+ {
926
+ "epoch": 0.35704323570432356,
927
+ "grad_norm": 1.2309836816544464,
928
+ "learning_rate": 1.9193711411210138e-05,
929
+ "loss": 1.3361,
930
+ "step": 128
931
+ },
932
+ {
933
+ "epoch": 0.3598326359832636,
934
+ "grad_norm": 1.1714321663378802,
935
+ "learning_rate": 1.917533001876113e-05,
936
+ "loss": 1.3019,
937
+ "step": 129
938
+ },
939
+ {
940
+ "epoch": 0.36262203626220363,
941
+ "grad_norm": 1.2813447334304535,
942
+ "learning_rate": 1.9156750461168768e-05,
943
+ "loss": 1.4319,
944
+ "step": 130
945
+ },
946
+ {
947
+ "epoch": 0.36541143654114366,
948
+ "grad_norm": 1.427767209588848,
949
+ "learning_rate": 1.9137973139706973e-05,
950
+ "loss": 1.4712,
951
+ "step": 131
952
+ },
953
+ {
954
+ "epoch": 0.3682008368200837,
955
+ "grad_norm": 1.3426640935974619,
956
+ "learning_rate": 1.91189984599209e-05,
957
+ "loss": 1.4397,
958
+ "step": 132
959
+ },
960
+ {
961
+ "epoch": 0.37099023709902373,
962
+ "grad_norm": 1.3173830250699687,
963
+ "learning_rate": 1.9099826831618168e-05,
964
+ "loss": 1.4799,
965
+ "step": 133
966
+ },
967
+ {
968
+ "epoch": 0.3737796373779637,
969
+ "grad_norm": 1.5260053920559482,
970
+ "learning_rate": 1.908045866886001e-05,
971
+ "loss": 1.5167,
972
+ "step": 134
973
+ },
974
+ {
975
+ "epoch": 0.37656903765690375,
976
+ "grad_norm": 1.2838799058228236,
977
+ "learning_rate": 1.9060894389952328e-05,
978
+ "loss": 1.3957,
979
+ "step": 135
980
+ },
981
+ {
982
+ "epoch": 0.37656903765690375,
983
+ "eval_loss": 1.629968523979187,
984
+ "eval_runtime": 155.8796,
985
+ "eval_samples_per_second": 2.04,
986
+ "eval_steps_per_second": 0.128,
987
+ "step": 135
988
+ },
989
+ {
990
+ "epoch": 0.3793584379358438,
991
+ "grad_norm": 1.2595723963522658,
992
+ "learning_rate": 1.9041134417436674e-05,
993
+ "loss": 1.3773,
994
+ "step": 136
995
+ },
996
+ {
997
+ "epoch": 0.3821478382147838,
998
+ "grad_norm": 1.380977078216302,
999
+ "learning_rate": 1.9021179178081107e-05,
1000
+ "loss": 1.5358,
1001
+ "step": 137
1002
+ },
1003
+ {
1004
+ "epoch": 0.38493723849372385,
1005
+ "grad_norm": 1.3245015694120374,
1006
+ "learning_rate": 1.9001029102870982e-05,
1007
+ "loss": 1.506,
1008
+ "step": 138
1009
+ },
1010
+ {
1011
+ "epoch": 0.3877266387726639,
1012
+ "grad_norm": 1.2602456347612,
1013
+ "learning_rate": 1.898068462699964e-05,
1014
+ "loss": 1.4246,
1015
+ "step": 139
1016
+ },
1017
+ {
1018
+ "epoch": 0.3905160390516039,
1019
+ "grad_norm": 1.3989105118625398,
1020
+ "learning_rate": 1.8960146189859014e-05,
1021
+ "loss": 1.4692,
1022
+ "step": 140
1023
+ },
1024
+ {
1025
+ "epoch": 0.39330543933054396,
1026
+ "grad_norm": 1.2616111800783727,
1027
+ "learning_rate": 1.8939414235030137e-05,
1028
+ "loss": 1.3755,
1029
+ "step": 141
1030
+ },
1031
+ {
1032
+ "epoch": 0.39609483960948394,
1033
+ "grad_norm": 1.2686523296470786,
1034
+ "learning_rate": 1.891848921027355e-05,
1035
+ "loss": 1.3442,
1036
+ "step": 142
1037
+ },
1038
+ {
1039
+ "epoch": 0.398884239888424,
1040
+ "grad_norm": 1.37417212405681,
1041
+ "learning_rate": 1.889737156751965e-05,
1042
+ "loss": 1.3651,
1043
+ "step": 143
1044
+ },
1045
+ {
1046
+ "epoch": 0.401673640167364,
1047
+ "grad_norm": 1.373244156828418,
1048
+ "learning_rate": 1.887606176285893e-05,
1049
+ "loss": 1.4961,
1050
+ "step": 144
1051
+ },
1052
+ {
1053
+ "epoch": 0.40446304044630405,
1054
+ "grad_norm": 1.1872961109156253,
1055
+ "learning_rate": 1.8854560256532098e-05,
1056
+ "loss": 1.2587,
1057
+ "step": 145
1058
+ },
1059
+ {
1060
+ "epoch": 0.4072524407252441,
1061
+ "grad_norm": 1.313036403643509,
1062
+ "learning_rate": 1.883286751292018e-05,
1063
+ "loss": 1.4575,
1064
+ "step": 146
1065
+ },
1066
+ {
1067
+ "epoch": 0.4100418410041841,
1068
+ "grad_norm": 1.390974479025736,
1069
+ "learning_rate": 1.8810984000534457e-05,
1070
+ "loss": 1.3891,
1071
+ "step": 147
1072
+ },
1073
+ {
1074
+ "epoch": 0.41283124128312415,
1075
+ "grad_norm": 1.3368020257438076,
1076
+ "learning_rate": 1.8788910192006363e-05,
1077
+ "loss": 1.3415,
1078
+ "step": 148
1079
+ },
1080
+ {
1081
+ "epoch": 0.41562064156206413,
1082
+ "grad_norm": 1.2329515511987332,
1083
+ "learning_rate": 1.8766646564077265e-05,
1084
+ "loss": 1.3339,
1085
+ "step": 149
1086
+ },
1087
+ {
1088
+ "epoch": 0.41841004184100417,
1089
+ "grad_norm": 1.276208090352136,
1090
+ "learning_rate": 1.8744193597588185e-05,
1091
+ "loss": 1.4495,
1092
+ "step": 150
1093
+ },
1094
+ {
1095
+ "epoch": 0.4211994421199442,
1096
+ "grad_norm": 1.1548092334953926,
1097
+ "learning_rate": 1.8721551777469397e-05,
1098
+ "loss": 1.2099,
1099
+ "step": 151
1100
+ },
1101
+ {
1102
+ "epoch": 0.42398884239888424,
1103
+ "grad_norm": 1.3184986062317001,
1104
+ "learning_rate": 1.869872159272997e-05,
1105
+ "loss": 1.2136,
1106
+ "step": 152
1107
+ },
1108
+ {
1109
+ "epoch": 0.42677824267782427,
1110
+ "grad_norm": 1.1962726760049636,
1111
+ "learning_rate": 1.8675703536447178e-05,
1112
+ "loss": 1.2598,
1113
+ "step": 153
1114
+ },
1115
+ {
1116
+ "epoch": 0.4295676429567643,
1117
+ "grad_norm": 1.3302312487017707,
1118
+ "learning_rate": 1.8652498105755898e-05,
1119
+ "loss": 1.3719,
1120
+ "step": 154
1121
+ },
1122
+ {
1123
+ "epoch": 0.43235704323570434,
1124
+ "grad_norm": 1.55872330252289,
1125
+ "learning_rate": 1.862910580183782e-05,
1126
+ "loss": 1.4867,
1127
+ "step": 155
1128
+ },
1129
+ {
1130
+ "epoch": 0.4351464435146444,
1131
+ "grad_norm": 1.3004017172912832,
1132
+ "learning_rate": 1.8605527129910663e-05,
1133
+ "loss": 1.3089,
1134
+ "step": 156
1135
+ },
1136
+ {
1137
+ "epoch": 0.43793584379358436,
1138
+ "grad_norm": 1.2650294480346138,
1139
+ "learning_rate": 1.858176259921724e-05,
1140
+ "loss": 1.2856,
1141
+ "step": 157
1142
+ },
1143
+ {
1144
+ "epoch": 0.4407252440725244,
1145
+ "grad_norm": 1.414189467122214,
1146
+ "learning_rate": 1.8557812723014476e-05,
1147
+ "loss": 1.4827,
1148
+ "step": 158
1149
+ },
1150
+ {
1151
+ "epoch": 0.4435146443514644,
1152
+ "grad_norm": 1.2634959665686347,
1153
+ "learning_rate": 1.853367801856231e-05,
1154
+ "loss": 1.3568,
1155
+ "step": 159
1156
+ },
1157
+ {
1158
+ "epoch": 0.44630404463040446,
1159
+ "grad_norm": 1.3164047095667806,
1160
+ "learning_rate": 1.8509359007112523e-05,
1161
+ "loss": 1.5306,
1162
+ "step": 160
1163
+ },
1164
+ {
1165
+ "epoch": 0.4490934449093445,
1166
+ "grad_norm": 1.3232600329575266,
1167
+ "learning_rate": 1.8484856213897496e-05,
1168
+ "loss": 1.4279,
1169
+ "step": 161
1170
+ },
1171
+ {
1172
+ "epoch": 0.45188284518828453,
1173
+ "grad_norm": 1.286194256752095,
1174
+ "learning_rate": 1.8460170168118857e-05,
1175
+ "loss": 1.2656,
1176
+ "step": 162
1177
+ },
1178
+ {
1179
+ "epoch": 0.45467224546722457,
1180
+ "grad_norm": 1.393553888811773,
1181
+ "learning_rate": 1.843530140293603e-05,
1182
+ "loss": 1.4003,
1183
+ "step": 163
1184
+ },
1185
+ {
1186
+ "epoch": 0.45746164574616455,
1187
+ "grad_norm": 1.2952418440030533,
1188
+ "learning_rate": 1.841025045545477e-05,
1189
+ "loss": 1.365,
1190
+ "step": 164
1191
+ },
1192
+ {
1193
+ "epoch": 0.4602510460251046,
1194
+ "grad_norm": 1.2556167978994803,
1195
+ "learning_rate": 1.8385017866715507e-05,
1196
+ "loss": 1.3313,
1197
+ "step": 165
1198
+ },
1199
+ {
1200
+ "epoch": 0.4630404463040446,
1201
+ "grad_norm": 1.3067564204278406,
1202
+ "learning_rate": 1.8359604181681703e-05,
1203
+ "loss": 1.4114,
1204
+ "step": 166
1205
+ },
1206
+ {
1207
+ "epoch": 0.46582984658298465,
1208
+ "grad_norm": 1.2088590174928828,
1209
+ "learning_rate": 1.833400994922806e-05,
1210
+ "loss": 1.1866,
1211
+ "step": 167
1212
+ },
1213
+ {
1214
+ "epoch": 0.4686192468619247,
1215
+ "grad_norm": 1.334753865529686,
1216
+ "learning_rate": 1.8308235722128674e-05,
1217
+ "loss": 1.2744,
1218
+ "step": 168
1219
+ },
1220
+ {
1221
+ "epoch": 0.4714086471408647,
1222
+ "grad_norm": 1.3612556693462265,
1223
+ "learning_rate": 1.8282282057045087e-05,
1224
+ "loss": 1.3558,
1225
+ "step": 169
1226
+ },
1227
+ {
1228
+ "epoch": 0.47419804741980476,
1229
+ "grad_norm": 1.2660924285869366,
1230
+ "learning_rate": 1.8256149514514284e-05,
1231
+ "loss": 1.2804,
1232
+ "step": 170
1233
+ },
1234
+ {
1235
+ "epoch": 0.4769874476987448,
1236
+ "grad_norm": 1.3192403133250346,
1237
+ "learning_rate": 1.8229838658936566e-05,
1238
+ "loss": 1.3874,
1239
+ "step": 171
1240
+ },
1241
+ {
1242
+ "epoch": 0.4797768479776848,
1243
+ "grad_norm": 1.3924722985838183,
1244
+ "learning_rate": 1.8203350058563366e-05,
1245
+ "loss": 1.5013,
1246
+ "step": 172
1247
+ },
1248
+ {
1249
+ "epoch": 0.4825662482566248,
1250
+ "grad_norm": 1.2874077296032287,
1251
+ "learning_rate": 1.8176684285484985e-05,
1252
+ "loss": 1.3261,
1253
+ "step": 173
1254
+ },
1255
+ {
1256
+ "epoch": 0.48535564853556484,
1257
+ "grad_norm": 1.309597924994118,
1258
+ "learning_rate": 1.814984191561823e-05,
1259
+ "loss": 1.4157,
1260
+ "step": 174
1261
+ },
1262
+ {
1263
+ "epoch": 0.4881450488145049,
1264
+ "grad_norm": 1.1912282212302885,
1265
+ "learning_rate": 1.8122823528693966e-05,
1266
+ "loss": 1.2585,
1267
+ "step": 175
1268
+ },
1269
+ {
1270
+ "epoch": 0.4909344490934449,
1271
+ "grad_norm": 1.2765007106705224,
1272
+ "learning_rate": 1.809562970824462e-05,
1273
+ "loss": 1.3437,
1274
+ "step": 176
1275
+ },
1276
+ {
1277
+ "epoch": 0.49372384937238495,
1278
+ "grad_norm": 1.2571675750543854,
1279
+ "learning_rate": 1.8068261041591548e-05,
1280
+ "loss": 1.4383,
1281
+ "step": 177
1282
+ },
1283
+ {
1284
+ "epoch": 0.496513249651325,
1285
+ "grad_norm": 1.1735759325774886,
1286
+ "learning_rate": 1.8040718119832378e-05,
1287
+ "loss": 1.3234,
1288
+ "step": 178
1289
+ },
1290
+ {
1291
+ "epoch": 0.499302649930265,
1292
+ "grad_norm": 1.1634243266804525,
1293
+ "learning_rate": 1.8013001537828213e-05,
1294
+ "loss": 1.2169,
1295
+ "step": 179
1296
+ }
1297
+ ],
1298
+ "logging_steps": 1,
1299
+ "max_steps": 716,
1300
+ "num_input_tokens_seen": 0,
1301
+ "num_train_epochs": 2,
1302
+ "save_steps": 179,
1303
+ "stateful_callbacks": {
1304
+ "TrainerControl": {
1305
+ "args": {
1306
+ "should_epoch_stop": false,
1307
+ "should_evaluate": false,
1308
+ "should_log": false,
1309
+ "should_save": true,
1310
+ "should_training_stop": false
1311
+ },
1312
+ "attributes": {}
1313
+ }
1314
+ },
1315
+ "total_flos": 116435221217280.0,
1316
+ "train_batch_size": 4,
1317
+ "trial_name": null,
1318
+ "trial_params": null
1319
+ }
checkpoint-179/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:176779fd314d79db1323a9603622ba6af7ce08e6291ea5cb8066c39938973900
3
+ size 8504
checkpoint-179/zero_to_fp32.py ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example:
14
+ # python zero_to_fp32.py . output_dir/
15
+ # or
16
+ # python zero_to_fp32.py . output_dir/ --safe_serialization
17
+
18
+ import argparse
19
+ import torch
20
+ import glob
21
+ import math
22
+ import os
23
+ import re
24
+ import json
25
+ from tqdm import tqdm
26
+ from collections import OrderedDict
27
+ from dataclasses import dataclass
28
+
29
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
30
+ # DeepSpeed data structures it has to be available in the current python environment.
31
+ from deepspeed.utils import logger
32
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
33
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
34
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
35
+
36
+
37
+ @dataclass
38
+ class zero_model_state:
39
+ buffers: dict()
40
+ param_shapes: dict()
41
+ shared_params: list
42
+ ds_version: int
43
+ frozen_param_shapes: dict()
44
+ frozen_param_fragments: dict()
45
+
46
+
47
+ debug = 0
48
+
49
+ # load to cpu
50
+ device = torch.device('cpu')
51
+
52
+
53
+ def atoi(text):
54
+ return int(text) if text.isdigit() else text
55
+
56
+
57
+ def natural_keys(text):
58
+ '''
59
+ alist.sort(key=natural_keys) sorts in human order
60
+ http://nedbatchelder.com/blog/200712/human_sorting.html
61
+ (See Toothy's implementation in the comments)
62
+ '''
63
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
64
+
65
+
66
+ def get_model_state_file(checkpoint_dir, zero_stage):
67
+ if not os.path.isdir(checkpoint_dir):
68
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
69
+
70
+ # there should be only one file
71
+ if zero_stage <= 2:
72
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
73
+ elif zero_stage == 3:
74
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
75
+
76
+ if not os.path.exists(file):
77
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
78
+
79
+ return file
80
+
81
+
82
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
83
+ # XXX: need to test that this simple glob rule works for multi-node setup too
84
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
85
+
86
+ if len(ckpt_files) == 0:
87
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
88
+
89
+ return ckpt_files
90
+
91
+
92
+ def get_optim_files(checkpoint_dir):
93
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
94
+
95
+
96
+ def get_model_state_files(checkpoint_dir):
97
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
98
+
99
+
100
+ def parse_model_states(files):
101
+ zero_model_states = []
102
+ for file in files:
103
+ state_dict = torch.load(file, map_location=device)
104
+
105
+ if BUFFER_NAMES not in state_dict:
106
+ raise ValueError(f"{file} is not a model state checkpoint")
107
+ buffer_names = state_dict[BUFFER_NAMES]
108
+ if debug:
109
+ print("Found buffers:", buffer_names)
110
+
111
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
112
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
113
+ param_shapes = state_dict[PARAM_SHAPES]
114
+
115
+ # collect parameters that are included in param_shapes
116
+ param_names = []
117
+ for s in param_shapes:
118
+ for name in s.keys():
119
+ param_names.append(name)
120
+
121
+ # update with frozen parameters
122
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
123
+ if frozen_param_shapes is not None:
124
+ if debug:
125
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
126
+ param_names += list(frozen_param_shapes.keys())
127
+
128
+ # handle shared params
129
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
130
+
131
+ ds_version = state_dict.get(DS_VERSION, None)
132
+
133
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
134
+
135
+ z_model_state = zero_model_state(buffers=buffers,
136
+ param_shapes=param_shapes,
137
+ shared_params=shared_params,
138
+ ds_version=ds_version,
139
+ frozen_param_shapes=frozen_param_shapes,
140
+ frozen_param_fragments=frozen_param_fragments)
141
+ zero_model_states.append(z_model_state)
142
+
143
+ return zero_model_states
144
+
145
+
146
+ def parse_optim_states(files, ds_checkpoint_dir):
147
+ total_files = len(files)
148
+ state_dicts = []
149
+ for f in files:
150
+ state_dict = torch.load(f, map_location=device)
151
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
152
+ # and also handle the case where it was already removed by another helper script
153
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
154
+ state_dicts.append(state_dict)
155
+
156
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
157
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
158
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
159
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
160
+
161
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
162
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
163
+ # use the max of the partition_count to get the dp world_size.
164
+
165
+ if type(world_size) is list:
166
+ world_size = max(world_size)
167
+
168
+ if world_size != total_files:
169
+ raise ValueError(
170
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
171
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
172
+ )
173
+
174
+ # the groups are named differently in each stage
175
+ if zero_stage <= 2:
176
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
177
+ elif zero_stage == 3:
178
+ fp32_groups_key = FP32_FLAT_GROUPS
179
+ else:
180
+ raise ValueError(f"unknown zero stage {zero_stage}")
181
+
182
+ if zero_stage <= 2:
183
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
184
+ elif zero_stage == 3:
185
+ # if there is more than one param group, there will be multiple flattened tensors - one
186
+ # flattened tensor per group - for simplicity merge them into a single tensor
187
+ #
188
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
189
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
190
+
191
+ fp32_flat_groups = [
192
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
193
+ ]
194
+
195
+ return zero_stage, world_size, fp32_flat_groups
196
+
197
+
198
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
199
+ """
200
+ Returns fp32 state_dict reconstructed from ds checkpoint
201
+
202
+ Args:
203
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
204
+
205
+ """
206
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
207
+
208
+ optim_files = get_optim_files(ds_checkpoint_dir)
209
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
210
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
211
+
212
+ model_files = get_model_state_files(ds_checkpoint_dir)
213
+
214
+ zero_model_states = parse_model_states(model_files)
215
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
216
+
217
+ if zero_stage <= 2:
218
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
219
+ exclude_frozen_parameters)
220
+ elif zero_stage == 3:
221
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
222
+ exclude_frozen_parameters)
223
+
224
+
225
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
226
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
227
+ return
228
+
229
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
230
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
231
+
232
+ if debug:
233
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
234
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
235
+
236
+ wanted_params = len(frozen_param_shapes)
237
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
238
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
239
+ print(f'Frozen params: Have {avail_numel} numels to process.')
240
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
241
+
242
+ total_params = 0
243
+ total_numel = 0
244
+ for name, shape in frozen_param_shapes.items():
245
+ total_params += 1
246
+ unpartitioned_numel = shape.numel()
247
+ total_numel += unpartitioned_numel
248
+
249
+ state_dict[name] = frozen_param_fragments[name]
250
+
251
+ if debug:
252
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
253
+
254
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
255
+
256
+
257
+ def _has_callable(obj, fn):
258
+ attr = getattr(obj, fn, None)
259
+ return callable(attr)
260
+
261
+
262
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
263
+ param_shapes = zero_model_states[0].param_shapes
264
+
265
+ # Reconstruction protocol:
266
+ #
267
+ # XXX: document this
268
+
269
+ if debug:
270
+ for i in range(world_size):
271
+ for j in range(len(fp32_flat_groups[0])):
272
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
273
+
274
+ # XXX: memory usage doubles here (zero2)
275
+ num_param_groups = len(fp32_flat_groups[0])
276
+ merged_single_partition_of_fp32_groups = []
277
+ for i in range(num_param_groups):
278
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
279
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
280
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
281
+ avail_numel = sum(
282
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
283
+
284
+ if debug:
285
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
286
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
287
+ # not asserting if there is a mismatch due to possible padding
288
+ print(f"Have {avail_numel} numels to process.")
289
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
290
+
291
+ # params
292
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
293
+ # out-of-core computing solution
294
+ total_numel = 0
295
+ total_params = 0
296
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
297
+ offset = 0
298
+ avail_numel = full_single_fp32_vector.numel()
299
+ for name, shape in shapes.items():
300
+
301
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
302
+ total_numel += unpartitioned_numel
303
+ total_params += 1
304
+
305
+ if debug:
306
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
307
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
308
+ offset += unpartitioned_numel
309
+
310
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
311
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
312
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
313
+ # live optimizer object, so we are checking that the numbers are within the right range
314
+ align_to = 2 * world_size
315
+
316
+ def zero2_align(x):
317
+ return align_to * math.ceil(x / align_to)
318
+
319
+ if debug:
320
+ print(f"original offset={offset}, avail_numel={avail_numel}")
321
+
322
+ offset = zero2_align(offset)
323
+ avail_numel = zero2_align(avail_numel)
324
+
325
+ if debug:
326
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
327
+
328
+ # Sanity check
329
+ if offset != avail_numel:
330
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
331
+
332
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
333
+
334
+
335
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
336
+ exclude_frozen_parameters):
337
+ state_dict = OrderedDict()
338
+
339
+ # buffers
340
+ buffers = zero_model_states[0].buffers
341
+ state_dict.update(buffers)
342
+ if debug:
343
+ print(f"added {len(buffers)} buffers")
344
+
345
+ if not exclude_frozen_parameters:
346
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
347
+
348
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
349
+
350
+ # recover shared parameters
351
+ for pair in zero_model_states[0].shared_params:
352
+ if pair[1] in state_dict:
353
+ state_dict[pair[0]] = state_dict[pair[1]]
354
+
355
+ return state_dict
356
+
357
+
358
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
359
+ remainder = unpartitioned_numel % world_size
360
+ padding_numel = (world_size - remainder) if remainder else 0
361
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
362
+ return partitioned_numel, padding_numel
363
+
364
+
365
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
366
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
367
+ return
368
+
369
+ if debug:
370
+ for i in range(world_size):
371
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
372
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
373
+
374
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
375
+ wanted_params = len(frozen_param_shapes)
376
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
377
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
378
+ print(f'Frozen params: Have {avail_numel} numels to process.')
379
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
380
+
381
+ total_params = 0
382
+ total_numel = 0
383
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
384
+ total_params += 1
385
+ unpartitioned_numel = shape.numel()
386
+ total_numel += unpartitioned_numel
387
+
388
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
389
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
390
+
391
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
392
+
393
+ if debug:
394
+ print(
395
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
396
+ )
397
+
398
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
399
+
400
+
401
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
402
+ param_shapes = zero_model_states[0].param_shapes
403
+ avail_numel = fp32_flat_groups[0].numel() * world_size
404
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
405
+ # param, re-consolidating each param, while dealing with padding if any
406
+
407
+ # merge list of dicts, preserving order
408
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
409
+
410
+ if debug:
411
+ for i in range(world_size):
412
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
413
+
414
+ wanted_params = len(param_shapes)
415
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
416
+ # not asserting if there is a mismatch due to possible padding
417
+ avail_numel = fp32_flat_groups[0].numel() * world_size
418
+ print(f"Trainable params: Have {avail_numel} numels to process.")
419
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
420
+
421
+ # params
422
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
423
+ # out-of-core computing solution
424
+ offset = 0
425
+ total_numel = 0
426
+ total_params = 0
427
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering Sharded Weights'):
428
+ unpartitioned_numel = shape.numel()
429
+ total_numel += unpartitioned_numel
430
+ total_params += 1
431
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
432
+
433
+ if debug:
434
+ print(
435
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
436
+ )
437
+
438
+ # XXX: memory usage doubles here
439
+ state_dict[name] = torch.cat(
440
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
441
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
442
+ offset += partitioned_numel
443
+
444
+ offset *= world_size
445
+
446
+ # Sanity check
447
+ if offset != avail_numel:
448
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
449
+
450
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
451
+
452
+
453
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
454
+ exclude_frozen_parameters):
455
+ state_dict = OrderedDict()
456
+
457
+ # buffers
458
+ buffers = zero_model_states[0].buffers
459
+ state_dict.update(buffers)
460
+ if debug:
461
+ print(f"added {len(buffers)} buffers")
462
+
463
+ if not exclude_frozen_parameters:
464
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
465
+
466
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
467
+
468
+ # recover shared parameters
469
+ for pair in zero_model_states[0].shared_params:
470
+ if pair[1] in state_dict:
471
+ state_dict[pair[0]] = state_dict[pair[1]]
472
+
473
+ return state_dict
474
+
475
+
476
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None, exclude_frozen_parameters=False):
477
+ """
478
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
479
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
480
+ via a model hub.
481
+
482
+ Args:
483
+ - ``checkpoint_dir``: path to the desired checkpoint folder
484
+ - ``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``
485
+ - ``exclude_frozen_parameters``: exclude frozen parameters
486
+
487
+ Returns:
488
+ - pytorch ``state_dict``
489
+
490
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
491
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
492
+ the checkpoint.
493
+
494
+ A typical usage might be ::
495
+
496
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
497
+ # do the training and checkpoint saving
498
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
499
+ model = model.cpu() # move to cpu
500
+ model.load_state_dict(state_dict)
501
+ # submit to model hub or save the model to share with others
502
+
503
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
504
+ application. i.e. you will need to re-initialize the deepspeed engine, since
505
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
506
+
507
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
508
+
509
+ """
510
+ if tag is None:
511
+ latest_path = os.path.join(checkpoint_dir, 'latest')
512
+ if os.path.isfile(latest_path):
513
+ with open(latest_path, 'r') as fd:
514
+ tag = fd.read().strip()
515
+ else:
516
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
517
+
518
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
519
+
520
+ if not os.path.isdir(ds_checkpoint_dir):
521
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
522
+
523
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
524
+
525
+
526
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
527
+ output_dir,
528
+ max_shard_size="5GB",
529
+ safe_serialization=False,
530
+ tag=None,
531
+ exclude_frozen_parameters=False):
532
+ """
533
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
534
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
535
+
536
+ Args:
537
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
538
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
539
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
540
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
541
+ - ``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``
542
+ - ``exclude_frozen_parameters``: exclude frozen parameters
543
+ """
544
+ # Dependency pre-check
545
+ if safe_serialization:
546
+ try:
547
+ from safetensors.torch import save_file
548
+ except ImportError:
549
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
550
+ raise
551
+ if max_shard_size is not None:
552
+ try:
553
+ from huggingface_hub import split_torch_state_dict_into_shards
554
+ except ImportError:
555
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
556
+ raise
557
+
558
+ # Convert zero checkpoint to state_dict
559
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag, exclude_frozen_parameters)
560
+
561
+ # Shard the model if it is too big.
562
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
563
+ if max_shard_size is not None:
564
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
565
+ state_dict_split = split_torch_state_dict_into_shards(state_dict,
566
+ filename_pattern=filename_pattern,
567
+ max_shard_size=max_shard_size)
568
+ else:
569
+ from collections import namedtuple
570
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
571
+ state_dict_split = StateDictSplit(is_sharded=False,
572
+ filename_to_tensors={weights_name: list(state_dict.keys())})
573
+
574
+ # Save the model
575
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
576
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
577
+ shard = {tensor: state_dict[tensor].contiguous() for tensor in tensors}
578
+ output_path = os.path.join(output_dir, shard_file)
579
+ if safe_serialization:
580
+ save_file(shard, output_path, metadata={"format": "pt"})
581
+ else:
582
+ torch.save(shard, output_path)
583
+
584
+ # Save index if sharded
585
+ if state_dict_split.is_sharded:
586
+ index = {
587
+ "metadata": state_dict_split.metadata,
588
+ "weight_map": state_dict_split.tensor_to_filename,
589
+ }
590
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
591
+ save_index_file = os.path.join(output_dir, save_index_file)
592
+ with open(save_index_file, "w", encoding="utf-8") as f:
593
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
594
+ f.write(content)
595
+
596
+
597
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
598
+ """
599
+ 1. Put the provided model to cpu
600
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
601
+ 3. Load it into the provided model
602
+
603
+ Args:
604
+ - ``model``: the model object to update
605
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
606
+ - ``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``
607
+
608
+ Returns:
609
+ - ``model`: modified model
610
+
611
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
612
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
613
+ conveniently placed for you in the checkpoint folder.
614
+
615
+ A typical usage might be ::
616
+
617
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
618
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
619
+ # submit to model hub or save the model to share with others
620
+
621
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
622
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
623
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
624
+
625
+ """
626
+ logger.info(f"Extracting fp32 weights")
627
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
628
+
629
+ logger.info(f"Overwriting model with fp32 weights")
630
+ model = model.cpu()
631
+ model.load_state_dict(state_dict, strict=False)
632
+
633
+ return model
634
+
635
+
636
+ if __name__ == "__main__":
637
+ parser = argparse.ArgumentParser()
638
+ parser.add_argument("checkpoint_dir",
639
+ type=str,
640
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
641
+ parser.add_argument("output_dir",
642
+ type=str,
643
+ help="directory to the pytorch fp32 state_dict output files"
644
+ "(e.g. path/checkpoint-12-output/)")
645
+ parser.add_argument(
646
+ "--max_shard_size",
647
+ type=str,
648
+ default="5GB",
649
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
650
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
651
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
652
+ "without CPU OOM issues.")
653
+ parser.add_argument(
654
+ "--safe_serialization",
655
+ default=False,
656
+ action='store_true',
657
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
658
+ parser.add_argument("-t",
659
+ "--tag",
660
+ type=str,
661
+ default=None,
662
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
663
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
664
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
665
+ args = parser.parse_args()
666
+
667
+ debug = args.debug
668
+
669
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
670
+ args.output_dir,
671
+ max_shard_size=args.max_shard_size,
672
+ safe_serialization=args.safe_serialization,
673
+ tag=args.tag,
674
+ exclude_frozen_parameters=args.exclude_frozen_parameters)