mlabonne commited on
Commit
44f439e
1 Parent(s): 55056a1

Upload folder using huggingface_hub

Browse files
Files changed (39) hide show
  1. README.md +27 -15
  2. adapter_config.json +9 -9
  3. adapter_model.bin +2 -2
  4. checkpoint-126/README.md +202 -0
  5. checkpoint-126/adapter_config.json +39 -0
  6. checkpoint-126/adapter_model.safetensors +3 -0
  7. checkpoint-126/global_step126/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt +3 -0
  8. checkpoint-126/global_step126/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt +3 -0
  9. checkpoint-126/global_step126/mp_rank_00_model_states.pt +3 -0
  10. checkpoint-126/latest +1 -0
  11. checkpoint-126/rng_state_0.pth +3 -0
  12. checkpoint-126/rng_state_1.pth +3 -0
  13. checkpoint-126/scheduler.pt +3 -0
  14. checkpoint-126/special_tokens_map.json +30 -0
  15. checkpoint-126/tokenizer.json +0 -0
  16. checkpoint-126/tokenizer.model +3 -0
  17. checkpoint-126/tokenizer_config.json +48 -0
  18. checkpoint-126/trainer_state.json +935 -0
  19. checkpoint-126/training_args.bin +3 -0
  20. checkpoint-126/zero_to_fp32.py +592 -0
  21. checkpoint-168/README.md +202 -0
  22. checkpoint-168/adapter_config.json +39 -0
  23. checkpoint-168/adapter_model.safetensors +3 -0
  24. checkpoint-168/global_step168/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt +3 -0
  25. checkpoint-168/global_step168/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt +3 -0
  26. checkpoint-168/global_step168/mp_rank_00_model_states.pt +3 -0
  27. checkpoint-168/latest +1 -0
  28. checkpoint-168/rng_state_0.pth +3 -0
  29. checkpoint-168/rng_state_1.pth +3 -0
  30. checkpoint-168/scheduler.pt +3 -0
  31. checkpoint-168/special_tokens_map.json +30 -0
  32. checkpoint-168/tokenizer.json +0 -0
  33. checkpoint-168/tokenizer.model +3 -0
  34. checkpoint-168/tokenizer_config.json +48 -0
  35. checkpoint-168/trainer_state.json +1237 -0
  36. checkpoint-168/training_args.bin +3 -0
  37. checkpoint-168/zero_to_fp32.py +592 -0
  38. config.json +7 -9
  39. tokenizer_config.json +1 -0
README.md CHANGED
@@ -7,11 +7,10 @@ base_model: ai21labs/Jamba-v0.1
7
  model-index:
8
  - name: out
9
  results: []
10
- datasets:
11
- - chargoddard/Open-Platypus-Chat
12
  ---
13
 
14
- # Jambatypus
 
15
 
