Flyben commited on
Commit
8c849cc
·
verified ·
1 Parent(s): 2aeb6af

Upload 16 files

Browse files
Multitask/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: /home/bingxing2/ailab/gaoben/models/Mistral-7B-Instruct/Mistral-7B-Instruct-v0.2/AI-ModelScope/Mistral-7B-Instruct-v0___2
3
+ library_name: peft
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.15.1
Multitask/adapter_config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "/home/bingxing2/ailab/gaoben/models/Mistral-7B-Instruct/Mistral-7B-Instruct-v0.2/AI-ModelScope/Mistral-7B-Instruct-v0___2",
5
+ "bias": "none",
6
+ "corda_config": null,
7
+ "eva_config": null,
8
+ "exclude_modules": null,
9
+ "fan_in_fan_out": false,
10
+ "inference_mode": true,
11
+ "init_lora_weights": true,
12
+ "layer_replication": null,
13
+ "layers_pattern": null,
14
+ "layers_to_transform": null,
15
+ "loftq_config": {},
16
+ "lora_alpha": 128,
17
+ "lora_bias": false,
18
+ "lora_dropout": 0.0,
19
+ "megatron_config": null,
20
+ "megatron_core": "megatron.core",
21
+ "modules_to_save": null,
22
+ "peft_type": "LORA",
23
+ "r": 64,
24
+ "rank_pattern": {},
25
+ "revision": null,
26
+ "target_modules": [
27
+ "gate_proj",
28
+ "q_proj",
29
+ "down_proj",
30
+ "o_proj",
31
+ "v_proj",
32
+ "up_proj",
33
+ "k_proj"
34
+ ],
35
+ "task_type": "CAUSAL_LM",
36
+ "trainable_token_indices": null,
37
+ "use_dora": false,
38
+ "use_rslora": false
39
+ }
Multitask/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e66c1a723e86dc9e67dd728d08922e3d823c3d0d9887376028c7d0b8597435cd
3
+ size 335605144
Multitask/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step1748
Multitask/rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7d74de51245105e1fbf57a6707ef3538b353952485508f6e2f8f74dc5d479d4
3
+ size 15024
Multitask/rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0617c9eb6cf7df57b2e0bb53cfe17c05f0910de56fe5b14427fe39ab54a44782
3
+ size 15024
Multitask/rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ed68a365057022897d9645ee60902a77102f43215dcdf2ddd5d3842b6a8446d8
3
+ size 15024
Multitask/rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:63ebaa0c302cadbdfcd9f8ee2289e35ecf9c9fc8c9968fc0c05f100dac20c6b9
3
+ size 15024
Multitask/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d84bce0dc28d54d9c075e29d38cb4d4e03938d7b6ffa3b8d32674f5dbaa337a
3
+ size 1064
Multitask/special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "</s>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
Multitask/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
Multitask/tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055
3
+ size 493443
Multitask/tokenizer_config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": null,
5
+ "added_tokens_decoder": {
6
+ "0": {
7
+ "content": "<unk>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<s>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "2": {
23
+ "content": "</s>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ }
30
+ },
31
+ "additional_special_tokens": [],
32
+ "bos_token": "<s>",
33
+ "chat_template": "{{ bos_token }}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if message['role'] == 'user' %}{{ '[INST] ' + message['content'] + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ message['content'] + eos_token}}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}",
34
+ "clean_up_tokenization_spaces": false,
35
+ "eos_token": "</s>",
36
+ "extra_special_tokens": {},
37
+ "legacy": true,
38
+ "model_max_length": 1000000000000000019884624838656,
39
+ "pad_token": "</s>",
40
+ "padding_side": "right",
41
+ "sp_model_kwargs": {},
42
+ "spaces_between_special_tokens": false,
43
+ "split_special_tokens": false,
44
+ "tokenizer_class": "LlamaTokenizer",
45
+ "unk_token": "<unk>",
46
+ "use_default_system_prompt": false
47
+ }
Multitask/trainer_state.json ADDED
@@ -0,0 +1,1426 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 14.993576017130621,
6
+ "eval_steps": 500,
7
+ "global_step": 1740,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.08565310492505353,
14
+ "grad_norm": 5.411635875701904,
15
+ "learning_rate": 9.999339889379647e-06,
16
+ "loss": 1.5609,
17
+ "num_input_tokens_seen": 255328,
18
+ "step": 10
19
+ },
20
+ {
21
+ "epoch": 0.17130620985010706,
22
+ "grad_norm": 0.7214002013206482,
23
+ "learning_rate": 9.997058249278764e-06,
24
+ "loss": 0.2055,
25
+ "num_input_tokens_seen": 510640,
26
+ "step": 20
27
+ },
28
+ {
29
+ "epoch": 0.2569593147751606,
30
+ "grad_norm": 0.47501006722450256,
31
+ "learning_rate": 9.993147673772869e-06,
32
+ "loss": 0.184,
33
+ "num_input_tokens_seen": 763808,
34
+ "step": 30
35
+ },
36
+ {
37
+ "epoch": 0.3426124197002141,
38
+ "grad_norm": 0.20641829073429108,
39
+ "learning_rate": 9.987609437626955e-06,
40
+ "loss": 0.1767,
41
+ "num_input_tokens_seen": 1017472,
42
+ "step": 40
43
+ },
44
+ {
45
+ "epoch": 0.4282655246252677,
46
+ "grad_norm": 0.49966660141944885,
47
+ "learning_rate": 9.98044534618898e-06,
48
+ "loss": 0.1821,
49
+ "num_input_tokens_seen": 1273488,
50
+ "step": 50
51
+ },
52
+ {
53
+ "epoch": 0.5139186295503212,
54
+ "grad_norm": 0.8994255065917969,
55
+ "learning_rate": 9.971657734801385e-06,
56
+ "loss": 0.1819,
57
+ "num_input_tokens_seen": 1527744,
58
+ "step": 60
59
+ },
60
+ {
61
+ "epoch": 0.5995717344753747,
62
+ "grad_norm": 1.7688418626785278,
63
+ "learning_rate": 9.961249468039806e-06,
64
+ "loss": 0.1797,
65
+ "num_input_tokens_seen": 1785520,
66
+ "step": 70
67
+ },
68
+ {
69
+ "epoch": 0.6852248394004282,
70
+ "grad_norm": 0.7211973071098328,
71
+ "learning_rate": 9.949223938779286e-06,
72
+ "loss": 0.1765,
73
+ "num_input_tokens_seen": 2037648,
74
+ "step": 80
75
+ },
76
+ {
77
+ "epoch": 0.7708779443254818,
78
+ "grad_norm": 0.94338458776474,
79
+ "learning_rate": 9.935585067088276e-06,
80
+ "loss": 0.1766,
81
+ "num_input_tokens_seen": 2292464,
82
+ "step": 90
83
+ },
84
+ {
85
+ "epoch": 0.8565310492505354,
86
+ "grad_norm": 0.6227909326553345,
87
+ "learning_rate": 9.920337298950767e-06,
88
+ "loss": 0.1714,
89
+ "num_input_tokens_seen": 2547872,
90
+ "step": 100
91
+ },
92
+ {
93
+ "epoch": 0.9421841541755889,
94
+ "grad_norm": 0.5941164493560791,
95
+ "learning_rate": 9.903485604816993e-06,
96
+ "loss": 0.1728,
97
+ "num_input_tokens_seen": 2801536,
98
+ "step": 110
99
+ },
100
+ {
101
+ "epoch": 1.0342612419700214,
102
+ "grad_norm": 0.4057783782482147,
103
+ "learning_rate": 9.885035477983184e-06,
104
+ "loss": 0.1868,
105
+ "num_input_tokens_seen": 3074416,
106
+ "step": 120
107
+ },
108
+ {
109
+ "epoch": 1.119914346895075,
110
+ "grad_norm": 0.5549430251121521,
111
+ "learning_rate": 9.864992932800845e-06,
112
+ "loss": 0.1679,
113
+ "num_input_tokens_seen": 3327568,
114
+ "step": 130
115
+ },
116
+ {
117
+ "epoch": 1.2055674518201285,
118
+ "grad_norm": 0.41472136974334717,
119
+ "learning_rate": 9.843364502716225e-06,
120
+ "loss": 0.1671,
121
+ "num_input_tokens_seen": 3582240,
122
+ "step": 140
123
+ },
124
+ {
125
+ "epoch": 1.291220556745182,
126
+ "grad_norm": 0.5156757235527039,
127
+ "learning_rate": 9.820157238140535e-06,
128
+ "loss": 0.1682,
129
+ "num_input_tokens_seen": 3838160,
130
+ "step": 150
131
+ },
132
+ {
133
+ "epoch": 1.3768736616702355,
134
+ "grad_norm": 0.5046593546867371,
135
+ "learning_rate": 9.795378704151675e-06,
136
+ "loss": 0.1651,
137
+ "num_input_tokens_seen": 4092304,
138
+ "step": 160
139
+ },
140
+ {
141
+ "epoch": 1.462526766595289,
142
+ "grad_norm": 0.5588434338569641,
143
+ "learning_rate": 9.76903697802817e-06,
144
+ "loss": 0.1649,
145
+ "num_input_tokens_seen": 4346640,
146
+ "step": 170
147
+ },
148
+ {
149
+ "epoch": 1.5481798715203428,
150
+ "grad_norm": 0.46262454986572266,
151
+ "learning_rate": 9.741140646616161e-06,
152
+ "loss": 0.1669,
153
+ "num_input_tokens_seen": 4602192,
154
+ "step": 180
155
+ },
156
+ {
157
+ "epoch": 1.633832976445396,
158
+ "grad_norm": 0.45427972078323364,
159
+ "learning_rate": 9.711698803530253e-06,
160
+ "loss": 0.1674,
161
+ "num_input_tokens_seen": 4858240,
162
+ "step": 190
163
+ },
164
+ {
165
+ "epoch": 1.7194860813704498,
166
+ "grad_norm": 0.4514879882335663,
167
+ "learning_rate": 9.68072104618921e-06,
168
+ "loss": 0.1641,
169
+ "num_input_tokens_seen": 5113408,
170
+ "step": 200
171
+ },
172
+ {
173
+ "epoch": 1.805139186295503,
174
+ "grad_norm": 0.7933849692344666,
175
+ "learning_rate": 9.648217472687385e-06,
176
+ "loss": 0.1614,
177
+ "num_input_tokens_seen": 5368352,
178
+ "step": 210
179
+ },
180
+ {
181
+ "epoch": 1.8907922912205568,
182
+ "grad_norm": 0.6207934021949768,
183
+ "learning_rate": 9.614198678502965e-06,
184
+ "loss": 0.163,
185
+ "num_input_tokens_seen": 5622128,
186
+ "step": 220
187
+ },
188
+ {
189
+ "epoch": 1.9764453961456103,
190
+ "grad_norm": 0.8193040490150452,
191
+ "learning_rate": 9.57867575304406e-06,
192
+ "loss": 0.1589,
193
+ "num_input_tokens_seen": 5876816,
194
+ "step": 230
195
+ },
196
+ {
197
+ "epoch": 2.068522483940043,
198
+ "grad_norm": 1.0469202995300293,
199
+ "learning_rate": 9.541660276033795e-06,
200
+ "loss": 0.1755,
201
+ "num_input_tokens_seen": 6145392,
202
+ "step": 240
203
+ },
204
+ {
205
+ "epoch": 2.154175588865096,
206
+ "grad_norm": 0.9274189472198486,
207
+ "learning_rate": 9.503164313735566e-06,
208
+ "loss": 0.1595,
209
+ "num_input_tokens_seen": 6399504,
210
+ "step": 250
211
+ },
212
+ {
213
+ "epoch": 2.23982869379015,
214
+ "grad_norm": 0.6875982880592346,
215
+ "learning_rate": 9.46320041501969e-06,
216
+ "loss": 0.1563,
217
+ "num_input_tokens_seen": 6654160,
218
+ "step": 260
219
+ },
220
+ {
221
+ "epoch": 2.325481798715203,
222
+ "grad_norm": 0.5835751295089722,
223
+ "learning_rate": 9.421781607272741e-06,
224
+ "loss": 0.1554,
225
+ "num_input_tokens_seen": 6910752,
226
+ "step": 270
227
+ },
228
+ {
229
+ "epoch": 2.411134903640257,
230
+ "grad_norm": 0.6475698351860046,
231
+ "learning_rate": 9.378921392150893e-06,
232
+ "loss": 0.1579,
233
+ "num_input_tokens_seen": 7166960,
234
+ "step": 280
235
+ },
236
+ {
237
+ "epoch": 2.4967880085653107,
238
+ "grad_norm": 0.6029316782951355,
239
+ "learning_rate": 9.33463374117867e-06,
240
+ "loss": 0.1577,
241
+ "num_input_tokens_seen": 7420288,
242
+ "step": 290
243
+ },
244
+ {
245
+ "epoch": 2.582441113490364,
246
+ "grad_norm": 0.6444355845451355,
247
+ "learning_rate": 9.288933091194524e-06,
248
+ "loss": 0.1564,
249
+ "num_input_tokens_seen": 7675184,
250
+ "step": 300
251
+ },
252
+ {
253
+ "epoch": 2.6680942184154177,
254
+ "grad_norm": 0.5541071891784668,
255
+ "learning_rate": 9.241834339644726e-06,
256
+ "loss": 0.1528,
257
+ "num_input_tokens_seen": 7926976,
258
+ "step": 310
259
+ },
260
+ {
261
+ "epoch": 2.753747323340471,
262
+ "grad_norm": 0.6703725457191467,
263
+ "learning_rate": 9.193352839727122e-06,
264
+ "loss": 0.1549,
265
+ "num_input_tokens_seen": 8184992,
266
+ "step": 320
267
+ },
268
+ {
269
+ "epoch": 2.8394004282655247,
270
+ "grad_norm": 0.6515584588050842,
271
+ "learning_rate": 9.143504395386302e-06,
272
+ "loss": 0.157,
273
+ "num_input_tokens_seen": 8439712,
274
+ "step": 330
275
+ },
276
+ {
277
+ "epoch": 2.925053533190578,
278
+ "grad_norm": 0.5527693629264832,
279
+ "learning_rate": 9.09230525616186e-06,
280
+ "loss": 0.157,
281
+ "num_input_tokens_seen": 8694080,
282
+ "step": 340
283
+ },
284
+ {
285
+ "epoch": 3.017130620985011,
286
+ "grad_norm": 0.6593677401542664,
287
+ "learning_rate": 9.039772111891383e-06,
288
+ "loss": 0.1672,
289
+ "num_input_tokens_seen": 8965488,
290
+ "step": 350
291
+ },
292
+ {
293
+ "epoch": 3.102783725910064,
294
+ "grad_norm": 0.5042828917503357,
295
+ "learning_rate": 8.985922087269916e-06,
296
+ "loss": 0.1483,
297
+ "num_input_tokens_seen": 9220480,
298
+ "step": 360
299
+ },
300
+ {
301
+ "epoch": 3.188436830835118,
302
+ "grad_norm": 0.4123888611793518,
303
+ "learning_rate": 8.930772736267675e-06,
304
+ "loss": 0.1532,
305
+ "num_input_tokens_seen": 9477024,
306
+ "step": 370
307
+ },
308
+ {
309
+ "epoch": 3.274089935760171,
310
+ "grad_norm": 0.7851901054382324,
311
+ "learning_rate": 8.874342036407815e-06,
312
+ "loss": 0.1508,
313
+ "num_input_tokens_seen": 9731840,
314
+ "step": 380
315
+ },
316
+ {
317
+ "epoch": 3.359743040685225,
318
+ "grad_norm": 0.7545840740203857,
319
+ "learning_rate": 8.816648382906154e-06,
320
+ "loss": 0.1516,
321
+ "num_input_tokens_seen": 9986704,
322
+ "step": 390
323
+ },
324
+ {
325
+ "epoch": 3.445396145610278,
326
+ "grad_norm": 0.7439327239990234,
327
+ "learning_rate": 8.757710582674708e-06,
328
+ "loss": 0.1506,
329
+ "num_input_tokens_seen": 10238720,
330
+ "step": 400
331
+ },
332
+ {
333
+ "epoch": 3.531049250535332,
334
+ "grad_norm": 0.8343164920806885,
335
+ "learning_rate": 8.697547848191037e-06,
336
+ "loss": 0.1516,
337
+ "num_input_tokens_seen": 10491856,
338
+ "step": 410
339
+ },
340
+ {
341
+ "epoch": 3.6167023554603857,
342
+ "grad_norm": 0.817565381526947,
343
+ "learning_rate": 8.63617979123539e-06,
344
+ "loss": 0.1542,
345
+ "num_input_tokens_seen": 10744240,
346
+ "step": 420
347
+ },
348
+ {
349
+ "epoch": 3.702355460385439,
350
+ "grad_norm": 0.5334470272064209,
351
+ "learning_rate": 8.573626416497669e-06,
352
+ "loss": 0.1446,
353
+ "num_input_tokens_seen": 10996768,
354
+ "step": 430
355
+ },
356
+ {
357
+ "epoch": 3.7880085653104922,
358
+ "grad_norm": 0.9441611766815186,
359
+ "learning_rate": 8.509908115056334e-06,
360
+ "loss": 0.1515,
361
+ "num_input_tokens_seen": 11254560,
362
+ "step": 440
363
+ },
364
+ {
365
+ "epoch": 3.873661670235546,
366
+ "grad_norm": 0.6177489757537842,
367
+ "learning_rate": 8.445045657731329e-06,
368
+ "loss": 0.1513,
369
+ "num_input_tokens_seen": 11512992,
370
+ "step": 450
371
+ },
372
+ {
373
+ "epoch": 3.9593147751605997,
374
+ "grad_norm": 0.5743350982666016,
375
+ "learning_rate": 8.379060188313244e-06,
376
+ "loss": 0.1458,
377
+ "num_input_tokens_seen": 11765808,
378
+ "step": 460
379
+ },
380
+ {
381
+ "epoch": 4.0513918629550325,
382
+ "grad_norm": 0.8525713086128235,
383
+ "learning_rate": 8.311973216670888e-06,
384
+ "loss": 0.1598,
385
+ "num_input_tokens_seen": 12036784,
386
+ "step": 470
387
+ },
388
+ {
389
+ "epoch": 4.137044967880086,
390
+ "grad_norm": 0.6399952173233032,
391
+ "learning_rate": 8.243806611739516e-06,
392
+ "loss": 0.1448,
393
+ "num_input_tokens_seen": 12290592,
394
+ "step": 480
395
+ },
396
+ {
397
+ "epoch": 4.222698072805139,
398
+ "grad_norm": 0.657546877861023,
399
+ "learning_rate": 8.17458259439202e-06,
400
+ "loss": 0.144,
401
+ "num_input_tokens_seen": 12542464,
402
+ "step": 490
403
+ },
404
+ {
405
+ "epoch": 4.308351177730192,
406
+ "grad_norm": 0.6414650678634644,
407
+ "learning_rate": 8.104323730195407e-06,
408
+ "loss": 0.1406,
409
+ "num_input_tokens_seen": 12796848,
410
+ "step": 500
411
+ },
412
+ {
413
+ "epoch": 4.394004282655247,
414
+ "grad_norm": 0.7480872869491577,
415
+ "learning_rate": 8.033052922054882e-06,
416
+ "loss": 0.1436,
417
+ "num_input_tokens_seen": 13051760,
418
+ "step": 510
419
+ },
420
+ {
421
+ "epoch": 4.4796573875803,
422
+ "grad_norm": 0.7025752067565918,
423
+ "learning_rate": 7.960793402748001e-06,
424
+ "loss": 0.147,
425
+ "num_input_tokens_seen": 13305808,
426
+ "step": 520
427
+ },
428
+ {
429
+ "epoch": 4.565310492505353,
430
+ "grad_norm": 0.5708986520767212,
431
+ "learning_rate": 7.887568727351262e-06,
432
+ "loss": 0.1456,
433
+ "num_input_tokens_seen": 13563056,
434
+ "step": 530
435
+ },
436
+ {
437
+ "epoch": 4.650963597430406,
438
+ "grad_norm": 0.6903087496757507,
439
+ "learning_rate": 7.813402765561664e-06,
440
+ "loss": 0.143,
441
+ "num_input_tokens_seen": 13816992,
442
+ "step": 540
443
+ },
444
+ {
445
+ "epoch": 4.736616702355461,
446
+ "grad_norm": 0.6083903908729553,
447
+ "learning_rate": 7.738319693915673e-06,
448
+ "loss": 0.1439,
449
+ "num_input_tokens_seen": 14071936,
450
+ "step": 550
451
+ },
452
+ {
453
+ "epoch": 4.822269807280514,
454
+ "grad_norm": 0.6583831906318665,
455
+ "learning_rate": 7.662343987908195e-06,
456
+ "loss": 0.147,
457
+ "num_input_tokens_seen": 14327440,
458
+ "step": 560
459
+ },
460
+ {
461
+ "epoch": 4.907922912205567,
462
+ "grad_norm": 0.8827478885650635,
463
+ "learning_rate": 7.585500414014077e-06,
464
+ "loss": 0.1467,
465
+ "num_input_tokens_seen": 14582832,
466
+ "step": 570
467
+ },
468
+ {
469
+ "epoch": 4.993576017130621,
470
+ "grad_norm": 0.8274891972541809,
471
+ "learning_rate": 7.507814021614761e-06,
472
+ "loss": 0.1478,
473
+ "num_input_tokens_seen": 14839136,
474
+ "step": 580
475
+ },
476
+ {
477
+ "epoch": 5.085653104925053,
478
+ "grad_norm": 1.3195112943649292,
479
+ "learning_rate": 7.429310134832709e-06,
480
+ "loss": 0.1517,
481
+ "num_input_tokens_seen": 15109264,
482
+ "step": 590
483
+ },
484
+ {
485
+ "epoch": 5.1713062098501075,
486
+ "grad_norm": 0.7981224656105042,
487
+ "learning_rate": 7.35001434427628e-06,
488
+ "loss": 0.1396,
489
+ "num_input_tokens_seen": 15363824,
490
+ "step": 600
491
+ },
492
+ {
493
+ "epoch": 5.256959314775161,
494
+ "grad_norm": 0.6522560715675354,
495
+ "learning_rate": 7.269952498697734e-06,
496
+ "loss": 0.142,
497
+ "num_input_tokens_seen": 15618576,
498
+ "step": 610
499
+ },
500
+ {
501
+ "epoch": 5.342612419700214,
502
+ "grad_norm": 0.7629905343055725,
503
+ "learning_rate": 7.189150696567081e-06,
504
+ "loss": 0.1384,
505
+ "num_input_tokens_seen": 15871056,
506
+ "step": 620
507
+ },
508
+ {
509
+ "epoch": 5.428265524625267,
510
+ "grad_norm": 0.9554848670959473,
511
+ "learning_rate": 7.10763527756453e-06,
512
+ "loss": 0.1405,
513
+ "num_input_tokens_seen": 16124976,
514
+ "step": 630
515
+ },
516
+ {
517
+ "epoch": 5.5139186295503215,
518
+ "grad_norm": 0.8175866603851318,
519
+ "learning_rate": 7.025432813994315e-06,
520
+ "loss": 0.1357,
521
+ "num_input_tokens_seen": 16381680,
522
+ "step": 640
523
+ },
524
+ {
525
+ "epoch": 5.599571734475375,
526
+ "grad_norm": 0.7990790009498596,
527
+ "learning_rate": 6.942570102122679e-06,
528
+ "loss": 0.1387,
529
+ "num_input_tokens_seen": 16638048,
530
+ "step": 650
531
+ },
532
+ {
533
+ "epoch": 5.685224839400428,
534
+ "grad_norm": 0.9116854667663574,
535
+ "learning_rate": 6.859074153442864e-06,
536
+ "loss": 0.1414,
537
+ "num_input_tokens_seen": 16894688,
538
+ "step": 660
539
+ },
540
+ {
541
+ "epoch": 5.770877944325482,
542
+ "grad_norm": 0.7633938789367676,
543
+ "learning_rate": 6.774972185869928e-06,
544
+ "loss": 0.1389,
545
+ "num_input_tokens_seen": 17147808,
546
+ "step": 670
547
+ },
548
+ {
549
+ "epoch": 5.856531049250536,
550
+ "grad_norm": 0.8924551606178284,
551
+ "learning_rate": 6.690291614868287e-06,
552
+ "loss": 0.1361,
553
+ "num_input_tokens_seen": 17403280,
554
+ "step": 680
555
+ },
556
+ {
557
+ "epoch": 5.942184154175589,
558
+ "grad_norm": 0.8566009998321533,
559
+ "learning_rate": 6.60506004451485e-06,
560
+ "loss": 0.1356,
561
+ "num_input_tokens_seen": 17657888,
562
+ "step": 690
563
+ },
564
+ {
565
+ "epoch": 6.034261241970022,
566
+ "grad_norm": 0.9057173132896423,
567
+ "learning_rate": 6.5193052585006666e-06,
568
+ "loss": 0.1483,
569
+ "num_input_tokens_seen": 17927520,
570
+ "step": 700
571
+ },
572
+ {
573
+ "epoch": 6.119914346895075,
574
+ "grad_norm": 0.9895085692405701,
575
+ "learning_rate": 6.433055211074042e-06,
576
+ "loss": 0.1308,
577
+ "num_input_tokens_seen": 18184352,
578
+ "step": 710
579
+ },
580
+ {
581
+ "epoch": 6.205567451820128,
582
+ "grad_norm": 1.0845868587493896,
583
+ "learning_rate": 6.346338017928036e-06,
584
+ "loss": 0.1269,
585
+ "num_input_tokens_seen": 18437792,
586
+ "step": 720
587
+ },
588
+ {
589
+ "epoch": 6.291220556745182,
590
+ "grad_norm": 1.021283745765686,
591
+ "learning_rate": 6.2591819470353424e-06,
592
+ "loss": 0.1301,
593
+ "num_input_tokens_seen": 18690144,
594
+ "step": 730
595
+ },
596
+ {
597
+ "epoch": 6.376873661670236,
598
+ "grad_norm": 1.1350120306015015,
599
+ "learning_rate": 6.171615409433525e-06,
600
+ "loss": 0.1275,
601
+ "num_input_tokens_seen": 18944688,
602
+ "step": 740
603
+ },
604
+ {
605
+ "epoch": 6.462526766595289,
606
+ "grad_norm": 1.0572874546051025,
607
+ "learning_rate": 6.0836669499636255e-06,
608
+ "loss": 0.1264,
609
+ "num_input_tokens_seen": 19199984,
610
+ "step": 750
611
+ },
612
+ {
613
+ "epoch": 6.548179871520342,
614
+ "grad_norm": 1.1884225606918335,
615
+ "learning_rate": 5.995365237965144e-06,
616
+ "loss": 0.1294,
617
+ "num_input_tokens_seen": 19452032,
618
+ "step": 760
619
+ },
620
+ {
621
+ "epoch": 6.6338329764453965,
622
+ "grad_norm": 0.9745492339134216,
623
+ "learning_rate": 5.906739057930439e-06,
624
+ "loss": 0.1262,
625
+ "num_input_tokens_seen": 19707040,
626
+ "step": 770
627
+ },
628
+ {
629
+ "epoch": 6.71948608137045,
630
+ "grad_norm": 1.090391755104065,
631
+ "learning_rate": 5.817817300121592e-06,
632
+ "loss": 0.1266,
633
+ "num_input_tokens_seen": 19962960,
634
+ "step": 780
635
+ },
636
+ {
637
+ "epoch": 6.805139186295503,
638
+ "grad_norm": 1.1640676259994507,
639
+ "learning_rate": 5.728628951152799e-06,
640
+ "loss": 0.1324,
641
+ "num_input_tokens_seen": 20219008,
642
+ "step": 790
643
+ },
644
+ {
645
+ "epoch": 6.890792291220556,
646
+ "grad_norm": 0.9813507199287415,
647
+ "learning_rate": 5.639203084541338e-06,
648
+ "loss": 0.1338,
649
+ "num_input_tokens_seen": 20473664,
650
+ "step": 800
651
+ },
652
+ {
653
+ "epoch": 6.9764453961456105,
654
+ "grad_norm": 1.11289644241333,
655
+ "learning_rate": 5.549568851230219e-06,
656
+ "loss": 0.1273,
657
+ "num_input_tokens_seen": 20727296,
658
+ "step": 810
659
+ },
660
+ {
661
+ "epoch": 7.0685224839400425,
662
+ "grad_norm": 1.5624918937683105,
663
+ "learning_rate": 5.459755470085595e-06,
664
+ "loss": 0.1332,
665
+ "num_input_tokens_seen": 20996432,
666
+ "step": 820
667
+ },
668
+ {
669
+ "epoch": 7.154175588865097,
670
+ "grad_norm": 1.3339862823486328,
671
+ "learning_rate": 5.369792218372026e-06,
672
+ "loss": 0.1104,
673
+ "num_input_tokens_seen": 21252272,
674
+ "step": 830
675
+ },
676
+ {
677
+ "epoch": 7.23982869379015,
678
+ "grad_norm": 1.5236716270446777,
679
+ "learning_rate": 5.2797084222087105e-06,
680
+ "loss": 0.1114,
681
+ "num_input_tokens_seen": 21508208,
682
+ "step": 840
683
+ },
684
+ {
685
+ "epoch": 7.325481798715203,
686
+ "grad_norm": 1.4154669046401978,
687
+ "learning_rate": 5.189533447009795e-06,
688
+ "loss": 0.1134,
689
+ "num_input_tokens_seen": 21765536,
690
+ "step": 850
691
+ },
692
+ {
693
+ "epoch": 7.4111349036402565,
694
+ "grad_norm": 1.5260732173919678,
695
+ "learning_rate": 5.099296687911858e-06,
696
+ "loss": 0.1102,
697
+ "num_input_tokens_seen": 22020160,
698
+ "step": 860
699
+ },
700
+ {
701
+ "epoch": 7.496788008565311,
702
+ "grad_norm": 1.2989623546600342,
703
+ "learning_rate": 5.009027560191732e-06,
704
+ "loss": 0.1122,
705
+ "num_input_tokens_seen": 22274400,
706
+ "step": 870
707
+ },
708
+ {
709
+ "epoch": 7.582441113490364,
710
+ "grad_norm": 1.4925442934036255,
711
+ "learning_rate": 4.918755489677729e-06,
712
+ "loss": 0.1094,
713
+ "num_input_tokens_seen": 22526464,
714
+ "step": 880
715
+ },
716
+ {
717
+ "epoch": 7.668094218415417,
718
+ "grad_norm": 1.3059921264648438,
719
+ "learning_rate": 4.828509903157451e-06,
720
+ "loss": 0.1128,
721
+ "num_input_tokens_seen": 22779664,
722
+ "step": 890
723
+ },
724
+ {
725
+ "epoch": 7.7537473233404715,
726
+ "grad_norm": 1.6819276809692383,
727
+ "learning_rate": 4.738320218785281e-06,
728
+ "loss": 0.1146,
729
+ "num_input_tokens_seen": 23036160,
730
+ "step": 900
731
+ },
732
+ {
733
+ "epoch": 7.839400428265525,
734
+ "grad_norm": 1.3909580707550049,
735
+ "learning_rate": 4.648215836492682e-06,
736
+ "loss": 0.1145,
737
+ "num_input_tokens_seen": 23292016,
738
+ "step": 910
739
+ },
740
+ {
741
+ "epoch": 7.925053533190578,
742
+ "grad_norm": 1.7210851907730103,
743
+ "learning_rate": 4.5582261284044385e-06,
744
+ "loss": 0.1156,
745
+ "num_input_tokens_seen": 23544800,
746
+ "step": 920
747
+ },
748
+ {
749
+ "epoch": 8.01713062098501,
750
+ "grad_norm": 1.2723944187164307,
751
+ "learning_rate": 4.468380429263973e-06,
752
+ "loss": 0.1197,
753
+ "num_input_tokens_seen": 23816288,
754
+ "step": 930
755
+ },
756
+ {
757
+ "epoch": 8.102783725910065,
758
+ "grad_norm": 1.9091925621032715,
759
+ "learning_rate": 4.378708026870825e-06,
760
+ "loss": 0.0916,
761
+ "num_input_tokens_seen": 24071488,
762
+ "step": 940
763
+ },
764
+ {
765
+ "epoch": 8.188436830835117,
766
+ "grad_norm": 1.7839370965957642,
767
+ "learning_rate": 4.289238152533465e-06,
768
+ "loss": 0.0893,
769
+ "num_input_tokens_seen": 24324720,
770
+ "step": 950
771
+ },
772
+ {
773
+ "epoch": 8.274089935760172,
774
+ "grad_norm": 2.00311541557312,
775
+ "learning_rate": 4.199999971540489e-06,
776
+ "loss": 0.0889,
777
+ "num_input_tokens_seen": 24579648,
778
+ "step": 960
779
+ },
780
+ {
781
+ "epoch": 8.359743040685224,
782
+ "grad_norm": 2.047337293624878,
783
+ "learning_rate": 4.111022573653366e-06,
784
+ "loss": 0.0873,
785
+ "num_input_tokens_seen": 24833840,
786
+ "step": 970
787
+ },
788
+ {
789
+ "epoch": 8.445396145610278,
790
+ "grad_norm": 1.9115785360336304,
791
+ "learning_rate": 4.0223349636237766e-06,
792
+ "loss": 0.0904,
793
+ "num_input_tokens_seen": 25089776,
794
+ "step": 980
795
+ },
796
+ {
797
+ "epoch": 8.531049250535332,
798
+ "grad_norm": 1.8445810079574585,
799
+ "learning_rate": 3.933966051738684e-06,
800
+ "loss": 0.088,
801
+ "num_input_tokens_seen": 25345264,
802
+ "step": 990
803
+ },
804
+ {
805
+ "epoch": 8.616702355460385,
806
+ "grad_norm": 1.6529115438461304,
807
+ "learning_rate": 3.845944644396194e-06,
808
+ "loss": 0.0919,
809
+ "num_input_tokens_seen": 25598112,
810
+ "step": 1000
811
+ },
812
+ {
813
+ "epoch": 8.702355460385439,
814
+ "grad_norm": 2.129995346069336,
815
+ "learning_rate": 3.758299434715268e-06,
816
+ "loss": 0.0906,
817
+ "num_input_tokens_seen": 25851728,
818
+ "step": 1010
819
+ },
820
+ {
821
+ "epoch": 8.788008565310493,
822
+ "grad_norm": 2.1039373874664307,
823
+ "learning_rate": 3.6710589931823837e-06,
824
+ "loss": 0.0895,
825
+ "num_input_tokens_seen": 26104704,
826
+ "step": 1020
827
+ },
828
+ {
829
+ "epoch": 8.873661670235546,
830
+ "grad_norm": 2.058598518371582,
831
+ "learning_rate": 3.584251758338151e-06,
832
+ "loss": 0.0923,
833
+ "num_input_tokens_seen": 26361680,
834
+ "step": 1030
835
+ },
836
+ {
837
+ "epoch": 8.9593147751606,
838
+ "grad_norm": 1.8930065631866455,
839
+ "learning_rate": 3.4979060275069576e-06,
840
+ "loss": 0.0908,
841
+ "num_input_tokens_seen": 26617536,
842
+ "step": 1040
843
+ },
844
+ {
845
+ "epoch": 9.051391862955033,
846
+ "grad_norm": 1.8233646154403687,
847
+ "learning_rate": 3.4120499475726266e-06,
848
+ "loss": 0.0847,
849
+ "num_input_tokens_seen": 26888160,
850
+ "step": 1050
851
+ },
852
+ {
853
+ "epoch": 9.137044967880085,
854
+ "grad_norm": 2.1758053302764893,
855
+ "learning_rate": 3.3267115058031418e-06,
856
+ "loss": 0.0657,
857
+ "num_input_tokens_seen": 27142528,
858
+ "step": 1060
859
+ },
860
+ {
861
+ "epoch": 9.222698072805139,
862
+ "grad_norm": 2.0327367782592773,
863
+ "learning_rate": 3.2419185207273816e-06,
864
+ "loss": 0.0662,
865
+ "num_input_tokens_seen": 27394144,
866
+ "step": 1070
867
+ },
868
+ {
869
+ "epoch": 9.308351177730193,
870
+ "grad_norm": 2.2035434246063232,
871
+ "learning_rate": 3.157698633066863e-06,
872
+ "loss": 0.0665,
873
+ "num_input_tokens_seen": 27649488,
874
+ "step": 1080
875
+ },
876
+ {
877
+ "epoch": 9.394004282655246,
878
+ "grad_norm": 1.9066494703292847,
879
+ "learning_rate": 3.0740792967254606e-06,
880
+ "loss": 0.0642,
881
+ "num_input_tokens_seen": 27904992,
882
+ "step": 1090
883
+ },
884
+ {
885
+ "epoch": 9.4796573875803,
886
+ "grad_norm": 2.2175674438476562,
887
+ "learning_rate": 2.991087769840001e-06,
888
+ "loss": 0.0625,
889
+ "num_input_tokens_seen": 28160336,
890
+ "step": 1100
891
+ },
892
+ {
893
+ "epoch": 9.565310492505354,
894
+ "grad_norm": 2.435115337371826,
895
+ "learning_rate": 2.9087511058947014e-06,
896
+ "loss": 0.0643,
897
+ "num_input_tokens_seen": 28417360,
898
+ "step": 1110
899
+ },
900
+ {
901
+ "epoch": 9.650963597430406,
902
+ "grad_norm": 2.237015724182129,
903
+ "learning_rate": 2.827096144902289e-06,
904
+ "loss": 0.0645,
905
+ "num_input_tokens_seen": 28670512,
906
+ "step": 1120
907
+ },
908
+ {
909
+ "epoch": 9.73661670235546,
910
+ "grad_norm": 2.473604202270508,
911
+ "learning_rate": 2.7461495046547436e-06,
912
+ "loss": 0.068,
913
+ "num_input_tokens_seen": 28927232,
914
+ "step": 1130
915
+ },
916
+ {
917
+ "epoch": 9.822269807280513,
918
+ "grad_norm": 2.220705270767212,
919
+ "learning_rate": 2.665937572046432e-06,
920
+ "loss": 0.0647,
921
+ "num_input_tokens_seen": 29182768,
922
+ "step": 1140
923
+ },
924
+ {
925
+ "epoch": 9.907922912205567,
926
+ "grad_norm": 2.652024269104004,
927
+ "learning_rate": 2.586486494472572e-06,
928
+ "loss": 0.0644,
929
+ "num_input_tokens_seen": 29437936,
930
+ "step": 1150
931
+ },
932
+ {
933
+ "epoch": 9.993576017130621,
934
+ "grad_norm": 2.180983304977417,
935
+ "learning_rate": 2.5078221713057048e-06,
936
+ "loss": 0.0658,
937
+ "num_input_tokens_seen": 29690944,
938
+ "step": 1160
939
+ },
940
+ {
941
+ "epoch": 10.085653104925054,
942
+ "grad_norm": 1.6538355350494385,
943
+ "learning_rate": 2.4299702454530605e-06,
944
+ "loss": 0.053,
945
+ "num_input_tokens_seen": 29964448,
946
+ "step": 1170
947
+ },
948
+ {
949
+ "epoch": 10.171306209850107,
950
+ "grad_norm": 2.229673147201538,
951
+ "learning_rate": 2.3529560949975184e-06,
952
+ "loss": 0.0446,
953
+ "num_input_tokens_seen": 30215952,
954
+ "step": 1180
955
+ },
956
+ {
957
+ "epoch": 10.25695931477516,
958
+ "grad_norm": 1.8106822967529297,
959
+ "learning_rate": 2.2768048249248648e-06,
960
+ "loss": 0.0449,
961
+ "num_input_tokens_seen": 30471952,
962
+ "step": 1190
963
+ },
964
+ {
965
+ "epoch": 10.342612419700215,
966
+ "grad_norm": 2.150508403778076,
967
+ "learning_rate": 2.201541258940129e-06,
968
+ "loss": 0.0422,
969
+ "num_input_tokens_seen": 30727376,
970
+ "step": 1200
971
+ },
972
+ {
973
+ "epoch": 10.428265524625267,
974
+ "grad_norm": 2.0471906661987305,
975
+ "learning_rate": 2.12718993137555e-06,
976
+ "loss": 0.0461,
977
+ "num_input_tokens_seen": 30983760,
978
+ "step": 1210
979
+ },
980
+ {
981
+ "epoch": 10.513918629550322,
982
+ "grad_norm": 2.299278497695923,
983
+ "learning_rate": 2.0537750791929296e-06,
984
+ "loss": 0.0458,
985
+ "num_input_tokens_seen": 31238720,
986
+ "step": 1220
987
+ },
988
+ {
989
+ "epoch": 10.599571734475374,
990
+ "grad_norm": 2.1924257278442383,
991
+ "learning_rate": 1.981320634082873e-06,
992
+ "loss": 0.0434,
993
+ "num_input_tokens_seen": 31494560,
994
+ "step": 1230
995
+ },
996
+ {
997
+ "epoch": 10.685224839400428,
998
+ "grad_norm": 2.3524584770202637,
999
+ "learning_rate": 1.909850214663575e-06,
1000
+ "loss": 0.0452,
1001
+ "num_input_tokens_seen": 31750784,
1002
+ "step": 1240
1003
+ },
1004
+ {
1005
+ "epoch": 10.770877944325482,
1006
+ "grad_norm": 2.2468934059143066,
1007
+ "learning_rate": 1.8393871187816526e-06,
1008
+ "loss": 0.0447,
1009
+ "num_input_tokens_seen": 32005120,
1010
+ "step": 1250
1011
+ },
1012
+ {
1013
+ "epoch": 10.856531049250535,
1014
+ "grad_norm": 2.448117971420288,
1015
+ "learning_rate": 1.7699543159175215e-06,
1016
+ "loss": 0.0449,
1017
+ "num_input_tokens_seen": 32258480,
1018
+ "step": 1260
1019
+ },
1020
+ {
1021
+ "epoch": 10.942184154175589,
1022
+ "grad_norm": 2.0848143100738525,
1023
+ "learning_rate": 1.7015744396978557e-06,
1024
+ "loss": 0.0442,
1025
+ "num_input_tokens_seen": 32510944,
1026
+ "step": 1270
1027
+ },
1028
+ {
1029
+ "epoch": 11.034261241970022,
1030
+ "grad_norm": 1.6036432981491089,
1031
+ "learning_rate": 1.634269780517483e-06,
1032
+ "loss": 0.0435,
1033
+ "num_input_tokens_seen": 32780608,
1034
+ "step": 1280
1035
+ },
1036
+ {
1037
+ "epoch": 11.119914346895074,
1038
+ "grad_norm": 3.015963315963745,
1039
+ "learning_rate": 1.568062278273197e-06,
1040
+ "loss": 0.0286,
1041
+ "num_input_tokens_seen": 33034112,
1042
+ "step": 1290
1043
+ },
1044
+ {
1045
+ "epoch": 11.205567451820128,
1046
+ "grad_norm": 1.6929532289505005,
1047
+ "learning_rate": 1.5029735152118125e-06,
1048
+ "loss": 0.0308,
1049
+ "num_input_tokens_seen": 33290224,
1050
+ "step": 1300
1051
+ },
1052
+ {
1053
+ "epoch": 11.291220556745182,
1054
+ "grad_norm": 1.9741885662078857,
1055
+ "learning_rate": 1.4390247088948073e-06,
1056
+ "loss": 0.0309,
1057
+ "num_input_tokens_seen": 33544448,
1058
+ "step": 1310
1059
+ },
1060
+ {
1061
+ "epoch": 11.376873661670235,
1062
+ "grad_norm": 1.5955508947372437,
1063
+ "learning_rate": 1.3762367052818527e-06,
1064
+ "loss": 0.0275,
1065
+ "num_input_tokens_seen": 33799536,
1066
+ "step": 1320
1067
+ },
1068
+ {
1069
+ "epoch": 11.462526766595289,
1070
+ "grad_norm": 2.293123245239258,
1071
+ "learning_rate": 1.3146299719354544e-06,
1072
+ "loss": 0.0304,
1073
+ "num_input_tokens_seen": 34055952,
1074
+ "step": 1330
1075
+ },
1076
+ {
1077
+ "epoch": 11.548179871520343,
1078
+ "grad_norm": 1.8011912107467651,
1079
+ "learning_rate": 1.254224591348983e-06,
1080
+ "loss": 0.0299,
1081
+ "num_input_tokens_seen": 34310000,
1082
+ "step": 1340
1083
+ },
1084
+ {
1085
+ "epoch": 11.633832976445396,
1086
+ "grad_norm": 1.8339879512786865,
1087
+ "learning_rate": 1.1950402544001849e-06,
1088
+ "loss": 0.0311,
1089
+ "num_input_tokens_seen": 34565680,
1090
+ "step": 1350
1091
+ },
1092
+ {
1093
+ "epoch": 11.71948608137045,
1094
+ "grad_norm": 1.6808807849884033,
1095
+ "learning_rate": 1.1370962539323837e-06,
1096
+ "loss": 0.0314,
1097
+ "num_input_tokens_seen": 34820768,
1098
+ "step": 1360
1099
+ },
1100
+ {
1101
+ "epoch": 11.805139186295504,
1102
+ "grad_norm": 1.7647879123687744,
1103
+ "learning_rate": 1.0804114784654158e-06,
1104
+ "loss": 0.0311,
1105
+ "num_input_tokens_seen": 35074016,
1106
+ "step": 1370
1107
+ },
1108
+ {
1109
+ "epoch": 11.890792291220556,
1110
+ "grad_norm": 1.753990650177002,
1111
+ "learning_rate": 1.0250044060383734e-06,
1112
+ "loss": 0.0299,
1113
+ "num_input_tokens_seen": 35328272,
1114
+ "step": 1380
1115
+ },
1116
+ {
1117
+ "epoch": 11.97644539614561,
1118
+ "grad_norm": 2.10841965675354,
1119
+ "learning_rate": 9.708930981861603e-07,
1120
+ "loss": 0.03,
1121
+ "num_input_tokens_seen": 35582880,
1122
+ "step": 1390
1123
+ },
1124
+ {
1125
+ "epoch": 12.068522483940043,
1126
+ "grad_norm": 1.4194451570510864,
1127
+ "learning_rate": 9.180951940518002e-07,
1128
+ "loss": 0.026,
1129
+ "num_input_tokens_seen": 35853280,
1130
+ "step": 1400
1131
+ },
1132
+ {
1133
+ "epoch": 12.154175588865096,
1134
+ "grad_norm": 1.612318515777588,
1135
+ "learning_rate": 8.666279046364595e-07,
1136
+ "loss": 0.0208,
1137
+ "num_input_tokens_seen": 36106816,
1138
+ "step": 1410
1139
+ },
1140
+ {
1141
+ "epoch": 12.23982869379015,
1142
+ "grad_norm": 1.6022765636444092,
1143
+ "learning_rate": 8.165080071890208e-07,
1144
+ "loss": 0.0205,
1145
+ "num_input_tokens_seen": 36359232,
1146
+ "step": 1420
1147
+ },
1148
+ {
1149
+ "epoch": 12.325481798715204,
1150
+ "grad_norm": 1.608430027961731,
1151
+ "learning_rate": 7.677518397370548e-07,
1152
+ "loss": 0.0228,
1153
+ "num_input_tokens_seen": 36614176,
1154
+ "step": 1430
1155
+ },
1156
+ {
1157
+ "epoch": 12.411134903640257,
1158
+ "grad_norm": 1.4423803091049194,
1159
+ "learning_rate": 7.203752957609672e-07,
1160
+ "loss": 0.0207,
1161
+ "num_input_tokens_seen": 36868400,
1162
+ "step": 1440
1163
+ },
1164
+ {
1165
+ "epoch": 12.49678800856531,
1166
+ "grad_norm": 1.6684809923171997,
1167
+ "learning_rate": 6.743938190130616e-07,
1168
+ "loss": 0.0215,
1169
+ "num_input_tokens_seen": 37121536,
1170
+ "step": 1450
1171
+ },
1172
+ {
1173
+ "epoch": 12.582441113490365,
1174
+ "grad_norm": 1.7179003953933716,
1175
+ "learning_rate": 6.298223984832047e-07,
1176
+ "loss": 0.0216,
1177
+ "num_input_tokens_seen": 37377168,
1178
+ "step": 1460
1179
+ },
1180
+ {
1181
+ "epoch": 12.668094218415417,
1182
+ "grad_norm": 1.6454778909683228,
1183
+ "learning_rate": 5.866755635127247e-07,
1184
+ "loss": 0.0207,
1185
+ "num_input_tokens_seen": 37632992,
1186
+ "step": 1470
1187
+ },
1188
+ {
1189
+ "epoch": 12.753747323340471,
1190
+ "grad_norm": 1.8044767379760742,
1191
+ "learning_rate": 5.449673790581611e-07,
1192
+ "loss": 0.0217,
1193
+ "num_input_tokens_seen": 37888640,
1194
+ "step": 1480
1195
+ },
1196
+ {
1197
+ "epoch": 12.839400428265524,
1198
+ "grad_norm": 1.874295711517334,
1199
+ "learning_rate": 5.04711441106382e-07,
1200
+ "loss": 0.0197,
1201
+ "num_input_tokens_seen": 38143760,
1202
+ "step": 1490
1203
+ },
1204
+ {
1205
+ "epoch": 12.925053533190578,
1206
+ "grad_norm": 1.3250926733016968,
1207
+ "learning_rate": 4.659208722425806e-07,
1208
+ "loss": 0.0207,
1209
+ "num_input_tokens_seen": 38398560,
1210
+ "step": 1500
1211
+ },
1212
+ {
1213
+ "epoch": 13.01713062098501,
1214
+ "grad_norm": 1.2411588430404663,
1215
+ "learning_rate": 4.2860831737258857e-07,
1216
+ "loss": 0.0216,
1217
+ "num_input_tokens_seen": 38670912,
1218
+ "step": 1510
1219
+ },
1220
+ {
1221
+ "epoch": 13.102783725910065,
1222
+ "grad_norm": 1.3138427734375,
1223
+ "learning_rate": 3.9278593960090873e-07,
1224
+ "loss": 0.0167,
1225
+ "num_input_tokens_seen": 38925872,
1226
+ "step": 1520
1227
+ },
1228
+ {
1229
+ "epoch": 13.188436830835117,
1230
+ "grad_norm": 1.362457036972046,
1231
+ "learning_rate": 3.5846541626579026e-07,
1232
+ "loss": 0.0159,
1233
+ "num_input_tokens_seen": 39183632,
1234
+ "step": 1530
1235
+ },
1236
+ {
1237
+ "epoch": 13.274089935760172,
1238
+ "grad_norm": 1.515376091003418,
1239
+ "learning_rate": 3.256579351326744e-07,
1240
+ "loss": 0.0156,
1241
+ "num_input_tokens_seen": 39440864,
1242
+ "step": 1540
1243
+ },
1244
+ {
1245
+ "epoch": 13.359743040685224,
1246
+ "grad_norm": 1.4070255756378174,
1247
+ "learning_rate": 2.94374190747212e-07,
1248
+ "loss": 0.0166,
1249
+ "num_input_tokens_seen": 39695712,
1250
+ "step": 1550
1251
+ },
1252
+ {
1253
+ "epoch": 13.445396145610278,
1254
+ "grad_norm": 1.4853448867797852,
1255
+ "learning_rate": 2.64624380949069e-07,
1256
+ "loss": 0.0173,
1257
+ "num_input_tokens_seen": 39950304,
1258
+ "step": 1560
1259
+ },
1260
+ {
1261
+ "epoch": 13.531049250535332,
1262
+ "grad_norm": 1.542286992073059,
1263
+ "learning_rate": 2.3641820354764755e-07,
1264
+ "loss": 0.0165,
1265
+ "num_input_tokens_seen": 40203616,
1266
+ "step": 1570
1267
+ },
1268
+ {
1269
+ "epoch": 13.616702355460385,
1270
+ "grad_norm": 1.565663456916809,
1271
+ "learning_rate": 2.0976485316080375e-07,
1272
+ "loss": 0.0167,
1273
+ "num_input_tokens_seen": 40458464,
1274
+ "step": 1580
1275
+ },
1276
+ {
1277
+ "epoch": 13.702355460385439,
1278
+ "grad_norm": 1.3701163530349731,
1279
+ "learning_rate": 1.846730182175993e-07,
1280
+ "loss": 0.017,
1281
+ "num_input_tokens_seen": 40711216,
1282
+ "step": 1590
1283
+ },
1284
+ {
1285
+ "epoch": 13.788008565310493,
1286
+ "grad_norm": 1.4886751174926758,
1287
+ "learning_rate": 1.6115087812605123e-07,
1288
+ "loss": 0.015,
1289
+ "num_input_tokens_seen": 40965856,
1290
+ "step": 1600
1291
+ },
1292
+ {
1293
+ "epoch": 13.873661670235546,
1294
+ "grad_norm": 1.2140471935272217,
1295
+ "learning_rate": 1.392061006068246e-07,
1296
+ "loss": 0.0169,
1297
+ "num_input_tokens_seen": 41220736,
1298
+ "step": 1610
1299
+ },
1300
+ {
1301
+ "epoch": 13.9593147751606,
1302
+ "grad_norm": 1.314063549041748,
1303
+ "learning_rate": 1.1884583919371251e-07,
1304
+ "loss": 0.0164,
1305
+ "num_input_tokens_seen": 41473952,
1306
+ "step": 1620
1307
+ },
1308
+ {
1309
+ "epoch": 14.051391862955033,
1310
+ "grad_norm": 1.2103674411773682,
1311
+ "learning_rate": 1.0007673090173808e-07,
1312
+ "loss": 0.0168,
1313
+ "num_input_tokens_seen": 41742832,
1314
+ "step": 1630
1315
+ },
1316
+ {
1317
+ "epoch": 14.137044967880085,
1318
+ "grad_norm": 1.250216007232666,
1319
+ "learning_rate": 8.29048940636279e-08,
1320
+ "loss": 0.0153,
1321
+ "num_input_tokens_seen": 41998320,
1322
+ "step": 1640
1323
+ },
1324
+ {
1325
+ "epoch": 14.222698072805139,
1326
+ "grad_norm": 1.114964485168457,
1327
+ "learning_rate": 6.733592633536124e-08,
1328
+ "loss": 0.0148,
1329
+ "num_input_tokens_seen": 42253104,
1330
+ "step": 1650
1331
+ },
1332
+ {
1333
+ "epoch": 14.308351177730193,
1334
+ "grad_norm": 1.3133609294891357,
1335
+ "learning_rate": 5.3374902871456965e-08,
1336
+ "loss": 0.0151,
1337
+ "num_input_tokens_seen": 42509584,
1338
+ "step": 1660
1339
+ },
1340
+ {
1341
+ "epoch": 14.394004282655246,
1342
+ "grad_norm": 1.3046901226043701,
1343
+ "learning_rate": 4.102637467057746e-08,
1344
+ "loss": 0.0144,
1345
+ "num_input_tokens_seen": 42764768,
1346
+ "step": 1670
1347
+ },
1348
+ {
1349
+ "epoch": 14.4796573875803,
1350
+ "grad_norm": 1.3270611763000488,
1351
+ "learning_rate": 3.029436709200084e-08,
1352
+ "loss": 0.0142,
1353
+ "num_input_tokens_seen": 43019376,
1354
+ "step": 1680
1355
+ },
1356
+ {
1357
+ "epoch": 14.565310492505354,
1358
+ "grad_norm": 1.1487038135528564,
1359
+ "learning_rate": 2.1182378543438408e-08,
1360
+ "loss": 0.0159,
1361
+ "num_input_tokens_seen": 43273248,
1362
+ "step": 1690
1363
+ },
1364
+ {
1365
+ "epoch": 14.650963597430406,
1366
+ "grad_norm": 1.1392930746078491,
1367
+ "learning_rate": 1.3693379340626867e-08,
1368
+ "loss": 0.0148,
1369
+ "num_input_tokens_seen": 43529200,
1370
+ "step": 1700
1371
+ },
1372
+ {
1373
+ "epoch": 14.73661670235546,
1374
+ "grad_norm": 1.24246084690094,
1375
+ "learning_rate": 7.829810739069521e-09,
1376
+ "loss": 0.0144,
1377
+ "num_input_tokens_seen": 43781760,
1378
+ "step": 1710
1379
+ },
1380
+ {
1381
+ "epoch": 14.822269807280513,
1382
+ "grad_norm": 1.2764571905136108,
1383
+ "learning_rate": 3.593584138237294e-09,
1384
+ "loss": 0.0142,
1385
+ "num_input_tokens_seen": 44036144,
1386
+ "step": 1720
1387
+ },
1388
+ {
1389
+ "epoch": 14.907922912205567,
1390
+ "grad_norm": 1.4254299402236938,
1391
+ "learning_rate": 9.860804584937988e-10,
1392
+ "loss": 0.0144,
1393
+ "num_input_tokens_seen": 44292256,
1394
+ "step": 1730
1395
+ },
1396
+ {
1397
+ "epoch": 14.993576017130621,
1398
+ "grad_norm": 1.1011109352111816,
1399
+ "learning_rate": 8.149690943204391e-12,
1400
+ "loss": 0.014,
1401
+ "num_input_tokens_seen": 44548112,
1402
+ "step": 1740
1403
+ }
1404
+ ],
1405
+ "logging_steps": 10,
1406
+ "max_steps": 1740,
1407
+ "num_input_tokens_seen": 44548112,
1408
+ "num_train_epochs": 15,
1409
+ "save_steps": 500,
1410
+ "stateful_callbacks": {
1411
+ "TrainerControl": {
1412
+ "args": {
1413
+ "should_epoch_stop": false,
1414
+ "should_evaluate": false,
1415
+ "should_log": false,
1416
+ "should_save": true,
1417
+ "should_training_stop": true
1418
+ },
1419
+ "attributes": {}
1420
+ }
1421
+ },
1422
+ "total_flos": 1.9454424851110953e+18,
1423
+ "train_batch_size": 2,
1424
+ "trial_name": null,
1425
+ "trial_params": null
1426
+ }
Multitask/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee78070b6948641e9d45d7eb61fba486bdbaaa146690d84abf77b19e6e3f5333
3
+ size 7480
Multitask/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)