PEFT
Safetensors
deu05232 commited on
Commit
bf9ac77
·
verified ·
1 Parent(s): d3412e6

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: meta-llama/Llama-2-7b-hf
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.14.0
adapter_config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "meta-llama/Llama-2-7b-hf",
5
+ "bias": "none",
6
+ "eva_config": null,
7
+ "exclude_modules": null,
8
+ "fan_in_fan_out": false,
9
+ "inference_mode": true,
10
+ "init_lora_weights": true,
11
+ "layer_replication": null,
12
+ "layers_pattern": null,
13
+ "layers_to_transform": null,
14
+ "loftq_config": {},
15
+ "lora_alpha": 64,
16
+ "lora_bias": false,
17
+ "lora_dropout": 0.1,
18
+ "megatron_config": null,
19
+ "megatron_core": "megatron.core",
20
+ "modules_to_save": null,
21
+ "peft_type": "LORA",
22
+ "r": 32,
23
+ "rank_pattern": {},
24
+ "revision": null,
25
+ "target_modules": [
26
+ "down_proj",
27
+ "gate_proj",
28
+ "k_proj",
29
+ "up_proj",
30
+ "q_proj",
31
+ "v_proj",
32
+ "o_proj"
33
+ ],
34
+ "task_type": "FEATURE_EXTRACTION",
35
+ "use_dora": false,
36
+ "use_rslora": false
37
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52b1e17579ae7a201521e14c7cf7f18e6daf9b7ce5590919d41c7d87fd057b74
3
+ size 159965640
global_step3310/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:7b51b2bca142cab6c6a3e360deedbeefae15e9b3b75829d1282afadb59e96c3e
3
+ size 479727769
global_step3310/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:e258499bc9490b893b6e721c1fa983904aac0ddc17ca9e81de083487cf4342a4
3
+ size 479727769
global_step3310/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:b7b0abbf9825e669e9d08645c5261c88118487430b64f0a3aec260199b163e07
3
+ size 6608028566
global_step3310/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:e1ff1fc44edfb16759ea0664e4ed7c49a0b6272fc526da8c2f2ac4fcd441d4b7
3
+ size 6608028566
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step3310
rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:176d3aaf52ecb5d14e2795e92bfc4db4bbf1f941c2eac3d3ff17ed1fdff7bb0e
3
+ size 14713
rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ccf24e52455ea91253371d1efb37ffc454e4f33bbdda7434be1dd756c3f71f4a
3
+ size 14713
special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "</s>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": null,
5
+ "added_tokens_decoder": {
6
+ "0": {
7
+ "content": "<unk>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<s>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "2": {
23
+ "content": "</s>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ }
30
+ },
31
+ "bos_token": "<s>",
32
+ "clean_up_tokenization_spaces": false,
33
+ "eos_token": "</s>",
34
+ "legacy": false,
35
+ "model_max_length": 1000000000000000019884624838656,
36
+ "pad_token": "</s>",
37
+ "padding_side": "right",
38
+ "sp_model_kwargs": {},
39
+ "tokenizer_class": "LlamaTokenizer",
40
+ "unk_token": "<unk>",
41
+ "use_default_system_prompt": false
42
+ }
trainer_state.json ADDED
@@ -0,0 +1,2350 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.9998489654130795,
5
+ "eval_steps": 500,
6
+ "global_step": 3310,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.0030206917384080953,
13
+ "grad_norm": 6.613835485331974,
14
+ "learning_rate": 4.9999999999999996e-05,
15
+ "loss": 6.2562,
16
+ "step": 10
17
+ },
18
+ {
19
+ "epoch": 0.006041383476816191,
20
+ "grad_norm": 4.759929469878327,
21
+ "learning_rate": 6.505149978319905e-05,
22
+ "loss": 3.3105,
23
+ "step": 20
24
+ },
25
+ {
26
+ "epoch": 0.009062075215224286,
27
+ "grad_norm": 3.4302773742415433,
28
+ "learning_rate": 7.385606273598311e-05,
29
+ "loss": 1.6293,
30
+ "step": 30
31
+ },
32
+ {
33
+ "epoch": 0.012082766953632381,
34
+ "grad_norm": 2.200390666433873,
35
+ "learning_rate": 8.01029995663981e-05,
36
+ "loss": 1.2723,
37
+ "step": 40
38
+ },
39
+ {
40
+ "epoch": 0.015103458692040477,
41
+ "grad_norm": 1.9872314808738405,
42
+ "learning_rate": 8.494850021680092e-05,
43
+ "loss": 1.1221,
44
+ "step": 50
45
+ },
46
+ {
47
+ "epoch": 0.01812415043044857,
48
+ "grad_norm": 2.0585565038414173,
49
+ "learning_rate": 8.890756251918216e-05,
50
+ "loss": 1.1238,
51
+ "step": 60
52
+ },
53
+ {
54
+ "epoch": 0.02114484216885667,
55
+ "grad_norm": 1.5179740873933507,
56
+ "learning_rate": 9.225490200071284e-05,
57
+ "loss": 1.0437,
58
+ "step": 70
59
+ },
60
+ {
61
+ "epoch": 0.024165533907264763,
62
+ "grad_norm": 1.7872492138745553,
63
+ "learning_rate": 9.515449934959716e-05,
64
+ "loss": 0.9537,
65
+ "step": 80
66
+ },
67
+ {
68
+ "epoch": 0.02718622564567286,
69
+ "grad_norm": 1.59848853171592,
70
+ "learning_rate": 9.771212547196623e-05,
71
+ "loss": 0.9299,
72
+ "step": 90
73
+ },
74
+ {
75
+ "epoch": 0.030206917384080954,
76
+ "grad_norm": 1.4459867462911404,
77
+ "learning_rate": 9.999999999999999e-05,
78
+ "loss": 0.8744,
79
+ "step": 100
80
+ },
81
+ {
82
+ "epoch": 0.03322760912248905,
83
+ "grad_norm": 1.2666954985573535,
84
+ "learning_rate": 9.97196261682243e-05,
85
+ "loss": 0.9279,
86
+ "step": 110
87
+ },
88
+ {
89
+ "epoch": 0.03624830086089714,
90
+ "grad_norm": 1.1375696912612132,
91
+ "learning_rate": 9.940809968847352e-05,
92
+ "loss": 0.943,
93
+ "step": 120
94
+ },
95
+ {
96
+ "epoch": 0.03926899259930524,
97
+ "grad_norm": 1.5887317329510864,
98
+ "learning_rate": 9.909657320872274e-05,
99
+ "loss": 0.8703,
100
+ "step": 130
101
+ },
102
+ {
103
+ "epoch": 0.04228968433771334,
104
+ "grad_norm": 1.5838324888073332,
105
+ "learning_rate": 9.878504672897197e-05,
106
+ "loss": 0.8943,
107
+ "step": 140
108
+ },
109
+ {
110
+ "epoch": 0.045310376076121435,
111
+ "grad_norm": 1.247226983069568,
112
+ "learning_rate": 9.847352024922119e-05,
113
+ "loss": 0.8818,
114
+ "step": 150
115
+ },
116
+ {
117
+ "epoch": 0.048331067814529526,
118
+ "grad_norm": 1.6083164873540423,
119
+ "learning_rate": 9.816199376947041e-05,
120
+ "loss": 0.8748,
121
+ "step": 160
122
+ },
123
+ {
124
+ "epoch": 0.05135175955293762,
125
+ "grad_norm": 1.0686893898752028,
126
+ "learning_rate": 9.785046728971962e-05,
127
+ "loss": 0.875,
128
+ "step": 170
129
+ },
130
+ {
131
+ "epoch": 0.05437245129134572,
132
+ "grad_norm": 1.3766933277373585,
133
+ "learning_rate": 9.753894080996884e-05,
134
+ "loss": 0.8324,
135
+ "step": 180
136
+ },
137
+ {
138
+ "epoch": 0.05739314302975381,
139
+ "grad_norm": 1.0332571782362285,
140
+ "learning_rate": 9.722741433021807e-05,
141
+ "loss": 0.8414,
142
+ "step": 190
143
+ },
144
+ {
145
+ "epoch": 0.06041383476816191,
146
+ "grad_norm": 1.2849086192566328,
147
+ "learning_rate": 9.691588785046729e-05,
148
+ "loss": 0.825,
149
+ "step": 200
150
+ },
151
+ {
152
+ "epoch": 0.06343452650657,
153
+ "grad_norm": 1.125015534848599,
154
+ "learning_rate": 9.660436137071651e-05,
155
+ "loss": 0.827,
156
+ "step": 210
157
+ },
158
+ {
159
+ "epoch": 0.0664552182449781,
160
+ "grad_norm": 1.0924381371211556,
161
+ "learning_rate": 9.629283489096573e-05,
162
+ "loss": 0.8381,
163
+ "step": 220
164
+ },
165
+ {
166
+ "epoch": 0.0694759099833862,
167
+ "grad_norm": 1.1382918007143823,
168
+ "learning_rate": 9.598130841121496e-05,
169
+ "loss": 0.8047,
170
+ "step": 230
171
+ },
172
+ {
173
+ "epoch": 0.07249660172179428,
174
+ "grad_norm": 1.263038309691145,
175
+ "learning_rate": 9.566978193146418e-05,
176
+ "loss": 0.7401,
177
+ "step": 240
178
+ },
179
+ {
180
+ "epoch": 0.07551729346020239,
181
+ "grad_norm": 1.223191453286042,
182
+ "learning_rate": 9.53582554517134e-05,
183
+ "loss": 0.7566,
184
+ "step": 250
185
+ },
186
+ {
187
+ "epoch": 0.07853798519861048,
188
+ "grad_norm": 1.4311949668852009,
189
+ "learning_rate": 9.504672897196261e-05,
190
+ "loss": 0.8324,
191
+ "step": 260
192
+ },
193
+ {
194
+ "epoch": 0.08155867693701857,
195
+ "grad_norm": 1.1199798019887752,
196
+ "learning_rate": 9.473520249221183e-05,
197
+ "loss": 0.7918,
198
+ "step": 270
199
+ },
200
+ {
201
+ "epoch": 0.08457936867542667,
202
+ "grad_norm": 1.1353541939369336,
203
+ "learning_rate": 9.442367601246106e-05,
204
+ "loss": 0.7982,
205
+ "step": 280
206
+ },
207
+ {
208
+ "epoch": 0.08760006041383477,
209
+ "grad_norm": 1.0377240839273387,
210
+ "learning_rate": 9.411214953271028e-05,
211
+ "loss": 0.759,
212
+ "step": 290
213
+ },
214
+ {
215
+ "epoch": 0.09062075215224287,
216
+ "grad_norm": 1.0430291081517695,
217
+ "learning_rate": 9.38006230529595e-05,
218
+ "loss": 0.7489,
219
+ "step": 300
220
+ },
221
+ {
222
+ "epoch": 0.09364144389065096,
223
+ "grad_norm": 1.0556490523453508,
224
+ "learning_rate": 9.348909657320873e-05,
225
+ "loss": 0.7972,
226
+ "step": 310
227
+ },
228
+ {
229
+ "epoch": 0.09666213562905905,
230
+ "grad_norm": 0.8377680272528175,
231
+ "learning_rate": 9.317757009345795e-05,
232
+ "loss": 0.7883,
233
+ "step": 320
234
+ },
235
+ {
236
+ "epoch": 0.09968282736746716,
237
+ "grad_norm": 1.133534627320159,
238
+ "learning_rate": 9.286604361370717e-05,
239
+ "loss": 0.7963,
240
+ "step": 330
241
+ },
242
+ {
243
+ "epoch": 0.10270351910587525,
244
+ "grad_norm": 1.115336306572395,
245
+ "learning_rate": 9.255451713395639e-05,
246
+ "loss": 0.7115,
247
+ "step": 340
248
+ },
249
+ {
250
+ "epoch": 0.10572421084428334,
251
+ "grad_norm": 1.0771112865985937,
252
+ "learning_rate": 9.22429906542056e-05,
253
+ "loss": 0.6852,
254
+ "step": 350
255
+ },
256
+ {
257
+ "epoch": 0.10874490258269144,
258
+ "grad_norm": 1.1279818268954833,
259
+ "learning_rate": 9.193146417445482e-05,
260
+ "loss": 0.752,
261
+ "step": 360
262
+ },
263
+ {
264
+ "epoch": 0.11176559432109953,
265
+ "grad_norm": 1.1447909234403442,
266
+ "learning_rate": 9.161993769470405e-05,
267
+ "loss": 0.7813,
268
+ "step": 370
269
+ },
270
+ {
271
+ "epoch": 0.11478628605950762,
272
+ "grad_norm": 0.9732050999087476,
273
+ "learning_rate": 9.130841121495327e-05,
274
+ "loss": 0.7529,
275
+ "step": 380
276
+ },
277
+ {
278
+ "epoch": 0.11780697779791573,
279
+ "grad_norm": 0.9183505631954165,
280
+ "learning_rate": 9.099688473520249e-05,
281
+ "loss": 0.8184,
282
+ "step": 390
283
+ },
284
+ {
285
+ "epoch": 0.12082766953632382,
286
+ "grad_norm": 1.3406866026704565,
287
+ "learning_rate": 9.068535825545172e-05,
288
+ "loss": 0.7546,
289
+ "step": 400
290
+ },
291
+ {
292
+ "epoch": 0.12384836127473191,
293
+ "grad_norm": 1.080230905978024,
294
+ "learning_rate": 9.037383177570094e-05,
295
+ "loss": 0.7943,
296
+ "step": 410
297
+ },
298
+ {
299
+ "epoch": 0.12686905301314,
300
+ "grad_norm": 0.981708271024814,
301
+ "learning_rate": 9.006230529595016e-05,
302
+ "loss": 0.7748,
303
+ "step": 420
304
+ },
305
+ {
306
+ "epoch": 0.1298897447515481,
307
+ "grad_norm": 1.032944901370365,
308
+ "learning_rate": 8.975077881619937e-05,
309
+ "loss": 0.7367,
310
+ "step": 430
311
+ },
312
+ {
313
+ "epoch": 0.1329104364899562,
314
+ "grad_norm": 0.9828039027398626,
315
+ "learning_rate": 8.943925233644859e-05,
316
+ "loss": 0.7562,
317
+ "step": 440
318
+ },
319
+ {
320
+ "epoch": 0.13593112822836428,
321
+ "grad_norm": 1.025926244346921,
322
+ "learning_rate": 8.912772585669782e-05,
323
+ "loss": 0.7799,
324
+ "step": 450
325
+ },
326
+ {
327
+ "epoch": 0.1389518199667724,
328
+ "grad_norm": 1.0500959648810009,
329
+ "learning_rate": 8.881619937694704e-05,
330
+ "loss": 0.7523,
331
+ "step": 460
332
+ },
333
+ {
334
+ "epoch": 0.1419725117051805,
335
+ "grad_norm": 1.1701611318445844,
336
+ "learning_rate": 8.850467289719626e-05,
337
+ "loss": 0.7686,
338
+ "step": 470
339
+ },
340
+ {
341
+ "epoch": 0.14499320344358857,
342
+ "grad_norm": 0.8990869023938298,
343
+ "learning_rate": 8.819314641744548e-05,
344
+ "loss": 0.7289,
345
+ "step": 480
346
+ },
347
+ {
348
+ "epoch": 0.14801389518199667,
349
+ "grad_norm": 1.1095162409175816,
350
+ "learning_rate": 8.78816199376947e-05,
351
+ "loss": 0.7332,
352
+ "step": 490
353
+ },
354
+ {
355
+ "epoch": 0.15103458692040478,
356
+ "grad_norm": 1.0108816660931794,
357
+ "learning_rate": 8.757009345794393e-05,
358
+ "loss": 0.7125,
359
+ "step": 500
360
+ },
361
+ {
362
+ "epoch": 0.15405527865881286,
363
+ "grad_norm": 1.3324995099592942,
364
+ "learning_rate": 8.725856697819315e-05,
365
+ "loss": 0.7254,
366
+ "step": 510
367
+ },
368
+ {
369
+ "epoch": 0.15707597039722096,
370
+ "grad_norm": 1.0845745603450858,
371
+ "learning_rate": 8.694704049844236e-05,
372
+ "loss": 0.7115,
373
+ "step": 520
374
+ },
375
+ {
376
+ "epoch": 0.16009666213562906,
377
+ "grad_norm": 0.7967865715388287,
378
+ "learning_rate": 8.663551401869158e-05,
379
+ "loss": 0.7334,
380
+ "step": 530
381
+ },
382
+ {
383
+ "epoch": 0.16311735387403714,
384
+ "grad_norm": 0.9490631327452955,
385
+ "learning_rate": 8.63239875389408e-05,
386
+ "loss": 0.7399,
387
+ "step": 540
388
+ },
389
+ {
390
+ "epoch": 0.16613804561244525,
391
+ "grad_norm": 0.8962644592007071,
392
+ "learning_rate": 8.601246105919003e-05,
393
+ "loss": 0.7498,
394
+ "step": 550
395
+ },
396
+ {
397
+ "epoch": 0.16915873735085335,
398
+ "grad_norm": 1.1678557286758378,
399
+ "learning_rate": 8.570093457943925e-05,
400
+ "loss": 0.7067,
401
+ "step": 560
402
+ },
403
+ {
404
+ "epoch": 0.17217942908926145,
405
+ "grad_norm": 1.088949753627781,
406
+ "learning_rate": 8.538940809968847e-05,
407
+ "loss": 0.748,
408
+ "step": 570
409
+ },
410
+ {
411
+ "epoch": 0.17520012082766953,
412
+ "grad_norm": 1.0893408136265033,
413
+ "learning_rate": 8.50778816199377e-05,
414
+ "loss": 0.7623,
415
+ "step": 580
416
+ },
417
+ {
418
+ "epoch": 0.17822081256607764,
419
+ "grad_norm": 0.9840533089260339,
420
+ "learning_rate": 8.476635514018692e-05,
421
+ "loss": 0.6797,
422
+ "step": 590
423
+ },
424
+ {
425
+ "epoch": 0.18124150430448574,
426
+ "grad_norm": 1.0812493862448191,
427
+ "learning_rate": 8.445482866043614e-05,
428
+ "loss": 0.7275,
429
+ "step": 600
430
+ },
431
+ {
432
+ "epoch": 0.18426219604289382,
433
+ "grad_norm": 1.2195461231662528,
434
+ "learning_rate": 8.414330218068535e-05,
435
+ "loss": 0.6863,
436
+ "step": 610
437
+ },
438
+ {
439
+ "epoch": 0.18728288778130192,
440
+ "grad_norm": 0.8428943981031285,
441
+ "learning_rate": 8.383177570093457e-05,
442
+ "loss": 0.7412,
443
+ "step": 620
444
+ },
445
+ {
446
+ "epoch": 0.19030357951971003,
447
+ "grad_norm": 0.9484156439369784,
448
+ "learning_rate": 8.35202492211838e-05,
449
+ "loss": 0.7479,
450
+ "step": 630
451
+ },
452
+ {
453
+ "epoch": 0.1933242712581181,
454
+ "grad_norm": 1.5268349287880287,
455
+ "learning_rate": 8.320872274143302e-05,
456
+ "loss": 0.7421,
457
+ "step": 640
458
+ },
459
+ {
460
+ "epoch": 0.1963449629965262,
461
+ "grad_norm": 1.0210188261100828,
462
+ "learning_rate": 8.289719626168224e-05,
463
+ "loss": 0.735,
464
+ "step": 650
465
+ },
466
+ {
467
+ "epoch": 0.1993656547349343,
468
+ "grad_norm": 1.0507811901351063,
469
+ "learning_rate": 8.258566978193147e-05,
470
+ "loss": 0.7174,
471
+ "step": 660
472
+ },
473
+ {
474
+ "epoch": 0.2023863464733424,
475
+ "grad_norm": 0.977107559554224,
476
+ "learning_rate": 8.227414330218069e-05,
477
+ "loss": 0.6539,
478
+ "step": 670
479
+ },
480
+ {
481
+ "epoch": 0.2054070382117505,
482
+ "grad_norm": 1.0747746808663372,
483
+ "learning_rate": 8.196261682242991e-05,
484
+ "loss": 0.6529,
485
+ "step": 680
486
+ },
487
+ {
488
+ "epoch": 0.2084277299501586,
489
+ "grad_norm": 0.9082287831059276,
490
+ "learning_rate": 8.165109034267912e-05,
491
+ "loss": 0.732,
492
+ "step": 690
493
+ },
494
+ {
495
+ "epoch": 0.21144842168856667,
496
+ "grad_norm": 0.9212172953657185,
497
+ "learning_rate": 8.133956386292834e-05,
498
+ "loss": 0.6734,
499
+ "step": 700
500
+ },
501
+ {
502
+ "epoch": 0.21446911342697478,
503
+ "grad_norm": 0.7665370190006591,
504
+ "learning_rate": 8.102803738317756e-05,
505
+ "loss": 0.7048,
506
+ "step": 710
507
+ },
508
+ {
509
+ "epoch": 0.21748980516538288,
510
+ "grad_norm": 0.8983656963975071,
511
+ "learning_rate": 8.071651090342679e-05,
512
+ "loss": 0.7166,
513
+ "step": 720
514
+ },
515
+ {
516
+ "epoch": 0.22051049690379096,
517
+ "grad_norm": 0.996733266552071,
518
+ "learning_rate": 8.040498442367601e-05,
519
+ "loss": 0.7354,
520
+ "step": 730
521
+ },
522
+ {
523
+ "epoch": 0.22353118864219906,
524
+ "grad_norm": 0.8782696913983529,
525
+ "learning_rate": 8.009345794392523e-05,
526
+ "loss": 0.6911,
527
+ "step": 740
528
+ },
529
+ {
530
+ "epoch": 0.22655188038060717,
531
+ "grad_norm": 1.0464611268652604,
532
+ "learning_rate": 7.978193146417447e-05,
533
+ "loss": 0.6791,
534
+ "step": 750
535
+ },
536
+ {
537
+ "epoch": 0.22957257211901524,
538
+ "grad_norm": 1.429521202085466,
539
+ "learning_rate": 7.947040498442369e-05,
540
+ "loss": 0.7254,
541
+ "step": 760
542
+ },
543
+ {
544
+ "epoch": 0.23259326385742335,
545
+ "grad_norm": 0.8265481561359109,
546
+ "learning_rate": 7.91588785046729e-05,
547
+ "loss": 0.6933,
548
+ "step": 770
549
+ },
550
+ {
551
+ "epoch": 0.23561395559583145,
552
+ "grad_norm": 1.1395351111445386,
553
+ "learning_rate": 7.884735202492212e-05,
554
+ "loss": 0.6927,
555
+ "step": 780
556
+ },
557
+ {
558
+ "epoch": 0.23863464733423953,
559
+ "grad_norm": 0.8683132914875289,
560
+ "learning_rate": 7.853582554517135e-05,
561
+ "loss": 0.7115,
562
+ "step": 790
563
+ },
564
+ {
565
+ "epoch": 0.24165533907264763,
566
+ "grad_norm": 1.0048357199050497,
567
+ "learning_rate": 7.822429906542057e-05,
568
+ "loss": 0.7258,
569
+ "step": 800
570
+ },
571
+ {
572
+ "epoch": 0.24467603081105574,
573
+ "grad_norm": 0.9186551341926896,
574
+ "learning_rate": 7.791277258566979e-05,
575
+ "loss": 0.6937,
576
+ "step": 810
577
+ },
578
+ {
579
+ "epoch": 0.24769672254946382,
580
+ "grad_norm": 0.90949443461049,
581
+ "learning_rate": 7.760124610591901e-05,
582
+ "loss": 0.717,
583
+ "step": 820
584
+ },
585
+ {
586
+ "epoch": 0.2507174142878719,
587
+ "grad_norm": 1.2709292068990643,
588
+ "learning_rate": 7.728971962616824e-05,
589
+ "loss": 0.7313,
590
+ "step": 830
591
+ },
592
+ {
593
+ "epoch": 0.25373810602628,
594
+ "grad_norm": 1.039112358866248,
595
+ "learning_rate": 7.697819314641746e-05,
596
+ "loss": 0.6961,
597
+ "step": 840
598
+ },
599
+ {
600
+ "epoch": 0.25675879776468813,
601
+ "grad_norm": 0.9738088719115688,
602
+ "learning_rate": 7.666666666666667e-05,
603
+ "loss": 0.7418,
604
+ "step": 850
605
+ },
606
+ {
607
+ "epoch": 0.2597794895030962,
608
+ "grad_norm": 1.0293122474854857,
609
+ "learning_rate": 7.635514018691589e-05,
610
+ "loss": 0.7208,
611
+ "step": 860
612
+ },
613
+ {
614
+ "epoch": 0.2628001812415043,
615
+ "grad_norm": 0.9219605479548113,
616
+ "learning_rate": 7.604361370716511e-05,
617
+ "loss": 0.6573,
618
+ "step": 870
619
+ },
620
+ {
621
+ "epoch": 0.2658208729799124,
622
+ "grad_norm": 0.986441148226433,
623
+ "learning_rate": 7.573208722741434e-05,
624
+ "loss": 0.6882,
625
+ "step": 880
626
+ },
627
+ {
628
+ "epoch": 0.2688415647183205,
629
+ "grad_norm": 0.8721644047390303,
630
+ "learning_rate": 7.542056074766356e-05,
631
+ "loss": 0.699,
632
+ "step": 890
633
+ },
634
+ {
635
+ "epoch": 0.27186225645672857,
636
+ "grad_norm": 0.8397538474783728,
637
+ "learning_rate": 7.510903426791278e-05,
638
+ "loss": 0.7473,
639
+ "step": 900
640
+ },
641
+ {
642
+ "epoch": 0.2748829481951367,
643
+ "grad_norm": 0.9204492440191102,
644
+ "learning_rate": 7.4797507788162e-05,
645
+ "loss": 0.682,
646
+ "step": 910
647
+ },
648
+ {
649
+ "epoch": 0.2779036399335448,
650
+ "grad_norm": 0.9916189555392334,
651
+ "learning_rate": 7.448598130841123e-05,
652
+ "loss": 0.6714,
653
+ "step": 920
654
+ },
655
+ {
656
+ "epoch": 0.28092433167195285,
657
+ "grad_norm": 0.9959802073019116,
658
+ "learning_rate": 7.417445482866045e-05,
659
+ "loss": 0.7068,
660
+ "step": 930
661
+ },
662
+ {
663
+ "epoch": 0.283945023410361,
664
+ "grad_norm": 0.822413918128088,
665
+ "learning_rate": 7.386292834890966e-05,
666
+ "loss": 0.6993,
667
+ "step": 940
668
+ },
669
+ {
670
+ "epoch": 0.28696571514876906,
671
+ "grad_norm": 0.9857850966520738,
672
+ "learning_rate": 7.355140186915888e-05,
673
+ "loss": 0.708,
674
+ "step": 950
675
+ },
676
+ {
677
+ "epoch": 0.28998640688717714,
678
+ "grad_norm": 0.7935815329490274,
679
+ "learning_rate": 7.32398753894081e-05,
680
+ "loss": 0.7262,
681
+ "step": 960
682
+ },
683
+ {
684
+ "epoch": 0.29300709862558527,
685
+ "grad_norm": 0.9762914722861878,
686
+ "learning_rate": 7.292834890965733e-05,
687
+ "loss": 0.6663,
688
+ "step": 970
689
+ },
690
+ {
691
+ "epoch": 0.29602779036399335,
692
+ "grad_norm": 0.9841123533490521,
693
+ "learning_rate": 7.261682242990655e-05,
694
+ "loss": 0.693,
695
+ "step": 980
696
+ },
697
+ {
698
+ "epoch": 0.2990484821024014,
699
+ "grad_norm": 0.9136079490982437,
700
+ "learning_rate": 7.230529595015577e-05,
701
+ "loss": 0.7049,
702
+ "step": 990
703
+ },
704
+ {
705
+ "epoch": 0.30206917384080956,
706
+ "grad_norm": 0.8902281683899582,
707
+ "learning_rate": 7.1993769470405e-05,
708
+ "loss": 0.6956,
709
+ "step": 1000
710
+ },
711
+ {
712
+ "epoch": 0.30508986557921763,
713
+ "grad_norm": 0.9555339802943792,
714
+ "learning_rate": 7.168224299065422e-05,
715
+ "loss": 0.6923,
716
+ "step": 1010
717
+ },
718
+ {
719
+ "epoch": 0.3081105573176257,
720
+ "grad_norm": 0.9226515554395557,
721
+ "learning_rate": 7.137071651090344e-05,
722
+ "loss": 0.7047,
723
+ "step": 1020
724
+ },
725
+ {
726
+ "epoch": 0.31113124905603384,
727
+ "grad_norm": 1.0265101302708708,
728
+ "learning_rate": 7.105919003115265e-05,
729
+ "loss": 0.6342,
730
+ "step": 1030
731
+ },
732
+ {
733
+ "epoch": 0.3141519407944419,
734
+ "grad_norm": 0.7354809813158237,
735
+ "learning_rate": 7.074766355140187e-05,
736
+ "loss": 0.7276,
737
+ "step": 1040
738
+ },
739
+ {
740
+ "epoch": 0.31717263253285,
741
+ "grad_norm": 0.753423387786277,
742
+ "learning_rate": 7.04361370716511e-05,
743
+ "loss": 0.6743,
744
+ "step": 1050
745
+ },
746
+ {
747
+ "epoch": 0.32019332427125813,
748
+ "grad_norm": 1.057091313600942,
749
+ "learning_rate": 7.012461059190032e-05,
750
+ "loss": 0.6715,
751
+ "step": 1060
752
+ },
753
+ {
754
+ "epoch": 0.3232140160096662,
755
+ "grad_norm": 0.7838790412397071,
756
+ "learning_rate": 6.981308411214954e-05,
757
+ "loss": 0.6671,
758
+ "step": 1070
759
+ },
760
+ {
761
+ "epoch": 0.3262347077480743,
762
+ "grad_norm": 0.8980932417690051,
763
+ "learning_rate": 6.950155763239876e-05,
764
+ "loss": 0.6774,
765
+ "step": 1080
766
+ },
767
+ {
768
+ "epoch": 0.3292553994864824,
769
+ "grad_norm": 0.9220267366468554,
770
+ "learning_rate": 6.919003115264799e-05,
771
+ "loss": 0.6428,
772
+ "step": 1090
773
+ },
774
+ {
775
+ "epoch": 0.3322760912248905,
776
+ "grad_norm": 0.9214463298045865,
777
+ "learning_rate": 6.887850467289721e-05,
778
+ "loss": 0.7271,
779
+ "step": 1100
780
+ },
781
+ {
782
+ "epoch": 0.3352967829632986,
783
+ "grad_norm": 0.9321131041370911,
784
+ "learning_rate": 6.856697819314643e-05,
785
+ "loss": 0.7258,
786
+ "step": 1110
787
+ },
788
+ {
789
+ "epoch": 0.3383174747017067,
790
+ "grad_norm": 1.279210720148468,
791
+ "learning_rate": 6.825545171339564e-05,
792
+ "loss": 0.6632,
793
+ "step": 1120
794
+ },
795
+ {
796
+ "epoch": 0.3413381664401148,
797
+ "grad_norm": 1.0059923489692595,
798
+ "learning_rate": 6.794392523364486e-05,
799
+ "loss": 0.6364,
800
+ "step": 1130
801
+ },
802
+ {
803
+ "epoch": 0.3443588581785229,
804
+ "grad_norm": 1.047129656921137,
805
+ "learning_rate": 6.763239875389409e-05,
806
+ "loss": 0.7291,
807
+ "step": 1140
808
+ },
809
+ {
810
+ "epoch": 0.347379549916931,
811
+ "grad_norm": 0.9272803839751749,
812
+ "learning_rate": 6.732087227414331e-05,
813
+ "loss": 0.6395,
814
+ "step": 1150
815
+ },
816
+ {
817
+ "epoch": 0.35040024165533906,
818
+ "grad_norm": 1.1151649879002739,
819
+ "learning_rate": 6.700934579439253e-05,
820
+ "loss": 0.6657,
821
+ "step": 1160
822
+ },
823
+ {
824
+ "epoch": 0.3534209333937472,
825
+ "grad_norm": 0.9241781872831288,
826
+ "learning_rate": 6.669781931464175e-05,
827
+ "loss": 0.6653,
828
+ "step": 1170
829
+ },
830
+ {
831
+ "epoch": 0.35644162513215527,
832
+ "grad_norm": 0.8358913806558893,
833
+ "learning_rate": 6.638629283489098e-05,
834
+ "loss": 0.7389,
835
+ "step": 1180
836
+ },
837
+ {
838
+ "epoch": 0.35946231687056335,
839
+ "grad_norm": 1.0319211344473511,
840
+ "learning_rate": 6.60747663551402e-05,
841
+ "loss": 0.6954,
842
+ "step": 1190
843
+ },
844
+ {
845
+ "epoch": 0.3624830086089715,
846
+ "grad_norm": 1.1505728351225282,
847
+ "learning_rate": 6.576323987538941e-05,
848
+ "loss": 0.7043,
849
+ "step": 1200
850
+ },
851
+ {
852
+ "epoch": 0.36550370034737956,
853
+ "grad_norm": 0.7959153182677297,
854
+ "learning_rate": 6.545171339563863e-05,
855
+ "loss": 0.6695,
856
+ "step": 1210
857
+ },
858
+ {
859
+ "epoch": 0.36852439208578763,
860
+ "grad_norm": 0.9337856655171398,
861
+ "learning_rate": 6.514018691588785e-05,
862
+ "loss": 0.7429,
863
+ "step": 1220
864
+ },
865
+ {
866
+ "epoch": 0.37154508382419577,
867
+ "grad_norm": 0.8063590050110404,
868
+ "learning_rate": 6.482866043613708e-05,
869
+ "loss": 0.6899,
870
+ "step": 1230
871
+ },
872
+ {
873
+ "epoch": 0.37456577556260384,
874
+ "grad_norm": 1.0599327700787213,
875
+ "learning_rate": 6.45171339563863e-05,
876
+ "loss": 0.6542,
877
+ "step": 1240
878
+ },
879
+ {
880
+ "epoch": 0.3775864673010119,
881
+ "grad_norm": 0.9744322038123949,
882
+ "learning_rate": 6.420560747663552e-05,
883
+ "loss": 0.706,
884
+ "step": 1250
885
+ },
886
+ {
887
+ "epoch": 0.38060715903942005,
888
+ "grad_norm": 0.8586307372164459,
889
+ "learning_rate": 6.389408099688475e-05,
890
+ "loss": 0.655,
891
+ "step": 1260
892
+ },
893
+ {
894
+ "epoch": 0.3836278507778281,
895
+ "grad_norm": 0.9830477484209696,
896
+ "learning_rate": 6.358255451713397e-05,
897
+ "loss": 0.6742,
898
+ "step": 1270
899
+ },
900
+ {
901
+ "epoch": 0.3866485425162362,
902
+ "grad_norm": 0.9902981913412452,
903
+ "learning_rate": 6.327102803738319e-05,
904
+ "loss": 0.6978,
905
+ "step": 1280
906
+ },
907
+ {
908
+ "epoch": 0.38966923425464434,
909
+ "grad_norm": 1.1185182362842843,
910
+ "learning_rate": 6.29595015576324e-05,
911
+ "loss": 0.73,
912
+ "step": 1290
913
+ },
914
+ {
915
+ "epoch": 0.3926899259930524,
916
+ "grad_norm": 0.877292130995857,
917
+ "learning_rate": 6.264797507788162e-05,
918
+ "loss": 0.7157,
919
+ "step": 1300
920
+ },
921
+ {
922
+ "epoch": 0.3957106177314605,
923
+ "grad_norm": 0.9682140121699045,
924
+ "learning_rate": 6.233644859813084e-05,
925
+ "loss": 0.678,
926
+ "step": 1310
927
+ },
928
+ {
929
+ "epoch": 0.3987313094698686,
930
+ "grad_norm": 1.0751962176923822,
931
+ "learning_rate": 6.202492211838007e-05,
932
+ "loss": 0.6393,
933
+ "step": 1320
934
+ },
935
+ {
936
+ "epoch": 0.4017520012082767,
937
+ "grad_norm": 0.8236677739270527,
938
+ "learning_rate": 6.171339563862929e-05,
939
+ "loss": 0.6709,
940
+ "step": 1330
941
+ },
942
+ {
943
+ "epoch": 0.4047726929466848,
944
+ "grad_norm": 0.9406647365344084,
945
+ "learning_rate": 6.140186915887851e-05,
946
+ "loss": 0.6588,
947
+ "step": 1340
948
+ },
949
+ {
950
+ "epoch": 0.4077933846850929,
951
+ "grad_norm": 1.2046005814359064,
952
+ "learning_rate": 6.109034267912774e-05,
953
+ "loss": 0.6807,
954
+ "step": 1350
955
+ },
956
+ {
957
+ "epoch": 0.410814076423501,
958
+ "grad_norm": 0.9066360882428902,
959
+ "learning_rate": 6.077881619937695e-05,
960
+ "loss": 0.7168,
961
+ "step": 1360
962
+ },
963
+ {
964
+ "epoch": 0.41383476816190906,
965
+ "grad_norm": 0.9527150302995969,
966
+ "learning_rate": 6.0467289719626174e-05,
967
+ "loss": 0.6984,
968
+ "step": 1370
969
+ },
970
+ {
971
+ "epoch": 0.4168554599003172,
972
+ "grad_norm": 0.8541783908332572,
973
+ "learning_rate": 6.01557632398754e-05,
974
+ "loss": 0.6596,
975
+ "step": 1380
976
+ },
977
+ {
978
+ "epoch": 0.41987615163872527,
979
+ "grad_norm": 0.9929215209215169,
980
+ "learning_rate": 5.984423676012462e-05,
981
+ "loss": 0.6496,
982
+ "step": 1390
983
+ },
984
+ {
985
+ "epoch": 0.42289684337713335,
986
+ "grad_norm": 0.8614209306432289,
987
+ "learning_rate": 5.9532710280373836e-05,
988
+ "loss": 0.6639,
989
+ "step": 1400
990
+ },
991
+ {
992
+ "epoch": 0.4259175351155415,
993
+ "grad_norm": 0.9182204803735963,
994
+ "learning_rate": 5.922118380062306e-05,
995
+ "loss": 0.6599,
996
+ "step": 1410
997
+ },
998
+ {
999
+ "epoch": 0.42893822685394956,
1000
+ "grad_norm": 0.991639681929367,
1001
+ "learning_rate": 5.890965732087228e-05,
1002
+ "loss": 0.6997,
1003
+ "step": 1420
1004
+ },
1005
+ {
1006
+ "epoch": 0.43195891859235763,
1007
+ "grad_norm": 0.9192897320069349,
1008
+ "learning_rate": 5.8598130841121504e-05,
1009
+ "loss": 0.6911,
1010
+ "step": 1430
1011
+ },
1012
+ {
1013
+ "epoch": 0.43497961033076576,
1014
+ "grad_norm": 0.8791677727387652,
1015
+ "learning_rate": 5.828660436137072e-05,
1016
+ "loss": 0.6133,
1017
+ "step": 1440
1018
+ },
1019
+ {
1020
+ "epoch": 0.43800030206917384,
1021
+ "grad_norm": 0.9146654670599264,
1022
+ "learning_rate": 5.797507788161994e-05,
1023
+ "loss": 0.6671,
1024
+ "step": 1450
1025
+ },
1026
+ {
1027
+ "epoch": 0.4410209938075819,
1028
+ "grad_norm": 0.7904811312174689,
1029
+ "learning_rate": 5.7663551401869165e-05,
1030
+ "loss": 0.6664,
1031
+ "step": 1460
1032
+ },
1033
+ {
1034
+ "epoch": 0.44404168554599005,
1035
+ "grad_norm": 0.7986284407143894,
1036
+ "learning_rate": 5.735202492211839e-05,
1037
+ "loss": 0.7036,
1038
+ "step": 1470
1039
+ },
1040
+ {
1041
+ "epoch": 0.4470623772843981,
1042
+ "grad_norm": 1.1832322364502883,
1043
+ "learning_rate": 5.704049844236761e-05,
1044
+ "loss": 0.6819,
1045
+ "step": 1480
1046
+ },
1047
+ {
1048
+ "epoch": 0.4500830690228062,
1049
+ "grad_norm": 1.416546083504211,
1050
+ "learning_rate": 5.6728971962616826e-05,
1051
+ "loss": 0.6478,
1052
+ "step": 1490
1053
+ },
1054
+ {
1055
+ "epoch": 0.45310376076121434,
1056
+ "grad_norm": 0.9415627484625246,
1057
+ "learning_rate": 5.641744548286605e-05,
1058
+ "loss": 0.6146,
1059
+ "step": 1500
1060
+ },
1061
+ {
1062
+ "epoch": 0.4561244524996224,
1063
+ "grad_norm": 0.9223288773940925,
1064
+ "learning_rate": 5.610591900311527e-05,
1065
+ "loss": 0.7053,
1066
+ "step": 1510
1067
+ },
1068
+ {
1069
+ "epoch": 0.4591451442380305,
1070
+ "grad_norm": 0.970256765114157,
1071
+ "learning_rate": 5.5794392523364494e-05,
1072
+ "loss": 0.6443,
1073
+ "step": 1520
1074
+ },
1075
+ {
1076
+ "epoch": 0.4621658359764386,
1077
+ "grad_norm": 0.7403345850081653,
1078
+ "learning_rate": 5.548286604361371e-05,
1079
+ "loss": 0.6207,
1080
+ "step": 1530
1081
+ },
1082
+ {
1083
+ "epoch": 0.4651865277148467,
1084
+ "grad_norm": 1.1294910445688315,
1085
+ "learning_rate": 5.517133956386293e-05,
1086
+ "loss": 0.6837,
1087
+ "step": 1540
1088
+ },
1089
+ {
1090
+ "epoch": 0.4682072194532548,
1091
+ "grad_norm": 1.084685705504392,
1092
+ "learning_rate": 5.4859813084112156e-05,
1093
+ "loss": 0.6619,
1094
+ "step": 1550
1095
+ },
1096
+ {
1097
+ "epoch": 0.4712279111916629,
1098
+ "grad_norm": 0.9613159354858272,
1099
+ "learning_rate": 5.454828660436138e-05,
1100
+ "loss": 0.6515,
1101
+ "step": 1560
1102
+ },
1103
+ {
1104
+ "epoch": 0.474248602930071,
1105
+ "grad_norm": 0.9837692555022853,
1106
+ "learning_rate": 5.4236760124610594e-05,
1107
+ "loss": 0.5924,
1108
+ "step": 1570
1109
+ },
1110
+ {
1111
+ "epoch": 0.47726929466847906,
1112
+ "grad_norm": 0.9979615856918954,
1113
+ "learning_rate": 5.392523364485982e-05,
1114
+ "loss": 0.7001,
1115
+ "step": 1580
1116
+ },
1117
+ {
1118
+ "epoch": 0.4802899864068872,
1119
+ "grad_norm": 0.9728439737052923,
1120
+ "learning_rate": 5.361370716510904e-05,
1121
+ "loss": 0.6458,
1122
+ "step": 1590
1123
+ },
1124
+ {
1125
+ "epoch": 0.48331067814529527,
1126
+ "grad_norm": 1.0126438240737292,
1127
+ "learning_rate": 5.330218068535826e-05,
1128
+ "loss": 0.7399,
1129
+ "step": 1600
1130
+ },
1131
+ {
1132
+ "epoch": 0.48633136988370335,
1133
+ "grad_norm": 1.0282465120937962,
1134
+ "learning_rate": 5.2990654205607485e-05,
1135
+ "loss": 0.6591,
1136
+ "step": 1610
1137
+ },
1138
+ {
1139
+ "epoch": 0.4893520616221115,
1140
+ "grad_norm": 1.0608069664171718,
1141
+ "learning_rate": 5.26791277258567e-05,
1142
+ "loss": 0.6852,
1143
+ "step": 1620
1144
+ },
1145
+ {
1146
+ "epoch": 0.49237275336051955,
1147
+ "grad_norm": 1.06193177949756,
1148
+ "learning_rate": 5.2367601246105924e-05,
1149
+ "loss": 0.6256,
1150
+ "step": 1630
1151
+ },
1152
+ {
1153
+ "epoch": 0.49539344509892763,
1154
+ "grad_norm": 0.8994514739072711,
1155
+ "learning_rate": 5.2056074766355146e-05,
1156
+ "loss": 0.6157,
1157
+ "step": 1640
1158
+ },
1159
+ {
1160
+ "epoch": 0.49841413683733576,
1161
+ "grad_norm": 0.8831776925916133,
1162
+ "learning_rate": 5.174454828660437e-05,
1163
+ "loss": 0.6585,
1164
+ "step": 1650
1165
+ },
1166
+ {
1167
+ "epoch": 0.5014348285757438,
1168
+ "grad_norm": 0.9057465973326372,
1169
+ "learning_rate": 5.1433021806853585e-05,
1170
+ "loss": 0.6548,
1171
+ "step": 1660
1172
+ },
1173
+ {
1174
+ "epoch": 0.504455520314152,
1175
+ "grad_norm": 0.8470568048981005,
1176
+ "learning_rate": 5.112149532710281e-05,
1177
+ "loss": 0.5995,
1178
+ "step": 1670
1179
+ },
1180
+ {
1181
+ "epoch": 0.50747621205256,
1182
+ "grad_norm": 0.9274346159474457,
1183
+ "learning_rate": 5.080996884735203e-05,
1184
+ "loss": 0.6695,
1185
+ "step": 1680
1186
+ },
1187
+ {
1188
+ "epoch": 0.5104969037909681,
1189
+ "grad_norm": 0.8266785564731086,
1190
+ "learning_rate": 5.049844236760125e-05,
1191
+ "loss": 0.6749,
1192
+ "step": 1690
1193
+ },
1194
+ {
1195
+ "epoch": 0.5135175955293763,
1196
+ "grad_norm": 1.0808475616587816,
1197
+ "learning_rate": 5.018691588785047e-05,
1198
+ "loss": 0.6696,
1199
+ "step": 1700
1200
+ },
1201
+ {
1202
+ "epoch": 0.5165382872677843,
1203
+ "grad_norm": 0.938631750728695,
1204
+ "learning_rate": 4.987538940809969e-05,
1205
+ "loss": 0.6953,
1206
+ "step": 1710
1207
+ },
1208
+ {
1209
+ "epoch": 0.5195589790061924,
1210
+ "grad_norm": 1.0041642156156723,
1211
+ "learning_rate": 4.9563862928348914e-05,
1212
+ "loss": 0.6873,
1213
+ "step": 1720
1214
+ },
1215
+ {
1216
+ "epoch": 0.5225796707446005,
1217
+ "grad_norm": 0.8610395612409752,
1218
+ "learning_rate": 4.925233644859814e-05,
1219
+ "loss": 0.7225,
1220
+ "step": 1730
1221
+ },
1222
+ {
1223
+ "epoch": 0.5256003624830086,
1224
+ "grad_norm": 0.9496184351237903,
1225
+ "learning_rate": 4.894080996884736e-05,
1226
+ "loss": 0.6382,
1227
+ "step": 1740
1228
+ },
1229
+ {
1230
+ "epoch": 0.5286210542214167,
1231
+ "grad_norm": 1.0830488045922504,
1232
+ "learning_rate": 4.8629283489096575e-05,
1233
+ "loss": 0.6314,
1234
+ "step": 1750
1235
+ },
1236
+ {
1237
+ "epoch": 0.5316417459598248,
1238
+ "grad_norm": 1.3308812167096526,
1239
+ "learning_rate": 4.83177570093458e-05,
1240
+ "loss": 0.6279,
1241
+ "step": 1760
1242
+ },
1243
+ {
1244
+ "epoch": 0.5346624376982329,
1245
+ "grad_norm": 1.0384804569396457,
1246
+ "learning_rate": 4.800623052959502e-05,
1247
+ "loss": 0.6661,
1248
+ "step": 1770
1249
+ },
1250
+ {
1251
+ "epoch": 0.537683129436641,
1252
+ "grad_norm": 0.9268941184363317,
1253
+ "learning_rate": 4.7694704049844244e-05,
1254
+ "loss": 0.5982,
1255
+ "step": 1780
1256
+ },
1257
+ {
1258
+ "epoch": 0.5407038211750491,
1259
+ "grad_norm": 1.0041389636701843,
1260
+ "learning_rate": 4.738317757009346e-05,
1261
+ "loss": 0.5852,
1262
+ "step": 1790
1263
+ },
1264
+ {
1265
+ "epoch": 0.5437245129134571,
1266
+ "grad_norm": 1.0812438556748192,
1267
+ "learning_rate": 4.707165109034268e-05,
1268
+ "loss": 0.6445,
1269
+ "step": 1800
1270
+ },
1271
+ {
1272
+ "epoch": 0.5467452046518653,
1273
+ "grad_norm": 0.7998207518212354,
1274
+ "learning_rate": 4.6760124610591905e-05,
1275
+ "loss": 0.6212,
1276
+ "step": 1810
1277
+ },
1278
+ {
1279
+ "epoch": 0.5497658963902734,
1280
+ "grad_norm": 0.9860219965019006,
1281
+ "learning_rate": 4.644859813084113e-05,
1282
+ "loss": 0.6453,
1283
+ "step": 1820
1284
+ },
1285
+ {
1286
+ "epoch": 0.5527865881286814,
1287
+ "grad_norm": 1.0673930524321107,
1288
+ "learning_rate": 4.6137071651090343e-05,
1289
+ "loss": 0.5837,
1290
+ "step": 1830
1291
+ },
1292
+ {
1293
+ "epoch": 0.5558072798670896,
1294
+ "grad_norm": 1.143808636631285,
1295
+ "learning_rate": 4.5825545171339566e-05,
1296
+ "loss": 0.6996,
1297
+ "step": 1840
1298
+ },
1299
+ {
1300
+ "epoch": 0.5588279716054977,
1301
+ "grad_norm": 0.9805310678029436,
1302
+ "learning_rate": 4.551401869158879e-05,
1303
+ "loss": 0.6062,
1304
+ "step": 1850
1305
+ },
1306
+ {
1307
+ "epoch": 0.5618486633439057,
1308
+ "grad_norm": 1.0396445753595607,
1309
+ "learning_rate": 4.520249221183801e-05,
1310
+ "loss": 0.6249,
1311
+ "step": 1860
1312
+ },
1313
+ {
1314
+ "epoch": 0.5648693550823138,
1315
+ "grad_norm": 0.9626964932261893,
1316
+ "learning_rate": 4.4890965732087234e-05,
1317
+ "loss": 0.6571,
1318
+ "step": 1870
1319
+ },
1320
+ {
1321
+ "epoch": 0.567890046820722,
1322
+ "grad_norm": 0.9540429394126168,
1323
+ "learning_rate": 4.457943925233645e-05,
1324
+ "loss": 0.6324,
1325
+ "step": 1880
1326
+ },
1327
+ {
1328
+ "epoch": 0.57091073855913,
1329
+ "grad_norm": 0.9015174511995171,
1330
+ "learning_rate": 4.426791277258567e-05,
1331
+ "loss": 0.6863,
1332
+ "step": 1890
1333
+ },
1334
+ {
1335
+ "epoch": 0.5739314302975381,
1336
+ "grad_norm": 0.7989728677956948,
1337
+ "learning_rate": 4.3956386292834895e-05,
1338
+ "loss": 0.6107,
1339
+ "step": 1900
1340
+ },
1341
+ {
1342
+ "epoch": 0.5769521220359463,
1343
+ "grad_norm": 1.0283655646158905,
1344
+ "learning_rate": 4.364485981308412e-05,
1345
+ "loss": 0.5799,
1346
+ "step": 1910
1347
+ },
1348
+ {
1349
+ "epoch": 0.5799728137743543,
1350
+ "grad_norm": 0.8496110087014387,
1351
+ "learning_rate": 4.3333333333333334e-05,
1352
+ "loss": 0.6114,
1353
+ "step": 1920
1354
+ },
1355
+ {
1356
+ "epoch": 0.5829935055127624,
1357
+ "grad_norm": 0.9378297749359396,
1358
+ "learning_rate": 4.302180685358256e-05,
1359
+ "loss": 0.6238,
1360
+ "step": 1930
1361
+ },
1362
+ {
1363
+ "epoch": 0.5860141972511705,
1364
+ "grad_norm": 0.7724041203791813,
1365
+ "learning_rate": 4.271028037383178e-05,
1366
+ "loss": 0.6684,
1367
+ "step": 1940
1368
+ },
1369
+ {
1370
+ "epoch": 0.5890348889895786,
1371
+ "grad_norm": 0.919952085375962,
1372
+ "learning_rate": 4.2398753894081e-05,
1373
+ "loss": 0.658,
1374
+ "step": 1950
1375
+ },
1376
+ {
1377
+ "epoch": 0.5920555807279867,
1378
+ "grad_norm": 1.0984535902148247,
1379
+ "learning_rate": 4.2087227414330225e-05,
1380
+ "loss": 0.6271,
1381
+ "step": 1960
1382
+ },
1383
+ {
1384
+ "epoch": 0.5950762724663948,
1385
+ "grad_norm": 1.089793595134447,
1386
+ "learning_rate": 4.177570093457944e-05,
1387
+ "loss": 0.6401,
1388
+ "step": 1970
1389
+ },
1390
+ {
1391
+ "epoch": 0.5980969642048029,
1392
+ "grad_norm": 0.9470634176090514,
1393
+ "learning_rate": 4.1464174454828663e-05,
1394
+ "loss": 0.6269,
1395
+ "step": 1980
1396
+ },
1397
+ {
1398
+ "epoch": 0.601117655943211,
1399
+ "grad_norm": 0.9586690317848461,
1400
+ "learning_rate": 4.1152647975077886e-05,
1401
+ "loss": 0.6455,
1402
+ "step": 1990
1403
+ },
1404
+ {
1405
+ "epoch": 0.6041383476816191,
1406
+ "grad_norm": 0.9355637416127348,
1407
+ "learning_rate": 4.084112149532711e-05,
1408
+ "loss": 0.6505,
1409
+ "step": 2000
1410
+ },
1411
+ {
1412
+ "epoch": 0.6071590394200271,
1413
+ "grad_norm": 0.9422028995953846,
1414
+ "learning_rate": 4.0529595015576325e-05,
1415
+ "loss": 0.5881,
1416
+ "step": 2010
1417
+ },
1418
+ {
1419
+ "epoch": 0.6101797311584353,
1420
+ "grad_norm": 1.0662379927757937,
1421
+ "learning_rate": 4.021806853582555e-05,
1422
+ "loss": 0.6965,
1423
+ "step": 2020
1424
+ },
1425
+ {
1426
+ "epoch": 0.6132004228968434,
1427
+ "grad_norm": 1.112340047069814,
1428
+ "learning_rate": 3.990654205607477e-05,
1429
+ "loss": 0.6696,
1430
+ "step": 2030
1431
+ },
1432
+ {
1433
+ "epoch": 0.6162211146352514,
1434
+ "grad_norm": 0.9811828345166662,
1435
+ "learning_rate": 3.959501557632399e-05,
1436
+ "loss": 0.6774,
1437
+ "step": 2040
1438
+ },
1439
+ {
1440
+ "epoch": 0.6192418063736596,
1441
+ "grad_norm": 0.8797632809116769,
1442
+ "learning_rate": 3.928348909657321e-05,
1443
+ "loss": 0.6814,
1444
+ "step": 2050
1445
+ },
1446
+ {
1447
+ "epoch": 0.6222624981120677,
1448
+ "grad_norm": 1.0012864041487008,
1449
+ "learning_rate": 3.897196261682243e-05,
1450
+ "loss": 0.6789,
1451
+ "step": 2060
1452
+ },
1453
+ {
1454
+ "epoch": 0.6252831898504757,
1455
+ "grad_norm": 0.9363857271307736,
1456
+ "learning_rate": 3.8660436137071654e-05,
1457
+ "loss": 0.6286,
1458
+ "step": 2070
1459
+ },
1460
+ {
1461
+ "epoch": 0.6283038815888838,
1462
+ "grad_norm": 0.8994398345785907,
1463
+ "learning_rate": 3.834890965732088e-05,
1464
+ "loss": 0.5957,
1465
+ "step": 2080
1466
+ },
1467
+ {
1468
+ "epoch": 0.631324573327292,
1469
+ "grad_norm": 0.9307639618859869,
1470
+ "learning_rate": 3.80373831775701e-05,
1471
+ "loss": 0.6365,
1472
+ "step": 2090
1473
+ },
1474
+ {
1475
+ "epoch": 0.6343452650657,
1476
+ "grad_norm": 0.8458149477874153,
1477
+ "learning_rate": 3.7725856697819315e-05,
1478
+ "loss": 0.682,
1479
+ "step": 2100
1480
+ },
1481
+ {
1482
+ "epoch": 0.6373659568041081,
1483
+ "grad_norm": 0.782298940529486,
1484
+ "learning_rate": 3.741433021806854e-05,
1485
+ "loss": 0.68,
1486
+ "step": 2110
1487
+ },
1488
+ {
1489
+ "epoch": 0.6403866485425163,
1490
+ "grad_norm": 0.9771834449277986,
1491
+ "learning_rate": 3.710280373831776e-05,
1492
+ "loss": 0.6732,
1493
+ "step": 2120
1494
+ },
1495
+ {
1496
+ "epoch": 0.6434073402809243,
1497
+ "grad_norm": 0.9295914583308844,
1498
+ "learning_rate": 3.6791277258566983e-05,
1499
+ "loss": 0.6173,
1500
+ "step": 2130
1501
+ },
1502
+ {
1503
+ "epoch": 0.6464280320193324,
1504
+ "grad_norm": 1.179909806414257,
1505
+ "learning_rate": 3.64797507788162e-05,
1506
+ "loss": 0.6193,
1507
+ "step": 2140
1508
+ },
1509
+ {
1510
+ "epoch": 0.6494487237577405,
1511
+ "grad_norm": 0.99878344996002,
1512
+ "learning_rate": 3.616822429906542e-05,
1513
+ "loss": 0.6116,
1514
+ "step": 2150
1515
+ },
1516
+ {
1517
+ "epoch": 0.6524694154961486,
1518
+ "grad_norm": 1.1005346639943379,
1519
+ "learning_rate": 3.5856697819314645e-05,
1520
+ "loss": 0.6794,
1521
+ "step": 2160
1522
+ },
1523
+ {
1524
+ "epoch": 0.6554901072345567,
1525
+ "grad_norm": 0.8754349383421103,
1526
+ "learning_rate": 3.554517133956387e-05,
1527
+ "loss": 0.627,
1528
+ "step": 2170
1529
+ },
1530
+ {
1531
+ "epoch": 0.6585107989729648,
1532
+ "grad_norm": 0.8266136534894406,
1533
+ "learning_rate": 3.523364485981308e-05,
1534
+ "loss": 0.5961,
1535
+ "step": 2180
1536
+ },
1537
+ {
1538
+ "epoch": 0.6615314907113728,
1539
+ "grad_norm": 1.0546584904026568,
1540
+ "learning_rate": 3.4922118380062306e-05,
1541
+ "loss": 0.6374,
1542
+ "step": 2190
1543
+ },
1544
+ {
1545
+ "epoch": 0.664552182449781,
1546
+ "grad_norm": 0.9197595680333482,
1547
+ "learning_rate": 3.461059190031153e-05,
1548
+ "loss": 0.6493,
1549
+ "step": 2200
1550
+ },
1551
+ {
1552
+ "epoch": 0.6675728741881891,
1553
+ "grad_norm": 0.8832736598142242,
1554
+ "learning_rate": 3.429906542056075e-05,
1555
+ "loss": 0.6243,
1556
+ "step": 2210
1557
+ },
1558
+ {
1559
+ "epoch": 0.6705935659265972,
1560
+ "grad_norm": 0.7953765164555499,
1561
+ "learning_rate": 3.3987538940809974e-05,
1562
+ "loss": 0.6413,
1563
+ "step": 2220
1564
+ },
1565
+ {
1566
+ "epoch": 0.6736142576650053,
1567
+ "grad_norm": 0.8616203793917606,
1568
+ "learning_rate": 3.367601246105919e-05,
1569
+ "loss": 0.6466,
1570
+ "step": 2230
1571
+ },
1572
+ {
1573
+ "epoch": 0.6766349494034134,
1574
+ "grad_norm": 0.9546691619897619,
1575
+ "learning_rate": 3.336448598130841e-05,
1576
+ "loss": 0.61,
1577
+ "step": 2240
1578
+ },
1579
+ {
1580
+ "epoch": 0.6796556411418215,
1581
+ "grad_norm": 0.9931567171367084,
1582
+ "learning_rate": 3.3052959501557635e-05,
1583
+ "loss": 0.6541,
1584
+ "step": 2250
1585
+ },
1586
+ {
1587
+ "epoch": 0.6826763328802296,
1588
+ "grad_norm": 0.910445823032414,
1589
+ "learning_rate": 3.274143302180686e-05,
1590
+ "loss": 0.6512,
1591
+ "step": 2260
1592
+ },
1593
+ {
1594
+ "epoch": 0.6856970246186377,
1595
+ "grad_norm": 0.9925620053257106,
1596
+ "learning_rate": 3.2429906542056074e-05,
1597
+ "loss": 0.6731,
1598
+ "step": 2270
1599
+ },
1600
+ {
1601
+ "epoch": 0.6887177163570458,
1602
+ "grad_norm": 0.9314964027183025,
1603
+ "learning_rate": 3.21183800623053e-05,
1604
+ "loss": 0.6349,
1605
+ "step": 2280
1606
+ },
1607
+ {
1608
+ "epoch": 0.6917384080954538,
1609
+ "grad_norm": 0.9924403199233388,
1610
+ "learning_rate": 3.180685358255452e-05,
1611
+ "loss": 0.6119,
1612
+ "step": 2290
1613
+ },
1614
+ {
1615
+ "epoch": 0.694759099833862,
1616
+ "grad_norm": 1.016617404918067,
1617
+ "learning_rate": 3.149532710280374e-05,
1618
+ "loss": 0.6364,
1619
+ "step": 2300
1620
+ },
1621
+ {
1622
+ "epoch": 0.6977797915722701,
1623
+ "grad_norm": 1.2100326550184481,
1624
+ "learning_rate": 3.118380062305296e-05,
1625
+ "loss": 0.6502,
1626
+ "step": 2310
1627
+ },
1628
+ {
1629
+ "epoch": 0.7008004833106781,
1630
+ "grad_norm": 0.8640417568500796,
1631
+ "learning_rate": 3.087227414330218e-05,
1632
+ "loss": 0.6129,
1633
+ "step": 2320
1634
+ },
1635
+ {
1636
+ "epoch": 0.7038211750490863,
1637
+ "grad_norm": 1.0875619618857508,
1638
+ "learning_rate": 3.05607476635514e-05,
1639
+ "loss": 0.6615,
1640
+ "step": 2330
1641
+ },
1642
+ {
1643
+ "epoch": 0.7068418667874944,
1644
+ "grad_norm": 0.8939128045261261,
1645
+ "learning_rate": 3.0249221183800626e-05,
1646
+ "loss": 0.6081,
1647
+ "step": 2340
1648
+ },
1649
+ {
1650
+ "epoch": 0.7098625585259024,
1651
+ "grad_norm": 0.8987589575526329,
1652
+ "learning_rate": 2.9937694704049845e-05,
1653
+ "loss": 0.6811,
1654
+ "step": 2350
1655
+ },
1656
+ {
1657
+ "epoch": 0.7128832502643105,
1658
+ "grad_norm": 0.9024007443688661,
1659
+ "learning_rate": 2.9626168224299068e-05,
1660
+ "loss": 0.6009,
1661
+ "step": 2360
1662
+ },
1663
+ {
1664
+ "epoch": 0.7159039420027187,
1665
+ "grad_norm": 0.963849254096249,
1666
+ "learning_rate": 2.9314641744548287e-05,
1667
+ "loss": 0.6509,
1668
+ "step": 2370
1669
+ },
1670
+ {
1671
+ "epoch": 0.7189246337411267,
1672
+ "grad_norm": 1.0800126230646785,
1673
+ "learning_rate": 2.900311526479751e-05,
1674
+ "loss": 0.6791,
1675
+ "step": 2380
1676
+ },
1677
+ {
1678
+ "epoch": 0.7219453254795348,
1679
+ "grad_norm": 0.8294159891121566,
1680
+ "learning_rate": 2.869158878504673e-05,
1681
+ "loss": 0.6334,
1682
+ "step": 2390
1683
+ },
1684
+ {
1685
+ "epoch": 0.724966017217943,
1686
+ "grad_norm": 1.0308203810536511,
1687
+ "learning_rate": 2.8380062305295952e-05,
1688
+ "loss": 0.627,
1689
+ "step": 2400
1690
+ },
1691
+ {
1692
+ "epoch": 0.727986708956351,
1693
+ "grad_norm": 0.9512924723408093,
1694
+ "learning_rate": 2.806853582554517e-05,
1695
+ "loss": 0.5754,
1696
+ "step": 2410
1697
+ },
1698
+ {
1699
+ "epoch": 0.7310074006947591,
1700
+ "grad_norm": 1.010781394411619,
1701
+ "learning_rate": 2.7757009345794394e-05,
1702
+ "loss": 0.6416,
1703
+ "step": 2420
1704
+ },
1705
+ {
1706
+ "epoch": 0.7340280924331672,
1707
+ "grad_norm": 1.0951399649684406,
1708
+ "learning_rate": 2.7445482866043613e-05,
1709
+ "loss": 0.6088,
1710
+ "step": 2430
1711
+ },
1712
+ {
1713
+ "epoch": 0.7370487841715753,
1714
+ "grad_norm": 1.0040444715395704,
1715
+ "learning_rate": 2.7133956386292836e-05,
1716
+ "loss": 0.6473,
1717
+ "step": 2440
1718
+ },
1719
+ {
1720
+ "epoch": 0.7400694759099834,
1721
+ "grad_norm": 0.9086640535011864,
1722
+ "learning_rate": 2.682242990654206e-05,
1723
+ "loss": 0.5991,
1724
+ "step": 2450
1725
+ },
1726
+ {
1727
+ "epoch": 0.7430901676483915,
1728
+ "grad_norm": 0.9979590888744413,
1729
+ "learning_rate": 2.6510903426791278e-05,
1730
+ "loss": 0.6554,
1731
+ "step": 2460
1732
+ },
1733
+ {
1734
+ "epoch": 0.7461108593867996,
1735
+ "grad_norm": 0.996844139395838,
1736
+ "learning_rate": 2.61993769470405e-05,
1737
+ "loss": 0.611,
1738
+ "step": 2470
1739
+ },
1740
+ {
1741
+ "epoch": 0.7491315511252077,
1742
+ "grad_norm": 1.0523632147482274,
1743
+ "learning_rate": 2.588785046728972e-05,
1744
+ "loss": 0.6327,
1745
+ "step": 2480
1746
+ },
1747
+ {
1748
+ "epoch": 0.7521522428636158,
1749
+ "grad_norm": 1.1077614436376035,
1750
+ "learning_rate": 2.5576323987538943e-05,
1751
+ "loss": 0.6846,
1752
+ "step": 2490
1753
+ },
1754
+ {
1755
+ "epoch": 0.7551729346020238,
1756
+ "grad_norm": 1.0062846906925333,
1757
+ "learning_rate": 2.5264797507788162e-05,
1758
+ "loss": 0.632,
1759
+ "step": 2500
1760
+ },
1761
+ {
1762
+ "epoch": 0.758193626340432,
1763
+ "grad_norm": 0.8044057354860985,
1764
+ "learning_rate": 2.4953271028037385e-05,
1765
+ "loss": 0.6423,
1766
+ "step": 2510
1767
+ },
1768
+ {
1769
+ "epoch": 0.7612143180788401,
1770
+ "grad_norm": 1.0776815216184104,
1771
+ "learning_rate": 2.4641744548286604e-05,
1772
+ "loss": 0.5959,
1773
+ "step": 2520
1774
+ },
1775
+ {
1776
+ "epoch": 0.7642350098172481,
1777
+ "grad_norm": 1.3229091185592443,
1778
+ "learning_rate": 2.4330218068535827e-05,
1779
+ "loss": 0.6308,
1780
+ "step": 2530
1781
+ },
1782
+ {
1783
+ "epoch": 0.7672557015556563,
1784
+ "grad_norm": 1.0134005011914144,
1785
+ "learning_rate": 2.4018691588785046e-05,
1786
+ "loss": 0.6082,
1787
+ "step": 2540
1788
+ },
1789
+ {
1790
+ "epoch": 0.7702763932940644,
1791
+ "grad_norm": 1.0710215536966488,
1792
+ "learning_rate": 2.370716510903427e-05,
1793
+ "loss": 0.5964,
1794
+ "step": 2550
1795
+ },
1796
+ {
1797
+ "epoch": 0.7732970850324724,
1798
+ "grad_norm": 1.0857761269794204,
1799
+ "learning_rate": 2.3395638629283488e-05,
1800
+ "loss": 0.5891,
1801
+ "step": 2560
1802
+ },
1803
+ {
1804
+ "epoch": 0.7763177767708805,
1805
+ "grad_norm": 0.9369701363776228,
1806
+ "learning_rate": 2.308411214953271e-05,
1807
+ "loss": 0.6104,
1808
+ "step": 2570
1809
+ },
1810
+ {
1811
+ "epoch": 0.7793384685092887,
1812
+ "grad_norm": 0.8529120199979476,
1813
+ "learning_rate": 2.2772585669781933e-05,
1814
+ "loss": 0.6451,
1815
+ "step": 2580
1816
+ },
1817
+ {
1818
+ "epoch": 0.7823591602476967,
1819
+ "grad_norm": 0.9061359038046752,
1820
+ "learning_rate": 2.2461059190031153e-05,
1821
+ "loss": 0.6287,
1822
+ "step": 2590
1823
+ },
1824
+ {
1825
+ "epoch": 0.7853798519861048,
1826
+ "grad_norm": 1.022842846924079,
1827
+ "learning_rate": 2.2149532710280375e-05,
1828
+ "loss": 0.6424,
1829
+ "step": 2600
1830
+ },
1831
+ {
1832
+ "epoch": 0.788400543724513,
1833
+ "grad_norm": 1.1644483297932762,
1834
+ "learning_rate": 2.1838006230529595e-05,
1835
+ "loss": 0.6165,
1836
+ "step": 2610
1837
+ },
1838
+ {
1839
+ "epoch": 0.791421235462921,
1840
+ "grad_norm": 0.901213276967422,
1841
+ "learning_rate": 2.1526479750778817e-05,
1842
+ "loss": 0.6631,
1843
+ "step": 2620
1844
+ },
1845
+ {
1846
+ "epoch": 0.7944419272013291,
1847
+ "grad_norm": 0.939968751090103,
1848
+ "learning_rate": 2.1214953271028037e-05,
1849
+ "loss": 0.6562,
1850
+ "step": 2630
1851
+ },
1852
+ {
1853
+ "epoch": 0.7974626189397372,
1854
+ "grad_norm": 0.9433346580971289,
1855
+ "learning_rate": 2.090342679127726e-05,
1856
+ "loss": 0.6181,
1857
+ "step": 2640
1858
+ },
1859
+ {
1860
+ "epoch": 0.8004833106781453,
1861
+ "grad_norm": 1.0194887755025552,
1862
+ "learning_rate": 2.059190031152648e-05,
1863
+ "loss": 0.6399,
1864
+ "step": 2650
1865
+ },
1866
+ {
1867
+ "epoch": 0.8035040024165534,
1868
+ "grad_norm": 1.1638844007159146,
1869
+ "learning_rate": 2.02803738317757e-05,
1870
+ "loss": 0.6491,
1871
+ "step": 2660
1872
+ },
1873
+ {
1874
+ "epoch": 0.8065246941549615,
1875
+ "grad_norm": 1.0276398667542848,
1876
+ "learning_rate": 1.996884735202492e-05,
1877
+ "loss": 0.6145,
1878
+ "step": 2670
1879
+ },
1880
+ {
1881
+ "epoch": 0.8095453858933696,
1882
+ "grad_norm": 0.8210616041641313,
1883
+ "learning_rate": 1.9657320872274143e-05,
1884
+ "loss": 0.6466,
1885
+ "step": 2680
1886
+ },
1887
+ {
1888
+ "epoch": 0.8125660776317777,
1889
+ "grad_norm": 1.093871978484254,
1890
+ "learning_rate": 1.9345794392523366e-05,
1891
+ "loss": 0.6194,
1892
+ "step": 2690
1893
+ },
1894
+ {
1895
+ "epoch": 0.8155867693701858,
1896
+ "grad_norm": 1.2620240032817829,
1897
+ "learning_rate": 1.9034267912772585e-05,
1898
+ "loss": 0.6183,
1899
+ "step": 2700
1900
+ },
1901
+ {
1902
+ "epoch": 0.8186074611085938,
1903
+ "grad_norm": 0.8779223909750274,
1904
+ "learning_rate": 1.8722741433021808e-05,
1905
+ "loss": 0.6586,
1906
+ "step": 2710
1907
+ },
1908
+ {
1909
+ "epoch": 0.821628152847002,
1910
+ "grad_norm": 0.7699492596332658,
1911
+ "learning_rate": 1.8411214953271027e-05,
1912
+ "loss": 0.5942,
1913
+ "step": 2720
1914
+ },
1915
+ {
1916
+ "epoch": 0.8246488445854101,
1917
+ "grad_norm": 1.1685873990863083,
1918
+ "learning_rate": 1.809968847352025e-05,
1919
+ "loss": 0.6443,
1920
+ "step": 2730
1921
+ },
1922
+ {
1923
+ "epoch": 0.8276695363238181,
1924
+ "grad_norm": 1.083337396850288,
1925
+ "learning_rate": 1.778816199376947e-05,
1926
+ "loss": 0.6482,
1927
+ "step": 2740
1928
+ },
1929
+ {
1930
+ "epoch": 0.8306902280622263,
1931
+ "grad_norm": 0.8063684272668464,
1932
+ "learning_rate": 1.7476635514018695e-05,
1933
+ "loss": 0.606,
1934
+ "step": 2750
1935
+ },
1936
+ {
1937
+ "epoch": 0.8337109198006344,
1938
+ "grad_norm": 0.824663714107508,
1939
+ "learning_rate": 1.7165109034267915e-05,
1940
+ "loss": 0.586,
1941
+ "step": 2760
1942
+ },
1943
+ {
1944
+ "epoch": 0.8367316115390424,
1945
+ "grad_norm": 0.9760183523742957,
1946
+ "learning_rate": 1.6853582554517137e-05,
1947
+ "loss": 0.5791,
1948
+ "step": 2770
1949
+ },
1950
+ {
1951
+ "epoch": 0.8397523032774505,
1952
+ "grad_norm": 1.0330407004022142,
1953
+ "learning_rate": 1.6542056074766357e-05,
1954
+ "loss": 0.6037,
1955
+ "step": 2780
1956
+ },
1957
+ {
1958
+ "epoch": 0.8427729950158587,
1959
+ "grad_norm": 0.9234529390674108,
1960
+ "learning_rate": 1.623052959501558e-05,
1961
+ "loss": 0.61,
1962
+ "step": 2790
1963
+ },
1964
+ {
1965
+ "epoch": 0.8457936867542667,
1966
+ "grad_norm": 1.0821057854566793,
1967
+ "learning_rate": 1.59190031152648e-05,
1968
+ "loss": 0.6463,
1969
+ "step": 2800
1970
+ },
1971
+ {
1972
+ "epoch": 0.8488143784926748,
1973
+ "grad_norm": 1.0890558497862515,
1974
+ "learning_rate": 1.560747663551402e-05,
1975
+ "loss": 0.6438,
1976
+ "step": 2810
1977
+ },
1978
+ {
1979
+ "epoch": 0.851835070231083,
1980
+ "grad_norm": 0.7374750576790412,
1981
+ "learning_rate": 1.529595015576324e-05,
1982
+ "loss": 0.6205,
1983
+ "step": 2820
1984
+ },
1985
+ {
1986
+ "epoch": 0.854855761969491,
1987
+ "grad_norm": 0.8883192786185565,
1988
+ "learning_rate": 1.4984423676012463e-05,
1989
+ "loss": 0.6249,
1990
+ "step": 2830
1991
+ },
1992
+ {
1993
+ "epoch": 0.8578764537078991,
1994
+ "grad_norm": 1.1008000896235184,
1995
+ "learning_rate": 1.4672897196261684e-05,
1996
+ "loss": 0.5964,
1997
+ "step": 2840
1998
+ },
1999
+ {
2000
+ "epoch": 0.8608971454463072,
2001
+ "grad_norm": 0.9588924680911977,
2002
+ "learning_rate": 1.4361370716510905e-05,
2003
+ "loss": 0.6246,
2004
+ "step": 2850
2005
+ },
2006
+ {
2007
+ "epoch": 0.8639178371847153,
2008
+ "grad_norm": 1.224312320705181,
2009
+ "learning_rate": 1.4049844236760126e-05,
2010
+ "loss": 0.6571,
2011
+ "step": 2860
2012
+ },
2013
+ {
2014
+ "epoch": 0.8669385289231234,
2015
+ "grad_norm": 0.9905124714238223,
2016
+ "learning_rate": 1.3738317757009347e-05,
2017
+ "loss": 0.6687,
2018
+ "step": 2870
2019
+ },
2020
+ {
2021
+ "epoch": 0.8699592206615315,
2022
+ "grad_norm": 0.8353778159477359,
2023
+ "learning_rate": 1.3426791277258568e-05,
2024
+ "loss": 0.6,
2025
+ "step": 2880
2026
+ },
2027
+ {
2028
+ "epoch": 0.8729799123999396,
2029
+ "grad_norm": 0.905312921332729,
2030
+ "learning_rate": 1.311526479750779e-05,
2031
+ "loss": 0.606,
2032
+ "step": 2890
2033
+ },
2034
+ {
2035
+ "epoch": 0.8760006041383477,
2036
+ "grad_norm": 0.8649231871193698,
2037
+ "learning_rate": 1.280373831775701e-05,
2038
+ "loss": 0.5743,
2039
+ "step": 2900
2040
+ },
2041
+ {
2042
+ "epoch": 0.8790212958767558,
2043
+ "grad_norm": 1.0254699594493124,
2044
+ "learning_rate": 1.2492211838006231e-05,
2045
+ "loss": 0.6204,
2046
+ "step": 2910
2047
+ },
2048
+ {
2049
+ "epoch": 0.8820419876151638,
2050
+ "grad_norm": 1.0278406308415082,
2051
+ "learning_rate": 1.2180685358255452e-05,
2052
+ "loss": 0.5853,
2053
+ "step": 2920
2054
+ },
2055
+ {
2056
+ "epoch": 0.885062679353572,
2057
+ "grad_norm": 0.9990676256188065,
2058
+ "learning_rate": 1.1869158878504673e-05,
2059
+ "loss": 0.6224,
2060
+ "step": 2930
2061
+ },
2062
+ {
2063
+ "epoch": 0.8880833710919801,
2064
+ "grad_norm": 1.0949270827311683,
2065
+ "learning_rate": 1.1557632398753894e-05,
2066
+ "loss": 0.6125,
2067
+ "step": 2940
2068
+ },
2069
+ {
2070
+ "epoch": 0.8911040628303881,
2071
+ "grad_norm": 1.2006202540115667,
2072
+ "learning_rate": 1.1246105919003117e-05,
2073
+ "loss": 0.6392,
2074
+ "step": 2950
2075
+ },
2076
+ {
2077
+ "epoch": 0.8941247545687963,
2078
+ "grad_norm": 1.1187121516645784,
2079
+ "learning_rate": 1.0934579439252338e-05,
2080
+ "loss": 0.6357,
2081
+ "step": 2960
2082
+ },
2083
+ {
2084
+ "epoch": 0.8971454463072044,
2085
+ "grad_norm": 0.8638598049799623,
2086
+ "learning_rate": 1.0623052959501559e-05,
2087
+ "loss": 0.5989,
2088
+ "step": 2970
2089
+ },
2090
+ {
2091
+ "epoch": 0.9001661380456124,
2092
+ "grad_norm": 0.9297895550418135,
2093
+ "learning_rate": 1.031152647975078e-05,
2094
+ "loss": 0.6528,
2095
+ "step": 2980
2096
+ },
2097
+ {
2098
+ "epoch": 0.9031868297840205,
2099
+ "grad_norm": 0.9615985258637098,
2100
+ "learning_rate": 1e-05,
2101
+ "loss": 0.6123,
2102
+ "step": 2990
2103
+ },
2104
+ {
2105
+ "epoch": 0.9062075215224287,
2106
+ "grad_norm": 0.8309736923021925,
2107
+ "learning_rate": 9.688473520249222e-06,
2108
+ "loss": 0.6459,
2109
+ "step": 3000
2110
+ },
2111
+ {
2112
+ "epoch": 0.9092282132608367,
2113
+ "grad_norm": 0.9815142795709194,
2114
+ "learning_rate": 9.376947040498443e-06,
2115
+ "loss": 0.571,
2116
+ "step": 3010
2117
+ },
2118
+ {
2119
+ "epoch": 0.9122489049992448,
2120
+ "grad_norm": 0.8008160564268554,
2121
+ "learning_rate": 9.065420560747664e-06,
2122
+ "loss": 0.6037,
2123
+ "step": 3020
2124
+ },
2125
+ {
2126
+ "epoch": 0.915269596737653,
2127
+ "grad_norm": 1.0819593992572683,
2128
+ "learning_rate": 8.753894080996885e-06,
2129
+ "loss": 0.5869,
2130
+ "step": 3030
2131
+ },
2132
+ {
2133
+ "epoch": 0.918290288476061,
2134
+ "grad_norm": 0.8665948995270025,
2135
+ "learning_rate": 8.442367601246107e-06,
2136
+ "loss": 0.611,
2137
+ "step": 3040
2138
+ },
2139
+ {
2140
+ "epoch": 0.9213109802144691,
2141
+ "grad_norm": 0.8583950697207722,
2142
+ "learning_rate": 8.130841121495328e-06,
2143
+ "loss": 0.579,
2144
+ "step": 3050
2145
+ },
2146
+ {
2147
+ "epoch": 0.9243316719528772,
2148
+ "grad_norm": 0.921012636719109,
2149
+ "learning_rate": 7.81931464174455e-06,
2150
+ "loss": 0.6101,
2151
+ "step": 3060
2152
+ },
2153
+ {
2154
+ "epoch": 0.9273523636912853,
2155
+ "grad_norm": 0.8604105683200605,
2156
+ "learning_rate": 7.5077881619937705e-06,
2157
+ "loss": 0.585,
2158
+ "step": 3070
2159
+ },
2160
+ {
2161
+ "epoch": 0.9303730554296934,
2162
+ "grad_norm": 0.9924409498073824,
2163
+ "learning_rate": 7.1962616822429915e-06,
2164
+ "loss": 0.5966,
2165
+ "step": 3080
2166
+ },
2167
+ {
2168
+ "epoch": 0.9333937471681015,
2169
+ "grad_norm": 0.8554914123213949,
2170
+ "learning_rate": 6.8847352024922125e-06,
2171
+ "loss": 0.6001,
2172
+ "step": 3090
2173
+ },
2174
+ {
2175
+ "epoch": 0.9364144389065095,
2176
+ "grad_norm": 1.0189344509024982,
2177
+ "learning_rate": 6.5732087227414335e-06,
2178
+ "loss": 0.6072,
2179
+ "step": 3100
2180
+ },
2181
+ {
2182
+ "epoch": 0.9394351306449177,
2183
+ "grad_norm": 0.7551552875967538,
2184
+ "learning_rate": 6.2616822429906544e-06,
2185
+ "loss": 0.6195,
2186
+ "step": 3110
2187
+ },
2188
+ {
2189
+ "epoch": 0.9424558223833258,
2190
+ "grad_norm": 0.7876647280151428,
2191
+ "learning_rate": 5.9501557632398754e-06,
2192
+ "loss": 0.5982,
2193
+ "step": 3120
2194
+ },
2195
+ {
2196
+ "epoch": 0.9454765141217338,
2197
+ "grad_norm": 1.0198335362611242,
2198
+ "learning_rate": 5.638629283489097e-06,
2199
+ "loss": 0.6261,
2200
+ "step": 3130
2201
+ },
2202
+ {
2203
+ "epoch": 0.948497205860142,
2204
+ "grad_norm": 1.0604464411076657,
2205
+ "learning_rate": 5.327102803738318e-06,
2206
+ "loss": 0.6302,
2207
+ "step": 3140
2208
+ },
2209
+ {
2210
+ "epoch": 0.9515178975985501,
2211
+ "grad_norm": 0.951744438195523,
2212
+ "learning_rate": 5.015576323987539e-06,
2213
+ "loss": 0.6093,
2214
+ "step": 3150
2215
+ },
2216
+ {
2217
+ "epoch": 0.9545385893369581,
2218
+ "grad_norm": 0.8133396952083934,
2219
+ "learning_rate": 4.70404984423676e-06,
2220
+ "loss": 0.5976,
2221
+ "step": 3160
2222
+ },
2223
+ {
2224
+ "epoch": 0.9575592810753663,
2225
+ "grad_norm": 0.9048179249325315,
2226
+ "learning_rate": 4.392523364485981e-06,
2227
+ "loss": 0.5917,
2228
+ "step": 3170
2229
+ },
2230
+ {
2231
+ "epoch": 0.9605799728137744,
2232
+ "grad_norm": 0.9211845494853066,
2233
+ "learning_rate": 4.080996884735202e-06,
2234
+ "loss": 0.6598,
2235
+ "step": 3180
2236
+ },
2237
+ {
2238
+ "epoch": 0.9636006645521824,
2239
+ "grad_norm": 1.1245992131314346,
2240
+ "learning_rate": 3.7694704049844237e-06,
2241
+ "loss": 0.6366,
2242
+ "step": 3190
2243
+ },
2244
+ {
2245
+ "epoch": 0.9666213562905905,
2246
+ "grad_norm": 0.8622643092177033,
2247
+ "learning_rate": 3.4579439252336447e-06,
2248
+ "loss": 0.6032,
2249
+ "step": 3200
2250
+ },
2251
+ {
2252
+ "epoch": 0.9696420480289987,
2253
+ "grad_norm": 0.9757245422407422,
2254
+ "learning_rate": 3.146417445482866e-06,
2255
+ "loss": 0.6109,
2256
+ "step": 3210
2257
+ },
2258
+ {
2259
+ "epoch": 0.9726627397674067,
2260
+ "grad_norm": 0.9177066421934855,
2261
+ "learning_rate": 2.8348909657320875e-06,
2262
+ "loss": 0.5852,
2263
+ "step": 3220
2264
+ },
2265
+ {
2266
+ "epoch": 0.9756834315058148,
2267
+ "grad_norm": 1.0589749886784343,
2268
+ "learning_rate": 2.5233644859813085e-06,
2269
+ "loss": 0.6162,
2270
+ "step": 3230
2271
+ },
2272
+ {
2273
+ "epoch": 0.978704123244223,
2274
+ "grad_norm": 0.8439326188110577,
2275
+ "learning_rate": 2.21183800623053e-06,
2276
+ "loss": 0.5679,
2277
+ "step": 3240
2278
+ },
2279
+ {
2280
+ "epoch": 0.981724814982631,
2281
+ "grad_norm": 0.8843365815693212,
2282
+ "learning_rate": 1.900311526479751e-06,
2283
+ "loss": 0.5856,
2284
+ "step": 3250
2285
+ },
2286
+ {
2287
+ "epoch": 0.9847455067210391,
2288
+ "grad_norm": 0.91811081864421,
2289
+ "learning_rate": 1.588785046728972e-06,
2290
+ "loss": 0.5229,
2291
+ "step": 3260
2292
+ },
2293
+ {
2294
+ "epoch": 0.9877661984594472,
2295
+ "grad_norm": 0.8575199450142503,
2296
+ "learning_rate": 1.2772585669781931e-06,
2297
+ "loss": 0.6195,
2298
+ "step": 3270
2299
+ },
2300
+ {
2301
+ "epoch": 0.9907868901978553,
2302
+ "grad_norm": 0.9360300893347252,
2303
+ "learning_rate": 9.657320872274145e-07,
2304
+ "loss": 0.6176,
2305
+ "step": 3280
2306
+ },
2307
+ {
2308
+ "epoch": 0.9938075819362634,
2309
+ "grad_norm": 0.9000581153467687,
2310
+ "learning_rate": 6.542056074766356e-07,
2311
+ "loss": 0.5858,
2312
+ "step": 3290
2313
+ },
2314
+ {
2315
+ "epoch": 0.9968282736746715,
2316
+ "grad_norm": 0.9999683040058044,
2317
+ "learning_rate": 3.4267912772585674e-07,
2318
+ "loss": 0.5731,
2319
+ "step": 3300
2320
+ },
2321
+ {
2322
+ "epoch": 0.9998489654130795,
2323
+ "grad_norm": 0.9739409873164033,
2324
+ "learning_rate": 3.1152647975077883e-08,
2325
+ "loss": 0.6497,
2326
+ "step": 3310
2327
+ }
2328
+ ],
2329
+ "logging_steps": 10,
2330
+ "max_steps": 3310,
2331
+ "num_input_tokens_seen": 0,
2332
+ "num_train_epochs": 1,
2333
+ "save_steps": 100,
2334
+ "stateful_callbacks": {
2335
+ "TrainerControl": {
2336
+ "args": {
2337
+ "should_epoch_stop": false,
2338
+ "should_evaluate": false,
2339
+ "should_log": false,
2340
+ "should_save": true,
2341
+ "should_training_stop": true
2342
+ },
2343
+ "attributes": {}
2344
+ }
2345
+ },
2346
+ "total_flos": 0.0,
2347
+ "train_batch_size": 32,
2348
+ "trial_name": null,
2349
+ "trial_params": null
2350
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c7eb5e6738373140f9ceaea10b91147f6aead460fed27c539494474ad32d8c3f
3
+ size 7683
zero_to_fp32.py ADDED
@@ -0,0 +1,760 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example:
14
+ # python zero_to_fp32.py . output_dir/
15
+ # or
16
+ # python zero_to_fp32.py . output_dir/ --safe_serialization
17
+
18
+ import argparse
19
+ import torch
20
+ import glob
21
+ import math
22
+ import os
23
+ import re
24
+ import gc
25
+ import json
26
+ import numpy as np
27
+ from tqdm import tqdm
28
+ from collections import OrderedDict
29
+ from dataclasses import dataclass
30
+
31
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
32
+ # DeepSpeed data structures it has to be available in the current python environment.
33
+ from deepspeed.utils import logger
34
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
35
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
36
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
37
+
38
+
39
+ @dataclass
40
+ class zero_model_state:
41
+ buffers: dict()
42
+ param_shapes: dict()
43
+ shared_params: list
44
+ ds_version: int
45
+ frozen_param_shapes: dict()
46
+ frozen_param_fragments: dict()
47
+
48
+
49
+ debug = 0
50
+
51
+ # load to cpu
52
+ device = torch.device('cpu')
53
+
54
+
55
+ def atoi(text):
56
+ return int(text) if text.isdigit() else text
57
+
58
+
59
+ def natural_keys(text):
60
+ '''
61
+ alist.sort(key=natural_keys) sorts in human order
62
+ http://nedbatchelder.com/blog/200712/human_sorting.html
63
+ (See Toothy's implementation in the comments)
64
+ '''
65
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
66
+
67
+
68
+ def get_model_state_file(checkpoint_dir, zero_stage):
69
+ if not os.path.isdir(checkpoint_dir):
70
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
71
+
72
+ # there should be only one file
73
+ if zero_stage <= 2:
74
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
75
+ elif zero_stage == 3:
76
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
77
+
78
+ if not os.path.exists(file):
79
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
80
+
81
+ return file
82
+
83
+
84
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
85
+ # XXX: need to test that this simple glob rule works for multi-node setup too
86
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
87
+
88
+ if len(ckpt_files) == 0:
89
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
90
+
91
+ return ckpt_files
92
+
93
+
94
+ def get_optim_files(checkpoint_dir):
95
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
96
+
97
+
98
+ def get_model_state_files(checkpoint_dir):
99
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
100
+
101
+
102
+ def parse_model_states(files):
103
+ zero_model_states = []
104
+ for file in files:
105
+ state_dict = torch.load(file, map_location=device, weights_only=False)
106
+
107
+ if BUFFER_NAMES not in state_dict:
108
+ raise ValueError(f"{file} is not a model state checkpoint")
109
+ buffer_names = state_dict[BUFFER_NAMES]
110
+ if debug:
111
+ print("Found buffers:", buffer_names)
112
+
113
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
114
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
115
+ param_shapes = state_dict[PARAM_SHAPES]
116
+
117
+ # collect parameters that are included in param_shapes
118
+ param_names = []
119
+ for s in param_shapes:
120
+ for name in s.keys():
121
+ param_names.append(name)
122
+
123
+ # update with frozen parameters
124
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
125
+ if frozen_param_shapes is not None:
126
+ if debug:
127
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
128
+ param_names += list(frozen_param_shapes.keys())
129
+
130
+ # handle shared params
131
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
132
+
133
+ ds_version = state_dict.get(DS_VERSION, None)
134
+
135
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
136
+
137
+ z_model_state = zero_model_state(buffers=buffers,
138
+ param_shapes=param_shapes,
139
+ shared_params=shared_params,
140
+ ds_version=ds_version,
141
+ frozen_param_shapes=frozen_param_shapes,
142
+ frozen_param_fragments=frozen_param_fragments)
143
+ zero_model_states.append(z_model_state)
144
+
145
+ return zero_model_states
146
+
147
+
148
+ def parse_optim_states(files, ds_checkpoint_dir):
149
+ total_files = len(files)
150
+ state_dicts = []
151
+ for f in tqdm(files, desc='Loading checkpoint shards'):
152
+ state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
153
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
154
+ # and also handle the case where it was already removed by another helper script
155
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
156
+ state_dicts.append(state_dict)
157
+
158
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
159
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
160
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
161
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
162
+
163
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
164
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
165
+ # use the max of the partition_count to get the dp world_size.
166
+
167
+ if type(world_size) is list:
168
+ world_size = max(world_size)
169
+
170
+ if world_size != total_files:
171
+ raise ValueError(
172
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
173
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
174
+ )
175
+
176
+ # the groups are named differently in each stage
177
+ if zero_stage <= 2:
178
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
179
+ elif zero_stage == 3:
180
+ fp32_groups_key = FP32_FLAT_GROUPS
181
+ else:
182
+ raise ValueError(f"unknown zero stage {zero_stage}")
183
+
184
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
185
+ return zero_stage, world_size, fp32_flat_groups
186
+
187
+
188
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
189
+ """
190
+ Returns fp32 state_dict reconstructed from ds checkpoint
191
+
192
+ Args:
193
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
194
+
195
+ """
196
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
197
+
198
+ optim_files = get_optim_files(ds_checkpoint_dir)
199
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
200
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
201
+
202
+ model_files = get_model_state_files(ds_checkpoint_dir)
203
+
204
+ zero_model_states = parse_model_states(model_files)
205
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
206
+
207
+ if zero_stage <= 2:
208
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
209
+ exclude_frozen_parameters)
210
+ elif zero_stage == 3:
211
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
212
+ exclude_frozen_parameters)
213
+
214
+
215
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
216
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
217
+ return
218
+
219
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
220
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
221
+
222
+ if debug:
223
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
224
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
225
+
226
+ wanted_params = len(frozen_param_shapes)
227
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
228
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
229
+ print(f'Frozen params: Have {avail_numel} numels to process.')
230
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
231
+
232
+ total_params = 0
233
+ total_numel = 0
234
+ for name, shape in frozen_param_shapes.items():
235
+ total_params += 1
236
+ unpartitioned_numel = shape.numel()
237
+ total_numel += unpartitioned_numel
238
+
239
+ state_dict[name] = frozen_param_fragments[name]
240
+
241
+ if debug:
242
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
243
+
244
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
245
+
246
+
247
+ def _has_callable(obj, fn):
248
+ attr = getattr(obj, fn, None)
249
+ return callable(attr)
250
+
251
+
252
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
253
+ param_shapes = zero_model_states[0].param_shapes
254
+
255
+ # Reconstruction protocol:
256
+ #
257
+ # XXX: document this
258
+
259
+ if debug:
260
+ for i in range(world_size):
261
+ for j in range(len(fp32_flat_groups[0])):
262
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
263
+
264
+ # XXX: memory usage doubles here (zero2)
265
+ num_param_groups = len(fp32_flat_groups[0])
266
+ merged_single_partition_of_fp32_groups = []
267
+ for i in range(num_param_groups):
268
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
269
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
270
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
271
+ avail_numel = sum(
272
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
273
+
274
+ if debug:
275
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
276
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
277
+ # not asserting if there is a mismatch due to possible padding
278
+ print(f"Have {avail_numel} numels to process.")
279
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
280
+
281
+ # params
282
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
283
+ # out-of-core computing solution
284
+ total_numel = 0
285
+ total_params = 0
286
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
287
+ offset = 0
288
+ avail_numel = full_single_fp32_vector.numel()
289
+ for name, shape in shapes.items():
290
+
291
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
292
+ total_numel += unpartitioned_numel
293
+ total_params += 1
294
+
295
+ if debug:
296
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
297
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
298
+ offset += unpartitioned_numel
299
+
300
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
301
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
302
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
303
+ # live optimizer object, so we are checking that the numbers are within the right range
304
+ align_to = 2 * world_size
305
+
306
+ def zero2_align(x):
307
+ return align_to * math.ceil(x / align_to)
308
+
309
+ if debug:
310
+ print(f"original offset={offset}, avail_numel={avail_numel}")
311
+
312
+ offset = zero2_align(offset)
313
+ avail_numel = zero2_align(avail_numel)
314
+
315
+ if debug:
316
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
317
+
318
+ # Sanity check
319
+ if offset != avail_numel:
320
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
321
+
322
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
323
+
324
+
325
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
326
+ exclude_frozen_parameters):
327
+ state_dict = OrderedDict()
328
+
329
+ # buffers
330
+ buffers = zero_model_states[0].buffers
331
+ state_dict.update(buffers)
332
+ if debug:
333
+ print(f"added {len(buffers)} buffers")
334
+
335
+ if not exclude_frozen_parameters:
336
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
337
+
338
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
339
+
340
+ # recover shared parameters
341
+ for pair in zero_model_states[0].shared_params:
342
+ if pair[1] in state_dict:
343
+ state_dict[pair[0]] = state_dict[pair[1]]
344
+
345
+ return state_dict
346
+
347
+
348
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
349
+ remainder = unpartitioned_numel % world_size
350
+ padding_numel = (world_size - remainder) if remainder else 0
351
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
352
+ return partitioned_numel, padding_numel
353
+
354
+
355
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
356
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
357
+ return
358
+
359
+ if debug:
360
+ for i in range(world_size):
361
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
362
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
363
+
364
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
365
+ wanted_params = len(frozen_param_shapes)
366
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
367
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
368
+ print(f'Frozen params: Have {avail_numel} numels to process.')
369
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
370
+
371
+ total_params = 0
372
+ total_numel = 0
373
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
374
+ total_params += 1
375
+ unpartitioned_numel = shape.numel()
376
+ total_numel += unpartitioned_numel
377
+
378
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
379
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
380
+
381
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
382
+
383
+ if debug:
384
+ print(
385
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
386
+ )
387
+
388
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
389
+
390
+
391
+ class GatheredTensor:
392
+ """
393
+ A pseudo tensor that collects partitioned weights.
394
+ It is more memory efficient when there are multiple groups.
395
+ """
396
+
397
+ def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
398
+ self.flat_groups = flat_groups
399
+ self.flat_groups_offset = flat_groups_offset
400
+ self.offset = offset
401
+ self.partitioned_numel = partitioned_numel
402
+ self.shape = shape
403
+ self.dtype = self.flat_groups[0][0].dtype
404
+
405
+ def contiguous(self):
406
+ """
407
+ Merge partitioned weights from flat_groups into a single tensor.
408
+ """
409
+ end_idx = self.offset + self.partitioned_numel
410
+ world_size = len(self.flat_groups)
411
+ pad_flat_param_chunks = []
412
+
413
+ for rank_i in range(world_size):
414
+ # for each rank, we need to collect weights from related group/groups
415
+ flat_groups_at_rank_i = self.flat_groups[rank_i]
416
+ start_group_id = None
417
+ end_group_id = None
418
+ for group_id in range(len(self.flat_groups_offset)):
419
+ if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
420
+ start_group_id = group_id
421
+ if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
422
+ end_group_id = group_id
423
+ break
424
+ # collect weights from related group/groups
425
+ for group_id in range(start_group_id, end_group_id + 1):
426
+ flat_tensor = flat_groups_at_rank_i[group_id]
427
+ start_offset = self.offset - self.flat_groups_offset[group_id]
428
+ end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
429
+ pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
430
+
431
+ # collect weights from all ranks
432
+ pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
433
+ param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
434
+ return param
435
+
436
+
437
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
438
+ param_shapes = zero_model_states[0].param_shapes
439
+ avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
440
+
441
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
442
+ # param, re-consolidating each param, while dealing with padding if any
443
+
444
+ # merge list of dicts, preserving order
445
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
446
+
447
+ if debug:
448
+ for i in range(world_size):
449
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
450
+
451
+ wanted_params = len(param_shapes)
452
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
453
+ # not asserting if there is a mismatch due to possible padding
454
+ avail_numel = fp32_flat_groups[0].numel() * world_size
455
+ print(f"Trainable params: Have {avail_numel} numels to process.")
456
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
457
+
458
+ # params
459
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
460
+ # out-of-core computing solution
461
+ offset = 0
462
+ total_numel = 0
463
+ total_params = 0
464
+ flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
465
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
466
+ unpartitioned_numel = shape.numel()
467
+ total_numel += unpartitioned_numel
468
+ total_params += 1
469
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
470
+
471
+ if debug:
472
+ print(
473
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
474
+ )
475
+
476
+ # memory efficient tensor
477
+ tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
478
+ state_dict[name] = tensor
479
+ offset += partitioned_numel
480
+
481
+ offset *= world_size
482
+
483
+ # Sanity check
484
+ if offset != avail_numel:
485
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
486
+
487
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
488
+
489
+
490
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
491
+ exclude_frozen_parameters):
492
+ state_dict = OrderedDict()
493
+
494
+ # buffers
495
+ buffers = zero_model_states[0].buffers
496
+ state_dict.update(buffers)
497
+ if debug:
498
+ print(f"added {len(buffers)} buffers")
499
+
500
+ if not exclude_frozen_parameters:
501
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
502
+
503
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
504
+
505
+ # recover shared parameters
506
+ for pair in zero_model_states[0].shared_params:
507
+ if pair[1] in state_dict:
508
+ state_dict[pair[0]] = state_dict[pair[1]]
509
+
510
+ return state_dict
511
+
512
+
513
+ def to_torch_tensor(state_dict, return_empty_tensor=False):
514
+ """
515
+ Convert state_dict of GatheredTensor to torch tensor
516
+ """
517
+ torch_state_dict = {}
518
+ converted_tensors = {}
519
+ for name, tensor in state_dict.items():
520
+ tensor_id = id(tensor)
521
+ if tensor_id in converted_tensors: # shared tensors
522
+ shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
523
+ torch_state_dict[name] = shared_tensor
524
+ else:
525
+ converted_tensors[tensor_id] = name
526
+ if return_empty_tensor:
527
+ torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
528
+ else:
529
+ torch_state_dict[name] = tensor.contiguous()
530
+ return torch_state_dict
531
+
532
+
533
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
534
+ tag=None,
535
+ exclude_frozen_parameters=False,
536
+ lazy_mode=False):
537
+ """
538
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
539
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
540
+ via a model hub.
541
+
542
+ Args:
543
+ - ``checkpoint_dir``: path to the desired checkpoint folder
544
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
545
+ - ``exclude_frozen_parameters``: exclude frozen parameters
546
+ - ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
547
+ Convert the pesduo tensor to torch tensor by ``.contiguous()``
548
+
549
+ Returns:
550
+ - pytorch ``state_dict``
551
+
552
+ A typical usage might be ::
553
+
554
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
555
+ # do the training and checkpoint saving
556
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
557
+ model = model.cpu() # move to cpu
558
+ model.load_state_dict(state_dict)
559
+ # submit to model hub or save the model to share with others
560
+
561
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
562
+ application. i.e. you will need to re-initialize the deepspeed engine, since
563
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
564
+
565
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
566
+
567
+ Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
568
+ You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
569
+ the checkpoint. Or you can load state_dict in lazy mode ::
570
+
571
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
572
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
573
+ for name, lazy_tensor in state_dict.item():
574
+ tensor = lazy_tensor.contiguous() # to cpu
575
+ print(name, tensor)
576
+ # del tensor to release memory if it no longer in use
577
+ """
578
+ if tag is None:
579
+ latest_path = os.path.join(checkpoint_dir, 'latest')
580
+ if os.path.isfile(latest_path):
581
+ with open(latest_path, 'r') as fd:
582
+ tag = fd.read().strip()
583
+ else:
584
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
585
+
586
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
587
+
588
+ if not os.path.isdir(ds_checkpoint_dir):
589
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
590
+
591
+ state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
592
+ if lazy_mode:
593
+ return state_dict
594
+ else:
595
+ return to_torch_tensor(state_dict)
596
+
597
+
598
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
599
+ output_dir,
600
+ max_shard_size="5GB",
601
+ safe_serialization=False,
602
+ tag=None,
603
+ exclude_frozen_parameters=False):
604
+ """
605
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
606
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
607
+
608
+ Args:
609
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
610
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
611
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
612
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
613
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
614
+ - ``exclude_frozen_parameters``: exclude frozen parameters
615
+ """
616
+
617
+ # Dependency pre-check
618
+ if safe_serialization:
619
+ try:
620
+ from safetensors.torch import save_file
621
+ except ImportError:
622
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
623
+ raise
624
+ if max_shard_size is not None:
625
+ try:
626
+ from huggingface_hub import split_torch_state_dict_into_shards
627
+ except ImportError:
628
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
629
+ raise
630
+
631
+ # Convert zero checkpoint to state_dict
632
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
633
+ tag,
634
+ exclude_frozen_parameters,
635
+ lazy_mode=True)
636
+
637
+ # Shard the model if it is too big.
638
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
639
+ if max_shard_size is not None:
640
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
641
+ # an memory-efficient approach for sharding
642
+ empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
643
+ state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
644
+ filename_pattern=filename_pattern,
645
+ max_shard_size=max_shard_size)
646
+ else:
647
+ from collections import namedtuple
648
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
649
+ state_dict_split = StateDictSplit(is_sharded=False,
650
+ filename_to_tensors={weights_name: list(state_dict.keys())})
651
+
652
+ # Save the model by shard
653
+ os.makedirs(output_dir, exist_ok=True)
654
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
655
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
656
+ shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
657
+ shard_state_dict = to_torch_tensor(shard_state_dict)
658
+ output_path = os.path.join(output_dir, shard_file)
659
+ if safe_serialization:
660
+ save_file(shard_state_dict, output_path, metadata={"format": "pt"})
661
+ else:
662
+ torch.save(shard_state_dict, output_path)
663
+ # release the memory of current shard
664
+ for tensor_name in list(shard_state_dict.keys()):
665
+ del state_dict[tensor_name]
666
+ del shard_state_dict[tensor_name]
667
+ del shard_state_dict
668
+ gc.collect()
669
+
670
+ # Save index if sharded
671
+ if state_dict_split.is_sharded:
672
+ index = {
673
+ "metadata": state_dict_split.metadata,
674
+ "weight_map": state_dict_split.tensor_to_filename,
675
+ }
676
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
677
+ save_index_file = os.path.join(output_dir, save_index_file)
678
+ with open(save_index_file, "w", encoding="utf-8") as f:
679
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
680
+ f.write(content)
681
+
682
+
683
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
684
+ """
685
+ 1. Put the provided model to cpu
686
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
687
+ 3. Load it into the provided model
688
+
689
+ Args:
690
+ - ``model``: the model object to update
691
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
692
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
693
+
694
+ Returns:
695
+ - ``model`: modified model
696
+
697
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
698
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
699
+ conveniently placed for you in the checkpoint folder.
700
+
701
+ A typical usage might be ::
702
+
703
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
704
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
705
+ # submit to model hub or save the model to share with others
706
+
707
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
708
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
709
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
710
+
711
+ """
712
+ logger.info(f"Extracting fp32 weights")
713
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
714
+
715
+ logger.info(f"Overwriting model with fp32 weights")
716
+ model = model.cpu()
717
+ model.load_state_dict(state_dict, strict=False)
718
+
719
+ return model
720
+
721
+
722
+ if __name__ == "__main__":
723
+ parser = argparse.ArgumentParser()
724
+ parser.add_argument("checkpoint_dir",
725
+ type=str,
726
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
727
+ parser.add_argument("output_dir",
728
+ type=str,
729
+ help="directory to the pytorch fp32 state_dict output files"
730
+ "(e.g. path/checkpoint-12-output/)")
731
+ parser.add_argument(
732
+ "--max_shard_size",
733
+ type=str,
734
+ default="5GB",
735
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
736
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
737
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
738
+ "without CPU OOM issues.")
739
+ parser.add_argument(
740
+ "--safe_serialization",
741
+ default=False,
742
+ action='store_true',
743
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
744
+ parser.add_argument("-t",
745
+ "--tag",
746
+ type=str,
747
+ default=None,
748
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
749
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
750
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
751
+ args = parser.parse_args()
752
+
753
+ debug = args.debug
754
+
755
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
756
+ args.output_dir,
757
+ max_shard_size=args.max_shard_size,
758
+ safe_serialization=args.safe_serialization,
759
+ tag=args.tag,
760
+ exclude_frozen_parameters=args.exclude_frozen_parameters)