loopback-kr commited on
Commit
28b4cf2
·
verified ·
1 Parent(s): d113e3a

Upload folder using huggingface_hub

Browse files
checkpoint-17182/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: /workspace/previous_works/M3D/LaMed/pretrained_model/Llama-3.1-8B-Instruct
3
+ library_name: peft
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.14.0
checkpoint-17182/adapter_config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "/workspace/previous_works/M3D/LaMed/pretrained_model/Llama-3.1-8B-Instruct",
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": 32,
16
+ "lora_bias": false,
17
+ "lora_dropout": 0.05,
18
+ "megatron_config": null,
19
+ "megatron_core": "megatron.core",
20
+ "modules_to_save": null,
21
+ "peft_type": "LORA",
22
+ "r": 16,
23
+ "rank_pattern": {},
24
+ "revision": null,
25
+ "target_modules": [
26
+ "o_proj",
27
+ "down_proj",
28
+ "q_proj",
29
+ "up_proj",
30
+ "v_proj",
31
+ "k_proj",
32
+ "gate_proj"
33
+ ],
34
+ "task_type": "CAUSAL_LM",
35
+ "use_dora": false,
36
+ "use_rslora": false
37
+ }
checkpoint-17182/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:63c17d9ede9f8d89ac6daf540c85d55ed5576dbfa8b04e7cece6220758d921d9
3
+ size 2185310560
checkpoint-17182/global_step17182/mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:48fa233bfbb6395d957b3ad7bdce7a3246fb1c7f393d8ff773711564cfa5bb85
3
+ size 2740728772
checkpoint-17182/global_step17182/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:3060037fdd9d729670b088a836a581577734ee29346800ad18a927b0fd57f678
3
+ size 16441247696
checkpoint-17182/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step17182
checkpoint-17182/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb954ee3383f73afc1c0d595ac9c0cd09be141436adb4e67254bb75a82e2b665
3
+ size 14244
checkpoint-17182/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7cdfe524d424822e652a97fdd0370846096c7574c8a46308f66c8c4af183b1d7
3
+ size 1064
checkpoint-17182/trainer_state.json ADDED
@@ -0,0 +1,2114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": 0.8844256401062012,
3
+ "best_model_checkpoint": "/workspace/previous_works/MedBLIP/output/MedBLIP-0005/checkpoint-17182",
4
+ "epoch": 0.9000052380702949,
5
+ "eval_steps": 17182,
6
+ "global_step": 17182,
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.0030380807710439473,
13
+ "grad_norm": 119.46666717529297,
14
+ "learning_rate": 1.3268156424581008e-07,
15
+ "loss": 5.0724,
16
+ "step": 58
17
+ },
18
+ {
19
+ "epoch": 0.006076161542087895,
20
+ "grad_norm": 34.45277786254883,
21
+ "learning_rate": 3.3519553072625703e-07,
22
+ "loss": 3.6479,
23
+ "step": 116
24
+ },
25
+ {
26
+ "epoch": 0.009114242313131841,
27
+ "grad_norm": 14.232598304748535,
28
+ "learning_rate": 5.37709497206704e-07,
29
+ "loss": 2.2356,
30
+ "step": 174
31
+ },
32
+ {
33
+ "epoch": 0.01215232308417579,
34
+ "grad_norm": 10.709288597106934,
35
+ "learning_rate": 7.402234636871509e-07,
36
+ "loss": 1.9953,
37
+ "step": 232
38
+ },
39
+ {
40
+ "epoch": 0.015190403855219737,
41
+ "grad_norm": 7.259119987487793,
42
+ "learning_rate": 9.427374301675979e-07,
43
+ "loss": 1.8188,
44
+ "step": 290
45
+ },
46
+ {
47
+ "epoch": 0.018228484626263683,
48
+ "grad_norm": 6.452203273773193,
49
+ "learning_rate": 1.1452513966480447e-06,
50
+ "loss": 1.5639,
51
+ "step": 348
52
+ },
53
+ {
54
+ "epoch": 0.021266565397307632,
55
+ "grad_norm": 9.458000183105469,
56
+ "learning_rate": 1.3477653631284918e-06,
57
+ "loss": 1.504,
58
+ "step": 406
59
+ },
60
+ {
61
+ "epoch": 0.02430464616835158,
62
+ "grad_norm": 6.162489414215088,
63
+ "learning_rate": 1.5502793296089386e-06,
64
+ "loss": 1.2581,
65
+ "step": 464
66
+ },
67
+ {
68
+ "epoch": 0.027342726939395528,
69
+ "grad_norm": 6.684648513793945,
70
+ "learning_rate": 1.7527932960893857e-06,
71
+ "loss": 1.1713,
72
+ "step": 522
73
+ },
74
+ {
75
+ "epoch": 0.030380807710439474,
76
+ "grad_norm": 6.966240882873535,
77
+ "learning_rate": 1.9553072625698325e-06,
78
+ "loss": 1.0504,
79
+ "step": 580
80
+ },
81
+ {
82
+ "epoch": 0.03341888848148342,
83
+ "grad_norm": 6.379108905792236,
84
+ "learning_rate": 2.1578212290502796e-06,
85
+ "loss": 0.968,
86
+ "step": 638
87
+ },
88
+ {
89
+ "epoch": 0.036456969252527366,
90
+ "grad_norm": 5.3792619705200195,
91
+ "learning_rate": 2.3603351955307262e-06,
92
+ "loss": 0.9209,
93
+ "step": 696
94
+ },
95
+ {
96
+ "epoch": 0.039495050023571315,
97
+ "grad_norm": 6.413719177246094,
98
+ "learning_rate": 2.5628491620111733e-06,
99
+ "loss": 0.8723,
100
+ "step": 754
101
+ },
102
+ {
103
+ "epoch": 0.042533130794615265,
104
+ "grad_norm": 8.826435089111328,
105
+ "learning_rate": 2.7653631284916204e-06,
106
+ "loss": 0.8652,
107
+ "step": 812
108
+ },
109
+ {
110
+ "epoch": 0.045571211565659214,
111
+ "grad_norm": 6.294381618499756,
112
+ "learning_rate": 2.9678770949720674e-06,
113
+ "loss": 0.8099,
114
+ "step": 870
115
+ },
116
+ {
117
+ "epoch": 0.04860929233670316,
118
+ "grad_norm": 7.355430603027344,
119
+ "learning_rate": 3.170391061452514e-06,
120
+ "loss": 0.7396,
121
+ "step": 928
122
+ },
123
+ {
124
+ "epoch": 0.051647373107747106,
125
+ "grad_norm": 10.120753288269043,
126
+ "learning_rate": 3.372905027932961e-06,
127
+ "loss": 0.7511,
128
+ "step": 986
129
+ },
130
+ {
131
+ "epoch": 0.054685453878791056,
132
+ "grad_norm": 5.653336048126221,
133
+ "learning_rate": 3.575418994413408e-06,
134
+ "loss": 0.6688,
135
+ "step": 1044
136
+ },
137
+ {
138
+ "epoch": 0.057723534649835,
139
+ "grad_norm": 5.749114990234375,
140
+ "learning_rate": 3.7779329608938552e-06,
141
+ "loss": 0.677,
142
+ "step": 1102
143
+ },
144
+ {
145
+ "epoch": 0.06076161542087895,
146
+ "grad_norm": 7.65744686126709,
147
+ "learning_rate": 3.980446927374302e-06,
148
+ "loss": 0.7195,
149
+ "step": 1160
150
+ },
151
+ {
152
+ "epoch": 0.0637996961919229,
153
+ "grad_norm": 9.296794891357422,
154
+ "learning_rate": 4.1829608938547485e-06,
155
+ "loss": 0.7598,
156
+ "step": 1218
157
+ },
158
+ {
159
+ "epoch": 0.06683777696296685,
160
+ "grad_norm": 6.070080757141113,
161
+ "learning_rate": 4.385474860335196e-06,
162
+ "loss": 0.7015,
163
+ "step": 1276
164
+ },
165
+ {
166
+ "epoch": 0.0698758577340108,
167
+ "grad_norm": 6.638489723205566,
168
+ "learning_rate": 4.5879888268156435e-06,
169
+ "loss": 0.6778,
170
+ "step": 1334
171
+ },
172
+ {
173
+ "epoch": 0.07291393850505473,
174
+ "grad_norm": 9.076967239379883,
175
+ "learning_rate": 4.790502793296089e-06,
176
+ "loss": 0.5551,
177
+ "step": 1392
178
+ },
179
+ {
180
+ "epoch": 0.07595201927609868,
181
+ "grad_norm": 6.929805278778076,
182
+ "learning_rate": 4.993016759776537e-06,
183
+ "loss": 0.6792,
184
+ "step": 1450
185
+ },
186
+ {
187
+ "epoch": 0.07899010004714263,
188
+ "grad_norm": 8.316506385803223,
189
+ "learning_rate": 5.195530726256983e-06,
190
+ "loss": 0.6379,
191
+ "step": 1508
192
+ },
193
+ {
194
+ "epoch": 0.08202818081818658,
195
+ "grad_norm": 9.471745491027832,
196
+ "learning_rate": 5.398044692737431e-06,
197
+ "loss": 0.6242,
198
+ "step": 1566
199
+ },
200
+ {
201
+ "epoch": 0.08506626158923053,
202
+ "grad_norm": 6.022659778594971,
203
+ "learning_rate": 5.6005586592178775e-06,
204
+ "loss": 0.6368,
205
+ "step": 1624
206
+ },
207
+ {
208
+ "epoch": 0.08810434236027448,
209
+ "grad_norm": 7.15187406539917,
210
+ "learning_rate": 5.803072625698325e-06,
211
+ "loss": 0.5381,
212
+ "step": 1682
213
+ },
214
+ {
215
+ "epoch": 0.09114242313131843,
216
+ "grad_norm": 7.10537052154541,
217
+ "learning_rate": 6.005586592178772e-06,
218
+ "loss": 0.6885,
219
+ "step": 1740
220
+ },
221
+ {
222
+ "epoch": 0.09418050390236236,
223
+ "grad_norm": 5.685272216796875,
224
+ "learning_rate": 6.208100558659218e-06,
225
+ "loss": 0.6066,
226
+ "step": 1798
227
+ },
228
+ {
229
+ "epoch": 0.09721858467340631,
230
+ "grad_norm": 6.733754634857178,
231
+ "learning_rate": 6.410614525139666e-06,
232
+ "loss": 0.6124,
233
+ "step": 1856
234
+ },
235
+ {
236
+ "epoch": 0.10025666544445026,
237
+ "grad_norm": 6.112730026245117,
238
+ "learning_rate": 6.613128491620112e-06,
239
+ "loss": 0.6224,
240
+ "step": 1914
241
+ },
242
+ {
243
+ "epoch": 0.10329474621549421,
244
+ "grad_norm": 5.784328460693359,
245
+ "learning_rate": 6.815642458100559e-06,
246
+ "loss": 0.6289,
247
+ "step": 1972
248
+ },
249
+ {
250
+ "epoch": 0.10633282698653816,
251
+ "grad_norm": 9.69115924835205,
252
+ "learning_rate": 7.0181564245810065e-06,
253
+ "loss": 0.5952,
254
+ "step": 2030
255
+ },
256
+ {
257
+ "epoch": 0.10937090775758211,
258
+ "grad_norm": 5.509926795959473,
259
+ "learning_rate": 7.220670391061453e-06,
260
+ "loss": 0.6288,
261
+ "step": 2088
262
+ },
263
+ {
264
+ "epoch": 0.11240898852862606,
265
+ "grad_norm": 6.545931339263916,
266
+ "learning_rate": 7.423184357541901e-06,
267
+ "loss": 0.5243,
268
+ "step": 2146
269
+ },
270
+ {
271
+ "epoch": 0.11544706929967,
272
+ "grad_norm": 7.0921173095703125,
273
+ "learning_rate": 7.625698324022347e-06,
274
+ "loss": 0.5527,
275
+ "step": 2204
276
+ },
277
+ {
278
+ "epoch": 0.11848515007071395,
279
+ "grad_norm": 5.278844833374023,
280
+ "learning_rate": 7.828212290502794e-06,
281
+ "loss": 0.6739,
282
+ "step": 2262
283
+ },
284
+ {
285
+ "epoch": 0.1215232308417579,
286
+ "grad_norm": 5.799619197845459,
287
+ "learning_rate": 8.03072625698324e-06,
288
+ "loss": 0.5913,
289
+ "step": 2320
290
+ },
291
+ {
292
+ "epoch": 0.12456131161280184,
293
+ "grad_norm": 7.148493766784668,
294
+ "learning_rate": 8.233240223463687e-06,
295
+ "loss": 0.6117,
296
+ "step": 2378
297
+ },
298
+ {
299
+ "epoch": 0.1275993923838458,
300
+ "grad_norm": 5.538400650024414,
301
+ "learning_rate": 8.435754189944135e-06,
302
+ "loss": 0.5512,
303
+ "step": 2436
304
+ },
305
+ {
306
+ "epoch": 0.13063747315488974,
307
+ "grad_norm": 5.364485740661621,
308
+ "learning_rate": 8.638268156424582e-06,
309
+ "loss": 0.5458,
310
+ "step": 2494
311
+ },
312
+ {
313
+ "epoch": 0.1336755539259337,
314
+ "grad_norm": 7.3765549659729,
315
+ "learning_rate": 8.840782122905029e-06,
316
+ "loss": 0.5847,
317
+ "step": 2552
318
+ },
319
+ {
320
+ "epoch": 0.13671363469697764,
321
+ "grad_norm": 5.364510536193848,
322
+ "learning_rate": 9.043296089385475e-06,
323
+ "loss": 0.542,
324
+ "step": 2610
325
+ },
326
+ {
327
+ "epoch": 0.1397517154680216,
328
+ "grad_norm": 3.656923770904541,
329
+ "learning_rate": 9.245810055865922e-06,
330
+ "loss": 0.5528,
331
+ "step": 2668
332
+ },
333
+ {
334
+ "epoch": 0.14278979623906554,
335
+ "grad_norm": 3.117631435394287,
336
+ "learning_rate": 9.448324022346369e-06,
337
+ "loss": 0.5793,
338
+ "step": 2726
339
+ },
340
+ {
341
+ "epoch": 0.14582787701010946,
342
+ "grad_norm": 6.822358131408691,
343
+ "learning_rate": 9.650837988826817e-06,
344
+ "loss": 0.5967,
345
+ "step": 2784
346
+ },
347
+ {
348
+ "epoch": 0.1488659577811534,
349
+ "grad_norm": 4.629315376281738,
350
+ "learning_rate": 9.853351955307264e-06,
351
+ "loss": 0.5945,
352
+ "step": 2842
353
+ },
354
+ {
355
+ "epoch": 0.15190403855219736,
356
+ "grad_norm": 3.6398866176605225,
357
+ "learning_rate": 1.005586592178771e-05,
358
+ "loss": 0.6005,
359
+ "step": 2900
360
+ },
361
+ {
362
+ "epoch": 0.1549421193232413,
363
+ "grad_norm": 5.811204433441162,
364
+ "learning_rate": 1.0258379888268157e-05,
365
+ "loss": 0.5065,
366
+ "step": 2958
367
+ },
368
+ {
369
+ "epoch": 0.15798020009428526,
370
+ "grad_norm": 3.8507301807403564,
371
+ "learning_rate": 1.0460893854748604e-05,
372
+ "loss": 0.5802,
373
+ "step": 3016
374
+ },
375
+ {
376
+ "epoch": 0.1610182808653292,
377
+ "grad_norm": 5.666468143463135,
378
+ "learning_rate": 1.066340782122905e-05,
379
+ "loss": 0.5342,
380
+ "step": 3074
381
+ },
382
+ {
383
+ "epoch": 0.16405636163637316,
384
+ "grad_norm": 2.025376558303833,
385
+ "learning_rate": 1.0865921787709498e-05,
386
+ "loss": 0.5271,
387
+ "step": 3132
388
+ },
389
+ {
390
+ "epoch": 0.1670944424074171,
391
+ "grad_norm": 5.698912143707275,
392
+ "learning_rate": 1.1068435754189945e-05,
393
+ "loss": 0.538,
394
+ "step": 3190
395
+ },
396
+ {
397
+ "epoch": 0.17013252317846106,
398
+ "grad_norm": 4.067931652069092,
399
+ "learning_rate": 1.1270949720670392e-05,
400
+ "loss": 0.5601,
401
+ "step": 3248
402
+ },
403
+ {
404
+ "epoch": 0.173170603949505,
405
+ "grad_norm": 5.068817138671875,
406
+ "learning_rate": 1.1473463687150838e-05,
407
+ "loss": 0.5528,
408
+ "step": 3306
409
+ },
410
+ {
411
+ "epoch": 0.17620868472054896,
412
+ "grad_norm": 7.116920471191406,
413
+ "learning_rate": 1.1675977653631285e-05,
414
+ "loss": 0.5418,
415
+ "step": 3364
416
+ },
417
+ {
418
+ "epoch": 0.1792467654915929,
419
+ "grad_norm": 8.113608360290527,
420
+ "learning_rate": 1.1878491620111732e-05,
421
+ "loss": 0.5196,
422
+ "step": 3422
423
+ },
424
+ {
425
+ "epoch": 0.18228484626263686,
426
+ "grad_norm": 4.820245265960693,
427
+ "learning_rate": 1.208100558659218e-05,
428
+ "loss": 0.6029,
429
+ "step": 3480
430
+ },
431
+ {
432
+ "epoch": 0.18532292703368078,
433
+ "grad_norm": 1.1077276468276978,
434
+ "learning_rate": 1.2283519553072627e-05,
435
+ "loss": 0.5779,
436
+ "step": 3538
437
+ },
438
+ {
439
+ "epoch": 0.18836100780472473,
440
+ "grad_norm": 3.024624824523926,
441
+ "learning_rate": 1.2486033519553073e-05,
442
+ "loss": 0.5091,
443
+ "step": 3596
444
+ },
445
+ {
446
+ "epoch": 0.19139908857576868,
447
+ "grad_norm": 8.059369087219238,
448
+ "learning_rate": 1.268854748603352e-05,
449
+ "loss": 0.5012,
450
+ "step": 3654
451
+ },
452
+ {
453
+ "epoch": 0.19443716934681263,
454
+ "grad_norm": 3.9895098209381104,
455
+ "learning_rate": 1.2891061452513967e-05,
456
+ "loss": 0.578,
457
+ "step": 3712
458
+ },
459
+ {
460
+ "epoch": 0.19747525011785658,
461
+ "grad_norm": 7.111061096191406,
462
+ "learning_rate": 1.3093575418994415e-05,
463
+ "loss": 0.4958,
464
+ "step": 3770
465
+ },
466
+ {
467
+ "epoch": 0.20051333088890053,
468
+ "grad_norm": 5.541796684265137,
469
+ "learning_rate": 1.3296089385474861e-05,
470
+ "loss": 0.589,
471
+ "step": 3828
472
+ },
473
+ {
474
+ "epoch": 0.20355141165994448,
475
+ "grad_norm": 4.365527629852295,
476
+ "learning_rate": 1.3498603351955308e-05,
477
+ "loss": 0.6003,
478
+ "step": 3886
479
+ },
480
+ {
481
+ "epoch": 0.20658949243098843,
482
+ "grad_norm": 4.486824035644531,
483
+ "learning_rate": 1.3701117318435755e-05,
484
+ "loss": 0.6135,
485
+ "step": 3944
486
+ },
487
+ {
488
+ "epoch": 0.20962757320203237,
489
+ "grad_norm": 5.487951278686523,
490
+ "learning_rate": 1.3903631284916201e-05,
491
+ "loss": 0.6234,
492
+ "step": 4002
493
+ },
494
+ {
495
+ "epoch": 0.21266565397307632,
496
+ "grad_norm": 2.3850884437561035,
497
+ "learning_rate": 1.410614525139665e-05,
498
+ "loss": 0.5536,
499
+ "step": 4060
500
+ },
501
+ {
502
+ "epoch": 0.21570373474412027,
503
+ "grad_norm": 3.7957749366760254,
504
+ "learning_rate": 1.4305167597765364e-05,
505
+ "loss": 0.5211,
506
+ "step": 4118
507
+ },
508
+ {
509
+ "epoch": 0.21874181551516422,
510
+ "grad_norm": 5.272162437438965,
511
+ "learning_rate": 1.450768156424581e-05,
512
+ "loss": 0.4992,
513
+ "step": 4176
514
+ },
515
+ {
516
+ "epoch": 0.22177989628620817,
517
+ "grad_norm": 4.292142868041992,
518
+ "learning_rate": 1.4710195530726259e-05,
519
+ "loss": 0.5124,
520
+ "step": 4234
521
+ },
522
+ {
523
+ "epoch": 0.22481797705725212,
524
+ "grad_norm": 4.948460102081299,
525
+ "learning_rate": 1.4912709497206705e-05,
526
+ "loss": 0.5575,
527
+ "step": 4292
528
+ },
529
+ {
530
+ "epoch": 0.22785605782829604,
531
+ "grad_norm": 3.456590414047241,
532
+ "learning_rate": 1.5115223463687152e-05,
533
+ "loss": 0.5672,
534
+ "step": 4350
535
+ },
536
+ {
537
+ "epoch": 0.23089413859934,
538
+ "grad_norm": 5.341044902801514,
539
+ "learning_rate": 1.53177374301676e-05,
540
+ "loss": 0.5106,
541
+ "step": 4408
542
+ },
543
+ {
544
+ "epoch": 0.23393221937038394,
545
+ "grad_norm": 5.5106987953186035,
546
+ "learning_rate": 1.5520251396648043e-05,
547
+ "loss": 0.6037,
548
+ "step": 4466
549
+ },
550
+ {
551
+ "epoch": 0.2369703001414279,
552
+ "grad_norm": 4.941389560699463,
553
+ "learning_rate": 1.5722765363128495e-05,
554
+ "loss": 0.5995,
555
+ "step": 4524
556
+ },
557
+ {
558
+ "epoch": 0.24000838091247184,
559
+ "grad_norm": 3.719957113265991,
560
+ "learning_rate": 1.592527932960894e-05,
561
+ "loss": 0.5531,
562
+ "step": 4582
563
+ },
564
+ {
565
+ "epoch": 0.2430464616835158,
566
+ "grad_norm": 4.435623645782471,
567
+ "learning_rate": 1.612779329608939e-05,
568
+ "loss": 0.5502,
569
+ "step": 4640
570
+ },
571
+ {
572
+ "epoch": 0.24608454245455974,
573
+ "grad_norm": 4.688556671142578,
574
+ "learning_rate": 1.6330307262569833e-05,
575
+ "loss": 0.5056,
576
+ "step": 4698
577
+ },
578
+ {
579
+ "epoch": 0.2491226232256037,
580
+ "grad_norm": 5.511931896209717,
581
+ "learning_rate": 1.653282122905028e-05,
582
+ "loss": 0.5242,
583
+ "step": 4756
584
+ },
585
+ {
586
+ "epoch": 0.25216070399664764,
587
+ "grad_norm": 4.933206558227539,
588
+ "learning_rate": 1.673533519553073e-05,
589
+ "loss": 0.5115,
590
+ "step": 4814
591
+ },
592
+ {
593
+ "epoch": 0.2551987847676916,
594
+ "grad_norm": 2.942838191986084,
595
+ "learning_rate": 1.6937849162011175e-05,
596
+ "loss": 0.5941,
597
+ "step": 4872
598
+ },
599
+ {
600
+ "epoch": 0.25823686553873554,
601
+ "grad_norm": 4.0710625648498535,
602
+ "learning_rate": 1.7140363128491623e-05,
603
+ "loss": 0.4887,
604
+ "step": 4930
605
+ },
606
+ {
607
+ "epoch": 0.2612749463097795,
608
+ "grad_norm": 3.212920665740967,
609
+ "learning_rate": 1.7342877094972068e-05,
610
+ "loss": 0.5051,
611
+ "step": 4988
612
+ },
613
+ {
614
+ "epoch": 0.26431302708082344,
615
+ "grad_norm": 4.390661716461182,
616
+ "learning_rate": 1.7545391061452513e-05,
617
+ "loss": 0.5735,
618
+ "step": 5046
619
+ },
620
+ {
621
+ "epoch": 0.2673511078518674,
622
+ "grad_norm": 3.784395217895508,
623
+ "learning_rate": 1.7747905027932965e-05,
624
+ "loss": 0.4847,
625
+ "step": 5104
626
+ },
627
+ {
628
+ "epoch": 0.27038918862291134,
629
+ "grad_norm": 4.238777160644531,
630
+ "learning_rate": 1.795041899441341e-05,
631
+ "loss": 0.4303,
632
+ "step": 5162
633
+ },
634
+ {
635
+ "epoch": 0.2734272693939553,
636
+ "grad_norm": 4.616554260253906,
637
+ "learning_rate": 1.8152932960893855e-05,
638
+ "loss": 0.53,
639
+ "step": 5220
640
+ },
641
+ {
642
+ "epoch": 0.27646535016499924,
643
+ "grad_norm": 3.0670206546783447,
644
+ "learning_rate": 1.8355446927374303e-05,
645
+ "loss": 0.5089,
646
+ "step": 5278
647
+ },
648
+ {
649
+ "epoch": 0.2795034309360432,
650
+ "grad_norm": 5.144998550415039,
651
+ "learning_rate": 1.8557960893854748e-05,
652
+ "loss": 0.5352,
653
+ "step": 5336
654
+ },
655
+ {
656
+ "epoch": 0.28254151170708713,
657
+ "grad_norm": 3.9276976585388184,
658
+ "learning_rate": 1.8760474860335196e-05,
659
+ "loss": 0.5001,
660
+ "step": 5394
661
+ },
662
+ {
663
+ "epoch": 0.2855795924781311,
664
+ "grad_norm": 4.67507266998291,
665
+ "learning_rate": 1.8962988826815645e-05,
666
+ "loss": 0.5106,
667
+ "step": 5452
668
+ },
669
+ {
670
+ "epoch": 0.288617673249175,
671
+ "grad_norm": 11.027061462402344,
672
+ "learning_rate": 1.916550279329609e-05,
673
+ "loss": 0.5311,
674
+ "step": 5510
675
+ },
676
+ {
677
+ "epoch": 0.2916557540202189,
678
+ "grad_norm": 4.6279802322387695,
679
+ "learning_rate": 1.9368016759776538e-05,
680
+ "loss": 0.4722,
681
+ "step": 5568
682
+ },
683
+ {
684
+ "epoch": 0.2946938347912629,
685
+ "grad_norm": 3.2744059562683105,
686
+ "learning_rate": 1.9570530726256983e-05,
687
+ "loss": 0.5435,
688
+ "step": 5626
689
+ },
690
+ {
691
+ "epoch": 0.2977319155623068,
692
+ "grad_norm": 4.361588478088379,
693
+ "learning_rate": 1.977304469273743e-05,
694
+ "loss": 0.5182,
695
+ "step": 5684
696
+ },
697
+ {
698
+ "epoch": 0.3007699963333508,
699
+ "grad_norm": 4.725919246673584,
700
+ "learning_rate": 1.997555865921788e-05,
701
+ "loss": 0.5108,
702
+ "step": 5742
703
+ },
704
+ {
705
+ "epoch": 0.3038080771043947,
706
+ "grad_norm": 4.126678943634033,
707
+ "learning_rate": 1.999995169004151e-05,
708
+ "loss": 0.4113,
709
+ "step": 5800
710
+ },
711
+ {
712
+ "epoch": 0.3068461578754387,
713
+ "grad_norm": 4.924627780914307,
714
+ "learning_rate": 1.999977932757864e-05,
715
+ "loss": 0.5911,
716
+ "step": 5858
717
+ },
718
+ {
719
+ "epoch": 0.3098842386464826,
720
+ "grad_norm": 3.836568832397461,
721
+ "learning_rate": 1.9999482004657697e-05,
722
+ "loss": 0.5589,
723
+ "step": 5916
724
+ },
725
+ {
726
+ "epoch": 0.3129223194175266,
727
+ "grad_norm": 2.1909499168395996,
728
+ "learning_rate": 1.999905972499412e-05,
729
+ "loss": 0.5321,
730
+ "step": 5974
731
+ },
732
+ {
733
+ "epoch": 0.3159604001885705,
734
+ "grad_norm": 4.15761661529541,
735
+ "learning_rate": 1.9998512493864858e-05,
736
+ "loss": 0.4898,
737
+ "step": 6032
738
+ },
739
+ {
740
+ "epoch": 0.31899848095961447,
741
+ "grad_norm": 4.483209133148193,
742
+ "learning_rate": 1.9997840318108285e-05,
743
+ "loss": 0.5339,
744
+ "step": 6090
745
+ },
746
+ {
747
+ "epoch": 0.3220365617306584,
748
+ "grad_norm": 4.208775997161865,
749
+ "learning_rate": 1.9997058007847493e-05,
750
+ "loss": 0.4381,
751
+ "step": 6148
752
+ },
753
+ {
754
+ "epoch": 0.32507464250170237,
755
+ "grad_norm": 4.7916951179504395,
756
+ "learning_rate": 1.999613812340473e-05,
757
+ "loss": 0.5622,
758
+ "step": 6206
759
+ },
760
+ {
761
+ "epoch": 0.3281127232727463,
762
+ "grad_norm": 3.041353702545166,
763
+ "learning_rate": 1.999509332400555e-05,
764
+ "loss": 0.5797,
765
+ "step": 6264
766
+ },
767
+ {
768
+ "epoch": 0.33115080404379027,
769
+ "grad_norm": 2.720505714416504,
770
+ "learning_rate": 1.999392362270611e-05,
771
+ "loss": 0.5213,
772
+ "step": 6322
773
+ },
774
+ {
775
+ "epoch": 0.3341888848148342,
776
+ "grad_norm": 4.793097496032715,
777
+ "learning_rate": 1.999262903412336e-05,
778
+ "loss": 0.4593,
779
+ "step": 6380
780
+ },
781
+ {
782
+ "epoch": 0.33722696558587817,
783
+ "grad_norm": 3.890002489089966,
784
+ "learning_rate": 1.999120957443491e-05,
785
+ "loss": 0.4486,
786
+ "step": 6438
787
+ },
788
+ {
789
+ "epoch": 0.3402650463569221,
790
+ "grad_norm": 3.537182569503784,
791
+ "learning_rate": 1.9989665261378772e-05,
792
+ "loss": 0.4879,
793
+ "step": 6496
794
+ },
795
+ {
796
+ "epoch": 0.34330312712796607,
797
+ "grad_norm": 1.6273483037948608,
798
+ "learning_rate": 1.998799611425319e-05,
799
+ "loss": 0.483,
800
+ "step": 6554
801
+ },
802
+ {
803
+ "epoch": 0.34634120789901,
804
+ "grad_norm": 1.544161081314087,
805
+ "learning_rate": 1.9986202153916356e-05,
806
+ "loss": 0.5295,
807
+ "step": 6612
808
+ },
809
+ {
810
+ "epoch": 0.34937928867005397,
811
+ "grad_norm": 4.516360759735107,
812
+ "learning_rate": 1.9984283402786177e-05,
813
+ "loss": 0.5544,
814
+ "step": 6670
815
+ },
816
+ {
817
+ "epoch": 0.3524173694410979,
818
+ "grad_norm": 3.9603912830352783,
819
+ "learning_rate": 1.998223988483998e-05,
820
+ "loss": 0.5005,
821
+ "step": 6728
822
+ },
823
+ {
824
+ "epoch": 0.35545545021214187,
825
+ "grad_norm": 4.063785076141357,
826
+ "learning_rate": 1.998007162561423e-05,
827
+ "loss": 0.5339,
828
+ "step": 6786
829
+ },
830
+ {
831
+ "epoch": 0.3584935309831858,
832
+ "grad_norm": 4.825593948364258,
833
+ "learning_rate": 1.9977778652204192e-05,
834
+ "loss": 0.4702,
835
+ "step": 6844
836
+ },
837
+ {
838
+ "epoch": 0.36153161175422976,
839
+ "grad_norm": 0.5379557013511658,
840
+ "learning_rate": 1.997536099326359e-05,
841
+ "loss": 0.5397,
842
+ "step": 6902
843
+ },
844
+ {
845
+ "epoch": 0.3645696925252737,
846
+ "grad_norm": 3.922156810760498,
847
+ "learning_rate": 1.9972818679004273e-05,
848
+ "loss": 0.5663,
849
+ "step": 6960
850
+ },
851
+ {
852
+ "epoch": 0.36760777329631766,
853
+ "grad_norm": 3.376941442489624,
854
+ "learning_rate": 1.9970198778515604e-05,
855
+ "loss": 0.5321,
856
+ "step": 7018
857
+ },
858
+ {
859
+ "epoch": 0.37064585406736156,
860
+ "grad_norm": 4.569897174835205,
861
+ "learning_rate": 1.9967409398301135e-05,
862
+ "loss": 0.4517,
863
+ "step": 7076
864
+ },
865
+ {
866
+ "epoch": 0.3736839348384055,
867
+ "grad_norm": 4.267284393310547,
868
+ "learning_rate": 1.9964495462133642e-05,
869
+ "loss": 0.5225,
870
+ "step": 7134
871
+ },
872
+ {
873
+ "epoch": 0.37672201560944946,
874
+ "grad_norm": 4.1275506019592285,
875
+ "learning_rate": 1.9961457006426603e-05,
876
+ "loss": 0.5007,
877
+ "step": 7192
878
+ },
879
+ {
880
+ "epoch": 0.3797600963804934,
881
+ "grad_norm": 4.481261253356934,
882
+ "learning_rate": 1.995829406914954e-05,
883
+ "loss": 0.4754,
884
+ "step": 7250
885
+ },
886
+ {
887
+ "epoch": 0.38279817715153736,
888
+ "grad_norm": 2.876922845840454,
889
+ "learning_rate": 1.995500668982753e-05,
890
+ "loss": 0.4729,
891
+ "step": 7308
892
+ },
893
+ {
894
+ "epoch": 0.3858362579225813,
895
+ "grad_norm": 1.0541763305664062,
896
+ "learning_rate": 1.9951594909540727e-05,
897
+ "loss": 0.5697,
898
+ "step": 7366
899
+ },
900
+ {
901
+ "epoch": 0.38887433869362525,
902
+ "grad_norm": 3.462268114089966,
903
+ "learning_rate": 1.9948058770923837e-05,
904
+ "loss": 0.4803,
905
+ "step": 7424
906
+ },
907
+ {
908
+ "epoch": 0.3919124194646692,
909
+ "grad_norm": 3.209782123565674,
910
+ "learning_rate": 1.9944398318165578e-05,
911
+ "loss": 0.5239,
912
+ "step": 7482
913
+ },
914
+ {
915
+ "epoch": 0.39495050023571315,
916
+ "grad_norm": 4.3836445808410645,
917
+ "learning_rate": 1.994061359700815e-05,
918
+ "loss": 0.5096,
919
+ "step": 7540
920
+ },
921
+ {
922
+ "epoch": 0.3979885810067571,
923
+ "grad_norm": 2.8133575916290283,
924
+ "learning_rate": 1.9936704654746642e-05,
925
+ "loss": 0.4546,
926
+ "step": 7598
927
+ },
928
+ {
929
+ "epoch": 0.40102666177780105,
930
+ "grad_norm": 3.709463596343994,
931
+ "learning_rate": 1.9932671540228456e-05,
932
+ "loss": 0.4882,
933
+ "step": 7656
934
+ },
935
+ {
936
+ "epoch": 0.404064742548845,
937
+ "grad_norm": 3.9174060821533203,
938
+ "learning_rate": 1.992851430385269e-05,
939
+ "loss": 0.4311,
940
+ "step": 7714
941
+ },
942
+ {
943
+ "epoch": 0.40710282331988895,
944
+ "grad_norm": 2.9282238483428955,
945
+ "learning_rate": 1.99242329975695e-05,
946
+ "loss": 0.5204,
947
+ "step": 7772
948
+ },
949
+ {
950
+ "epoch": 0.4101409040909329,
951
+ "grad_norm": 4.139567852020264,
952
+ "learning_rate": 1.9919827674879473e-05,
953
+ "loss": 0.4739,
954
+ "step": 7830
955
+ },
956
+ {
957
+ "epoch": 0.41317898486197685,
958
+ "grad_norm": 3.436636447906494,
959
+ "learning_rate": 1.9915298390832935e-05,
960
+ "loss": 0.4838,
961
+ "step": 7888
962
+ },
963
+ {
964
+ "epoch": 0.4162170656330208,
965
+ "grad_norm": 3.512646198272705,
966
+ "learning_rate": 1.9910645202029272e-05,
967
+ "loss": 0.4594,
968
+ "step": 7946
969
+ },
970
+ {
971
+ "epoch": 0.41925514640406475,
972
+ "grad_norm": 3.1627018451690674,
973
+ "learning_rate": 1.9905868166616234e-05,
974
+ "loss": 0.5628,
975
+ "step": 8004
976
+ },
977
+ {
978
+ "epoch": 0.4222932271751087,
979
+ "grad_norm": 1.1955090761184692,
980
+ "learning_rate": 1.990096734428919e-05,
981
+ "loss": 0.4587,
982
+ "step": 8062
983
+ },
984
+ {
985
+ "epoch": 0.42533130794615265,
986
+ "grad_norm": 3.0422959327697754,
987
+ "learning_rate": 1.989594279629039e-05,
988
+ "loss": 0.5523,
989
+ "step": 8120
990
+ },
991
+ {
992
+ "epoch": 0.4283693887171966,
993
+ "grad_norm": 3.0934972763061523,
994
+ "learning_rate": 1.98907945854082e-05,
995
+ "loss": 0.4855,
996
+ "step": 8178
997
+ },
998
+ {
999
+ "epoch": 0.43140746948824055,
1000
+ "grad_norm": 3.9694907665252686,
1001
+ "learning_rate": 1.9885522775976324e-05,
1002
+ "loss": 0.543,
1003
+ "step": 8236
1004
+ },
1005
+ {
1006
+ "epoch": 0.4344455502592845,
1007
+ "grad_norm": 4.713873386383057,
1008
+ "learning_rate": 1.9880127433872983e-05,
1009
+ "loss": 0.4901,
1010
+ "step": 8294
1011
+ },
1012
+ {
1013
+ "epoch": 0.43748363103032845,
1014
+ "grad_norm": 2.3840503692626953,
1015
+ "learning_rate": 1.987460862652011e-05,
1016
+ "loss": 0.4265,
1017
+ "step": 8352
1018
+ },
1019
+ {
1020
+ "epoch": 0.4405217118013724,
1021
+ "grad_norm": 4.123522758483887,
1022
+ "learning_rate": 1.9868966422882496e-05,
1023
+ "loss": 0.4237,
1024
+ "step": 8410
1025
+ },
1026
+ {
1027
+ "epoch": 0.44355979257241634,
1028
+ "grad_norm": 3.1017978191375732,
1029
+ "learning_rate": 1.986320089346693e-05,
1030
+ "loss": 0.4106,
1031
+ "step": 8468
1032
+ },
1033
+ {
1034
+ "epoch": 0.4465978733434603,
1035
+ "grad_norm": 2.8059699535369873,
1036
+ "learning_rate": 1.9857414684867994e-05,
1037
+ "loss": 0.4641,
1038
+ "step": 8526
1039
+ },
1040
+ {
1041
+ "epoch": 0.44963595411450424,
1042
+ "grad_norm": 4.327667236328125,
1043
+ "learning_rate": 1.985140484474396e-05,
1044
+ "loss": 0.4337,
1045
+ "step": 8584
1046
+ },
1047
+ {
1048
+ "epoch": 0.45267403488554814,
1049
+ "grad_norm": 0.9626501798629761,
1050
+ "learning_rate": 1.9845271898297104e-05,
1051
+ "loss": 0.4932,
1052
+ "step": 8642
1053
+ },
1054
+ {
1055
+ "epoch": 0.4557121156565921,
1056
+ "grad_norm": 1.3852657079696655,
1057
+ "learning_rate": 1.9839015922166693e-05,
1058
+ "loss": 0.4866,
1059
+ "step": 8700
1060
+ },
1061
+ {
1062
+ "epoch": 0.45875019642763604,
1063
+ "grad_norm": 3.2711095809936523,
1064
+ "learning_rate": 1.983263699452942e-05,
1065
+ "loss": 0.4825,
1066
+ "step": 8758
1067
+ },
1068
+ {
1069
+ "epoch": 0.46178827719868,
1070
+ "grad_norm": 4.84442138671875,
1071
+ "learning_rate": 1.9826135195098416e-05,
1072
+ "loss": 0.4559,
1073
+ "step": 8816
1074
+ },
1075
+ {
1076
+ "epoch": 0.46482635796972394,
1077
+ "grad_norm": 1.2177191972732544,
1078
+ "learning_rate": 1.9819510605122255e-05,
1079
+ "loss": 0.4795,
1080
+ "step": 8874
1081
+ },
1082
+ {
1083
+ "epoch": 0.4678644387407679,
1084
+ "grad_norm": 3.1849379539489746,
1085
+ "learning_rate": 1.981276330738395e-05,
1086
+ "loss": 0.474,
1087
+ "step": 8932
1088
+ },
1089
+ {
1090
+ "epoch": 0.47090251951181183,
1091
+ "grad_norm": 4.420878887176514,
1092
+ "learning_rate": 1.9805893386199892e-05,
1093
+ "loss": 0.4876,
1094
+ "step": 8990
1095
+ },
1096
+ {
1097
+ "epoch": 0.4739406002828558,
1098
+ "grad_norm": 2.714984893798828,
1099
+ "learning_rate": 1.9798900927418835e-05,
1100
+ "loss": 0.4491,
1101
+ "step": 9048
1102
+ },
1103
+ {
1104
+ "epoch": 0.47697868105389973,
1105
+ "grad_norm": 2.185593843460083,
1106
+ "learning_rate": 1.9791786018420792e-05,
1107
+ "loss": 0.4808,
1108
+ "step": 9106
1109
+ },
1110
+ {
1111
+ "epoch": 0.4800167618249437,
1112
+ "grad_norm": 3.3326094150543213,
1113
+ "learning_rate": 1.9784548748115946e-05,
1114
+ "loss": 0.4502,
1115
+ "step": 9164
1116
+ },
1117
+ {
1118
+ "epoch": 0.48305484259598763,
1119
+ "grad_norm": 3.4437661170959473,
1120
+ "learning_rate": 1.977718920694356e-05,
1121
+ "loss": 0.5049,
1122
+ "step": 9222
1123
+ },
1124
+ {
1125
+ "epoch": 0.4860929233670316,
1126
+ "grad_norm": 5.456835746765137,
1127
+ "learning_rate": 1.9769707486870825e-05,
1128
+ "loss": 0.4791,
1129
+ "step": 9280
1130
+ },
1131
+ {
1132
+ "epoch": 0.48913100413807553,
1133
+ "grad_norm": 5.109498023986816,
1134
+ "learning_rate": 1.9762103681391724e-05,
1135
+ "loss": 0.5396,
1136
+ "step": 9338
1137
+ },
1138
+ {
1139
+ "epoch": 0.4921690849091195,
1140
+ "grad_norm": 4.347654342651367,
1141
+ "learning_rate": 1.9754377885525854e-05,
1142
+ "loss": 0.4433,
1143
+ "step": 9396
1144
+ },
1145
+ {
1146
+ "epoch": 0.49520716568016343,
1147
+ "grad_norm": 3.837158203125,
1148
+ "learning_rate": 1.9746530195817243e-05,
1149
+ "loss": 0.4791,
1150
+ "step": 9454
1151
+ },
1152
+ {
1153
+ "epoch": 0.4982452464512074,
1154
+ "grad_norm": 3.8552966117858887,
1155
+ "learning_rate": 1.9738699146560578e-05,
1156
+ "loss": 0.4979,
1157
+ "step": 9512
1158
+ },
1159
+ {
1160
+ "epoch": 0.5012833272222513,
1161
+ "grad_norm": 1.76126229763031,
1162
+ "learning_rate": 1.973061006224811e-05,
1163
+ "loss": 0.4716,
1164
+ "step": 9570
1165
+ },
1166
+ {
1167
+ "epoch": 0.5043214079932953,
1168
+ "grad_norm": 5.198726654052734,
1169
+ "learning_rate": 1.9722399381103267e-05,
1170
+ "loss": 0.4801,
1171
+ "step": 9628
1172
+ },
1173
+ {
1174
+ "epoch": 0.5073594887643392,
1175
+ "grad_norm": 3.2313361167907715,
1176
+ "learning_rate": 1.9714067205729356e-05,
1177
+ "loss": 0.4592,
1178
+ "step": 9686
1179
+ },
1180
+ {
1181
+ "epoch": 0.5103975695353832,
1182
+ "grad_norm": 0.9486598968505859,
1183
+ "learning_rate": 1.9705613640247928e-05,
1184
+ "loss": 0.4399,
1185
+ "step": 9744
1186
+ },
1187
+ {
1188
+ "epoch": 0.5134356503064271,
1189
+ "grad_norm": 3.271669864654541,
1190
+ "learning_rate": 1.9697038790297442e-05,
1191
+ "loss": 0.4722,
1192
+ "step": 9802
1193
+ },
1194
+ {
1195
+ "epoch": 0.5164737310774711,
1196
+ "grad_norm": 5.1848039627075195,
1197
+ "learning_rate": 1.9688342763031993e-05,
1198
+ "loss": 0.4336,
1199
+ "step": 9860
1200
+ },
1201
+ {
1202
+ "epoch": 0.519511811848515,
1203
+ "grad_norm": 4.134024620056152,
1204
+ "learning_rate": 1.967952566711993e-05,
1205
+ "loss": 0.4534,
1206
+ "step": 9918
1207
+ },
1208
+ {
1209
+ "epoch": 0.522549892619559,
1210
+ "grad_norm": 3.0904159545898438,
1211
+ "learning_rate": 1.9670587612742515e-05,
1212
+ "loss": 0.4461,
1213
+ "step": 9976
1214
+ },
1215
+ {
1216
+ "epoch": 0.5255879733906029,
1217
+ "grad_norm": 3.3785481452941895,
1218
+ "learning_rate": 1.9661528711592553e-05,
1219
+ "loss": 0.4906,
1220
+ "step": 10034
1221
+ },
1222
+ {
1223
+ "epoch": 0.5286260541616469,
1224
+ "grad_norm": 4.755141258239746,
1225
+ "learning_rate": 1.9652349076872986e-05,
1226
+ "loss": 0.4519,
1227
+ "step": 10092
1228
+ },
1229
+ {
1230
+ "epoch": 0.5316641349326908,
1231
+ "grad_norm": 4.502477645874023,
1232
+ "learning_rate": 1.9643048823295482e-05,
1233
+ "loss": 0.5454,
1234
+ "step": 10150
1235
+ },
1236
+ {
1237
+ "epoch": 0.5347022157037348,
1238
+ "grad_norm": 2.3361642360687256,
1239
+ "learning_rate": 1.9633628067078997e-05,
1240
+ "loss": 0.5069,
1241
+ "step": 10208
1242
+ },
1243
+ {
1244
+ "epoch": 0.5377402964747787,
1245
+ "grad_norm": 3.6974456310272217,
1246
+ "learning_rate": 1.9624086925948333e-05,
1247
+ "loss": 0.4604,
1248
+ "step": 10266
1249
+ },
1250
+ {
1251
+ "epoch": 0.5407783772458227,
1252
+ "grad_norm": 3.7012462615966797,
1253
+ "learning_rate": 1.9614425519132654e-05,
1254
+ "loss": 0.5368,
1255
+ "step": 10324
1256
+ },
1257
+ {
1258
+ "epoch": 0.5438164580168666,
1259
+ "grad_norm": 0.9825100898742676,
1260
+ "learning_rate": 1.9604643967364013e-05,
1261
+ "loss": 0.4917,
1262
+ "step": 10382
1263
+ },
1264
+ {
1265
+ "epoch": 0.5468545387879106,
1266
+ "grad_norm": 2.8980348110198975,
1267
+ "learning_rate": 1.959474239287582e-05,
1268
+ "loss": 0.4571,
1269
+ "step": 10440
1270
+ },
1271
+ {
1272
+ "epoch": 0.5498926195589545,
1273
+ "grad_norm": 6.615330696105957,
1274
+ "learning_rate": 1.9584720919401342e-05,
1275
+ "loss": 0.4949,
1276
+ "step": 10498
1277
+ },
1278
+ {
1279
+ "epoch": 0.5529307003299985,
1280
+ "grad_norm": 4.613067626953125,
1281
+ "learning_rate": 1.9574579672172126e-05,
1282
+ "loss": 0.4072,
1283
+ "step": 10556
1284
+ },
1285
+ {
1286
+ "epoch": 0.5559687811010424,
1287
+ "grad_norm": 3.3984858989715576,
1288
+ "learning_rate": 1.9564318777916456e-05,
1289
+ "loss": 0.412,
1290
+ "step": 10614
1291
+ },
1292
+ {
1293
+ "epoch": 0.5590068618720864,
1294
+ "grad_norm": 5.624422550201416,
1295
+ "learning_rate": 1.9553938364857775e-05,
1296
+ "loss": 0.4781,
1297
+ "step": 10672
1298
+ },
1299
+ {
1300
+ "epoch": 0.5620449426431303,
1301
+ "grad_norm": 4.486995697021484,
1302
+ "learning_rate": 1.954343856271306e-05,
1303
+ "loss": 0.4426,
1304
+ "step": 10730
1305
+ },
1306
+ {
1307
+ "epoch": 0.5650830234141743,
1308
+ "grad_norm": 2.862964391708374,
1309
+ "learning_rate": 1.953281950269121e-05,
1310
+ "loss": 0.506,
1311
+ "step": 10788
1312
+ },
1313
+ {
1314
+ "epoch": 0.5681211041852182,
1315
+ "grad_norm": 0.556151807308197,
1316
+ "learning_rate": 1.9522267467101615e-05,
1317
+ "loss": 0.4095,
1318
+ "step": 10846
1319
+ },
1320
+ {
1321
+ "epoch": 0.5711591849562622,
1322
+ "grad_norm": 3.035536527633667,
1323
+ "learning_rate": 1.9511412341335318e-05,
1324
+ "loss": 0.517,
1325
+ "step": 10904
1326
+ },
1327
+ {
1328
+ "epoch": 0.574197265727306,
1329
+ "grad_norm": 3.8603086471557617,
1330
+ "learning_rate": 1.950043835790185e-05,
1331
+ "loss": 0.4344,
1332
+ "step": 10962
1333
+ },
1334
+ {
1335
+ "epoch": 0.57723534649835,
1336
+ "grad_norm": 4.4469499588012695,
1337
+ "learning_rate": 1.9489345653935635e-05,
1338
+ "loss": 0.4774,
1339
+ "step": 11020
1340
+ },
1341
+ {
1342
+ "epoch": 0.5802734272693939,
1343
+ "grad_norm": 3.4457666873931885,
1344
+ "learning_rate": 1.9478134368054676e-05,
1345
+ "loss": 0.4274,
1346
+ "step": 11078
1347
+ },
1348
+ {
1349
+ "epoch": 0.5833115080404379,
1350
+ "grad_norm": 3.056290864944458,
1351
+ "learning_rate": 1.9466804640358798e-05,
1352
+ "loss": 0.4432,
1353
+ "step": 11136
1354
+ },
1355
+ {
1356
+ "epoch": 0.5863495888114818,
1357
+ "grad_norm": 4.071867942810059,
1358
+ "learning_rate": 1.9455356612427928e-05,
1359
+ "loss": 0.4344,
1360
+ "step": 11194
1361
+ },
1362
+ {
1363
+ "epoch": 0.5893876695825258,
1364
+ "grad_norm": 2.0395846366882324,
1365
+ "learning_rate": 1.9443790427320303e-05,
1366
+ "loss": 0.4714,
1367
+ "step": 11252
1368
+ },
1369
+ {
1370
+ "epoch": 0.5924257503535697,
1371
+ "grad_norm": 4.563007354736328,
1372
+ "learning_rate": 1.9432106229570685e-05,
1373
+ "loss": 0.5157,
1374
+ "step": 11310
1375
+ },
1376
+ {
1377
+ "epoch": 0.5954638311246137,
1378
+ "grad_norm": 3.7986621856689453,
1379
+ "learning_rate": 1.9420304165188574e-05,
1380
+ "loss": 0.4977,
1381
+ "step": 11368
1382
+ },
1383
+ {
1384
+ "epoch": 0.5985019118956576,
1385
+ "grad_norm": 5.301217555999756,
1386
+ "learning_rate": 1.9408384381656358e-05,
1387
+ "loss": 0.4662,
1388
+ "step": 11426
1389
+ },
1390
+ {
1391
+ "epoch": 0.6015399926667016,
1392
+ "grad_norm": 2.3288731575012207,
1393
+ "learning_rate": 1.939634702792749e-05,
1394
+ "loss": 0.4493,
1395
+ "step": 11484
1396
+ },
1397
+ {
1398
+ "epoch": 0.6045780734377455,
1399
+ "grad_norm": 3.7128169536590576,
1400
+ "learning_rate": 1.9384192254424606e-05,
1401
+ "loss": 0.4865,
1402
+ "step": 11542
1403
+ },
1404
+ {
1405
+ "epoch": 0.6076161542087894,
1406
+ "grad_norm": 4.314477920532227,
1407
+ "learning_rate": 1.9371920213037665e-05,
1408
+ "loss": 0.4715,
1409
+ "step": 11600
1410
+ },
1411
+ {
1412
+ "epoch": 0.6106542349798334,
1413
+ "grad_norm": 2.6989047527313232,
1414
+ "learning_rate": 1.935953105712205e-05,
1415
+ "loss": 0.4345,
1416
+ "step": 11658
1417
+ },
1418
+ {
1419
+ "epoch": 0.6136923157508773,
1420
+ "grad_norm": 3.5463671684265137,
1421
+ "learning_rate": 1.9347024941496628e-05,
1422
+ "loss": 0.4611,
1423
+ "step": 11716
1424
+ },
1425
+ {
1426
+ "epoch": 0.6167303965219213,
1427
+ "grad_norm": 4.914857387542725,
1428
+ "learning_rate": 1.9334402022441848e-05,
1429
+ "loss": 0.4952,
1430
+ "step": 11774
1431
+ },
1432
+ {
1433
+ "epoch": 0.6197684772929652,
1434
+ "grad_norm": 1.5133031606674194,
1435
+ "learning_rate": 1.932188309270537e-05,
1436
+ "loss": 0.4401,
1437
+ "step": 11832
1438
+ },
1439
+ {
1440
+ "epoch": 0.6228065580640092,
1441
+ "grad_norm": 2.30916428565979,
1442
+ "learning_rate": 1.9309029048500578e-05,
1443
+ "loss": 0.4177,
1444
+ "step": 11890
1445
+ },
1446
+ {
1447
+ "epoch": 0.6258446388350531,
1448
+ "grad_norm": 2.825598955154419,
1449
+ "learning_rate": 1.929605867567532e-05,
1450
+ "loss": 0.4529,
1451
+ "step": 11948
1452
+ },
1453
+ {
1454
+ "epoch": 0.6288827196060971,
1455
+ "grad_norm": 5.285458087921143,
1456
+ "learning_rate": 1.9282972136311554e-05,
1457
+ "loss": 0.4806,
1458
+ "step": 12006
1459
+ },
1460
+ {
1461
+ "epoch": 0.631920800377141,
1462
+ "grad_norm": 2.597923755645752,
1463
+ "learning_rate": 1.9269769593942872e-05,
1464
+ "loss": 0.4566,
1465
+ "step": 12064
1466
+ },
1467
+ {
1468
+ "epoch": 0.634958881148185,
1469
+ "grad_norm": 2.780212640762329,
1470
+ "learning_rate": 1.9256451213552497e-05,
1471
+ "loss": 0.4725,
1472
+ "step": 12122
1473
+ },
1474
+ {
1475
+ "epoch": 0.6379969619192289,
1476
+ "grad_norm": 4.1638031005859375,
1477
+ "learning_rate": 1.9243017161571194e-05,
1478
+ "loss": 0.463,
1479
+ "step": 12180
1480
+ },
1481
+ {
1482
+ "epoch": 0.6410350426902729,
1483
+ "grad_norm": 4.174670219421387,
1484
+ "learning_rate": 1.9229467605875196e-05,
1485
+ "loss": 0.5236,
1486
+ "step": 12238
1487
+ },
1488
+ {
1489
+ "epoch": 0.6440731234613168,
1490
+ "grad_norm": 1.9128369092941284,
1491
+ "learning_rate": 1.9215802715784096e-05,
1492
+ "loss": 0.4621,
1493
+ "step": 12296
1494
+ },
1495
+ {
1496
+ "epoch": 0.6471112042323608,
1497
+ "grad_norm": 4.490901947021484,
1498
+ "learning_rate": 1.9202022662058773e-05,
1499
+ "loss": 0.4517,
1500
+ "step": 12354
1501
+ },
1502
+ {
1503
+ "epoch": 0.6501492850034047,
1504
+ "grad_norm": 4.426553726196289,
1505
+ "learning_rate": 1.9188127616899202e-05,
1506
+ "loss": 0.488,
1507
+ "step": 12412
1508
+ },
1509
+ {
1510
+ "epoch": 0.6531873657744487,
1511
+ "grad_norm": 3.694254159927368,
1512
+ "learning_rate": 1.917411775394233e-05,
1513
+ "loss": 0.4705,
1514
+ "step": 12470
1515
+ },
1516
+ {
1517
+ "epoch": 0.6562254465454926,
1518
+ "grad_norm": 2.3134400844573975,
1519
+ "learning_rate": 1.9159993248259916e-05,
1520
+ "loss": 0.4402,
1521
+ "step": 12528
1522
+ },
1523
+ {
1524
+ "epoch": 0.6592635273165366,
1525
+ "grad_norm": 2.868987798690796,
1526
+ "learning_rate": 1.9145754276356323e-05,
1527
+ "loss": 0.4085,
1528
+ "step": 12586
1529
+ },
1530
+ {
1531
+ "epoch": 0.6623016080875805,
1532
+ "grad_norm": 3.815828323364258,
1533
+ "learning_rate": 1.9131401016166326e-05,
1534
+ "loss": 0.5569,
1535
+ "step": 12644
1536
+ },
1537
+ {
1538
+ "epoch": 0.6653396888586245,
1539
+ "grad_norm": 2.865863800048828,
1540
+ "learning_rate": 1.911693364705287e-05,
1541
+ "loss": 0.4515,
1542
+ "step": 12702
1543
+ },
1544
+ {
1545
+ "epoch": 0.6683777696296684,
1546
+ "grad_norm": 3.7862603664398193,
1547
+ "learning_rate": 1.9102352349804865e-05,
1548
+ "loss": 0.4685,
1549
+ "step": 12760
1550
+ },
1551
+ {
1552
+ "epoch": 0.6714158504007124,
1553
+ "grad_norm": 2.3399360179901123,
1554
+ "learning_rate": 1.9087657306634884e-05,
1555
+ "loss": 0.5087,
1556
+ "step": 12818
1557
+ },
1558
+ {
1559
+ "epoch": 0.6744539311717563,
1560
+ "grad_norm": 3.208674430847168,
1561
+ "learning_rate": 1.9072848701176905e-05,
1562
+ "loss": 0.4322,
1563
+ "step": 12876
1564
+ },
1565
+ {
1566
+ "epoch": 0.6774920119428003,
1567
+ "grad_norm": 1.2508207559585571,
1568
+ "learning_rate": 1.9057926718484036e-05,
1569
+ "loss": 0.39,
1570
+ "step": 12934
1571
+ },
1572
+ {
1573
+ "epoch": 0.6805300927138442,
1574
+ "grad_norm": 3.029885768890381,
1575
+ "learning_rate": 1.9042891545026164e-05,
1576
+ "loss": 0.4881,
1577
+ "step": 12992
1578
+ },
1579
+ {
1580
+ "epoch": 0.6835681734848882,
1581
+ "grad_norm": 1.723024606704712,
1582
+ "learning_rate": 1.9028005500450692e-05,
1583
+ "loss": 0.4016,
1584
+ "step": 13050
1585
+ },
1586
+ {
1587
+ "epoch": 0.6866062542559321,
1588
+ "grad_norm": 3.0587244033813477,
1589
+ "learning_rate": 1.9012746453978195e-05,
1590
+ "loss": 0.451,
1591
+ "step": 13108
1592
+ },
1593
+ {
1594
+ "epoch": 0.6896443350269761,
1595
+ "grad_norm": 3.979196548461914,
1596
+ "learning_rate": 1.899737478132781e-05,
1597
+ "loss": 0.4584,
1598
+ "step": 13166
1599
+ },
1600
+ {
1601
+ "epoch": 0.69268241579802,
1602
+ "grad_norm": 3.2428181171417236,
1603
+ "learning_rate": 1.8981890674588902e-05,
1604
+ "loss": 0.4419,
1605
+ "step": 13224
1606
+ },
1607
+ {
1608
+ "epoch": 0.695720496569064,
1609
+ "grad_norm": 1.9672743082046509,
1610
+ "learning_rate": 1.8966294327255843e-05,
1611
+ "loss": 0.4463,
1612
+ "step": 13282
1613
+ },
1614
+ {
1615
+ "epoch": 0.6987585773401079,
1616
+ "grad_norm": 3.543287754058838,
1617
+ "learning_rate": 1.895058593422561e-05,
1618
+ "loss": 0.5232,
1619
+ "step": 13340
1620
+ },
1621
+ {
1622
+ "epoch": 0.7017966581111519,
1623
+ "grad_norm": 2.751725435256958,
1624
+ "learning_rate": 1.8934765691795337e-05,
1625
+ "loss": 0.4627,
1626
+ "step": 13398
1627
+ },
1628
+ {
1629
+ "epoch": 0.7048347388821958,
1630
+ "grad_norm": 3.9089314937591553,
1631
+ "learning_rate": 1.8918833797659854e-05,
1632
+ "loss": 0.4701,
1633
+ "step": 13456
1634
+ },
1635
+ {
1636
+ "epoch": 0.7078728196532398,
1637
+ "grad_norm": 2.623382806777954,
1638
+ "learning_rate": 1.890279045090924e-05,
1639
+ "loss": 0.4627,
1640
+ "step": 13514
1641
+ },
1642
+ {
1643
+ "epoch": 0.7109109004242837,
1644
+ "grad_norm": 3.44734263420105,
1645
+ "learning_rate": 1.8886635852026307e-05,
1646
+ "loss": 0.5063,
1647
+ "step": 13572
1648
+ },
1649
+ {
1650
+ "epoch": 0.7139489811953277,
1651
+ "grad_norm": 4.096603870391846,
1652
+ "learning_rate": 1.887037020288412e-05,
1653
+ "loss": 0.4205,
1654
+ "step": 13630
1655
+ },
1656
+ {
1657
+ "epoch": 0.7169870619663716,
1658
+ "grad_norm": 3.9694747924804688,
1659
+ "learning_rate": 1.8853993706743465e-05,
1660
+ "loss": 0.479,
1661
+ "step": 13688
1662
+ },
1663
+ {
1664
+ "epoch": 0.7200251427374156,
1665
+ "grad_norm": 2.2461936473846436,
1666
+ "learning_rate": 1.88375065682503e-05,
1667
+ "loss": 0.4222,
1668
+ "step": 13746
1669
+ },
1670
+ {
1671
+ "epoch": 0.7230632235084595,
1672
+ "grad_norm": 4.268979549407959,
1673
+ "learning_rate": 1.882090899343321e-05,
1674
+ "loss": 0.4013,
1675
+ "step": 13804
1676
+ },
1677
+ {
1678
+ "epoch": 0.7261013042795035,
1679
+ "grad_norm": 2.9464776515960693,
1680
+ "learning_rate": 1.8804201189700833e-05,
1681
+ "loss": 0.5184,
1682
+ "step": 13862
1683
+ },
1684
+ {
1685
+ "epoch": 0.7291393850505474,
1686
+ "grad_norm": 3.1404519081115723,
1687
+ "learning_rate": 1.8787383365839248e-05,
1688
+ "loss": 0.4451,
1689
+ "step": 13920
1690
+ },
1691
+ {
1692
+ "epoch": 0.7321774658215914,
1693
+ "grad_norm": 3.048670530319214,
1694
+ "learning_rate": 1.8770455732009393e-05,
1695
+ "loss": 0.457,
1696
+ "step": 13978
1697
+ },
1698
+ {
1699
+ "epoch": 0.7352155465926353,
1700
+ "grad_norm": 3.074151039123535,
1701
+ "learning_rate": 1.8753418499744426e-05,
1702
+ "loss": 0.4711,
1703
+ "step": 14036
1704
+ },
1705
+ {
1706
+ "epoch": 0.7382536273636792,
1707
+ "grad_norm": 4.1698150634765625,
1708
+ "learning_rate": 1.873627188194708e-05,
1709
+ "loss": 0.4281,
1710
+ "step": 14094
1711
+ },
1712
+ {
1713
+ "epoch": 0.7412917081347231,
1714
+ "grad_norm": 2.6520071029663086,
1715
+ "learning_rate": 1.8719016092887e-05,
1716
+ "loss": 0.497,
1717
+ "step": 14152
1718
+ },
1719
+ {
1720
+ "epoch": 0.7443297889057671,
1721
+ "grad_norm": 1.3818339109420776,
1722
+ "learning_rate": 1.870165134819808e-05,
1723
+ "loss": 0.4234,
1724
+ "step": 14210
1725
+ },
1726
+ {
1727
+ "epoch": 0.747367869676811,
1728
+ "grad_norm": 3.5460736751556396,
1729
+ "learning_rate": 1.868417786487575e-05,
1730
+ "loss": 0.4444,
1731
+ "step": 14268
1732
+ },
1733
+ {
1734
+ "epoch": 0.750405950447855,
1735
+ "grad_norm": 2.8102331161499023,
1736
+ "learning_rate": 1.8666595861274283e-05,
1737
+ "loss": 0.4159,
1738
+ "step": 14326
1739
+ },
1740
+ {
1741
+ "epoch": 0.7534440312188989,
1742
+ "grad_norm": 3.3770508766174316,
1743
+ "learning_rate": 1.8648905557104046e-05,
1744
+ "loss": 0.4357,
1745
+ "step": 14384
1746
+ },
1747
+ {
1748
+ "epoch": 0.7564821119899429,
1749
+ "grad_norm": 2.95613169670105,
1750
+ "learning_rate": 1.863110717342876e-05,
1751
+ "loss": 0.4627,
1752
+ "step": 14442
1753
+ },
1754
+ {
1755
+ "epoch": 0.7595201927609868,
1756
+ "grad_norm": 2.80786395072937,
1757
+ "learning_rate": 1.8613200932662764e-05,
1758
+ "loss": 0.4331,
1759
+ "step": 14500
1760
+ },
1761
+ {
1762
+ "epoch": 0.7625582735320308,
1763
+ "grad_norm": 2.9433181285858154,
1764
+ "learning_rate": 1.8595187058568197e-05,
1765
+ "loss": 0.5087,
1766
+ "step": 14558
1767
+ },
1768
+ {
1769
+ "epoch": 0.7655963543030747,
1770
+ "grad_norm": 2.6625008583068848,
1771
+ "learning_rate": 1.8577065776252218e-05,
1772
+ "loss": 0.5018,
1773
+ "step": 14616
1774
+ },
1775
+ {
1776
+ "epoch": 0.7686344350741187,
1777
+ "grad_norm": 3.8713533878326416,
1778
+ "learning_rate": 1.8558837312164198e-05,
1779
+ "loss": 0.4454,
1780
+ "step": 14674
1781
+ },
1782
+ {
1783
+ "epoch": 0.7716725158451626,
1784
+ "grad_norm": 3.236130475997925,
1785
+ "learning_rate": 1.8540501894092894e-05,
1786
+ "loss": 0.4463,
1787
+ "step": 14732
1788
+ },
1789
+ {
1790
+ "epoch": 0.7747105966162066,
1791
+ "grad_norm": 1.9471006393432617,
1792
+ "learning_rate": 1.8522059751163578e-05,
1793
+ "loss": 0.4615,
1794
+ "step": 14790
1795
+ },
1796
+ {
1797
+ "epoch": 0.7777486773872505,
1798
+ "grad_norm": 1.1234129667282104,
1799
+ "learning_rate": 1.85035111138352e-05,
1800
+ "loss": 0.3841,
1801
+ "step": 14848
1802
+ },
1803
+ {
1804
+ "epoch": 0.7807867581582945,
1805
+ "grad_norm": 3.155194044113159,
1806
+ "learning_rate": 1.8484856213897496e-05,
1807
+ "loss": 0.4932,
1808
+ "step": 14906
1809
+ },
1810
+ {
1811
+ "epoch": 0.7838248389293384,
1812
+ "grad_norm": 1.2532273530960083,
1813
+ "learning_rate": 1.8466095284468103e-05,
1814
+ "loss": 0.427,
1815
+ "step": 14964
1816
+ },
1817
+ {
1818
+ "epoch": 0.7868629197003824,
1819
+ "grad_norm": 3.315812349319458,
1820
+ "learning_rate": 1.8447228559989618e-05,
1821
+ "loss": 0.4406,
1822
+ "step": 15022
1823
+ },
1824
+ {
1825
+ "epoch": 0.7899010004714263,
1826
+ "grad_norm": 2.3999452590942383,
1827
+ "learning_rate": 1.842858427754608e-05,
1828
+ "loss": 0.4413,
1829
+ "step": 15080
1830
+ },
1831
+ {
1832
+ "epoch": 0.7929390812424703,
1833
+ "grad_norm": 2.896650791168213,
1834
+ "learning_rate": 1.8409508485466538e-05,
1835
+ "loss": 0.4068,
1836
+ "step": 15138
1837
+ },
1838
+ {
1839
+ "epoch": 0.7959771620135142,
1840
+ "grad_norm": 3.3152272701263428,
1841
+ "learning_rate": 1.8390327605464747e-05,
1842
+ "loss": 0.4708,
1843
+ "step": 15196
1844
+ },
1845
+ {
1846
+ "epoch": 0.7990152427845582,
1847
+ "grad_norm": 2.573716163635254,
1848
+ "learning_rate": 1.8371041877231145e-05,
1849
+ "loss": 0.4506,
1850
+ "step": 15254
1851
+ },
1852
+ {
1853
+ "epoch": 0.8020533235556021,
1854
+ "grad_norm": 1.0098395347595215,
1855
+ "learning_rate": 1.8351651541766398e-05,
1856
+ "loss": 0.4614,
1857
+ "step": 15312
1858
+ },
1859
+ {
1860
+ "epoch": 0.805091404326646,
1861
+ "grad_norm": 2.7257494926452637,
1862
+ "learning_rate": 1.8332156841378376e-05,
1863
+ "loss": 0.481,
1864
+ "step": 15370
1865
+ },
1866
+ {
1867
+ "epoch": 0.80812948509769,
1868
+ "grad_norm": 3.291948080062866,
1869
+ "learning_rate": 1.8312558019679113e-05,
1870
+ "loss": 0.4872,
1871
+ "step": 15428
1872
+ },
1873
+ {
1874
+ "epoch": 0.811167565868734,
1875
+ "grad_norm": 0.6372181177139282,
1876
+ "learning_rate": 1.82928553215818e-05,
1877
+ "loss": 0.4664,
1878
+ "step": 15486
1879
+ },
1880
+ {
1881
+ "epoch": 0.8142056466397779,
1882
+ "grad_norm": 2.14487361907959,
1883
+ "learning_rate": 1.8273048993297682e-05,
1884
+ "loss": 0.4443,
1885
+ "step": 15544
1886
+ },
1887
+ {
1888
+ "epoch": 0.8172437274108219,
1889
+ "grad_norm": 1.6703099012374878,
1890
+ "learning_rate": 1.8253139282333005e-05,
1891
+ "loss": 0.4683,
1892
+ "step": 15602
1893
+ },
1894
+ {
1895
+ "epoch": 0.8202818081818658,
1896
+ "grad_norm": 3.7610647678375244,
1897
+ "learning_rate": 1.8233126437485925e-05,
1898
+ "loss": 0.4299,
1899
+ "step": 15660
1900
+ },
1901
+ {
1902
+ "epoch": 0.8233198889529098,
1903
+ "grad_norm": 3.429608106613159,
1904
+ "learning_rate": 1.821301070884338e-05,
1905
+ "loss": 0.3976,
1906
+ "step": 15718
1907
+ },
1908
+ {
1909
+ "epoch": 0.8263579697239537,
1910
+ "grad_norm": 3.0198211669921875,
1911
+ "learning_rate": 1.819279234777799e-05,
1912
+ "loss": 0.407,
1913
+ "step": 15776
1914
+ },
1915
+ {
1916
+ "epoch": 0.8293960504949976,
1917
+ "grad_norm": 3.1796703338623047,
1918
+ "learning_rate": 1.817247160694489e-05,
1919
+ "loss": 0.4235,
1920
+ "step": 15834
1921
+ },
1922
+ {
1923
+ "epoch": 0.8324341312660416,
1924
+ "grad_norm": 2.235328197479248,
1925
+ "learning_rate": 1.81520487402786e-05,
1926
+ "loss": 0.403,
1927
+ "step": 15892
1928
+ },
1929
+ {
1930
+ "epoch": 0.8354722120370855,
1931
+ "grad_norm": 3.7409324645996094,
1932
+ "learning_rate": 1.8131524002989816e-05,
1933
+ "loss": 0.4325,
1934
+ "step": 15950
1935
+ },
1936
+ {
1937
+ "epoch": 0.8385102928081295,
1938
+ "grad_norm": 2.7824206352233887,
1939
+ "learning_rate": 1.811089765156227e-05,
1940
+ "loss": 0.432,
1941
+ "step": 16008
1942
+ },
1943
+ {
1944
+ "epoch": 0.8415483735791734,
1945
+ "grad_norm": 1.6856441497802734,
1946
+ "learning_rate": 1.8090528175270648e-05,
1947
+ "loss": 0.4156,
1948
+ "step": 16066
1949
+ },
1950
+ {
1951
+ "epoch": 0.8445864543502174,
1952
+ "grad_norm": 2.9528396129608154,
1953
+ "learning_rate": 1.8069701110949214e-05,
1954
+ "loss": 0.4486,
1955
+ "step": 16124
1956
+ },
1957
+ {
1958
+ "epoch": 0.8476245351212613,
1959
+ "grad_norm": 1.5881803035736084,
1960
+ "learning_rate": 1.8048773205047752e-05,
1961
+ "loss": 0.4133,
1962
+ "step": 16182
1963
+ },
1964
+ {
1965
+ "epoch": 0.8506626158923053,
1966
+ "grad_norm": 5.50068473815918,
1967
+ "learning_rate": 1.8027744719088103e-05,
1968
+ "loss": 0.4553,
1969
+ "step": 16240
1970
+ },
1971
+ {
1972
+ "epoch": 0.8537006966633492,
1973
+ "grad_norm": 3.2943098545074463,
1974
+ "learning_rate": 1.800661591584899e-05,
1975
+ "loss": 0.4428,
1976
+ "step": 16298
1977
+ },
1978
+ {
1979
+ "epoch": 0.8567387774343932,
1980
+ "grad_norm": 1.3706376552581787,
1981
+ "learning_rate": 1.798538705936273e-05,
1982
+ "loss": 0.4779,
1983
+ "step": 16356
1984
+ },
1985
+ {
1986
+ "epoch": 0.8597768582054371,
1987
+ "grad_norm": 2.18271541595459,
1988
+ "learning_rate": 1.796405841491194e-05,
1989
+ "loss": 0.4687,
1990
+ "step": 16414
1991
+ },
1992
+ {
1993
+ "epoch": 0.8628149389764811,
1994
+ "grad_norm": 2.5106441974639893,
1995
+ "learning_rate": 1.794263024902622e-05,
1996
+ "loss": 0.4016,
1997
+ "step": 16472
1998
+ },
1999
+ {
2000
+ "epoch": 0.865853019747525,
2001
+ "grad_norm": 2.757732629776001,
2002
+ "learning_rate": 1.7921102829478832e-05,
2003
+ "loss": 0.4948,
2004
+ "step": 16530
2005
+ },
2006
+ {
2007
+ "epoch": 0.868891100518569,
2008
+ "grad_norm": 0.37621229887008667,
2009
+ "learning_rate": 1.7899476425283318e-05,
2010
+ "loss": 0.4304,
2011
+ "step": 16588
2012
+ },
2013
+ {
2014
+ "epoch": 0.8719291812896129,
2015
+ "grad_norm": 4.135168552398682,
2016
+ "learning_rate": 1.787775130669019e-05,
2017
+ "loss": 0.4195,
2018
+ "step": 16646
2019
+ },
2020
+ {
2021
+ "epoch": 0.8749672620606569,
2022
+ "grad_norm": 2.2052392959594727,
2023
+ "learning_rate": 1.7855927745183504e-05,
2024
+ "loss": 0.4449,
2025
+ "step": 16704
2026
+ },
2027
+ {
2028
+ "epoch": 0.8780053428317008,
2029
+ "grad_norm": 2.8733346462249756,
2030
+ "learning_rate": 1.7834006013477513e-05,
2031
+ "loss": 0.5016,
2032
+ "step": 16762
2033
+ },
2034
+ {
2035
+ "epoch": 0.8810434236027448,
2036
+ "grad_norm": 1.8927271366119385,
2037
+ "learning_rate": 1.7811986385513226e-05,
2038
+ "loss": 0.3793,
2039
+ "step": 16820
2040
+ },
2041
+ {
2042
+ "epoch": 0.8840815043737887,
2043
+ "grad_norm": 3.7612531185150146,
2044
+ "learning_rate": 1.7789869136454988e-05,
2045
+ "loss": 0.3601,
2046
+ "step": 16878
2047
+ },
2048
+ {
2049
+ "epoch": 0.8871195851448327,
2050
+ "grad_norm": 1.6613848209381104,
2051
+ "learning_rate": 1.7767654542687057e-05,
2052
+ "loss": 0.4772,
2053
+ "step": 16936
2054
+ },
2055
+ {
2056
+ "epoch": 0.8901576659158766,
2057
+ "grad_norm": 2.5755159854888916,
2058
+ "learning_rate": 1.7745342881810144e-05,
2059
+ "loss": 0.4475,
2060
+ "step": 16994
2061
+ },
2062
+ {
2063
+ "epoch": 0.8931957466869206,
2064
+ "grad_norm": 2.7520928382873535,
2065
+ "learning_rate": 1.7722934432637937e-05,
2066
+ "loss": 0.3942,
2067
+ "step": 17052
2068
+ },
2069
+ {
2070
+ "epoch": 0.8962338274579645,
2071
+ "grad_norm": 4.439705848693848,
2072
+ "learning_rate": 1.770042947519362e-05,
2073
+ "loss": 0.4361,
2074
+ "step": 17110
2075
+ },
2076
+ {
2077
+ "epoch": 0.8992719082290085,
2078
+ "grad_norm": 2.091926097869873,
2079
+ "learning_rate": 1.7677828290706382e-05,
2080
+ "loss": 0.42,
2081
+ "step": 17168
2082
+ },
2083
+ {
2084
+ "epoch": 0.9000052380702949,
2085
+ "eval_accuracy": 0.8844256401062012,
2086
+ "eval_loss": 0.44025254249572754,
2087
+ "eval_runtime": 5730.5358,
2088
+ "eval_samples_per_second": 0.835,
2089
+ "eval_steps_per_second": 0.835,
2090
+ "step": 17182
2091
+ }
2092
+ ],
2093
+ "logging_steps": 58,
2094
+ "max_steps": 57273,
2095
+ "num_input_tokens_seen": 0,
2096
+ "num_train_epochs": 3,
2097
+ "save_steps": 17182,
2098
+ "stateful_callbacks": {
2099
+ "TrainerControl": {
2100
+ "args": {
2101
+ "should_epoch_stop": false,
2102
+ "should_evaluate": false,
2103
+ "should_log": false,
2104
+ "should_save": true,
2105
+ "should_training_stop": false
2106
+ },
2107
+ "attributes": {}
2108
+ }
2109
+ },
2110
+ "total_flos": 9.194591202500936e+17,
2111
+ "train_batch_size": 1,
2112
+ "trial_name": null,
2113
+ "trial_params": null
2114
+ }
checkpoint-17182/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45bb857f851eca26cc0f63b7d66112d34751978b5bef3a55585230a15b9e2658
3
+ size 6840
checkpoint-17182/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)
checkpoint-34364/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: /workspace/previous_works/M3D/LaMed/pretrained_model/Llama-3.1-8B-Instruct
3
+ library_name: peft
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.14.0
checkpoint-34364/adapter_config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "/workspace/previous_works/M3D/LaMed/pretrained_model/Llama-3.1-8B-Instruct",
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": 32,
16
+ "lora_bias": false,
17
+ "lora_dropout": 0.05,
18
+ "megatron_config": null,
19
+ "megatron_core": "megatron.core",
20
+ "modules_to_save": null,
21
+ "peft_type": "LORA",
22
+ "r": 16,
23
+ "rank_pattern": {},
24
+ "revision": null,
25
+ "target_modules": [
26
+ "o_proj",
27
+ "down_proj",
28
+ "q_proj",
29
+ "up_proj",
30
+ "v_proj",
31
+ "k_proj",
32
+ "gate_proj"
33
+ ],
34
+ "task_type": "CAUSAL_LM",
35
+ "use_dora": false,
36
+ "use_rslora": false
37
+ }
checkpoint-34364/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:565e3569e37b879cb4dd2a6e09a0498eb76c721ebb1b2b39a362dd6364ad2194
3
+ size 2185310560
checkpoint-34364/global_step34364/mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6ca00cfd6414878bc513c15b99c9e6dfa41a41b70eff589cec6c84288c226926
3
+ size 2740728772
checkpoint-34364/global_step34364/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:952bf876c4537ed6d07f3d14d3b93084aa2192062d2179c5ae2b52f6d51e41f7
3
+ size 16441247696
checkpoint-34364/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step34364
checkpoint-34364/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c59ace3753319f7764a1a83023aab270e8578869d9fe48eee3075a2a3d8aef9
3
+ size 14244
checkpoint-34364/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c7ded1b51a6e39b228666b4e15df74e222fee6f4087593715829e250bd3a9ba
3
+ size 1064
checkpoint-34364/trainer_state.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-34364/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45bb857f851eca26cc0f63b7d66112d34751978b5bef3a55585230a15b9e2658
3
+ size 6840
checkpoint-34364/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)
runs/Mar05_20-22-45_c822449f9bae/events.out.tfevents.1741173988.c822449f9bae.445034.0 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:032924eb0ed156ebd95f063872d9857b1d8ce1b315801a24f3ce1cde80d2b88c
3
+ size 6274
runs/Mar05_20-32-52_c822449f9bae/events.out.tfevents.1741174531.c822449f9bae.451655.0 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ebb88652b1b4241872389ab7a090a2b1269b1b19d70df21ea0dd0994a25d6d2b
3
+ size 9228
runs/Mar05_21-06-22_c822449f9bae/events.out.tfevents.1741176539.c822449f9bae.471134.0 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:beb60ad37fdbbd4761679ff49f2b3c94d2a79936f9c3ab0c0eed07552f7a6f5d
3
+ size 138899