16
  [<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
17
  <details><summary>See axolotl config</summary>
@@ -33,7 +32,6 @@ chat_template: chatml
33
  dataset_prepared_path:
34
  val_set_size: 0.01
35
  output_dir: ./out
36
- hub_strategy: every_save
37
 
38
  sequence_len: 4096
39
  sample_packing: true
@@ -80,9 +78,6 @@ logging_steps: 1
80
  xformers_attention:
81
  flash_attention: true
82
 
83
- loss_watchdog_threshold: 5.0
84
- loss_watchdog_patience: 3
85
-
86
  warmup_steps: 10
87
  evals_per_epoch: 4
88
  saves_per_epoch: 4
@@ -96,9 +91,23 @@ special_tokens:
96
 
97
  </details><br>
98
 
99
- This model is a fine-tuned version of [ai21labs/Jamba-v0.1](https://huggingface.co/ai21labs/Jamba-v0.1) on the [chargoddard/Open-Platypus-Chat](https://huggingface.co/datasets/chargoddard/Open-Platypus-Chat) dataset.
 
 
100
  It achieves the following results on the evaluation set:
101
- - Loss: 0.9573
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  ## Training procedure
104
 
@@ -109,8 +118,11 @@ The following hyperparameters were used during training:
109
  - train_batch_size: 1
110
  - eval_batch_size: 1
111
  - seed: 42
 
 
112
  - gradient_accumulation_steps: 8
113
- - total_train_batch_size: 8
 
114
  - optimizer: Adam with betas=(0.9,0.95) and epsilon=1e-05
115
  - lr_scheduler_type: cosine
116
  - lr_scheduler_warmup_steps: 10
@@ -120,11 +132,11 @@ The following hyperparameters were used during training:
120
 
121
  | Training Loss | Epoch | Step | Validation Loss |
122
  |:-------------:|:-----:|:----:|:---------------:|
123
- | 0.5915 | 0.0 | 1 | 1.0279 |
124
- | 0.4249 | 0.25 | 84 | 0.9711 |
125
- | 0.3911 | 0.5 | 168 | 0.9590 |
126
- | 0.4655 | 0.75 | 252 | 0.9628 |
127
- | 0.4569 | 1.0 | 336 | 0.9573 |
128
 
129
 
130
  ### Framework versions
 
7
  model-index:
8
  - name: out
9
  results: []
 
 
10
  ---
11
 
12
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
13
+ should probably proofread and complete it, then remove this comment. -->
14
 
15
  [<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
16
  <details><summary>See axolotl config</summary>
 
32
  dataset_prepared_path:
33
  val_set_size: 0.01
34
  output_dir: ./out
 
35
 
36
  sequence_len: 4096
37
  sample_packing: true
 
78
  xformers_attention:
79
  flash_attention: true
80
 
 
 
 
81
  warmup_steps: 10
82
  evals_per_epoch: 4
83
  saves_per_epoch: 4
 
91
 
92
  </details><br>
93
 
94
+ # out
95
+
96
+ This model is a fine-tuned version of [ai21labs/Jamba-v0.1](https://huggingface.co/ai21labs/Jamba-v0.1) on the None dataset.
97
  It achieves the following results on the evaluation set:
98
+ - Loss: 0.9651
99
+
100
+ ## Model description
101
+
102
+ More information needed
103
+
104
+ ## Intended uses & limitations
105
+
106
+ More information needed
107
+
108
+ ## Training and evaluation data
109
+
110
+ More information needed
111
 
112
  ## Training procedure
113
 
 
118
  - train_batch_size: 1
119
  - eval_batch_size: 1
120
  - seed: 42
121
+ - distributed_type: multi-GPU
122
+ - num_devices: 2
123
  - gradient_accumulation_steps: 8
124
+ - total_train_batch_size: 16
125
+ - total_eval_batch_size: 2
126
  - optimizer: Adam with betas=(0.9,0.95) and epsilon=1e-05
127
  - lr_scheduler_type: cosine
128
  - lr_scheduler_warmup_steps: 10
 
132
 
133
  | Training Loss | Epoch | Step | Validation Loss |
134
  |:-------------:|:-----:|:----:|:---------------:|
135
+ | 0.6274 | 0.01 | 1 | 1.0298 |
136
+ | 0.4403 | 0.25 | 42 | 0.9768 |
137
+ | 0.4417 | 0.5 | 84 | 0.9675 |
138
+ | 0.4451 | 0.75 | 126 | 0.9652 |
139
+ | 0.4616 | 1.0 | 168 | 0.9651 |
140
 
141
 
142
  ### Framework versions
adapter_config.json CHANGED
@@ -20,18 +20,18 @@
20
  "rank_pattern": {},
21
  "revision": null,
22
  "target_modules": [
23
- "gate_proj",
24
- "q_proj",
 
 
 
 
25
  "k_proj",
 
26
  "in_proj",
 
27
  "out_proj",
28
- "dt_proj",
29
- "down_proj",
30
- "router",
31
- "up_proj",
32
- "o_proj",
33
- "v_proj",
34
- "x_proj"
35
  ],
36
  "task_type": "CAUSAL_LM",
37
  "use_dora": false,
 
20
  "rank_pattern": {},
21
  "revision": null,
22
  "target_modules": [
23
+ "x_proj",
24
+ "o_proj",
25
+ "up_proj",
26
+ "v_proj",
27
+ "down_proj",
28
+ "dt_proj",
29
  "k_proj",
30
+ "q_proj",
31
  "in_proj",
32
+ "gate_proj",
33
  "out_proj",
34
+ "router"
 
 
 
 
 
 
35
  ],
36
  "task_type": "CAUSAL_LM",
37
  "use_dora": false,
adapter_model.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:08b546e88fba6a21cb58cb344345b20a7fe1c09f4e948ca61b90164deb1efdd3
3
- size 1063383458
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:485eddbdd38763c9850251f824a3877a9ddc0db9c893fae77c6ad1f9eb0d379c
3
+ size 531653306
checkpoint-126/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ base_model: ai21labs/Jamba-v0.1
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.10.0
checkpoint-126/adapter_config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "ai21labs/Jamba-v0.1",
5
+ "bias": "none",
6
+ "fan_in_fan_out": null,
7
+ "inference_mode": true,
8
+ "init_lora_weights": true,
9
+ "layer_replication": null,
10
+ "layers_pattern": null,
11
+ "layers_to_transform": null,
12
+ "loftq_config": {},
13
+ "lora_alpha": 32,
14
+ "lora_dropout": 0.05,
15
+ "megatron_config": null,
16
+ "megatron_core": "megatron.core",
17
+ "modules_to_save": null,
18
+ "peft_type": "LORA",
19
+ "r": 16,
20
+ "rank_pattern": {},
21
+ "revision": null,
22
+ "target_modules": [
23
+ "x_proj",
24
+ "o_proj",
25
+ "up_proj",
26
+ "v_proj",
27
+ "down_proj",
28
+ "dt_proj",
29
+ "k_proj",
30
+ "q_proj",
31
+ "in_proj",
32
+ "gate_proj",
33
+ "out_proj",
34
+ "router"
35
+ ],
36
+ "task_type": "CAUSAL_LM",
37
+ "use_dora": false,
38
+ "use_rslora": false
39
+ }
checkpoint-126/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be949fb50dbe53d64e9f4375ed327e36ae2368bf683cfdaf813667de418fcbb8
3
+ size 531611600
checkpoint-126/global_step126/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f6998ecb2f6d60f27d30371a8ce207805cf8a48dd8f296036fff813d22b65593
3
+ size 797643792
checkpoint-126/global_step126/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f504e0638f11f71fa63e7587596b481c876e9ec17a2e4703833ab1713a855b1
3
+ size 797644432
checkpoint-126/global_step126/mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:271bfc43b751ef756538a0f6b19ee11530e5d5c9f68f5e3c3b086877dc1d3a6a
3
+ size 1345660121
checkpoint-126/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step126
checkpoint-126/rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:601237d8f7ccca9157ec802c2d8dbf105a33ca51949abaf17e8caac019fa582f
3
+ size 14512
checkpoint-126/rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b453660e9304c04b047fceaa4cad80dfb1b50b01880351c794e0268dc4d5d75
3
+ size 14512
checkpoint-126/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb0b78cebb6cf02731e93f8b5296f19d99fc5821bb80f3f750f5f7f3c9de25e2
3
+ size 1064
checkpoint-126/special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|startoftext|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|endoftext|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<|pad|>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<|unk|>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
checkpoint-126/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-126/tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02fd6530b8ede0eedd8e509fcab32da7b1dd04c8119f8498c787100f13112713
3
+ size 1124742
checkpoint-126/tokenizer_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<|pad|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<|startoftext|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "<|endoftext|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "3": {
30
+ "content": "<|unk|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ }
37
+ },
38
+ "bos_token": "<|startoftext|>",
39
+ "chat_template": "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
40
+ "clean_up_tokenization_spaces": false,
41
+ "eos_token": "<|endoftext|>",
42
+ "model_max_length": 1000000000000000019884624838656,
43
+ "pad_token": "<|pad|>",
44
+ "spaces_between_special_tokens": false,
45
+ "tokenizer_class": "LlamaTokenizer",
46
+ "unk_token": "<|unk|>",
47
+ "use_default_system_prompt": false
48
+ }
checkpoint-126/trainer_state.json ADDED
@@ -0,0 +1,935 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.7488855869242199,
5
+ "eval_steps": 42,
6
+ "global_step": 126,
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.01,
13
+ "grad_norm": 0.30475762367257353,
14
+ "learning_rate": 2e-05,
15
+ "loss": 0.6274,
16
+ "step": 1
17
+ },
18
+ {
19
+ "epoch": 0.01,
20
+ "eval_loss": 1.0297596454620361,
21
+ "eval_runtime": 150.6014,
22
+ "eval_samples_per_second": 1.653,
23
+ "eval_steps_per_second": 0.83,
24
+ "step": 1
25
+ },
26
+ {
27
+ "epoch": 0.01,
28
+ "grad_norm": 0.2798137150913395,
29
+ "learning_rate": 4e-05,
30
+ "loss": 0.6362,
31
+ "step": 2
32
+ },
33
+ {
34
+ "epoch": 0.02,
35
+ "grad_norm": 0.3178684451319545,
36
+ "learning_rate": 6e-05,
37
+ "loss": 0.6299,
38
+ "step": 3
39
+ },
40
+ {
41
+ "epoch": 0.02,
42
+ "grad_norm": 0.33651284916847835,
43
+ "learning_rate": 8e-05,
44
+ "loss": 0.6391,
45
+ "step": 4
46
+ },
47
+ {
48
+ "epoch": 0.03,
49
+ "grad_norm": 0.23984915388648712,
50
+ "learning_rate": 0.0001,
51
+ "loss": 0.6071,
52
+ "step": 5
53
+ },
54
+ {
55
+ "epoch": 0.04,
56
+ "grad_norm": 0.20514040410017348,
57
+ "learning_rate": 0.00012,
58
+ "loss": 0.5996,
59
+ "step": 6
60
+ },
61
+ {
62
+ "epoch": 0.04,
63
+ "grad_norm": 0.1950018128286362,
64
+ "learning_rate": 0.00014,
65
+ "loss": 0.6298,
66
+ "step": 7
67
+ },
68
+ {
69
+ "epoch": 0.05,
70
+ "grad_norm": 0.14246019947393238,
71
+ "learning_rate": 0.00016,
72
+ "loss": 0.5108,
73
+ "step": 8
74
+ },
75
+ {
76
+ "epoch": 0.05,
77
+ "grad_norm": 0.15792014279750227,
78
+ "learning_rate": 0.00018,
79
+ "loss": 0.5529,
80
+ "step": 9
81
+ },
82
+ {
83
+ "epoch": 0.06,
84
+ "grad_norm": 0.1517889177511264,
85
+ "learning_rate": 0.0002,
86
+ "loss": 0.5433,
87
+ "step": 10
88
+ },
89
+ {
90
+ "epoch": 0.07,
91
+ "grad_norm": 0.1372121219437277,
92
+ "learning_rate": 0.00019998023297700658,
93
+ "loss": 0.5856,
94
+ "step": 11
95
+ },
96
+ {
97
+ "epoch": 0.07,
98
+ "grad_norm": 0.16740807394942855,
99
+ "learning_rate": 0.00019992093972273018,
100
+ "loss": 0.5546,
101
+ "step": 12
102
+ },
103
+ {
104
+ "epoch": 0.08,
105
+ "grad_norm": 0.13512320693394078,
106
+ "learning_rate": 0.00019982214367819328,
107
+ "loss": 0.6193,
108
+ "step": 13
109
+ },
110
+ {
111
+ "epoch": 0.08,
112
+ "grad_norm": 0.16169796294070152,
113
+ "learning_rate": 0.0001996838839014696,
114
+ "loss": 0.5495,
115
+ "step": 14
116
+ },
117
+ {
118
+ "epoch": 0.09,
119
+ "grad_norm": 0.16796913812281988,
120
+ "learning_rate": 0.00019950621505224273,
121
+ "loss": 0.5035,
122
+ "step": 15
123
+ },
124
+ {
125
+ "epoch": 0.1,
126
+ "grad_norm": 0.1800514764162192,
127
+ "learning_rate": 0.00019928920737019733,
128
+ "loss": 0.5083,
129
+ "step": 16
130
+ },
131
+ {
132
+ "epoch": 0.1,
133
+ "grad_norm": 0.170432124866908,
134
+ "learning_rate": 0.0001990329466472502,
135
+ "loss": 0.632,
136
+ "step": 17
137
+ },
138
+ {
139
+ "epoch": 0.11,
140
+ "grad_norm": 0.19129325489749488,
141
+ "learning_rate": 0.00019873753419363336,
142
+ "loss": 0.4813,
143
+ "step": 18
144
+ },
145
+ {
146
+ "epoch": 0.11,
147
+ "grad_norm": 0.1459357988760762,
148
+ "learning_rate": 0.00019840308679784207,
149
+ "loss": 0.4973,
150
+ "step": 19
151
+ },
152
+ {
153
+ "epoch": 0.12,
154
+ "grad_norm": 0.192594730984382,
155
+ "learning_rate": 0.00019802973668046363,
156
+ "loss": 0.5291,
157
+ "step": 20
158
+ },
159
+ {
160
+ "epoch": 0.12,
161
+ "grad_norm": 0.859025467969139,
162
+ "learning_rate": 0.0001976176314419051,
163
+ "loss": 0.5296,
164
+ "step": 21
165
+ },
166
+ {
167
+ "epoch": 0.13,
168
+ "grad_norm": 0.13366297885670222,
169
+ "learning_rate": 0.000197166934004041,
170
+ "loss": 0.4819,
171
+ "step": 22
172
+ },
173
+ {
174
+ "epoch": 0.14,
175
+ "grad_norm": 0.15698714419747645,
176
+ "learning_rate": 0.00019667782254580374,
177
+ "loss": 0.5409,
178
+ "step": 23
179
+ },
180
+ {
181
+ "epoch": 0.14,
182
+ "grad_norm": 0.10995943735837355,
183
+ "learning_rate": 0.00019615049043274205,
184
+ "loss": 0.5108,
185
+ "step": 24
186
+ },
187
+ {
188
+ "epoch": 0.15,
189
+ "grad_norm": 0.10796742192788925,
190
+ "learning_rate": 0.00019558514614057609,
191
+ "loss": 0.5215,
192
+ "step": 25
193
+ },
194
+ {
195
+ "epoch": 0.15,
196
+ "grad_norm": 0.11641740089490231,
197
+ "learning_rate": 0.00019498201317277828,
198
+ "loss": 0.5012,
199
+ "step": 26
200
+ },
201
+ {
202
+ "epoch": 0.16,
203
+ "grad_norm": 0.1120175962893241,
204
+ "learning_rate": 0.00019434132997221345,
205
+ "loss": 0.474,
206
+ "step": 27
207
+ },
208
+ {
209
+ "epoch": 0.17,
210
+ "grad_norm": 0.1218171278782483,
211
+ "learning_rate": 0.0001936633498268728,
212
+ "loss": 0.5216,
213
+ "step": 28
214
+ },
215
+ {
216
+ "epoch": 0.17,
217
+ "grad_norm": 0.11718521115928844,
218
+ "learning_rate": 0.0001929483407697387,
219
+ "loss": 0.4856,
220
+ "step": 29
221
+ },
222
+ {
223
+ "epoch": 0.18,
224
+ "grad_norm": 0.12611471038571026,
225
+ "learning_rate": 0.00019219658547282067,
226
+ "loss": 0.4823,
227
+ "step": 30
228
+ },
229
+ {
230
+ "epoch": 0.18,
231
+ "grad_norm": 0.11106871615269753,
232
+ "learning_rate": 0.00019140838113540346,
233
+ "loss": 0.4869,
234
+ "step": 31
235
+ },
236
+ {
237
+ "epoch": 0.19,
238
+ "grad_norm": 0.1416503230360699,
239
+ "learning_rate": 0.00019058403936655233,
240
+ "loss": 0.5341,
241
+ "step": 32
242
+ },
243
+ {
244
+ "epoch": 0.2,
245
+ "grad_norm": 0.10761396399791698,
246
+ "learning_rate": 0.00018972388606192125,
247
+ "loss": 0.4304,
248
+ "step": 33
249
+ },
250
+ {
251
+ "epoch": 0.2,
252
+ "grad_norm": 0.10975376180434356,
253
+ "learning_rate": 0.0001888282612749132,
254
+ "loss": 0.4646,
255
+ "step": 34
256
+ },
257
+ {
258
+ "epoch": 0.21,
259
+ "grad_norm": 0.12848879670359908,
260
+ "learning_rate": 0.00018789751908224338,
261
+ "loss": 0.4972,
262
+ "step": 35
263
+ },
264
+ {
265
+ "epoch": 0.21,
266
+ "grad_norm": 0.11904721819683833,
267
+ "learning_rate": 0.00018693202744395827,
268
+ "loss": 0.505,
269
+ "step": 36
270
+ },
271
+ {
272
+ "epoch": 0.22,
273
+ "grad_norm": 0.12249852034224981,
274
+ "learning_rate": 0.00018593216805796612,
275
+ "loss": 0.5396,
276
+ "step": 37
277
+ },
278
+ {
279
+ "epoch": 0.23,
280
+ "grad_norm": 0.12453395046646995,
281
+ "learning_rate": 0.00018489833620913642,
282
+ "loss": 0.4917,
283
+ "step": 38
284
+ },
285
+ {
286
+ "epoch": 0.23,
287
+ "grad_norm": 0.12585770374422164,
288
+ "learning_rate": 0.00018383094061302766,
289
+ "loss": 0.5079,
290
+ "step": 39
291
+ },
292
+ {
293
+ "epoch": 0.24,
294
+ "grad_norm": 0.11095271476322731,
295
+ "learning_rate": 0.00018273040325430574,
296
+ "loss": 0.4812,
297
+ "step": 40
298
+ },
299
+ {
300
+ "epoch": 0.24,
301
+ "grad_norm": 0.12968115101635422,
302
+ "learning_rate": 0.00018159715921991612,
303
+ "loss": 0.5106,
304
+ "step": 41
305
+ },
306
+ {
307
+ "epoch": 0.25,
308
+ "grad_norm": 0.10933018515590627,
309
+ "learning_rate": 0.00018043165652707649,
310
+ "loss": 0.4403,
311
+ "step": 42
312
+ },
313
+ {
314
+ "epoch": 0.25,
315
+ "eval_loss": 0.9767947196960449,
316
+ "eval_runtime": 152.0343,
317
+ "eval_samples_per_second": 1.638,
318
+ "eval_steps_per_second": 0.822,
319
+ "step": 42
320
+ },
321
+ {
322
+ "epoch": 0.26,
323
+ "grad_norm": 0.11525719626792096,
324
+ "learning_rate": 0.00017923435594615744,
325
+ "loss": 0.482,
326
+ "step": 43
327
+ },
328
+ {
329
+ "epoch": 0.26,
330
+ "grad_norm": 0.12962154411778218,
331
+ "learning_rate": 0.00017800573081852122,
332
+ "loss": 0.5452,
333
+ "step": 44
334
+ },
335
+ {
336
+ "epoch": 0.27,
337
+ "grad_norm": 0.12555700120045588,
338
+ "learning_rate": 0.0001767462668693908,
339
+ "loss": 0.5084,
340
+ "step": 45
341
+ },
342
+ {
343
+ "epoch": 0.27,
344
+ "grad_norm": 0.11427565378293324,
345
+ "learning_rate": 0.00017545646201582303,
346
+ "loss": 0.5191,
347
+ "step": 46
348
+ },
349
+ {
350
+ "epoch": 0.28,
351
+ "grad_norm": 0.10974901402857151,
352
+ "learning_rate": 0.00017413682616986185,
353
+ "loss": 0.4703,
354
+ "step": 47
355
+ },
356
+ {
357
+ "epoch": 0.29,
358
+ "grad_norm": 0.11781465084480325,
359
+ "learning_rate": 0.00017278788103694943,
360
+ "loss": 0.4548,
361
+ "step": 48
362
+ },
363
+ {
364
+ "epoch": 0.29,
365
+ "grad_norm": 0.10781807228559999,
366
+ "learning_rate": 0.000171410159909675,
367
+ "loss": 0.476,
368
+ "step": 49
369
+ },
370
+ {
371
+ "epoch": 0.3,
372
+ "grad_norm": 0.12502639462035098,
373
+ "learning_rate": 0.00017000420745694254,
374
+ "loss": 0.5084,
375
+ "step": 50
376
+ },
377
+ {
378
+ "epoch": 0.3,
379
+ "grad_norm": 0.10718920826593327,
380
+ "learning_rate": 0.00016857057950864132,
381
+ "loss": 0.5093,
382
+ "step": 51
383
+ },
384
+ {
385
+ "epoch": 0.31,
386
+ "grad_norm": 0.10040549880547282,
387
+ "learning_rate": 0.0001671098428359037,
388
+ "loss": 0.4644,
389
+ "step": 52
390
+ },
391
+ {
392
+ "epoch": 0.32,
393
+ "grad_norm": 0.11778478994740472,
394
+ "learning_rate": 0.00016562257492703757,
395
+ "loss": 0.4725,
396
+ "step": 53
397
+ },
398
+ {
399
+ "epoch": 0.32,
400
+ "grad_norm": 0.1008386031049932,
401
+ "learning_rate": 0.000164109363759222,
402
+ "loss": 0.5121,
403
+ "step": 54
404
+ },
405
+ {
406
+ "epoch": 0.33,
407
+ "grad_norm": 0.1170302528140235,
408
+ "learning_rate": 0.000162570807566056,
409
+ "loss": 0.4766,
410
+ "step": 55
411
+ },
412
+ {
413
+ "epoch": 0.33,
414
+ "grad_norm": 0.1104526773884303,
415
+ "learning_rate": 0.00016100751460105243,
416
+ "loss": 0.4886,
417
+ "step": 56
418
+ },
419
+ {
420
+ "epoch": 0.34,
421
+ "grad_norm": 0.10467920768691032,
422
+ "learning_rate": 0.00015942010289717105,
423
+ "loss": 0.4703,
424
+ "step": 57
425
+ },
426
+ {
427
+ "epoch": 0.34,
428
+ "grad_norm": 0.11551406829220555,
429
+ "learning_rate": 0.00015780920002248484,
430
+ "loss": 0.4837,
431
+ "step": 58
432
+ },
433
+ {
434
+ "epoch": 0.35,
435
+ "grad_norm": 0.11133818831887894,
436
+ "learning_rate": 0.0001561754428320771,
437
+ "loss": 0.5148,
438
+ "step": 59
439
+ },
440
+ {
441
+ "epoch": 0.36,
442
+ "grad_norm": 0.11281448423273216,
443
+ "learning_rate": 0.00015451947721626676,
444
+ "loss": 0.4561,
445
+ "step": 60
446
+ },
447
+ {
448
+ "epoch": 0.36,
449
+ "grad_norm": 0.13934126997471205,
450
+ "learning_rate": 0.00015284195784526195,
451
+ "loss": 0.5069,
452
+ "step": 61
453
+ },
454
+ {
455
+ "epoch": 0.37,
456
+ "grad_norm": 0.11851655387640142,
457
+ "learning_rate": 0.00015114354791034225,
458
+ "loss": 0.5094,
459
+ "step": 62
460
+ },
461
+ {
462
+ "epoch": 0.37,
463
+ "grad_norm": 0.12909148374566123,
464
+ "learning_rate": 0.0001494249188616723,
465
+ "loss": 0.581,
466
+ "step": 63
467
+ },
468
+ {
469
+ "epoch": 0.38,
470
+ "grad_norm": 0.11070161341925377,
471
+ "learning_rate": 0.00014768675014285062,
472
+ "loss": 0.4585,
473
+ "step": 64
474
+ },
475
+ {
476
+ "epoch": 0.39,
477
+ "grad_norm": 0.13308674882888374,
478
+ "learning_rate": 0.00014592972892229778,
479
+ "loss": 0.4974,
480
+ "step": 65
481
+ },
482
+ {
483
+ "epoch": 0.39,
484
+ "grad_norm": 0.12124588853708144,
485
+ "learning_rate": 0.0001441545498215912,
486
+ "loss": 0.4463,
487
+ "step": 66
488
+ },
489
+ {
490
+ "epoch": 0.4,
491
+ "grad_norm": 0.1183570515369953,
492
+ "learning_rate": 0.00014236191464085286,
493
+ "loss": 0.447,
494
+ "step": 67
495
+ },
496
+ {
497
+ "epoch": 0.4,
498
+ "grad_norm": 0.13520024884417237,
499
+ "learning_rate": 0.00014055253208129938,
500
+ "loss": 0.5309,
501
+ "step": 68
502
+ },
503
+ {
504
+ "epoch": 0.41,
505
+ "grad_norm": 0.12184981458813801,
506
+ "learning_rate": 0.00013872711746506413,
507
+ "loss": 0.4532,
508
+ "step": 69
509
+ },
510
+ {
511
+ "epoch": 0.42,
512
+ "grad_norm": 0.12449299540645078,
513
+ "learning_rate": 0.00013688639245240078,
514
+ "loss": 0.5198,
515
+ "step": 70
516
+ },
517
+ {
518
+ "epoch": 0.42,
519
+ "grad_norm": 0.1383134750490429,
520
+ "learning_rate": 0.00013503108475638244,
521
+ "loss": 0.5629,
522
+ "step": 71
523
+ },
524
+ {
525
+ "epoch": 0.43,
526
+ "grad_norm": 0.246237001656926,
527
+ "learning_rate": 0.0001331619278552068,
528
+ "loss": 0.4869,
529
+ "step": 72
530
+ },
531
+ {
532
+ "epoch": 0.43,
533
+ "grad_norm": 0.13337703940933632,
534
+ "learning_rate": 0.00013127966070222274,
535
+ "loss": 0.4792,
536
+ "step": 73
537
+ },
538
+ {
539
+ "epoch": 0.44,
540
+ "grad_norm": 0.12428922033806454,
541
+ "learning_rate": 0.00012938502743379212,
542
+ "loss": 0.4825,
543
+ "step": 74
544
+ },
545
+ {
546
+ "epoch": 0.45,
547
+ "grad_norm": 0.13290774912900208,
548
+ "learning_rate": 0.00012747877707510252,
549
+ "loss": 0.5138,
550
+ "step": 75
551
+ },
552
+ {
553
+ "epoch": 0.45,
554
+ "grad_norm": 0.11185975046756892,
555
+ "learning_rate": 0.0001255616632440475,
556
+ "loss": 0.4815,
557
+ "step": 76
558
+ },
559
+ {
560
+ "epoch": 0.46,
561
+ "grad_norm": 0.1130592868215497,
562
+ "learning_rate": 0.0001236344438532905,
563
+ "loss": 0.5046,
564
+ "step": 77
565
+ },
566
+ {
567
+ "epoch": 0.46,
568
+ "grad_norm": 0.12882943465594857,
569
+ "learning_rate": 0.0001216978808106318,
570
+ "loss": 0.5091,
571
+ "step": 78
572
+ },
573
+ {
574
+ "epoch": 0.47,
575
+ "grad_norm": 0.14837896297082676,
576
+ "learning_rate": 0.00011975273971779528,
577
+ "loss": 0.5158,
578
+ "step": 79
579
+ },
580
+ {
581
+ "epoch": 0.48,
582
+ "grad_norm": 0.1265223309856292,
583
+ "learning_rate": 0.00011779978956775506,
584
+ "loss": 0.5068,
585
+ "step": 80
586
+ },
587
+ {
588
+ "epoch": 0.48,
589
+ "grad_norm": 0.14042502330520407,
590
+ "learning_rate": 0.0001158398024407215,
591
+ "loss": 0.5061,
592
+ "step": 81
593
+ },
594
+ {
595
+ "epoch": 0.49,
596
+ "grad_norm": 0.1261526695491767,
597
+ "learning_rate": 0.00011387355319890685,
598
+ "loss": 0.4691,
599
+ "step": 82
600
+ },
601
+ {
602
+ "epoch": 0.49,
603
+ "grad_norm": 0.12007305451001854,
604
+ "learning_rate": 0.00011190181918019049,
605
+ "loss": 0.4753,
606
+ "step": 83
607
+ },
608
+ {
609
+ "epoch": 0.5,
610
+ "grad_norm": 0.12809956897166885,
611
+ "learning_rate": 0.00010992537989080618,
612
+ "loss": 0.4417,
613
+ "step": 84
614
+ },
615
+ {
616
+ "epoch": 0.5,
617
+ "eval_loss": 0.9675251841545105,
618
+ "eval_runtime": 152.4793,
619
+ "eval_samples_per_second": 1.633,
620
+ "eval_steps_per_second": 0.82,
621
+ "step": 84
622
+ },
623
+ {
624
+ "epoch": 0.51,
625
+ "grad_norm": 0.11858329804793687,
626
+ "learning_rate": 0.00010794501669717145,
627
+ "loss": 0.4868,
628
+ "step": 85
629
+ },
630
+ {
631
+ "epoch": 0.51,
632
+ "grad_norm": 0.10984649953887334,
633
+ "learning_rate": 0.00010596151251698199,
634
+ "loss": 0.4598,
635
+ "step": 86
636
+ },
637
+ {
638
+ "epoch": 0.52,
639
+ "grad_norm": 0.10927203986256682,
640
+ "learning_rate": 0.0001039756515096926,
641
+ "loss": 0.4693,
642
+ "step": 87
643
+ },
644
+ {
645
+ "epoch": 0.52,
646
+ "grad_norm": 0.11205046531522328,
647
+ "learning_rate": 0.00010198821876650701,
648
+ "loss": 0.4921,
649
+ "step": 88
650
+ },
651
+ {
652
+ "epoch": 0.53,
653
+ "grad_norm": 0.13232347270009215,
654
+ "learning_rate": 0.0001,
655
+ "loss": 0.4695,
656
+ "step": 89
657
+ },
658
+ {
659
+ "epoch": 0.53,
660
+ "grad_norm": 0.12136881873560385,
661
+ "learning_rate": 9.801178123349298e-05,
662
+ "loss": 0.4859,
663
+ "step": 90
664
+ },
665
+ {
666
+ "epoch": 0.54,
667
+ "grad_norm": 0.14347476421156694,
668
+ "learning_rate": 9.602434849030745e-05,
669
+ "loss": 0.4796,
670
+ "step": 91
671
+ },
672
+ {
673
+ "epoch": 0.55,
674
+ "grad_norm": 0.13956845267055204,
675
+ "learning_rate": 9.403848748301802e-05,
676
+ "loss": 0.5339,
677
+ "step": 92
678
+ },
679
+ {
680
+ "epoch": 0.55,
681
+ "grad_norm": 0.12814010903196785,
682
+ "learning_rate": 9.205498330282856e-05,
683
+ "loss": 0.5267,
684
+ "step": 93
685
+ },
686
+ {
687
+ "epoch": 0.56,
688
+ "grad_norm": 0.12798850330908082,
689
+ "learning_rate": 9.007462010919386e-05,
690
+ "loss": 0.4604,
691
+ "step": 94
692
+ },
693
+ {
694
+ "epoch": 0.56,
695
+ "grad_norm": 0.13673366056605873,
696
+ "learning_rate": 8.809818081980953e-05,
697
+ "loss": 0.49,
698
+ "step": 95
699
+ },
700
+ {
701
+ "epoch": 0.57,
702
+ "grad_norm": 0.12607483394599764,
703
+ "learning_rate": 8.612644680109319e-05,
704
+ "loss": 0.4774,
705
+ "step": 96
706
+ },
707
+ {
708
+ "epoch": 0.58,
709
+ "grad_norm": 0.1365629261848207,
710
+ "learning_rate": 8.416019755927851e-05,
711
+ "loss": 0.4827,
712
+ "step": 97
713
+ },
714
+ {
715
+ "epoch": 0.58,
716
+ "grad_norm": 0.12122559291940836,
717
+ "learning_rate": 8.2200210432245e-05,
718
+ "loss": 0.5044,
719
+ "step": 98
720
+ },
721
+ {
722
+ "epoch": 0.59,
723
+ "grad_norm": 0.11655390642565265,
724
+ "learning_rate": 8.024726028220474e-05,
725
+ "loss": 0.503,
726
+ "step": 99
727
+ },
728
+ {
729
+ "epoch": 0.59,
730
+ "grad_norm": 0.12394574502796742,
731
+ "learning_rate": 7.83021191893682e-05,
732
+ "loss": 0.491,
733
+ "step": 100
734
+ },
735
+ {
736
+ "epoch": 0.6,
737
+ "grad_norm": 0.14922841699852962,
738
+ "learning_rate": 7.636555614670953e-05,
739
+ "loss": 0.457,
740
+ "step": 101
741
+ },
742
+ {
743
+ "epoch": 0.61,
744
+ "grad_norm": 0.11076924096187928,
745
+ "learning_rate": 7.443833675595255e-05,
746
+ "loss": 0.4603,
747
+ "step": 102
748
+ },
749
+ {
750
+ "epoch": 0.61,
751
+ "grad_norm": 0.1263594611752413,
752
+ "learning_rate": 7.252122292489747e-05,
753
+ "loss": 0.4859,
754
+ "step": 103
755
+ },
756
+ {
757
+ "epoch": 0.62,
758
+ "grad_norm": 0.11432575178505003,
759
+ "learning_rate": 7.061497256620793e-05,
760
+ "loss": 0.4627,
761
+ "step": 104
762
+ },
763
+ {
764
+ "epoch": 0.62,
765
+ "grad_norm": 0.1078119391965793,
766
+ "learning_rate": 6.87203392977773e-05,
767
+ "loss": 0.4829,
768
+ "step": 105
769
+ },
770
+ {
771
+ "epoch": 0.63,
772
+ "grad_norm": 0.12752089816514908,
773
+ "learning_rate": 6.683807214479323e-05,
774
+ "loss": 0.46,
775
+ "step": 106
776
+ },
777
+ {
778
+ "epoch": 0.64,
779
+ "grad_norm": 0.11421623043902956,
780
+ "learning_rate": 6.496891524361757e-05,
781
+ "loss": 0.4429,
782
+ "step": 107
783
+ },
784
+ {
785
+ "epoch": 0.64,
786
+ "grad_norm": 0.10432253193399477,
787
+ "learning_rate": 6.311360754759923e-05,
788
+ "loss": 0.402,
789
+ "step": 108
790
+ },
791
+ {
792
+ "epoch": 0.65,
793
+ "grad_norm": 0.12155248673662734,
794
+ "learning_rate": 6.127288253493591e-05,
795
+ "loss": 0.5126,
796
+ "step": 109
797
+ },
798
+ {
799
+ "epoch": 0.65,
800
+ "grad_norm": 0.14266947863559803,
801
+ "learning_rate": 5.9447467918700614e-05,
802
+ "loss": 0.4821,
803
+ "step": 110
804
+ },
805
+ {
806
+ "epoch": 0.66,
807
+ "grad_norm": 0.14851250761112514,
808
+ "learning_rate": 5.763808535914723e-05,
809
+ "loss": 0.4891,
810
+ "step": 111
811
+ },
812
+ {
813
+ "epoch": 0.67,
814
+ "grad_norm": 0.14264023747361737,
815
+ "learning_rate": 5.584545017840885e-05,
816
+ "loss": 0.5181,
817
+ "step": 112
818
+ },
819
+ {
820
+ "epoch": 0.67,
821
+ "grad_norm": 0.12837168363458795,
822
+ "learning_rate": 5.407027107770219e-05,
823
+ "loss": 0.5599,
824
+ "step": 113
825
+ },
826
+ {
827
+ "epoch": 0.68,
828
+ "grad_norm": 0.11874709251257598,
829
+ "learning_rate": 5.2313249857149414e-05,
830
+ "loss": 0.4536,
831
+ "step": 114
832
+ },
833
+ {
834
+ "epoch": 0.68,
835
+ "grad_norm": 0.12010754957532713,
836
+ "learning_rate": 5.0575081138327715e-05,
837
+ "loss": 0.5004,
838
+ "step": 115
839
+ },
840
+ {
841
+ "epoch": 0.69,
842
+ "grad_norm": 0.13464124440677885,
843
+ "learning_rate": 4.885645208965779e-05,
844
+ "loss": 0.4985,
845
+ "step": 116
846
+ },
847
+ {
848
+ "epoch": 0.7,
849
+ "grad_norm": 0.13701854261941088,
850
+ "learning_rate": 4.715804215473809e-05,
851
+ "loss": 0.4709,
852
+ "step": 117
853
+ },
854
+ {
855
+ "epoch": 0.7,
856
+ "grad_norm": 0.1335483738873249,
857
+ "learning_rate": 4.548052278373327e-05,
858
+ "loss": 0.4735,
859
+ "step": 118
860
+ },
861
+ {
862
+ "epoch": 0.71,
863
+ "grad_norm": 0.13603172024059101,
864
+ "learning_rate": 4.382455716792291e-05,
865
+ "loss": 0.4721,
866
+ "step": 119
867
+ },
868
+ {
869
+ "epoch": 0.71,
870
+ "grad_norm": 0.13843339239058639,
871
+ "learning_rate": 4.219079997751515e-05,
872
+ "loss": 0.4954,
873
+ "step": 120
874
+ },
875
+ {
876
+ "epoch": 0.72,
877
+ "grad_norm": 0.15011169526780793,
878
+ "learning_rate": 4.0579897102828966e-05,
879
+ "loss": 0.4648,
880
+ "step": 121
881
+ },
882
+ {
883
+ "epoch": 0.73,
884
+ "grad_norm": 0.13061595453081623,
885
+ "learning_rate": 3.899248539894757e-05,
886
+ "loss": 0.4801,
887
+ "step": 122
888
+ },
889
+ {
890
+ "epoch": 0.73,
891
+ "grad_norm": 0.14067787924603412,
892
+ "learning_rate": 3.7429192433944014e-05,
893
+ "loss": 0.4805,
894
+ "step": 123
895
+ },
896
+ {
897
+ "epoch": 0.74,
898
+ "grad_norm": 0.13420057703295998,
899
+ "learning_rate": 3.589063624077802e-05,
900
+ "loss": 0.4446,
901
+ "step": 124
902
+ },
903
+ {
904
+ "epoch": 0.74,
905
+ "grad_norm": 0.14083737654873127,
906
+ "learning_rate": 3.4377425072962465e-05,
907
+ "loss": 0.46,
908
+ "step": 125
909
+ },
910
+ {
911
+ "epoch": 0.75,
912
+ "grad_norm": 0.13231889777376862,
913
+ "learning_rate": 3.289015716409631e-05,
914
+ "loss": 0.4451,
915
+ "step": 126
916
+ },
917
+ {
918
+ "epoch": 0.75,
919
+ "eval_loss": 0.9651579260826111,
920
+ "eval_runtime": 155.5959,
921
+ "eval_samples_per_second": 1.6,
922
+ "eval_steps_per_second": 0.803,
923
+ "step": 126
924
+ }
925
+ ],
926
+ "logging_steps": 1,
927
+ "max_steps": 168,
928
+ "num_input_tokens_seen": 0,
929
+ "num_train_epochs": 1,
930
+ "save_steps": 42,
931
+ "total_flos": 2.5549258322041897e+18,
932
+ "train_batch_size": 1,
933
+ "trial_name": null,
934
+ "trial_params": null
935
+ }
checkpoint-126/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cbfaffe231fe183758cc2353296944fef75710807fa8ea7663978d9e906d00f7
3
+ size 6968
checkpoint-126/zero_to_fp32.py ADDED
@@ -0,0 +1,592 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example: python zero_to_fp32.py . pytorch_model.bin
14
+
15
+ import argparse
16
+ import torch
17
+ import glob
18
+ import math
19
+ import os
20
+ import re
21
+ from collections import OrderedDict
22
+ from dataclasses import dataclass
23
+
24
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
25
+ # DeepSpeed data structures it has to be available in the current python environment.
26
+ from deepspeed.utils import logger
27
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
28
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
29
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
30
+
31
+
32
+ @dataclass
33
+ class zero_model_state:
34
+ buffers: dict()
35
+ param_shapes: dict()
36
+ shared_params: list
37
+ ds_version: int
38
+ frozen_param_shapes: dict()
39
+ frozen_param_fragments: dict()
40
+
41
+
42
+ debug = 0
43
+
44
+ # load to cpu
45
+ device = torch.device('cpu')
46
+
47
+
48
+ def atoi(text):
49
+ return int(text) if text.isdigit() else text
50
+
51
+
52
+ def natural_keys(text):
53
+ '''
54
+ alist.sort(key=natural_keys) sorts in human order
55
+ http://nedbatchelder.com/blog/200712/human_sorting.html
56
+ (See Toothy's implementation in the comments)
57
+ '''
58
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
59
+
60
+
61
+ def get_model_state_file(checkpoint_dir, zero_stage):
62
+ if not os.path.isdir(checkpoint_dir):
63
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
64
+
65
+ # there should be only one file
66
+ if zero_stage <= 2:
67
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
68
+ elif zero_stage == 3:
69
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
70
+
71
+ if not os.path.exists(file):
72
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
73
+
74
+ return file
75
+
76
+
77
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
78
+ # XXX: need to test that this simple glob rule works for multi-node setup too
79
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
80
+
81
+ if len(ckpt_files) == 0:
82
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
83
+
84
+ return ckpt_files
85
+
86
+
87
+ def get_optim_files(checkpoint_dir):
88
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
89
+
90
+
91
+ def get_model_state_files(checkpoint_dir):
92
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
93
+
94
+
95
+ def parse_model_states(files):
96
+ zero_model_states = []
97
+ for file in files:
98
+ state_dict = torch.load(file, map_location=device)
99
+
100
+ if BUFFER_NAMES not in state_dict:
101
+ raise ValueError(f"{file} is not a model state checkpoint")
102
+ buffer_names = state_dict[BUFFER_NAMES]
103
+ if debug:
104
+ print("Found buffers:", buffer_names)
105
+
106
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
107
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
108
+ param_shapes = state_dict[PARAM_SHAPES]
109
+
110
+ # collect parameters that are included in param_shapes
111
+ param_names = []
112
+ for s in param_shapes:
113
+ for name in s.keys():
114
+ param_names.append(name)
115
+
116
+ # update with frozen parameters
117
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
118
+ if frozen_param_shapes is not None:
119
+ if debug:
120
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
121
+ param_names += list(frozen_param_shapes.keys())
122
+
123
+ # handle shared params
124
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
125
+
126
+ ds_version = state_dict.get(DS_VERSION, None)
127
+
128
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
129
+
130
+ z_model_state = zero_model_state(buffers=buffers,
131
+ param_shapes=param_shapes,
132
+ shared_params=shared_params,
133
+ ds_version=ds_version,
134
+ frozen_param_shapes=frozen_param_shapes,
135
+ frozen_param_fragments=frozen_param_fragments)
136
+ zero_model_states.append(z_model_state)
137
+
138
+ return zero_model_states
139
+
140
+
141
+ def parse_optim_states(files, ds_checkpoint_dir):
142
+
143
+ total_files = len(files)
144
+ state_dicts = []
145
+ for f in files:
146
+ state_dict = torch.load(f, map_location=device)
147
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
148
+ # and also handle the case where it was already removed by another helper script
149
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
150
+ state_dicts.append(state_dict)
151
+
152
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
153
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
154
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
155
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
156
+
157
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
158
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
159
+ # use the max of the partition_count to get the dp world_size.
160
+
161
+ if type(world_size) is list:
162
+ world_size = max(world_size)
163
+
164
+ if world_size != total_files:
165
+ raise ValueError(
166
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
167
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
168
+ )
169
+
170
+ # the groups are named differently in each stage
171
+ if zero_stage <= 2:
172
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
173
+ elif zero_stage == 3:
174
+ fp32_groups_key = FP32_FLAT_GROUPS
175
+ else:
176
+ raise ValueError(f"unknown zero stage {zero_stage}")
177
+
178
+ if zero_stage <= 2:
179
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
180
+ elif zero_stage == 3:
181
+ # if there is more than one param group, there will be multiple flattened tensors - one
182
+ # flattened tensor per group - for simplicity merge them into a single tensor
183
+ #
184
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
185
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
186
+
187
+ fp32_flat_groups = [
188
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
189
+ ]
190
+
191
+ return zero_stage, world_size, fp32_flat_groups
192
+
193
+
194
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir):
195
+ """
196
+ Returns fp32 state_dict reconstructed from ds checkpoint
197
+
198
+ Args:
199
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
200
+
201
+ """
202
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
203
+
204
+ optim_files = get_optim_files(ds_checkpoint_dir)
205
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
206
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
207
+
208
+ model_files = get_model_state_files(ds_checkpoint_dir)
209
+
210
+ zero_model_states = parse_model_states(model_files)
211
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
212
+
213
+ if zero_stage <= 2:
214
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states)
215
+ elif zero_stage == 3:
216
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states)
217
+
218
+
219
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
220
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
221
+ return
222
+
223
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
224
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
225
+
226
+ if debug:
227
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
228
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
229
+
230
+ wanted_params = len(frozen_param_shapes)
231
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
232
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
233
+ print(f'Frozen params: Have {avail_numel} numels to process.')
234
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
235
+
236
+ total_params = 0
237
+ total_numel = 0
238
+ for name, shape in frozen_param_shapes.items():
239
+ total_params += 1
240
+ unpartitioned_numel = shape.numel()
241
+ total_numel += unpartitioned_numel
242
+
243
+ state_dict[name] = frozen_param_fragments[name]
244
+
245
+ if debug:
246
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
247
+
248
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
249
+
250
+
251
+ def _has_callable(obj, fn):
252
+ attr = getattr(obj, fn, None)
253
+ return callable(attr)
254
+
255
+
256
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
257
+ param_shapes = zero_model_states[0].param_shapes
258
+
259
+ # Reconstruction protocol:
260
+ #
261
+ # XXX: document this
262
+
263
+ if debug:
264
+ for i in range(world_size):
265
+ for j in range(len(fp32_flat_groups[0])):
266
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
267
+
268
+ # XXX: memory usage doubles here (zero2)
269
+ num_param_groups = len(fp32_flat_groups[0])
270
+ merged_single_partition_of_fp32_groups = []
271
+ for i in range(num_param_groups):
272
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
273
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
274
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
275
+ avail_numel = sum(
276
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
277
+
278
+ if debug:
279
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
280
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
281
+ # not asserting if there is a mismatch due to possible padding
282
+ print(f"Have {avail_numel} numels to process.")
283
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
284
+
285
+ # params
286
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
287
+ # out-of-core computing solution
288
+ total_numel = 0
289
+ total_params = 0
290
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
291
+ offset = 0
292
+ avail_numel = full_single_fp32_vector.numel()
293
+ for name, shape in shapes.items():
294
+
295
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
296
+ total_numel += unpartitioned_numel
297
+ total_params += 1
298
+
299
+ if debug:
300
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
301
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
302
+ offset += unpartitioned_numel
303
+
304
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
305
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
306
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
307
+ # live optimizer object, so we are checking that the numbers are within the right range
308
+ align_to = 2 * world_size
309
+
310
+ def zero2_align(x):
311
+ return align_to * math.ceil(x / align_to)
312
+
313
+ if debug:
314
+ print(f"original offset={offset}, avail_numel={avail_numel}")
315
+
316
+ offset = zero2_align(offset)
317
+ avail_numel = zero2_align(avail_numel)
318
+
319
+ if debug:
320
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
321
+
322
+ # Sanity check
323
+ if offset != avail_numel:
324
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
325
+
326
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
327
+
328
+
329
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states):
330
+ state_dict = OrderedDict()
331
+
332
+ # buffers
333
+ buffers = zero_model_states[0].buffers
334
+ state_dict.update(buffers)
335
+ if debug:
336
+ print(f"added {len(buffers)} buffers")
337
+
338
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
339
+
340
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
341
+
342
+ # recover shared parameters
343
+ for pair in zero_model_states[0].shared_params:
344
+ if pair[1] in state_dict:
345
+ state_dict[pair[0]] = state_dict[pair[1]]
346
+
347
+ return state_dict
348
+
349
+
350
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
351
+ remainder = unpartitioned_numel % world_size
352
+ padding_numel = (world_size - remainder) if remainder else 0
353
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
354
+ return partitioned_numel, padding_numel
355
+
356
+
357
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
358
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
359
+ return
360
+
361
+ if debug:
362
+ for i in range(world_size):
363
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
364
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
365
+
366
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
367
+ wanted_params = len(frozen_param_shapes)
368
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
369
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
370
+ print(f'Frozen params: Have {avail_numel} numels to process.')
371
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
372
+
373
+ total_params = 0
374
+ total_numel = 0
375
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
376
+ total_params += 1
377
+ unpartitioned_numel = shape.numel()
378
+ total_numel += unpartitioned_numel
379
+
380
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
381
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
382
+
383
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
384
+
385
+ if debug:
386
+ print(
387
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
388
+ )
389
+
390
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
391
+
392
+
393
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
394
+ param_shapes = zero_model_states[0].param_shapes
395
+ avail_numel = fp32_flat_groups[0].numel() * world_size
396
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
397
+ # param, re-consolidating each param, while dealing with padding if any
398
+
399
+ # merge list of dicts, preserving order
400
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
401
+
402
+ if debug:
403
+ for i in range(world_size):
404
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
405
+
406
+ wanted_params = len(param_shapes)
407
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
408
+ # not asserting if there is a mismatch due to possible padding
409
+ avail_numel = fp32_flat_groups[0].numel() * world_size
410
+ print(f"Trainable params: Have {avail_numel} numels to process.")
411
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
412
+
413
+ # params
414
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
415
+ # out-of-core computing solution
416
+ offset = 0
417
+ total_numel = 0
418
+ total_params = 0
419
+ for name, shape in param_shapes.items():
420
+
421
+ unpartitioned_numel = shape.numel()
422
+ total_numel += unpartitioned_numel
423
+ total_params += 1
424
+
425
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
426
+
427
+ if debug:
428
+ print(
429
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
430
+ )
431
+
432
+ # XXX: memory usage doubles here
433
+ state_dict[name] = torch.cat(
434
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
435
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
436
+ offset += partitioned_numel
437
+
438
+ offset *= world_size
439
+
440
+ # Sanity check
441
+ if offset != avail_numel:
442
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
443
+
444
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
445
+
446
+
447
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states):
448
+ state_dict = OrderedDict()
449
+
450
+ # buffers
451
+ buffers = zero_model_states[0].buffers
452
+ state_dict.update(buffers)
453
+ if debug:
454
+ print(f"added {len(buffers)} buffers")
455
+
456
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
457
+
458
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
459
+
460
+ # recover shared parameters
461
+ for pair in zero_model_states[0].shared_params:
462
+ if pair[1] in state_dict:
463
+ state_dict[pair[0]] = state_dict[pair[1]]
464
+
465
+ return state_dict
466
+
467
+
468
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None):
469
+ """
470
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
471
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
472
+ via a model hub.
473
+
474
+ Args:
475
+ - ``checkpoint_dir``: path to the desired checkpoint folder
476
+ - ``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``
477
+
478
+ Returns:
479
+ - pytorch ``state_dict``
480
+
481
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
482
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
483
+ the checkpoint.
484
+
485
+ A typical usage might be ::
486
+
487
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
488
+ # do the training and checkpoint saving
489
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
490
+ model = model.cpu() # move to cpu
491
+ model.load_state_dict(state_dict)
492
+ # submit to model hub or save the model to share with others
493
+
494
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
495
+ application. i.e. you will need to re-initialize the deepspeed engine, since
496
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
497
+
498
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
499
+
500
+ """
501
+ if tag is None:
502
+ latest_path = os.path.join(checkpoint_dir, 'latest')
503
+ if os.path.isfile(latest_path):
504
+ with open(latest_path, 'r') as fd:
505
+ tag = fd.read().strip()
506
+ else:
507
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
508
+
509
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
510
+
511
+ if not os.path.isdir(ds_checkpoint_dir):
512
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
513
+
514
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir)
515
+
516
+
517
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None):
518
+ """
519
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
520
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
521
+
522
+ Args:
523
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
524
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
525
+ - ``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``
526
+ """
527
+
528
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
529
+ print(f"Saving fp32 state dict to {output_file}")
530
+ torch.save(state_dict, output_file)
531
+
532
+
533
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
534
+ """
535
+ 1. Put the provided model to cpu
536
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
537
+ 3. Load it into the provided model
538
+
539
+ Args:
540
+ - ``model``: the model object to update
541
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
542
+ - ``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``
543
+
544
+ Returns:
545
+ - ``model`: modified model
546
+
547
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
548
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
549
+ conveniently placed for you in the checkpoint folder.
550
+
551
+ A typical usage might be ::
552
+
553
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
554
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
555
+ # submit to model hub or save the model to share with others
556
+
557
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
558
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
559
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
560
+
561
+ """
562
+ logger.info(f"Extracting fp32 weights")
563
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
564
+
565
+ logger.info(f"Overwriting model with fp32 weights")
566
+ model = model.cpu()
567
+ model.load_state_dict(state_dict, strict=False)
568
+
569
+ return model
570
+
571
+
572
+ if __name__ == "__main__":
573
+
574
+ parser = argparse.ArgumentParser()
575
+ parser.add_argument("checkpoint_dir",
576
+ type=str,
577
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
578
+ parser.add_argument(
579
+ "output_file",
580
+ type=str,
581
+ help="path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)")
582
+ parser.add_argument("-t",
583
+ "--tag",
584
+ type=str,
585
+ default=None,
586
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
587
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
588
+ args = parser.parse_args()
589
+
590
+ debug = args.debug
591
+
592
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir, args.output_file, tag=args.tag)
checkpoint-168/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ base_model: ai21labs/Jamba-v0.1
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.10.0
checkpoint-168/adapter_config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "ai21labs/Jamba-v0.1",
5
+ "bias": "none",
6
+ "fan_in_fan_out": null,
7
+ "inference_mode": true,
8
+ "init_lora_weights": true,
9
+ "layer_replication": null,
10
+ "layers_pattern": null,
11
+ "layers_to_transform": null,
12
+ "loftq_config": {},
13
+ "lora_alpha": 32,
14
+ "lora_dropout": 0.05,
15
+ "megatron_config": null,
16
+ "megatron_core": "megatron.core",
17
+ "modules_to_save": null,
18
+ "peft_type": "LORA",
19
+ "r": 16,
20
+ "rank_pattern": {},
21
+ "revision": null,
22
+ "target_modules": [
23
+ "x_proj",
24
+ "o_proj",
25
+ "up_proj",
26
+ "v_proj",
27
+ "down_proj",
28
+ "dt_proj",
29
+ "k_proj",
30
+ "q_proj",
31
+ "in_proj",
32
+ "gate_proj",
33
+ "out_proj",
34
+ "router"
35
+ ],
36
+ "task_type": "CAUSAL_LM",
37
+ "use_dora": false,
38
+ "use_rslora": false
39
+ }
checkpoint-168/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e965e9e667252ca3c021de51e081f6a3831a14d282903458d11e44f878a73597
3
+ size 531611600
checkpoint-168/global_step168/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b66d8b3841b807a595a50e795a52d67de68eb94015081f06580ca93cd533b645
3
+ size 797643792
checkpoint-168/global_step168/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b94caa551e67c01642f6b55c16bf11b71089c2f0fbd09d4215bd26e34ed7a530
3
+ size 797644432
checkpoint-168/global_step168/mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8130cd37e9434fdc6e150b642bbebca3eeebac77da37779b2183486786db25a5
3
+ size 1345660121
checkpoint-168/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step168
checkpoint-168/rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:753bf22647e1e0f236cfa8df696cc134d9e1c0684712d00bf72503af01afa161
3
+ size 14512
checkpoint-168/rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c15347a58866f49cdc458b966fb754bbfbe4244548a2a26de0617bb3969cd63
3
+ size 14512
checkpoint-168/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:35ea2e1439244ec6e596a083a4657a3e879cc60c5a80ec3ad3f705a12a8fa66a
3
+ size 1064
checkpoint-168/special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|startoftext|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|endoftext|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<|pad|>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<|unk|>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
checkpoint-168/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-168/tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02fd6530b8ede0eedd8e509fcab32da7b1dd04c8119f8498c787100f13112713
3
+ size 1124742
checkpoint-168/tokenizer_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<|pad|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<|startoftext|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "<|endoftext|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "3": {
30
+ "content": "<|unk|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ }
37
+ },
38
+ "bos_token": "<|startoftext|>",
39
+ "chat_template": "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
40
+ "clean_up_tokenization_spaces": false,
41
+ "eos_token": "<|endoftext|>",
42
+ "model_max_length": 1000000000000000019884624838656,
43
+ "pad_token": "<|pad|>",
44
+ "spaces_between_special_tokens": false,
45
+ "tokenizer_class": "LlamaTokenizer",
46
+ "unk_token": "<|unk|>",
47
+ "use_default_system_prompt": false
48
+ }
checkpoint-168/trainer_state.json ADDED
@@ -0,0 +1,1237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.9985141158989599,
5
+ "eval_steps": 42,
6
+ "global_step": 168,
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.01,
13
+ "grad_norm": 0.30475762367257353,
14
+ "learning_rate": 2e-05,
15
+ "loss": 0.6274,
16
+ "step": 1
17
+ },
18
+ {
19
+ "epoch": 0.01,
20
+ "eval_loss": 1.0297596454620361,
21
+ "eval_runtime": 150.6014,
22
+ "eval_samples_per_second": 1.653,
23
+ "eval_steps_per_second": 0.83,
24
+ "step": 1
25
+ },
26
+ {
27
+ "epoch": 0.01,
28
+ "grad_norm": 0.2798137150913395,
29
+ "learning_rate": 4e-05,
30
+ "loss": 0.6362,
31
+ "step": 2
32
+ },
33
+ {
34
+ "epoch": 0.02,
35
+ "grad_norm": 0.3178684451319545,
36
+ "learning_rate": 6e-05,
37
+ "loss": 0.6299,
38
+ "step": 3
39
+ },
40
+ {
41
+ "epoch": 0.02,
42
+ "grad_norm": 0.33651284916847835,
43
+ "learning_rate": 8e-05,
44
+ "loss": 0.6391,
45
+ "step": 4
46
+ },
47
+ {
48
+ "epoch": 0.03,
49
+ "grad_norm": 0.23984915388648712,
50
+ "learning_rate": 0.0001,
51
+ "loss": 0.6071,
52
+ "step": 5
53
+ },
54
+ {
55
+ "epoch": 0.04,
56
+ "grad_norm": 0.20514040410017348,
57
+ "learning_rate": 0.00012,
58
+ "loss": 0.5996,
59
+ "step": 6
60
+ },
61
+ {
62
+ "epoch": 0.04,
63
+ "grad_norm": 0.1950018128286362,
64
+ "learning_rate": 0.00014,
65
+ "loss": 0.6298,
66
+ "step": 7
67
+ },
68
+ {
69
+ "epoch": 0.05,
70
+ "grad_norm": 0.14246019947393238,
71
+ "learning_rate": 0.00016,
72
+ "loss": 0.5108,
73
+ "step": 8
74
+ },
75
+ {
76
+ "epoch": 0.05,
77
+ "grad_norm": 0.15792014279750227,
78
+ "learning_rate": 0.00018,
79
+ "loss": 0.5529,
80
+ "step": 9
81
+ },
82
+ {
83
+ "epoch": 0.06,
84
+ "grad_norm": 0.1517889177511264,
85
+ "learning_rate": 0.0002,
86
+ "loss": 0.5433,
87
+ "step": 10
88
+ },
89
+ {
90
+ "epoch": 0.07,
91
+ "grad_norm": 0.1372121219437277,
92
+ "learning_rate": 0.00019998023297700658,
93
+ "loss": 0.5856,
94
+ "step": 11
95
+ },
96
+ {
97
+ "epoch": 0.07,
98
+ "grad_norm": 0.16740807394942855,
99
+ "learning_rate": 0.00019992093972273018,
100
+ "loss": 0.5546,
101
+ "step": 12
102
+ },
103
+ {
104
+ "epoch": 0.08,
105
+ "grad_norm": 0.13512320693394078,
106
+ "learning_rate": 0.00019982214367819328,
107
+ "loss": 0.6193,
108
+ "step": 13
109
+ },
110
+ {
111
+ "epoch": 0.08,
112
+ "grad_norm": 0.16169796294070152,
113
+ "learning_rate": 0.0001996838839014696,
114
+ "loss": 0.5495,
115
+ "step": 14
116
+ },
117
+ {
118
+ "epoch": 0.09,
119
+ "grad_norm": 0.16796913812281988,
120
+ "learning_rate": 0.00019950621505224273,
121
+ "loss": 0.5035,
122
+ "step": 15
123
+ },
124
+ {
125
+ "epoch": 0.1,
126
+ "grad_norm": 0.1800514764162192,
127
+ "learning_rate": 0.00019928920737019733,
128
+ "loss": 0.5083,
129
+ "step": 16
130
+ },
131
+ {
132
+ "epoch": 0.1,
133
+ "grad_norm": 0.170432124866908,
134
+ "learning_rate": 0.0001990329466472502,
135
+ "loss": 0.632,
136
+ "step": 17
137
+ },
138
+ {
139
+ "epoch": 0.11,
140
+ "grad_norm": 0.19129325489749488,
141
+ "learning_rate": 0.00019873753419363336,
142
+ "loss": 0.4813,
143
+ "step": 18
144
+ },
145
+ {
146
+ "epoch": 0.11,
147
+ "grad_norm": 0.1459357988760762,
148
+ "learning_rate": 0.00019840308679784207,
149
+ "loss": 0.4973,
150
+ "step": 19
151
+ },
152
+ {
153
+ "epoch": 0.12,
154
+ "grad_norm": 0.192594730984382,
155
+ "learning_rate": 0.00019802973668046363,
156
+ "loss": 0.5291,
157
+ "step": 20
158
+ },
159
+ {
160
+ "epoch": 0.12,
161
+ "grad_norm": 0.859025467969139,
162
+ "learning_rate": 0.0001976176314419051,
163
+ "loss": 0.5296,
164
+ "step": 21
165
+ },
166
+ {
167
+ "epoch": 0.13,
168
+ "grad_norm": 0.13366297885670222,
169
+ "learning_rate": 0.000197166934004041,
170
+ "loss": 0.4819,
171
+ "step": 22
172
+ },
173
+ {
174
+ "epoch": 0.14,
175
+ "grad_norm": 0.15698714419747645,
176
+ "learning_rate": 0.00019667782254580374,
177
+ "loss": 0.5409,
178
+ "step": 23
179
+ },
180
+ {
181
+ "epoch": 0.14,
182
+ "grad_norm": 0.10995943735837355,
183
+ "learning_rate": 0.00019615049043274205,
184
+ "loss": 0.5108,
185
+ "step": 24
186
+ },
187
+ {
188
+ "epoch": 0.15,
189
+ "grad_norm": 0.10796742192788925,
190
+ "learning_rate": 0.00019558514614057609,
191
+ "loss": 0.5215,
192
+ "step": 25
193
+ },
194
+ {
195
+ "epoch": 0.15,
196
+ "grad_norm": 0.11641740089490231,
197
+ "learning_rate": 0.00019498201317277828,
198
+ "loss": 0.5012,
199
+ "step": 26
200
+ },
201
+ {
202
+ "epoch": 0.16,
203
+ "grad_norm": 0.1120175962893241,
204
+ "learning_rate": 0.00019434132997221345,
205
+ "loss": 0.474,
206
+ "step": 27
207
+ },
208
+ {
209
+ "epoch": 0.17,
210
+ "grad_norm": 0.1218171278782483,
211
+ "learning_rate": 0.0001936633498268728,
212
+ "loss": 0.5216,
213
+ "step": 28
214
+ },
215
+ {
216
+ "epoch": 0.17,
217
+ "grad_norm": 0.11718521115928844,
218
+ "learning_rate": 0.0001929483407697387,
219
+ "loss": 0.4856,
220
+ "step": 29
221
+ },
222
+ {
223
+ "epoch": 0.18,
224
+ "grad_norm": 0.12611471038571026,
225
+ "learning_rate": 0.00019219658547282067,
226
+ "loss": 0.4823,
227
+ "step": 30
228
+ },
229
+ {
230
+ "epoch": 0.18,
231
+ "grad_norm": 0.11106871615269753,
232
+ "learning_rate": 0.00019140838113540346,
233
+ "loss": 0.4869,
234
+ "step": 31
235
+ },
236
+ {
237
+ "epoch": 0.19,
238
+ "grad_norm": 0.1416503230360699,
239
+ "learning_rate": 0.00019058403936655233,
240
+ "loss": 0.5341,
241
+ "step": 32
242
+ },
243
+ {
244
+ "epoch": 0.2,
245
+ "grad_norm": 0.10761396399791698,
246
+ "learning_rate": 0.00018972388606192125,
247
+ "loss": 0.4304,
248
+ "step": 33
249
+ },
250
+ {
251
+ "epoch": 0.2,
252
+ "grad_norm": 0.10975376180434356,
253
+ "learning_rate": 0.0001888282612749132,
254
+ "loss": 0.4646,
255
+ "step": 34
256
+ },
257
+ {
258
+ "epoch": 0.21,
259
+ "grad_norm": 0.12848879670359908,
260
+ "learning_rate": 0.00018789751908224338,
261
+ "loss": 0.4972,
262
+ "step": 35
263
+ },
264
+ {
265
+ "epoch": 0.21,
266
+ "grad_norm": 0.11904721819683833,
267
+ "learning_rate": 0.00018693202744395827,
268
+ "loss": 0.505,
269
+ "step": 36
270
+ },
271
+ {
272
+ "epoch": 0.22,
273
+ "grad_norm": 0.12249852034224981,
274
+ "learning_rate": 0.00018593216805796612,
275
+ "loss": 0.5396,
276
+ "step": 37
277
+ },
278
+ {
279
+ "epoch": 0.23,
280
+ "grad_norm": 0.12453395046646995,
281
+ "learning_rate": 0.00018489833620913642,
282
+ "loss": 0.4917,
283
+ "step": 38
284
+ },
285
+ {
286
+ "epoch": 0.23,
287
+ "grad_norm": 0.12585770374422164,
288
+ "learning_rate": 0.00018383094061302766,
289
+ "loss": 0.5079,
290
+ "step": 39
291
+ },
292
+ {
293
+ "epoch": 0.24,
294
+ "grad_norm": 0.11095271476322731,
295
+ "learning_rate": 0.00018273040325430574,
296
+ "loss": 0.4812,
297
+ "step": 40
298
+ },
299
+ {
300
+ "epoch": 0.24,
301
+ "grad_norm": 0.12968115101635422,
302
+ "learning_rate": 0.00018159715921991612,
303
+ "loss": 0.5106,
304
+ "step": 41
305
+ },
306
+ {
307
+ "epoch": 0.25,
308
+ "grad_norm": 0.10933018515590627,
309
+ "learning_rate": 0.00018043165652707649,
310
+ "loss": 0.4403,
311
+ "step": 42
312
+ },
313
+ {
314
+ "epoch": 0.25,
315
+ "eval_loss": 0.9767947196960449,
316
+ "eval_runtime": 152.0343,
317
+ "eval_samples_per_second": 1.638,
318
+ "eval_steps_per_second": 0.822,
319
+ "step": 42
320
+ },
321
+ {
322
+ "epoch": 0.26,
323
+ "grad_norm": 0.11525719626792096,
324
+ "learning_rate": 0.00017923435594615744,
325
+ "loss": 0.482,
326
+ "step": 43
327
+ },
328
+ {
329
+ "epoch": 0.26,
330
+ "grad_norm": 0.12962154411778218,
331
+ "learning_rate": 0.00017800573081852122,
332
+ "loss": 0.5452,
333
+ "step": 44
334
+ },
335
+ {
336
+ "epoch": 0.27,
337
+ "grad_norm": 0.12555700120045588,
338
+ "learning_rate": 0.0001767462668693908,
339
+ "loss": 0.5084,
340
+ "step": 45
341
+ },
342
+ {
343
+ "epoch": 0.27,
344
+ "grad_norm": 0.11427565378293324,
345
+ "learning_rate": 0.00017545646201582303,
346
+ "loss": 0.5191,
347
+ "step": 46
348
+ },
349
+ {
350
+ "epoch": 0.28,
351
+ "grad_norm": 0.10974901402857151,
352
+ "learning_rate": 0.00017413682616986185,
353
+ "loss": 0.4703,
354
+ "step": 47
355
+ },
356
+ {
357
+ "epoch": 0.29,
358
+ "grad_norm": 0.11781465084480325,
359
+ "learning_rate": 0.00017278788103694943,
360
+ "loss": 0.4548,
361
+ "step": 48
362
+ },
363
+ {
364
+ "epoch": 0.29,
365
+ "grad_norm": 0.10781807228559999,
366
+ "learning_rate": 0.000171410159909675,
367
+ "loss": 0.476,
368
+ "step": 49
369
+ },
370
+ {
371
+ "epoch": 0.3,
372
+ "grad_norm": 0.12502639462035098,
373
+ "learning_rate": 0.00017000420745694254,
374
+ "loss": 0.5084,
375
+ "step": 50
376
+ },
377
+ {
378
+ "epoch": 0.3,
379
+ "grad_norm": 0.10718920826593327,
380
+ "learning_rate": 0.00016857057950864132,
381
+ "loss": 0.5093,
382
+ "step": 51
383
+ },
384
+ {
385
+ "epoch": 0.31,
386
+ "grad_norm": 0.10040549880547282,
387
+ "learning_rate": 0.0001671098428359037,
388
+ "loss": 0.4644,
389
+ "step": 52
390
+ },
391
+ {
392
+ "epoch": 0.32,
393
+ "grad_norm": 0.11778478994740472,
394
+ "learning_rate": 0.00016562257492703757,
395
+ "loss": 0.4725,
396
+ "step": 53
397
+ },
398
+ {
399
+ "epoch": 0.32,
400
+ "grad_norm": 0.1008386031049932,
401
+ "learning_rate": 0.000164109363759222,
402
+ "loss": 0.5121,
403
+ "step": 54
404
+ },
405
+ {
406
+ "epoch": 0.33,
407
+ "grad_norm": 0.1170302528140235,
408
+ "learning_rate": 0.000162570807566056,
409
+ "loss": 0.4766,
410
+ "step": 55
411
+ },
412
+ {
413
+ "epoch": 0.33,
414
+ "grad_norm": 0.1104526773884303,
415
+ "learning_rate": 0.00016100751460105243,
416
+ "loss": 0.4886,
417
+ "step": 56
418
+ },
419
+ {
420
+ "epoch": 0.34,
421
+ "grad_norm": 0.10467920768691032,
422
+ "learning_rate": 0.00015942010289717105,
423
+ "loss": 0.4703,
424
+ "step": 57
425
+ },
426
+ {
427
+ "epoch": 0.34,
428
+ "grad_norm": 0.11551406829220555,
429
+ "learning_rate": 0.00015780920002248484,
430
+ "loss": 0.4837,
431
+ "step": 58
432
+ },
433
+ {
434
+ "epoch": 0.35,
435
+ "grad_norm": 0.11133818831887894,
436
+ "learning_rate": 0.0001561754428320771,
437
+ "loss": 0.5148,
438
+ "step": 59
439
+ },
440
+ {
441
+ "epoch": 0.36,
442
+ "grad_norm": 0.11281448423273216,
443
+ "learning_rate": 0.00015451947721626676,
444
+ "loss": 0.4561,
445
+ "step": 60
446
+ },
447
+ {
448
+ "epoch": 0.36,
449
+ "grad_norm": 0.13934126997471205,
450
+ "learning_rate": 0.00015284195784526195,
451
+ "loss": 0.5069,
452
+ "step": 61
453
+ },
454
+ {
455
+ "epoch": 0.37,
456
+ "grad_norm": 0.11851655387640142,
457
+ "learning_rate": 0.00015114354791034225,
458
+ "loss": 0.5094,
459
+ "step": 62
460
+ },
461
+ {
462
+ "epoch": 0.37,
463
+ "grad_norm": 0.12909148374566123,
464
+ "learning_rate": 0.0001494249188616723,
465
+ "loss": 0.581,
466
+ "step": 63
467
+ },
468
+ {
469
+ "epoch": 0.38,
470
+ "grad_norm": 0.11070161341925377,
471
+ "learning_rate": 0.00014768675014285062,
472
+ "loss": 0.4585,
473
+ "step": 64
474
+ },
475
+ {
476
+ "epoch": 0.39,
477
+ "grad_norm": 0.13308674882888374,
478
+ "learning_rate": 0.00014592972892229778,
479
+ "loss": 0.4974,
480
+ "step": 65
481
+ },
482
+ {
483
+ "epoch": 0.39,
484
+ "grad_norm": 0.12124588853708144,
485
+ "learning_rate": 0.0001441545498215912,
486
+ "loss": 0.4463,
487
+ "step": 66
488
+ },
489
+ {
490
+ "epoch": 0.4,
491
+ "grad_norm": 0.1183570515369953,
492
+ "learning_rate": 0.00014236191464085286,
493
+ "loss": 0.447,
494
+ "step": 67
495
+ },
496
+ {
497
+ "epoch": 0.4,
498
+ "grad_norm": 0.13520024884417237,
499
+ "learning_rate": 0.00014055253208129938,
500
+ "loss": 0.5309,
501
+ "step": 68
502
+ },
503
+ {
504
+ "epoch": 0.41,
505
+ "grad_norm": 0.12184981458813801,
506
+ "learning_rate": 0.00013872711746506413,
507
+ "loss": 0.4532,
508
+ "step": 69
509
+ },
510
+ {
511
+ "epoch": 0.42,
512
+ "grad_norm": 0.12449299540645078,
513
+ "learning_rate": 0.00013688639245240078,
514
+ "loss": 0.5198,
515
+ "step": 70
516
+ },
517
+ {
518
+ "epoch": 0.42,
519
+ "grad_norm": 0.1383134750490429,
520
+ "learning_rate": 0.00013503108475638244,
521
+ "loss": 0.5629,
522
+ "step": 71
523
+ },
524
+ {
525
+ "epoch": 0.43,
526
+ "grad_norm": 0.246237001656926,
527
+ "learning_rate": 0.0001331619278552068,
528
+ "loss": 0.4869,
529
+ "step": 72
530
+ },
531
+ {
532
+ "epoch": 0.43,
533
+ "grad_norm": 0.13337703940933632,
534
+ "learning_rate": 0.00013127966070222274,
535
+ "loss": 0.4792,
536
+ "step": 73
537
+ },
538
+ {
539
+ "epoch": 0.44,
540
+ "grad_norm": 0.12428922033806454,
541
+ "learning_rate": 0.00012938502743379212,
542
+ "loss": 0.4825,
543
+ "step": 74
544
+ },
545
+ {
546
+ "epoch": 0.45,
547
+ "grad_norm": 0.13290774912900208,
548
+ "learning_rate": 0.00012747877707510252,
549
+ "loss": 0.5138,
550
+ "step": 75
551
+ },
552
+ {
553
+ "epoch": 0.45,
554
+ "grad_norm": 0.11185975046756892,
555
+ "learning_rate": 0.0001255616632440475,
556
+ "loss": 0.4815,
557
+ "step": 76
558
+ },
559
+ {
560
+ "epoch": 0.46,
561
+ "grad_norm": 0.1130592868215497,
562
+ "learning_rate": 0.0001236344438532905,
563
+ "loss": 0.5046,
564
+ "step": 77
565
+ },
566
+ {
567
+ "epoch": 0.46,
568
+ "grad_norm": 0.12882943465594857,
569
+ "learning_rate": 0.0001216978808106318,
570
+ "loss": 0.5091,
571
+ "step": 78
572
+ },
573
+ {
574
+ "epoch": 0.47,
575
+ "grad_norm": 0.14837896297082676,
576
+ "learning_rate": 0.00011975273971779528,
577
+ "loss": 0.5158,
578
+ "step": 79
579
+ },
580
+ {
581
+ "epoch": 0.48,
582
+ "grad_norm": 0.1265223309856292,
583
+ "learning_rate": 0.00011779978956775506,
584
+ "loss": 0.5068,
585
+ "step": 80
586
+ },
587
+ {
588
+ "epoch": 0.48,
589
+ "grad_norm": 0.14042502330520407,
590
+ "learning_rate": 0.0001158398024407215,
591
+ "loss": 0.5061,
592
+ "step": 81
593
+ },
594
+ {
595
+ "epoch": 0.49,
596
+ "grad_norm": 0.1261526695491767,
597
+ "learning_rate": 0.00011387355319890685,
598
+ "loss": 0.4691,
599
+ "step": 82
600
+ },
601
+ {
602
+ "epoch": 0.49,
603
+ "grad_norm": 0.12007305451001854,
604
+ "learning_rate": 0.00011190181918019049,
605
+ "loss": 0.4753,
606
+ "step": 83
607
+ },
608
+ {
609
+ "epoch": 0.5,
610
+ "grad_norm": 0.12809956897166885,
611
+ "learning_rate": 0.00010992537989080618,
612
+ "loss": 0.4417,
613
+ "step": 84
614
+ },
615
+ {
616
+ "epoch": 0.5,
617
+ "eval_loss": 0.9675251841545105,
618
+ "eval_runtime": 152.4793,
619
+ "eval_samples_per_second": 1.633,
620
+ "eval_steps_per_second": 0.82,
621
+ "step": 84
622
+ },
623
+ {
624
+ "epoch": 0.51,
625
+ "grad_norm": 0.11858329804793687,
626
+ "learning_rate": 0.00010794501669717145,
627
+ "loss": 0.4868,
628
+ "step": 85
629
+ },
630
+ {
631
+ "epoch": 0.51,
632
+ "grad_norm": 0.10984649953887334,
633
+ "learning_rate": 0.00010596151251698199,
634
+ "loss": 0.4598,
635
+ "step": 86
636
+ },
637
+ {
638
+ "epoch": 0.52,
639
+ "grad_norm": 0.10927203986256682,
640
+ "learning_rate": 0.0001039756515096926,
641
+ "loss": 0.4693,
642
+ "step": 87
643
+ },
644
+ {
645
+ "epoch": 0.52,
646
+ "grad_norm": 0.11205046531522328,
647
+ "learning_rate": 0.00010198821876650701,
648
+ "loss": 0.4921,
649
+ "step": 88
650
+ },
651
+ {
652
+ "epoch": 0.53,
653
+ "grad_norm": 0.13232347270009215,
654
+ "learning_rate": 0.0001,
655
+ "loss": 0.4695,
656
+ "step": 89
657
+ },
658
+ {
659
+ "epoch": 0.53,
660
+ "grad_norm": 0.12136881873560385,
661
+ "learning_rate": 9.801178123349298e-05,
662
+ "loss": 0.4859,
663
+ "step": 90
664
+ },
665
+ {
666
+ "epoch": 0.54,
667
+ "grad_norm": 0.14347476421156694,
668
+ "learning_rate": 9.602434849030745e-05,
669
+ "loss": 0.4796,
670
+ "step": 91
671
+ },
672
+ {
673
+ "epoch": 0.55,
674
+ "grad_norm": 0.13956845267055204,
675
+ "learning_rate": 9.403848748301802e-05,
676
+ "loss": 0.5339,
677
+ "step": 92
678
+ },
679
+ {
680
+ "epoch": 0.55,
681
+ "grad_norm": 0.12814010903196785,
682
+ "learning_rate": 9.205498330282856e-05,
683
+ "loss": 0.5267,
684
+ "step": 93
685
+ },
686
+ {
687
+ "epoch": 0.56,
688
+ "grad_norm": 0.12798850330908082,
689
+ "learning_rate": 9.007462010919386e-05,
690
+ "loss": 0.4604,
691
+ "step": 94
692
+ },
693
+ {
694
+ "epoch": 0.56,
695
+ "grad_norm": 0.13673366056605873,
696
+ "learning_rate": 8.809818081980953e-05,
697
+ "loss": 0.49,
698
+ "step": 95
699
+ },
700
+ {
701
+ "epoch": 0.57,
702
+ "grad_norm": 0.12607483394599764,
703
+ "learning_rate": 8.612644680109319e-05,
704
+ "loss": 0.4774,
705
+ "step": 96
706
+ },
707
+ {
708
+ "epoch": 0.58,
709
+ "grad_norm": 0.1365629261848207,
710
+ "learning_rate": 8.416019755927851e-05,
711
+ "loss": 0.4827,
712
+ "step": 97
713
+ },
714
+ {
715
+ "epoch": 0.58,
716
+ "grad_norm": 0.12122559291940836,
717
+ "learning_rate": 8.2200210432245e-05,
718
+ "loss": 0.5044,
719
+ "step": 98
720
+ },
721
+ {
722
+ "epoch": 0.59,
723
+ "grad_norm": 0.11655390642565265,
724
+ "learning_rate": 8.024726028220474e-05,
725
+ "loss": 0.503,
726
+ "step": 99
727
+ },
728
+ {
729
+ "epoch": 0.59,
730
+ "grad_norm": 0.12394574502796742,
731
+ "learning_rate": 7.83021191893682e-05,
732
+ "loss": 0.491,
733
+ "step": 100
734
+ },
735
+ {
736
+ "epoch": 0.6,
737
+ "grad_norm": 0.14922841699852962,
738
+ "learning_rate": 7.636555614670953e-05,
739
+ "loss": 0.457,
740
+ "step": 101
741
+ },
742
+ {
743
+ "epoch": 0.61,
744
+ "grad_norm": 0.11076924096187928,
745
+ "learning_rate": 7.443833675595255e-05,
746
+ "loss": 0.4603,
747
+ "step": 102
748
+ },
749
+ {
750
+ "epoch": 0.61,
751
+ "grad_norm": 0.1263594611752413,
752
+ "learning_rate": 7.252122292489747e-05,
753
+ "loss": 0.4859,
754
+ "step": 103
755
+ },
756
+ {
757
+ "epoch": 0.62,
758
+ "grad_norm": 0.11432575178505003,
759
+ "learning_rate": 7.061497256620793e-05,
760
+ "loss": 0.4627,
761
+ "step": 104
762
+ },
763
+ {
764
+ "epoch": 0.62,
765
+ "grad_norm": 0.1078119391965793,
766
+ "learning_rate": 6.87203392977773e-05,
767
+ "loss": 0.4829,
768
+ "step": 105
769
+ },
770
+ {
771
+ "epoch": 0.63,
772
+ "grad_norm": 0.12752089816514908,
773
+ "learning_rate": 6.683807214479323e-05,
774
+ "loss": 0.46,
775
+ "step": 106
776
+ },
777
+ {
778
+ "epoch": 0.64,
779
+ "grad_norm": 0.11421623043902956,
780
+ "learning_rate": 6.496891524361757e-05,
781
+ "loss": 0.4429,
782
+ "step": 107
783
+ },
784
+ {
785
+ "epoch": 0.64,
786
+ "grad_norm": 0.10432253193399477,
787
+ "learning_rate": 6.311360754759923e-05,
788
+ "loss": 0.402,
789
+ "step": 108
790
+ },
791
+ {
792
+ "epoch": 0.65,
793
+ "grad_norm": 0.12155248673662734,
794
+ "learning_rate": 6.127288253493591e-05,
795
+ "loss": 0.5126,
796
+ "step": 109
797
+ },
798
+ {
799
+ "epoch": 0.65,
800
+ "grad_norm": 0.14266947863559803,
801
+ "learning_rate": 5.9447467918700614e-05,
802
+ "loss": 0.4821,
803
+ "step": 110
804
+ },
805
+ {
806
+ "epoch": 0.66,
807
+ "grad_norm": 0.14851250761112514,
808
+ "learning_rate": 5.763808535914723e-05,
809
+ "loss": 0.4891,
810
+ "step": 111
811
+ },
812
+ {
813
+ "epoch": 0.67,
814
+ "grad_norm": 0.14264023747361737,
815
+ "learning_rate": 5.584545017840885e-05,
816
+ "loss": 0.5181,
817
+ "step": 112
818
+ },
819
+ {
820
+ "epoch": 0.67,
821
+ "grad_norm": 0.12837168363458795,
822
+ "learning_rate": 5.407027107770219e-05,
823
+ "loss": 0.5599,
824
+ "step": 113
825
+ },
826
+ {
827
+ "epoch": 0.68,
828
+ "grad_norm": 0.11874709251257598,
829
+ "learning_rate": 5.2313249857149414e-05,
830
+ "loss": 0.4536,
831
+ "step": 114
832
+ },
833
+ {
834
+ "epoch": 0.68,
835
+ "grad_norm": 0.12010754957532713,
836
+ "learning_rate": 5.0575081138327715e-05,
837
+ "loss": 0.5004,
838
+ "step": 115
839
+ },
840
+ {
841
+ "epoch": 0.69,
842
+ "grad_norm": 0.13464124440677885,
843
+ "learning_rate": 4.885645208965779e-05,
844
+ "loss": 0.4985,
845
+ "step": 116
846
+ },
847
+ {
848
+ "epoch": 0.7,
849
+ "grad_norm": 0.13701854261941088,
850
+ "learning_rate": 4.715804215473809e-05,
851
+ "loss": 0.4709,
852
+ "step": 117
853
+ },
854
+ {
855
+ "epoch": 0.7,
856
+ "grad_norm": 0.1335483738873249,
857
+ "learning_rate": 4.548052278373327e-05,
858
+ "loss": 0.4735,
859
+ "step": 118
860
+ },
861
+ {
862
+ "epoch": 0.71,
863
+ "grad_norm": 0.13603172024059101,
864
+ "learning_rate": 4.382455716792291e-05,
865
+ "loss": 0.4721,
866
+ "step": 119
867
+ },
868
+ {
869
+ "epoch": 0.71,
870
+ "grad_norm": 0.13843339239058639,
871
+ "learning_rate": 4.219079997751515e-05,
872
+ "loss": 0.4954,
873
+ "step": 120
874
+ },
875
+ {
876
+ "epoch": 0.72,
877
+ "grad_norm": 0.15011169526780793,
878
+ "learning_rate": 4.0579897102828966e-05,
879
+ "loss": 0.4648,
880
+ "step": 121
881
+ },
882
+ {
883
+ "epoch": 0.73,
884
+ "grad_norm": 0.13061595453081623,
885
+ "learning_rate": 3.899248539894757e-05,
886
+ "loss": 0.4801,
887
+ "step": 122
888
+ },
889
+ {
890
+ "epoch": 0.73,
891
+ "grad_norm": 0.14067787924603412,
892
+ "learning_rate": 3.7429192433944014e-05,
893
+ "loss": 0.4805,
894
+ "step": 123
895
+ },
896
+ {
897
+ "epoch": 0.74,
898
+ "grad_norm": 0.13420057703295998,
899
+ "learning_rate": 3.589063624077802e-05,
900
+ "loss": 0.4446,
901
+ "step": 124
902
+ },
903
+ {
904
+ "epoch": 0.74,
905
+ "grad_norm": 0.14083737654873127,
906
+ "learning_rate": 3.4377425072962465e-05,
907
+ "loss": 0.46,
908
+ "step": 125
909
+ },
910
+ {
911
+ "epoch": 0.75,
912
+ "grad_norm": 0.13231889777376862,
913
+ "learning_rate": 3.289015716409631e-05,
914
+ "loss": 0.4451,
915
+ "step": 126
916
+ },
917
+ {
918
+ "epoch": 0.75,
919
+ "eval_loss": 0.9651579260826111,
920
+ "eval_runtime": 155.5959,
921
+ "eval_samples_per_second": 1.6,
922
+ "eval_steps_per_second": 0.803,
923
+ "step": 126
924
+ },
925
+ {
926
+ "epoch": 0.75,
927
+ "grad_norm": 0.1119782513388846,
928
+ "learning_rate": 3.14294204913587e-05,
929
+ "loss": 0.4728,
930
+ "step": 127
931
+ },
932
+ {
933
+ "epoch": 0.76,
934
+ "grad_norm": 0.1258610262132018,
935
+ "learning_rate": 2.9995792543057478e-05,
936
+ "loss": 0.4793,
937
+ "step": 128
938
+ },
939
+ {
940
+ "epoch": 0.77,
941
+ "grad_norm": 0.1332956040603169,
942
+ "learning_rate": 2.8589840090325027e-05,
943
+ "loss": 0.4919,
944
+ "step": 129
945
+ },
946
+ {
947
+ "epoch": 0.77,
948
+ "grad_norm": 0.13669237836174272,
949
+ "learning_rate": 2.7212118963050592e-05,
950
+ "loss": 0.4863,
951
+ "step": 130
952
+ },
953
+ {
954
+ "epoch": 0.78,
955
+ "grad_norm": 0.13718073990096244,
956
+ "learning_rate": 2.586317383013821e-05,
957
+ "loss": 0.4652,
958
+ "step": 131
959
+ },
960
+ {
961
+ "epoch": 0.78,
962
+ "grad_norm": 0.1328715725965393,
963
+ "learning_rate": 2.4543537984176978e-05,
964
+ "loss": 0.4464,
965
+ "step": 132
966
+ },
967
+ {
968
+ "epoch": 0.79,
969
+ "grad_norm": 0.12474829320490133,
970
+ "learning_rate": 2.325373313060919e-05,
971
+ "loss": 0.501,
972
+ "step": 133
973
+ },
974
+ {
975
+ "epoch": 0.8,
976
+ "grad_norm": 0.13832785688421897,
977
+ "learning_rate": 2.19942691814788e-05,
978
+ "loss": 0.5113,
979
+ "step": 134
980
+ },
981
+ {
982
+ "epoch": 0.8,
983
+ "grad_norm": 0.13446374612957607,
984
+ "learning_rate": 2.076564405384258e-05,
985
+ "loss": 0.452,
986
+ "step": 135
987
+ },
988
+ {
989
+ "epoch": 0.81,
990
+ "grad_norm": 0.15087962227561943,
991
+ "learning_rate": 1.9568343472923524e-05,
992
+ "loss": 0.5114,
993
+ "step": 136
994
+ },
995
+ {
996
+ "epoch": 0.81,
997
+ "grad_norm": 0.13471199433579678,
998
+ "learning_rate": 1.840284078008393e-05,
999
+ "loss": 0.5074,
1000
+ "step": 137
1001
+ },
1002
+ {
1003
+ "epoch": 0.82,
1004
+ "grad_norm": 0.14471602871304384,
1005
+ "learning_rate": 1.7269596745694295e-05,
1006
+ "loss": 0.4812,
1007
+ "step": 138
1008
+ },
1009
+ {
1010
+ "epoch": 0.83,
1011
+ "grad_norm": 0.12791095480012135,
1012
+ "learning_rate": 1.616905938697234e-05,
1013
+ "loss": 0.439,
1014
+ "step": 139
1015
+ },
1016
+ {
1017
+ "epoch": 0.83,
1018
+ "grad_norm": 0.13395748535894433,
1019
+ "learning_rate": 1.5101663790863596e-05,
1020
+ "loss": 0.4942,
1021
+ "step": 140
1022
+ },
1023
+ {
1024
+ "epoch": 0.84,
1025
+ "grad_norm": 0.1216157843375959,
1026
+ "learning_rate": 1.4067831942033904e-05,
1027
+ "loss": 0.4904,
1028
+ "step": 141
1029
+ },
1030
+ {
1031
+ "epoch": 0.84,
1032
+ "grad_norm": 0.12513029490165878,
1033
+ "learning_rate": 1.3067972556041752e-05,
1034
+ "loss": 0.4583,
1035
+ "step": 142
1036
+ },
1037
+ {
1038
+ "epoch": 0.85,
1039
+ "grad_norm": 0.11835922329329535,
1040
+ "learning_rate": 1.210248091775663e-05,
1041
+ "loss": 0.5281,
1042
+ "step": 143
1043
+ },
1044
+ {
1045
+ "epoch": 0.86,
1046
+ "grad_norm": 0.14513302866752326,
1047
+ "learning_rate": 1.1171738725086833e-05,
1048
+ "loss": 0.4432,
1049
+ "step": 144
1050
+ },
1051
+ {
1052
+ "epoch": 0.86,
1053
+ "grad_norm": 0.11934584390756656,
1054
+ "learning_rate": 1.0276113938078769e-05,
1055
+ "loss": 0.4664,
1056
+ "step": 145
1057
+ },
1058
+ {
1059
+ "epoch": 0.87,
1060
+ "grad_norm": 0.11746932949614314,
1061
+ "learning_rate": 9.415960633447674e-06,
1062
+ "loss": 0.4452,
1063
+ "step": 146
1064
+ },
1065
+ {
1066
+ "epoch": 0.87,
1067
+ "grad_norm": 0.1183312470782195,
1068
+ "learning_rate": 8.59161886459654e-06,
1069
+ "loss": 0.4858,
1070
+ "step": 147
1071
+ },
1072
+ {
1073
+ "epoch": 0.88,
1074
+ "grad_norm": 0.1226342260426643,
1075
+ "learning_rate": 7.803414527179343e-06,
1076
+ "loss": 0.4609,
1077
+ "step": 148
1078
+ },
1079
+ {
1080
+ "epoch": 0.89,
1081
+ "grad_norm": 0.12849903086517628,
1082
+ "learning_rate": 7.051659230261298e-06,
1083
+ "loss": 0.4992,
1084
+ "step": 149
1085
+ },
1086
+ {
1087
+ "epoch": 0.89,
1088
+ "grad_norm": 0.12558798780888547,
1089
+ "learning_rate": 6.336650173127223e-06,
1090
+ "loss": 0.5055,
1091
+ "step": 150
1092
+ },
1093
+ {
1094
+ "epoch": 0.9,
1095
+ "grad_norm": 0.11991457404362381,
1096
+ "learning_rate": 5.658670027786561e-06,
1097
+ "loss": 0.4711,
1098
+ "step": 151
1099
+ },
1100
+ {
1101
+ "epoch": 0.9,
1102
+ "grad_norm": 0.14486189343828018,
1103
+ "learning_rate": 5.017986827221733e-06,
1104
+ "loss": 0.4984,
1105
+ "step": 152
1106
+ },
1107
+ {
1108
+ "epoch": 0.91,
1109
+ "grad_norm": 0.14292272311516058,
1110
+ "learning_rate": 4.4148538594239174e-06,
1111
+ "loss": 0.518,
1112
+ "step": 153
1113
+ },
1114
+ {
1115
+ "epoch": 0.92,
1116
+ "grad_norm": 0.12669351883956026,
1117
+ "learning_rate": 3.849509567257959e-06,
1118
+ "loss": 0.509,
1119
+ "step": 154
1120
+ },
1121
+ {
1122
+ "epoch": 0.92,
1123
+ "grad_norm": 0.14745027617256945,
1124
+ "learning_rate": 3.3221774541962845e-06,
1125
+ "loss": 0.4655,
1126
+ "step": 155
1127
+ },
1128
+ {
1129
+ "epoch": 0.93,
1130
+ "grad_norm": 0.13904171638337365,
1131
+ "learning_rate": 2.8330659959589946e-06,
1132
+ "loss": 0.445,
1133
+ "step": 156
1134
+ },
1135
+ {
1136
+ "epoch": 0.93,
1137
+ "grad_norm": 0.12971202836694892,
1138
+ "learning_rate": 2.3823685580949273e-06,
1139
+ "loss": 0.4534,
1140
+ "step": 157
1141
+ },
1142
+ {
1143
+ "epoch": 0.94,
1144
+ "grad_norm": 0.13437185949159883,
1145
+ "learning_rate": 1.9702633195363917e-06,
1146
+ "loss": 0.4785,
1147
+ "step": 158
1148
+ },
1149
+ {
1150
+ "epoch": 0.95,
1151
+ "grad_norm": 0.12319276879857373,
1152
+ "learning_rate": 1.5969132021579347e-06,
1153
+ "loss": 0.5011,
1154
+ "step": 159
1155
+ },
1156
+ {
1157
+ "epoch": 0.95,
1158
+ "grad_norm": 0.12918661435233847,
1159
+ "learning_rate": 1.2624658063666639e-06,
1160
+ "loss": 0.5236,
1161
+ "step": 160
1162
+ },
1163
+ {
1164
+ "epoch": 0.96,
1165
+ "grad_norm": 0.12874241011432666,
1166
+ "learning_rate": 9.670533527498137e-07,
1167
+ "loss": 0.4439,
1168
+ "step": 161
1169
+ },
1170
+ {
1171
+ "epoch": 0.96,
1172
+ "grad_norm": 0.1315361924610259,
1173
+ "learning_rate": 7.10792629802659e-07,
1174
+ "loss": 0.4929,
1175
+ "step": 162
1176
+ },
1177
+ {
1178
+ "epoch": 0.97,
1179
+ "grad_norm": 0.1336404295007477,
1180
+ "learning_rate": 4.937849477572587e-07,
1181
+ "loss": 0.433,
1182
+ "step": 163
1183
+ },
1184
+ {
1185
+ "epoch": 0.97,
1186
+ "grad_norm": 0.11865993758025514,
1187
+ "learning_rate": 3.161160985304168e-07,
1188
+ "loss": 0.4266,
1189
+ "step": 164
1190
+ },
1191
+ {
1192
+ "epoch": 0.98,
1193
+ "grad_norm": 0.12559739797694514,
1194
+ "learning_rate": 1.7785632180670198e-07,
1195
+ "loss": 0.436,
1196
+ "step": 165
1197
+ },
1198
+ {
1199
+ "epoch": 0.99,
1200
+ "grad_norm": 0.12409278477769135,
1201
+ "learning_rate": 7.906027726981568e-08,
1202
+ "loss": 0.5017,
1203
+ "step": 166
1204
+ },
1205
+ {
1206
+ "epoch": 0.99,
1207
+ "grad_norm": 0.1398337808177678,
1208
+ "learning_rate": 1.976702299344435e-08,
1209
+ "loss": 0.5112,
1210
+ "step": 167
1211
+ },
1212
+ {
1213
+ "epoch": 1.0,
1214
+ "grad_norm": 0.11434132222175684,
1215
+ "learning_rate": 0.0,
1216
+ "loss": 0.4616,
1217
+ "step": 168
1218
+ },
1219
+ {
1220
+ "epoch": 1.0,
1221
+ "eval_loss": 0.9651336073875427,
1222
+ "eval_runtime": 154.7455,
1223
+ "eval_samples_per_second": 1.609,
1224
+ "eval_steps_per_second": 0.808,
1225
+ "step": 168
1226
+ }
1227
+ ],
1228
+ "logging_steps": 1,
1229
+ "max_steps": 168,
1230
+ "num_input_tokens_seen": 0,
1231
+ "num_train_epochs": 1,
1232
+ "save_steps": 42,
1233
+ "total_flos": 3.406567776272253e+18,
1234
+ "train_batch_size": 1,
1235
+ "trial_name": null,
1236
+ "trial_params": null
1237
+ }
checkpoint-168/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cbfaffe231fe183758cc2353296944fef75710807fa8ea7663978d9e906d00f7
3
+ size 6968
checkpoint-168/zero_to_fp32.py ADDED
@@ -0,0 +1,592 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example: python zero_to_fp32.py . pytorch_model.bin
14
+
15
+ import argparse
16
+ import torch
17
+ import glob
18
+ import math
19
+ import os
20
+ import re
21
+ from collections import OrderedDict
22
+ from dataclasses import dataclass
23
+
24
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
25
+ # DeepSpeed data structures it has to be available in the current python environment.
26
+ from deepspeed.utils import logger
27
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
28
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
29
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
30
+
31
+
32
+ @dataclass
33
+ class zero_model_state:
34
+ buffers: dict()
35
+ param_shapes: dict()
36
+ shared_params: list
37
+ ds_version: int
38
+ frozen_param_shapes: dict()
39
+ frozen_param_fragments: dict()
40
+
41
+
42
+ debug = 0
43
+
44
+ # load to cpu
45
+ device = torch.device('cpu')
46
+
47
+
48
+ def atoi(text):
49
+ return int(text) if text.isdigit() else text
50
+
51
+
52
+ def natural_keys(text):
53
+ '''
54
+ alist.sort(key=natural_keys) sorts in human order
55
+ http://nedbatchelder.com/blog/200712/human_sorting.html
56
+ (See Toothy's implementation in the comments)
57
+ '''
58
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
59
+
60
+
61
+ def get_model_state_file(checkpoint_dir, zero_stage):
62
+ if not os.path.isdir(checkpoint_dir):
63
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
64
+
65
+ # there should be only one file
66
+ if zero_stage <= 2:
67
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
68
+ elif zero_stage == 3:
69
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
70
+
71
+ if not os.path.exists(file):
72
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
73
+
74
+ return file
75
+
76
+
77
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
78
+ # XXX: need to test that this simple glob rule works for multi-node setup too
79
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
80
+
81
+ if len(ckpt_files) == 0:
82
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
83
+
84
+ return ckpt_files
85
+
86
+
87
+ def get_optim_files(checkpoint_dir):
88
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
89
+
90
+
91
+ def get_model_state_files(checkpoint_dir):
92
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
93
+
94
+
95
+ def parse_model_states(files):
96
+ zero_model_states = []
97
+ for file in files:
98
+ state_dict = torch.load(file, map_location=device)
99
+
100
+ if BUFFER_NAMES not in state_dict:
101
+ raise ValueError(f"{file} is not a model state checkpoint")
102
+ buffer_names = state_dict[BUFFER_NAMES]
103
+ if debug:
104
+ print("Found buffers:", buffer_names)
105
+
106
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
107
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
108
+ param_shapes = state_dict[PARAM_SHAPES]
109
+
110
+ # collect parameters that are included in param_shapes
111
+ param_names = []
112
+ for s in param_shapes:
113
+ for name in s.keys():
114
+ param_names.append(name)
115
+
116
+ # update with frozen parameters
117
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
118
+ if frozen_param_shapes is not None:
119
+ if debug:
120
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
121
+ param_names += list(frozen_param_shapes.keys())
122
+
123
+ # handle shared params
124
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
125
+
126
+ ds_version = state_dict.get(DS_VERSION, None)
127
+
128
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
129
+
130
+ z_model_state = zero_model_state(buffers=buffers,
131
+ param_shapes=param_shapes,
132
+ shared_params=shared_params,
133
+ ds_version=ds_version,
134
+ frozen_param_shapes=frozen_param_shapes,
135
+ frozen_param_fragments=frozen_param_fragments)
136
+ zero_model_states.append(z_model_state)
137
+
138
+ return zero_model_states
139
+
140
+
141
+ def parse_optim_states(files, ds_checkpoint_dir):
142
+
143
+ total_files = len(files)
144
+ state_dicts = []
145
+ for f in files:
146
+ state_dict = torch.load(f, map_location=device)
147
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
148
+ # and also handle the case where it was already removed by another helper script
149
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
150
+ state_dicts.append(state_dict)
151
+
152
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
153
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
154
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
155
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
156
+
157
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
158
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
159
+ # use the max of the partition_count to get the dp world_size.
160
+
161
+ if type(world_size) is list:
162
+ world_size = max(world_size)
163
+
164
+ if world_size != total_files:
165
+ raise ValueError(
166
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
167
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
168
+ )
169
+
170
+ # the groups are named differently in each stage
171
+ if zero_stage <= 2:
172
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
173
+ elif zero_stage == 3:
174
+ fp32_groups_key = FP32_FLAT_GROUPS
175
+ else:
176
+ raise ValueError(f"unknown zero stage {zero_stage}")
177
+
178
+ if zero_stage <= 2:
179
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
180
+ elif zero_stage == 3:
181
+ # if there is more than one param group, there will be multiple flattened tensors - one
182
+ # flattened tensor per group - for simplicity merge them into a single tensor
183
+ #
184
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
185
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
186
+
187
+ fp32_flat_groups = [
188
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
189
+ ]
190
+
191
+ return zero_stage, world_size, fp32_flat_groups
192
+
193
+
194
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir):
195
+ """
196
+ Returns fp32 state_dict reconstructed from ds checkpoint
197
+
198
+ Args:
199
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
200
+
201
+ """
202
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
203
+
204
+ optim_files = get_optim_files(ds_checkpoint_dir)
205
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
206
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
207
+
208
+ model_files = get_model_state_files(ds_checkpoint_dir)
209
+
210
+ zero_model_states = parse_model_states(model_files)
211
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
212
+
213
+ if zero_stage <= 2:
214
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states)
215
+ elif zero_stage == 3:
216
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states)
217
+
218
+
219
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
220
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
221
+ return
222
+
223
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
224
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
225
+
226
+ if debug:
227
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
228
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
229
+
230
+ wanted_params = len(frozen_param_shapes)
231
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
232
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
233
+ print(f'Frozen params: Have {avail_numel} numels to process.')
234
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
235
+
236
+ total_params = 0
237
+ total_numel = 0
238
+ for name, shape in frozen_param_shapes.items():
239
+ total_params += 1
240
+ unpartitioned_numel = shape.numel()
241
+ total_numel += unpartitioned_numel
242
+
243
+ state_dict[name] = frozen_param_fragments[name]
244
+
245
+ if debug:
246
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
247
+
248
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
249
+
250
+
251
+ def _has_callable(obj, fn):
252
+ attr = getattr(obj, fn, None)
253
+ return callable(attr)
254
+
255
+
256
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
257
+ param_shapes = zero_model_states[0].param_shapes
258
+
259
+ # Reconstruction protocol:
260
+ #
261
+ # XXX: document this
262
+
263
+ if debug:
264
+ for i in range(world_size):
265
+ for j in range(len(fp32_flat_groups[0])):
266
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
267
+
268
+ # XXX: memory usage doubles here (zero2)
269
+ num_param_groups = len(fp32_flat_groups[0])
270
+ merged_single_partition_of_fp32_groups = []
271
+ for i in range(num_param_groups):
272
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
273
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
274
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
275
+ avail_numel = sum(
276
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
277
+
278
+ if debug:
279
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
280
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
281
+ # not asserting if there is a mismatch due to possible padding
282
+ print(f"Have {avail_numel} numels to process.")
283
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
284
+
285
+ # params
286
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
287
+ # out-of-core computing solution
288
+ total_numel = 0
289
+ total_params = 0
290
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
291
+ offset = 0
292
+ avail_numel = full_single_fp32_vector.numel()
293
+ for name, shape in shapes.items():
294
+
295
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
296
+ total_numel += unpartitioned_numel
297
+ total_params += 1
298
+
299
+ if debug:
300
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
301
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
302
+ offset += unpartitioned_numel
303
+
304
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
305
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
306
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
307
+ # live optimizer object, so we are checking that the numbers are within the right range
308
+ align_to = 2 * world_size
309
+
310
+ def zero2_align(x):
311
+ return align_to * math.ceil(x / align_to)
312
+
313
+ if debug:
314
+ print(f"original offset={offset}, avail_numel={avail_numel}")
315
+
316
+ offset = zero2_align(offset)
317
+ avail_numel = zero2_align(avail_numel)
318
+
319
+ if debug:
320
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
321
+
322
+ # Sanity check
323
+ if offset != avail_numel:
324
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
325
+
326
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
327
+
328
+
329
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states):
330
+ state_dict = OrderedDict()
331
+
332
+ # buffers
333
+ buffers = zero_model_states[0].buffers
334
+ state_dict.update(buffers)
335
+ if debug:
336
+ print(f"added {len(buffers)} buffers")
337
+
338
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
339
+
340
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
341
+
342
+ # recover shared parameters
343
+ for pair in zero_model_states[0].shared_params:
344
+ if pair[1] in state_dict:
345
+ state_dict[pair[0]] = state_dict[pair[1]]
346
+
347
+ return state_dict
348
+
349
+
350
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
351
+ remainder = unpartitioned_numel % world_size
352
+ padding_numel = (world_size - remainder) if remainder else 0
353
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
354
+ return partitioned_numel, padding_numel
355
+
356
+
357
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
358
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
359
+ return
360
+
361
+ if debug:
362
+ for i in range(world_size):
363
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
364
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
365
+
366
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
367
+ wanted_params = len(frozen_param_shapes)
368
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
369
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
370
+ print(f'Frozen params: Have {avail_numel} numels to process.')
371
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
372
+
373
+ total_params = 0
374
+ total_numel = 0
375
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
376
+ total_params += 1
377
+ unpartitioned_numel = shape.numel()
378
+ total_numel += unpartitioned_numel
379
+
380
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
381
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
382
+
383
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
384
+
385
+ if debug:
386
+ print(
387
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
388
+ )
389
+
390
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
391
+
392
+
393
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
394
+ param_shapes = zero_model_states[0].param_shapes
395
+ avail_numel = fp32_flat_groups[0].numel() * world_size
396
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
397
+ # param, re-consolidating each param, while dealing with padding if any
398
+
399
+ # merge list of dicts, preserving order
400
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
401
+
402
+ if debug:
403
+ for i in range(world_size):
404
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
405
+
406
+ wanted_params = len(param_shapes)
407
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
408
+ # not asserting if there is a mismatch due to possible padding
409
+ avail_numel = fp32_flat_groups[0].numel() * world_size
410
+ print(f"Trainable params: Have {avail_numel} numels to process.")
411
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
412
+
413
+ # params
414
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
415
+ # out-of-core computing solution
416
+ offset = 0
417
+ total_numel = 0
418
+ total_params = 0
419
+ for name, shape in param_shapes.items():
420
+
421
+ unpartitioned_numel = shape.numel()
422
+ total_numel += unpartitioned_numel
423
+ total_params += 1
424
+
425
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
426
+
427
+ if debug:
428
+ print(
429
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
430
+ )
431
+
432
+ # XXX: memory usage doubles here
433
+ state_dict[name] = torch.cat(
434
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
435
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
436
+ offset += partitioned_numel
437
+
438
+ offset *= world_size
439
+
440
+ # Sanity check
441
+ if offset != avail_numel:
442
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
443
+
444
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
445
+
446
+
447
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states):
448
+ state_dict = OrderedDict()
449
+
450
+ # buffers
451
+ buffers = zero_model_states[0].buffers
452
+ state_dict.update(buffers)
453
+ if debug:
454
+ print(f"added {len(buffers)} buffers")
455
+
456
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
457
+
458
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
459
+
460
+ # recover shared parameters
461
+ for pair in zero_model_states[0].shared_params:
462
+ if pair[1] in state_dict:
463
+ state_dict[pair[0]] = state_dict[pair[1]]
464
+
465
+ return state_dict
466
+
467
+
468
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None):
469
+ """
470
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
471
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
472
+ via a model hub.
473
+
474
+ Args:
475
+ - ``checkpoint_dir``: path to the desired checkpoint folder
476
+ - ``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``
477
+
478
+ Returns:
479
+ - pytorch ``state_dict``
480
+
481
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
482
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
483
+ the checkpoint.
484
+
485
+ A typical usage might be ::
486
+
487
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
488
+ # do the training and checkpoint saving
489
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
490
+ model = model.cpu() # move to cpu
491
+ model.load_state_dict(state_dict)
492
+ # submit to model hub or save the model to share with others
493
+
494
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
495
+ application. i.e. you will need to re-initialize the deepspeed engine, since
496
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
497
+
498
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
499
+
500
+ """
501
+ if tag is None:
502
+ latest_path = os.path.join(checkpoint_dir, 'latest')
503
+ if os.path.isfile(latest_path):
504
+ with open(latest_path, 'r') as fd:
505
+ tag = fd.read().strip()
506
+ else:
507
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
508
+
509
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
510
+
511
+ if not os.path.isdir(ds_checkpoint_dir):
512
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
513
+
514
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir)
515
+
516
+
517
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None):
518
+ """
519
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
520
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
521
+
522
+ Args:
523
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
524
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
525
+ - ``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``
526
+ """
527
+
528
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
529
+ print(f"Saving fp32 state dict to {output_file}")
530
+ torch.save(state_dict, output_file)
531
+
532
+
533
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
534
+ """
535
+ 1. Put the provided model to cpu
536
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
537
+ 3. Load it into the provided model
538
+
539
+ Args:
540
+ - ``model``: the model object to update
541
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
542
+ - ``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``
543
+
544
+ Returns:
545
+ - ``model`: modified model
546
+
547
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
548
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
549
+ conveniently placed for you in the checkpoint folder.
550
+
551
+ A typical usage might be ::
552
+
553
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
554
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
555
+ # submit to model hub or save the model to share with others
556
+
557
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
558
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
559
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
560
+
561
+ """
562
+ logger.info(f"Extracting fp32 weights")
563
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
564
+
565
+ logger.info(f"Overwriting model with fp32 weights")
566
+ model = model.cpu()
567
+ model.load_state_dict(state_dict, strict=False)
568
+
569
+ return model
570
+
571
+
572
+ if __name__ == "__main__":
573
+
574
+ parser = argparse.ArgumentParser()
575
+ parser.add_argument("checkpoint_dir",
576
+ type=str,
577
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
578
+ parser.add_argument(
579
+ "output_file",
580
+ type=str,
581
+ help="path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)")
582
+ parser.add_argument("-t",
583
+ "--tag",
584
+ type=str,
585
+ default=None,
586
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
587
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
588
+ args = parser.parse_args()
589
+
590
+ debug = args.debug
591
+
592
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir, args.output_file, tag=args.tag)
config.json CHANGED
@@ -40,15 +40,13 @@
40
  "quantization_config": {
41
  "_load_in_4bit": true,
42
  "_load_in_8bit": false,
43
- "bnb_4bit_compute_dtype": "float32",
44
- "bnb_4bit_quant_storage": "uint8",
45
- "bnb_4bit_quant_type": "fp4",
46
- "bnb_4bit_use_double_quant": false,
47
  "llm_int8_enable_fp32_cpu_offload": false,
48
  "llm_int8_has_fp16_weight": false,
49
- "llm_int8_skip_modules": [
50
- "mamba"
51
- ],
52
  "llm_int8_threshold": 6.0,
53
  "load_in_4bit": true,
54
  "load_in_8bit": false,
@@ -58,9 +56,9 @@
58
  "router_aux_loss_coef": 0.001,
59
  "sliding_window": null,
60
  "tie_word_embeddings": false,
61
- "torch_dtype": "float16",
62
  "transformers_version": "4.40.0.dev0",
63
- "use_cache": true,
64
  "use_mamba_kernels": true,
65
  "vocab_size": 65536
66
  }
 
40
  "quantization_config": {
41
  "_load_in_4bit": true,
42
  "_load_in_8bit": false,
43
+ "bnb_4bit_compute_dtype": "bfloat16",
44
+ "bnb_4bit_quant_storage": "bfloat16",
45
+ "bnb_4bit_quant_type": "nf4",
46
+ "bnb_4bit_use_double_quant": true,
47
  "llm_int8_enable_fp32_cpu_offload": false,
48
  "llm_int8_has_fp16_weight": false,
49
+ "llm_int8_skip_modules": null,
 
 
50
  "llm_int8_threshold": 6.0,
51
  "load_in_4bit": true,
52
  "load_in_8bit": false,
 
56
  "router_aux_loss_coef": 0.001,
57
  "sliding_window": null,
58
  "tie_word_embeddings": false,
59
+ "torch_dtype": "bfloat16",
60
  "transformers_version": "4.40.0.dev0",
61
+ "use_cache": false,
62
  "use_mamba_kernels": true,
63
  "vocab_size": 65536
64
  }
tokenizer_config.json CHANGED
@@ -36,6 +36,7 @@
36
  }
37
  },
38
  "bos_token": "<|startoftext|>",
 
39
  "clean_up_tokenization_spaces": false,
40
  "eos_token": "<|endoftext|>",
41
  "model_max_length": 1000000000000000019884624838656,
 
36
  }
37
  },
38
  "bos_token": "<|startoftext|>",
39
+ "chat_template": "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
40
  "clean_up_tokenization_spaces": false,
41
  "eos_token": "<|endoftext|>",
42
  "model_max_length": 1000000000000000019884624838656,