Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +1 -0
- README.md +181 -0
- adapter_config.json +33 -0
- adapter_model.bin +3 -0
- checkpoint-40/README.md +202 -0
- checkpoint-40/adapter_config.json +33 -0
- checkpoint-40/adapter_model.safetensors +3 -0
- checkpoint-40/global_step40/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt +3 -0
- checkpoint-40/global_step40/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt +3 -0
- checkpoint-40/global_step40/bf16_zero_pp_rank_2_mp_rank_00_optim_states.pt +3 -0
- checkpoint-40/global_step40/bf16_zero_pp_rank_3_mp_rank_00_optim_states.pt +3 -0
- checkpoint-40/global_step40/mp_rank_00_model_states.pt +3 -0
- checkpoint-40/latest +1 -0
- checkpoint-40/rng_state_0.pth +3 -0
- checkpoint-40/rng_state_1.pth +3 -0
- checkpoint-40/rng_state_2.pth +3 -0
- checkpoint-40/rng_state_3.pth +3 -0
- checkpoint-40/scheduler.pt +3 -0
- checkpoint-40/trainer_state.json +469 -0
- checkpoint-40/training_args.bin +3 -0
- checkpoint-40/zero_to_fp32.py +592 -0
- checkpoint-64/README.md +202 -0
- checkpoint-64/adapter_config.json +33 -0
- checkpoint-64/adapter_model.safetensors +3 -0
- checkpoint-64/global_step64/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt +3 -0
- checkpoint-64/global_step64/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt +3 -0
- checkpoint-64/global_step64/bf16_zero_pp_rank_2_mp_rank_00_optim_states.pt +3 -0
- checkpoint-64/global_step64/bf16_zero_pp_rank_3_mp_rank_00_optim_states.pt +3 -0
- checkpoint-64/global_step64/mp_rank_00_model_states.pt +3 -0
- checkpoint-64/latest +1 -0
- checkpoint-64/rng_state_0.pth +3 -0
- checkpoint-64/rng_state_1.pth +3 -0
- checkpoint-64/rng_state_2.pth +3 -0
- checkpoint-64/rng_state_3.pth +3 -0
- checkpoint-64/scheduler.pt +3 -0
- checkpoint-64/trainer_state.json +733 -0
- checkpoint-64/training_args.bin +3 -0
- checkpoint-64/zero_to_fp32.py +592 -0
- checkpoint-72/README.md +202 -0
- checkpoint-72/adapter_config.json +33 -0
- checkpoint-72/adapter_model.safetensors +3 -0
- checkpoint-72/global_step72/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt +3 -0
- checkpoint-72/global_step72/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt +3 -0
- checkpoint-72/global_step72/bf16_zero_pp_rank_2_mp_rank_00_optim_states.pt +3 -0
- checkpoint-72/global_step72/bf16_zero_pp_rank_3_mp_rank_00_optim_states.pt +3 -0
- checkpoint-72/global_step72/mp_rank_00_model_states.pt +3 -0
- checkpoint-72/latest +1 -0
- checkpoint-72/rng_state_0.pth +3 -0
- checkpoint-72/rng_state_1.pth +3 -0
- checkpoint-72/rng_state_2.pth +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
library_name: peft
|
4 |
+
tags:
|
5 |
+
- generated_from_trainer
|
6 |
+
base_model: google/gemma-7b
|
7 |
+
model-index:
|
8 |
+
- name: gemma-python
|
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>
|
17 |
+
|
18 |
+
axolotl version: `0.4.0`
|
19 |
+
```yaml
|
20 |
+
# use google/gemma-7b if you have access
|
21 |
+
base_model: google/gemma-7b
|
22 |
+
model_type: AutoModelForCausalLM
|
23 |
+
tokenizer_type: AutoTokenizer
|
24 |
+
|
25 |
+
|
26 |
+
load_in_8bit: false
|
27 |
+
load_in_4bit: true
|
28 |
+
strict: false
|
29 |
+
|
30 |
+
# huggingface repo
|
31 |
+
datasets:
|
32 |
+
- path: ./dataset/data1.jsonl
|
33 |
+
type: input_output
|
34 |
+
val_set_size: 0.1
|
35 |
+
output_dir: ./gemma-python
|
36 |
+
|
37 |
+
adapter: qlora
|
38 |
+
lora_r: 32
|
39 |
+
lora_alpha: 16
|
40 |
+
lora_dropout: 0.05
|
41 |
+
lora_target_linear: true
|
42 |
+
|
43 |
+
sequence_len: 4096
|
44 |
+
sample_packing: false
|
45 |
+
pad_to_sequence_len: true
|
46 |
+
|
47 |
+
wandb_project:
|
48 |
+
wandb_entity:
|
49 |
+
wandb_watch:
|
50 |
+
wandb_name:
|
51 |
+
wandb_log_model:
|
52 |
+
|
53 |
+
|
54 |
+
gradient_accumulation_steps: 3
|
55 |
+
micro_batch_size: 2
|
56 |
+
num_epochs: 10
|
57 |
+
optimizer: adamw_bnb_8bit
|
58 |
+
lr_scheduler: cosine
|
59 |
+
learning_rate: 0.0002
|
60 |
+
|
61 |
+
train_on_inputs: false
|
62 |
+
group_by_length: false
|
63 |
+
bf16: auto
|
64 |
+
fp16:
|
65 |
+
tf32: false
|
66 |
+
|
67 |
+
gradient_checkpointing: true
|
68 |
+
early_stopping_patience:
|
69 |
+
resume_from_checkpoint:
|
70 |
+
local_rank:
|
71 |
+
logging_steps: 1
|
72 |
+
xformers_attention:
|
73 |
+
flash_attention: true
|
74 |
+
|
75 |
+
warmup_ratio: 0.1
|
76 |
+
evals_per_epoch: 4
|
77 |
+
eval_table_size:
|
78 |
+
eval_max_new_tokens: 128
|
79 |
+
saves_per_epoch: 1
|
80 |
+
debug:
|
81 |
+
deepspeed: deepspeed_configs/zero1.json
|
82 |
+
weight_decay: 0.0
|
83 |
+
fsdp:
|
84 |
+
fsdp_config:
|
85 |
+
special_tokens:
|
86 |
+
|
87 |
+
```
|
88 |
+
|
89 |
+
</details><br>
|
90 |
+
|
91 |
+
# gemma-python
|
92 |
+
|
93 |
+
This model is a fine-tuned version of [google/gemma-7b](https://huggingface.co/google/gemma-7b) on the None dataset.
|
94 |
+
It achieves the following results on the evaluation set:
|
95 |
+
- Loss: 2.1143
|
96 |
+
|
97 |
+
## Model description
|
98 |
+
|
99 |
+
More information needed
|
100 |
+
|
101 |
+
## Intended uses & limitations
|
102 |
+
|
103 |
+
More information needed
|
104 |
+
|
105 |
+
## Training and evaluation data
|
106 |
+
|
107 |
+
More information needed
|
108 |
+
|
109 |
+
## Training procedure
|
110 |
+
|
111 |
+
### Training hyperparameters
|
112 |
+
|
113 |
+
The following hyperparameters were used during training:
|
114 |
+
- learning_rate: 0.0002
|
115 |
+
- train_batch_size: 2
|
116 |
+
- eval_batch_size: 2
|
117 |
+
- seed: 42
|
118 |
+
- distributed_type: multi-GPU
|
119 |
+
- num_devices: 4
|
120 |
+
- gradient_accumulation_steps: 3
|
121 |
+
- total_train_batch_size: 24
|
122 |
+
- total_eval_batch_size: 8
|
123 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
124 |
+
- lr_scheduler_type: cosine
|
125 |
+
- lr_scheduler_warmup_steps: 2
|
126 |
+
- num_epochs: 10
|
127 |
+
|
128 |
+
### Training results
|
129 |
+
|
130 |
+
| Training Loss | Epoch | Step | Validation Loss |
|
131 |
+
|:-------------:|:-----:|:----:|:---------------:|
|
132 |
+
| 19.0016 | 0.12 | 1 | 18.6992 |
|
133 |
+
| 19.4686 | 0.25 | 2 | 16.2578 |
|
134 |
+
| 11.468 | 0.5 | 4 | 8.2891 |
|
135 |
+
| 7.5305 | 0.75 | 6 | 5.8847 |
|
136 |
+
| 5.7572 | 1.0 | 8 | 4.3635 |
|
137 |
+
| 4.3903 | 1.25 | 10 | 3.2849 |
|
138 |
+
| 2.9497 | 1.5 | 12 | 2.8539 |
|
139 |
+
| 2.8738 | 1.75 | 14 | 2.6203 |
|
140 |
+
| 2.7298 | 2.0 | 16 | 2.4534 |
|
141 |
+
| 2.4284 | 2.25 | 18 | 2.3077 |
|
142 |
+
| 2.394 | 2.5 | 20 | 2.1876 |
|
143 |
+
| 2.069 | 2.75 | 22 | 2.1294 |
|
144 |
+
| 1.9355 | 3.0 | 24 | 2.1048 |
|
145 |
+
| 1.9635 | 3.25 | 26 | 2.0707 |
|
146 |
+
| 2.092 | 3.5 | 28 | 2.0596 |
|
147 |
+
| 1.9675 | 3.75 | 30 | 2.0287 |
|
148 |
+
| 1.9693 | 4.0 | 32 | 2.0220 |
|
149 |
+
| 2.0198 | 4.25 | 34 | 2.0124 |
|
150 |
+
| 1.9357 | 4.5 | 36 | 1.9946 |
|
151 |
+
| 1.8147 | 4.75 | 38 | 1.9979 |
|
152 |
+
| 1.9084 | 5.0 | 40 | 1.9751 |
|
153 |
+
| 1.6678 | 5.25 | 42 | 2.0049 |
|
154 |
+
| 1.7639 | 5.5 | 44 | 1.9885 |
|
155 |
+
| 1.7475 | 5.75 | 46 | 1.9777 |
|
156 |
+
| 1.4848 | 6.0 | 48 | 1.9939 |
|
157 |
+
| 1.3065 | 6.25 | 50 | 2.0264 |
|
158 |
+
| 1.4792 | 6.5 | 52 | 2.0125 |
|
159 |
+
| 1.4233 | 6.75 | 54 | 2.0204 |
|
160 |
+
| 1.2534 | 7.0 | 56 | 2.0318 |
|
161 |
+
| 1.2409 | 7.25 | 58 | 2.0445 |
|
162 |
+
| 1.4309 | 7.5 | 60 | 2.0641 |
|
163 |
+
| 1.1622 | 7.75 | 62 | 2.0633 |
|
164 |
+
| 1.228 | 8.0 | 64 | 2.0930 |
|
165 |
+
| 1.3076 | 8.25 | 66 | 2.1077 |
|
166 |
+
| 1.2323 | 8.5 | 68 | 2.1060 |
|
167 |
+
| 1.1635 | 8.75 | 70 | 2.1039 |
|
168 |
+
| 1.261 | 9.0 | 72 | 2.1068 |
|
169 |
+
| 1.0122 | 9.25 | 74 | 2.1110 |
|
170 |
+
| 1.218 | 9.5 | 76 | 2.1180 |
|
171 |
+
| 1.1022 | 9.75 | 78 | 2.1226 |
|
172 |
+
| 1.2072 | 10.0 | 80 | 2.1143 |
|
173 |
+
|
174 |
+
|
175 |
+
### Framework versions
|
176 |
+
|
177 |
+
- PEFT 0.9.0
|
178 |
+
- Transformers 4.38.2
|
179 |
+
- Pytorch 2.2.1
|
180 |
+
- Datasets 2.18.0
|
181 |
+
- Tokenizers 0.15.0
|
adapter_config.json
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"alpha_pattern": {},
|
3 |
+
"auto_mapping": null,
|
4 |
+
"base_model_name_or_path": "google/gemma-7b",
|
5 |
+
"bias": "none",
|
6 |
+
"fan_in_fan_out": null,
|
7 |
+
"inference_mode": true,
|
8 |
+
"init_lora_weights": true,
|
9 |
+
"layers_pattern": null,
|
10 |
+
"layers_to_transform": null,
|
11 |
+
"loftq_config": {},
|
12 |
+
"lora_alpha": 16,
|
13 |
+
"lora_dropout": 0.05,
|
14 |
+
"megatron_config": null,
|
15 |
+
"megatron_core": "megatron.core",
|
16 |
+
"modules_to_save": null,
|
17 |
+
"peft_type": "LORA",
|
18 |
+
"r": 32,
|
19 |
+
"rank_pattern": {},
|
20 |
+
"revision": null,
|
21 |
+
"target_modules": [
|
22 |
+
"o_proj",
|
23 |
+
"up_proj",
|
24 |
+
"k_proj",
|
25 |
+
"q_proj",
|
26 |
+
"v_proj",
|
27 |
+
"gate_proj",
|
28 |
+
"down_proj"
|
29 |
+
],
|
30 |
+
"task_type": "CAUSAL_LM",
|
31 |
+
"use_dora": false,
|
32 |
+
"use_rslora": false
|
33 |
+
}
|
adapter_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:56027d240d1c3a71c42694a8d10be6ce43895d6fcf1f952d2c724a9e87326474
|
3 |
+
size 200078074
|
checkpoint-40/README.md
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: peft
|
3 |
+
base_model: google/gemma-7b
|
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.9.0
|
checkpoint-40/adapter_config.json
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"alpha_pattern": {},
|
3 |
+
"auto_mapping": null,
|
4 |
+
"base_model_name_or_path": "google/gemma-7b",
|
5 |
+
"bias": "none",
|
6 |
+
"fan_in_fan_out": null,
|
7 |
+
"inference_mode": true,
|
8 |
+
"init_lora_weights": true,
|
9 |
+
"layers_pattern": null,
|
10 |
+
"layers_to_transform": null,
|
11 |
+
"loftq_config": {},
|
12 |
+
"lora_alpha": 16,
|
13 |
+
"lora_dropout": 0.05,
|
14 |
+
"megatron_config": null,
|
15 |
+
"megatron_core": "megatron.core",
|
16 |
+
"modules_to_save": null,
|
17 |
+
"peft_type": "LORA",
|
18 |
+
"r": 32,
|
19 |
+
"rank_pattern": {},
|
20 |
+
"revision": null,
|
21 |
+
"target_modules": [
|
22 |
+
"o_proj",
|
23 |
+
"up_proj",
|
24 |
+
"k_proj",
|
25 |
+
"q_proj",
|
26 |
+
"v_proj",
|
27 |
+
"gate_proj",
|
28 |
+
"down_proj"
|
29 |
+
],
|
30 |
+
"task_type": "CAUSAL_LM",
|
31 |
+
"use_dora": false,
|
32 |
+
"use_rslora": false
|
33 |
+
}
|
checkpoint-40/adapter_model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d1aed72bc91825c6eaf1575f0a5c94f50d56417ca5b53f0b81cce29048b6ab70
|
3 |
+
size 200068904
|
checkpoint-40/global_step40/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:c24cda968c111802eab57451e1860053f2e38fd65f26135f266c9ffeac134c45
|
3 |
+
size 150126608
|
checkpoint-40/global_step40/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:fad69a773e6fc3a934d7bdb9d232fc948270842ba6fc8efbf370876ffa0f7e03
|
3 |
+
size 150126672
|
checkpoint-40/global_step40/bf16_zero_pp_rank_2_mp_rank_00_optim_states.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cbefc165cb203c96d8e832780b04524237e7b6eecc71d7ff978399d0d0c545ee
|
3 |
+
size 150126736
|
checkpoint-40/global_step40/bf16_zero_pp_rank_3_mp_rank_00_optim_states.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0bfd9defda8117e8665d598fff4c10cf611313f809395d507fbfc7658fbf5a9e
|
3 |
+
size 150126736
|
checkpoint-40/global_step40/mp_rank_00_model_states.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:408829abb39ec8d398d4973de44b3946c13a8327253229249eaf1572b03d1b54
|
3 |
+
size 1896781478
|
checkpoint-40/latest
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
global_step40
|
checkpoint-40/rng_state_0.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dfa8f3ba412a4ede1340e4612f378f735f109cbf5a004a7ef3413d51993099c5
|
3 |
+
size 15024
|
checkpoint-40/rng_state_1.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d540901c9ea15d4cbbe676b69891f7b748ca516ed58e850a2fd4e6d02d301a10
|
3 |
+
size 15024
|
checkpoint-40/rng_state_2.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7c0baa6c67b9316790653f049223543efdc12d27422fe3e39b0b8ac11b1af04e
|
3 |
+
size 15024
|
checkpoint-40/rng_state_3.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6f6491f57903cffa60cc5ed0ffde720e7ccebee6b0c3dcccdb9c0e1d27509c70
|
3 |
+
size 15024
|
checkpoint-40/scheduler.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a9fe9aa3a69b7aa00ab6c2c283052e530e526040db3d71112487efe44649fc62
|
3 |
+
size 1064
|
checkpoint-40/trainer_state.json
ADDED
@@ -0,0 +1,469 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"best_metric": 1.9750508069992065,
|
3 |
+
"best_model_checkpoint": "./gemma-python/checkpoint-40",
|
4 |
+
"epoch": 5.0,
|
5 |
+
"eval_steps": 2,
|
6 |
+
"global_step": 40,
|
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.12,
|
13 |
+
"grad_norm": 40.636978402335416,
|
14 |
+
"learning_rate": 0.0001,
|
15 |
+
"loss": 19.0016,
|
16 |
+
"step": 1
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"epoch": 0.12,
|
20 |
+
"eval_loss": 18.6992130279541,
|
21 |
+
"eval_runtime": 2.881,
|
22 |
+
"eval_samples_per_second": 7.289,
|
23 |
+
"eval_steps_per_second": 1.041,
|
24 |
+
"step": 1
|
25 |
+
},
|
26 |
+
{
|
27 |
+
"epoch": 0.25,
|
28 |
+
"grad_norm": 41.61053527062362,
|
29 |
+
"learning_rate": 0.0002,
|
30 |
+
"loss": 19.4686,
|
31 |
+
"step": 2
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"epoch": 0.25,
|
35 |
+
"eval_loss": 16.257802963256836,
|
36 |
+
"eval_runtime": 2.9111,
|
37 |
+
"eval_samples_per_second": 7.214,
|
38 |
+
"eval_steps_per_second": 1.031,
|
39 |
+
"step": 2
|
40 |
+
},
|
41 |
+
{
|
42 |
+
"epoch": 0.38,
|
43 |
+
"grad_norm": 28.704819713850974,
|
44 |
+
"learning_rate": 0.00019991889981715698,
|
45 |
+
"loss": 13.2303,
|
46 |
+
"step": 3
|
47 |
+
},
|
48 |
+
{
|
49 |
+
"epoch": 0.5,
|
50 |
+
"grad_norm": 26.40444243073739,
|
51 |
+
"learning_rate": 0.00019967573081342103,
|
52 |
+
"loss": 11.468,
|
53 |
+
"step": 4
|
54 |
+
},
|
55 |
+
{
|
56 |
+
"epoch": 0.5,
|
57 |
+
"eval_loss": 8.28911018371582,
|
58 |
+
"eval_runtime": 2.9257,
|
59 |
+
"eval_samples_per_second": 7.178,
|
60 |
+
"eval_steps_per_second": 1.025,
|
61 |
+
"step": 4
|
62 |
+
},
|
63 |
+
{
|
64 |
+
"epoch": 0.62,
|
65 |
+
"grad_norm": 12.912981323843146,
|
66 |
+
"learning_rate": 0.0001992708874098054,
|
67 |
+
"loss": 9.3107,
|
68 |
+
"step": 5
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"epoch": 0.75,
|
72 |
+
"grad_norm": 7.943058500648636,
|
73 |
+
"learning_rate": 0.00019870502626379127,
|
74 |
+
"loss": 7.5305,
|
75 |
+
"step": 6
|
76 |
+
},
|
77 |
+
{
|
78 |
+
"epoch": 0.75,
|
79 |
+
"eval_loss": 5.884701728820801,
|
80 |
+
"eval_runtime": 2.9479,
|
81 |
+
"eval_samples_per_second": 7.124,
|
82 |
+
"eval_steps_per_second": 1.018,
|
83 |
+
"step": 6
|
84 |
+
},
|
85 |
+
{
|
86 |
+
"epoch": 0.88,
|
87 |
+
"grad_norm": 6.267657551985817,
|
88 |
+
"learning_rate": 0.00019797906520422677,
|
89 |
+
"loss": 6.6492,
|
90 |
+
"step": 7
|
91 |
+
},
|
92 |
+
{
|
93 |
+
"epoch": 1.0,
|
94 |
+
"grad_norm": 5.0825555341832365,
|
95 |
+
"learning_rate": 0.0001970941817426052,
|
96 |
+
"loss": 5.7572,
|
97 |
+
"step": 8
|
98 |
+
},
|
99 |
+
{
|
100 |
+
"epoch": 1.0,
|
101 |
+
"eval_loss": 4.363473892211914,
|
102 |
+
"eval_runtime": 2.9653,
|
103 |
+
"eval_samples_per_second": 7.082,
|
104 |
+
"eval_steps_per_second": 1.012,
|
105 |
+
"step": 8
|
106 |
+
},
|
107 |
+
{
|
108 |
+
"epoch": 1.12,
|
109 |
+
"grad_norm": 4.88565620317727,
|
110 |
+
"learning_rate": 0.00019605181116313724,
|
111 |
+
"loss": 4.5414,
|
112 |
+
"step": 9
|
113 |
+
},
|
114 |
+
{
|
115 |
+
"epoch": 1.25,
|
116 |
+
"grad_norm": 5.0847008955317605,
|
117 |
+
"learning_rate": 0.00019485364419471454,
|
118 |
+
"loss": 4.3903,
|
119 |
+
"step": 10
|
120 |
+
},
|
121 |
+
{
|
122 |
+
"epoch": 1.25,
|
123 |
+
"eval_loss": 3.284867763519287,
|
124 |
+
"eval_runtime": 2.9746,
|
125 |
+
"eval_samples_per_second": 7.06,
|
126 |
+
"eval_steps_per_second": 1.009,
|
127 |
+
"step": 10
|
128 |
+
},
|
129 |
+
{
|
130 |
+
"epoch": 1.38,
|
131 |
+
"grad_norm": 3.424587898800574,
|
132 |
+
"learning_rate": 0.0001935016242685415,
|
133 |
+
"loss": 3.79,
|
134 |
+
"step": 11
|
135 |
+
},
|
136 |
+
{
|
137 |
+
"epoch": 1.5,
|
138 |
+
"grad_norm": 2.7255824385278506,
|
139 |
+
"learning_rate": 0.00019199794436588243,
|
140 |
+
"loss": 2.9497,
|
141 |
+
"step": 12
|
142 |
+
},
|
143 |
+
{
|
144 |
+
"epoch": 1.5,
|
145 |
+
"eval_loss": 2.853942394256592,
|
146 |
+
"eval_runtime": 2.9866,
|
147 |
+
"eval_samples_per_second": 7.031,
|
148 |
+
"eval_steps_per_second": 1.004,
|
149 |
+
"step": 12
|
150 |
+
},
|
151 |
+
{
|
152 |
+
"epoch": 1.62,
|
153 |
+
"grad_norm": 2.1001906898750624,
|
154 |
+
"learning_rate": 0.00019034504346103823,
|
155 |
+
"loss": 2.7728,
|
156 |
+
"step": 13
|
157 |
+
},
|
158 |
+
{
|
159 |
+
"epoch": 1.75,
|
160 |
+
"grad_norm": 1.9200021565941778,
|
161 |
+
"learning_rate": 0.000188545602565321,
|
162 |
+
"loss": 2.8738,
|
163 |
+
"step": 14
|
164 |
+
},
|
165 |
+
{
|
166 |
+
"epoch": 1.75,
|
167 |
+
"eval_loss": 2.62028431892395,
|
168 |
+
"eval_runtime": 2.9982,
|
169 |
+
"eval_samples_per_second": 7.004,
|
170 |
+
"eval_steps_per_second": 1.001,
|
171 |
+
"step": 14
|
172 |
+
},
|
173 |
+
{
|
174 |
+
"epoch": 1.88,
|
175 |
+
"grad_norm": 1.8837224890225774,
|
176 |
+
"learning_rate": 0.00018660254037844388,
|
177 |
+
"loss": 3.0787,
|
178 |
+
"step": 15
|
179 |
+
},
|
180 |
+
{
|
181 |
+
"epoch": 2.0,
|
182 |
+
"grad_norm": 1.8929687978608318,
|
183 |
+
"learning_rate": 0.0001845190085543795,
|
184 |
+
"loss": 2.7298,
|
185 |
+
"step": 16
|
186 |
+
},
|
187 |
+
{
|
188 |
+
"epoch": 2.0,
|
189 |
+
"eval_loss": 2.453444242477417,
|
190 |
+
"eval_runtime": 2.9964,
|
191 |
+
"eval_samples_per_second": 7.008,
|
192 |
+
"eval_steps_per_second": 1.001,
|
193 |
+
"step": 16
|
194 |
+
},
|
195 |
+
{
|
196 |
+
"epoch": 2.12,
|
197 |
+
"grad_norm": 1.3652069569291694,
|
198 |
+
"learning_rate": 0.00018229838658936564,
|
199 |
+
"loss": 2.5967,
|
200 |
+
"step": 17
|
201 |
+
},
|
202 |
+
{
|
203 |
+
"epoch": 2.25,
|
204 |
+
"grad_norm": 2.4263600812149417,
|
205 |
+
"learning_rate": 0.00017994427634035015,
|
206 |
+
"loss": 2.4284,
|
207 |
+
"step": 18
|
208 |
+
},
|
209 |
+
{
|
210 |
+
"epoch": 2.25,
|
211 |
+
"eval_loss": 2.307706832885742,
|
212 |
+
"eval_runtime": 2.9963,
|
213 |
+
"eval_samples_per_second": 7.009,
|
214 |
+
"eval_steps_per_second": 1.001,
|
215 |
+
"step": 18
|
216 |
+
},
|
217 |
+
{
|
218 |
+
"epoch": 2.38,
|
219 |
+
"grad_norm": 2.5673391658400053,
|
220 |
+
"learning_rate": 0.00017746049618276545,
|
221 |
+
"loss": 2.6721,
|
222 |
+
"step": 19
|
223 |
+
},
|
224 |
+
{
|
225 |
+
"epoch": 2.5,
|
226 |
+
"grad_norm": 2.2252437500899656,
|
227 |
+
"learning_rate": 0.00017485107481711012,
|
228 |
+
"loss": 2.394,
|
229 |
+
"step": 20
|
230 |
+
},
|
231 |
+
{
|
232 |
+
"epoch": 2.5,
|
233 |
+
"eval_loss": 2.187636137008667,
|
234 |
+
"eval_runtime": 2.9975,
|
235 |
+
"eval_samples_per_second": 7.006,
|
236 |
+
"eval_steps_per_second": 1.001,
|
237 |
+
"step": 20
|
238 |
+
},
|
239 |
+
{
|
240 |
+
"epoch": 2.62,
|
241 |
+
"grad_norm": 2.345233295279928,
|
242 |
+
"learning_rate": 0.00017212024473438147,
|
243 |
+
"loss": 2.3972,
|
244 |
+
"step": 21
|
245 |
+
},
|
246 |
+
{
|
247 |
+
"epoch": 2.75,
|
248 |
+
"grad_norm": 1.1122620317353238,
|
249 |
+
"learning_rate": 0.00016927243535095997,
|
250 |
+
"loss": 2.069,
|
251 |
+
"step": 22
|
252 |
+
},
|
253 |
+
{
|
254 |
+
"epoch": 2.75,
|
255 |
+
"eval_loss": 2.1294100284576416,
|
256 |
+
"eval_runtime": 2.993,
|
257 |
+
"eval_samples_per_second": 7.016,
|
258 |
+
"eval_steps_per_second": 1.002,
|
259 |
+
"step": 22
|
260 |
+
},
|
261 |
+
{
|
262 |
+
"epoch": 2.88,
|
263 |
+
"grad_norm": 2.8270209249093803,
|
264 |
+
"learning_rate": 0.00016631226582407952,
|
265 |
+
"loss": 2.211,
|
266 |
+
"step": 23
|
267 |
+
},
|
268 |
+
{
|
269 |
+
"epoch": 3.0,
|
270 |
+
"grad_norm": 7.323169716541166,
|
271 |
+
"learning_rate": 0.00016324453755953773,
|
272 |
+
"loss": 1.9355,
|
273 |
+
"step": 24
|
274 |
+
},
|
275 |
+
{
|
276 |
+
"epoch": 3.0,
|
277 |
+
"eval_loss": 2.1047682762145996,
|
278 |
+
"eval_runtime": 2.9871,
|
279 |
+
"eval_samples_per_second": 7.03,
|
280 |
+
"eval_steps_per_second": 1.004,
|
281 |
+
"step": 24
|
282 |
+
},
|
283 |
+
{
|
284 |
+
"epoch": 3.12,
|
285 |
+
"grad_norm": 1.9938311808450486,
|
286 |
+
"learning_rate": 0.0001600742264237979,
|
287 |
+
"loss": 2.1962,
|
288 |
+
"step": 25
|
289 |
+
},
|
290 |
+
{
|
291 |
+
"epoch": 3.25,
|
292 |
+
"grad_norm": 3.330986691029466,
|
293 |
+
"learning_rate": 0.00015680647467311557,
|
294 |
+
"loss": 1.9635,
|
295 |
+
"step": 26
|
296 |
+
},
|
297 |
+
{
|
298 |
+
"epoch": 3.25,
|
299 |
+
"eval_loss": 2.0707101821899414,
|
300 |
+
"eval_runtime": 2.9895,
|
301 |
+
"eval_samples_per_second": 7.025,
|
302 |
+
"eval_steps_per_second": 1.004,
|
303 |
+
"step": 26
|
304 |
+
},
|
305 |
+
{
|
306 |
+
"epoch": 3.38,
|
307 |
+
"grad_norm": 2.0371854480792178,
|
308 |
+
"learning_rate": 0.0001534465826127801,
|
309 |
+
"loss": 2.2319,
|
310 |
+
"step": 27
|
311 |
+
},
|
312 |
+
{
|
313 |
+
"epoch": 3.5,
|
314 |
+
"grad_norm": 3.2163831286077653,
|
315 |
+
"learning_rate": 0.00015000000000000001,
|
316 |
+
"loss": 2.092,
|
317 |
+
"step": 28
|
318 |
+
},
|
319 |
+
{
|
320 |
+
"epoch": 3.5,
|
321 |
+
"eval_loss": 2.059619426727295,
|
322 |
+
"eval_runtime": 2.9996,
|
323 |
+
"eval_samples_per_second": 7.001,
|
324 |
+
"eval_steps_per_second": 1.0,
|
325 |
+
"step": 28
|
326 |
+
},
|
327 |
+
{
|
328 |
+
"epoch": 3.62,
|
329 |
+
"grad_norm": 2.853987323853131,
|
330 |
+
"learning_rate": 0.00014647231720437686,
|
331 |
+
"loss": 1.9182,
|
332 |
+
"step": 29
|
333 |
+
},
|
334 |
+
{
|
335 |
+
"epoch": 3.75,
|
336 |
+
"grad_norm": 2.2997509863024352,
|
337 |
+
"learning_rate": 0.00014286925614030542,
|
338 |
+
"loss": 1.9675,
|
339 |
+
"step": 30
|
340 |
+
},
|
341 |
+
{
|
342 |
+
"epoch": 3.75,
|
343 |
+
"eval_loss": 2.0287458896636963,
|
344 |
+
"eval_runtime": 2.9966,
|
345 |
+
"eval_samples_per_second": 7.008,
|
346 |
+
"eval_steps_per_second": 1.001,
|
347 |
+
"step": 30
|
348 |
+
},
|
349 |
+
{
|
350 |
+
"epoch": 3.88,
|
351 |
+
"grad_norm": 2.2770679758385244,
|
352 |
+
"learning_rate": 0.00013919666098600753,
|
353 |
+
"loss": 1.9815,
|
354 |
+
"step": 31
|
355 |
+
},
|
356 |
+
{
|
357 |
+
"epoch": 4.0,
|
358 |
+
"grad_norm": 0.8553765652252152,
|
359 |
+
"learning_rate": 0.00013546048870425356,
|
360 |
+
"loss": 1.9693,
|
361 |
+
"step": 32
|
362 |
+
},
|
363 |
+
{
|
364 |
+
"epoch": 4.0,
|
365 |
+
"eval_loss": 2.022012710571289,
|
366 |
+
"eval_runtime": 2.9895,
|
367 |
+
"eval_samples_per_second": 7.025,
|
368 |
+
"eval_steps_per_second": 1.004,
|
369 |
+
"step": 32
|
370 |
+
},
|
371 |
+
{
|
372 |
+
"epoch": 4.12,
|
373 |
+
"grad_norm": 3.8094922067262336,
|
374 |
+
"learning_rate": 0.00013166679938014726,
|
375 |
+
"loss": 1.6479,
|
376 |
+
"step": 33
|
377 |
+
},
|
378 |
+
{
|
379 |
+
"epoch": 4.25,
|
380 |
+
"grad_norm": 3.5435911597121277,
|
381 |
+
"learning_rate": 0.0001278217463916453,
|
382 |
+
"loss": 2.0198,
|
383 |
+
"step": 34
|
384 |
+
},
|
385 |
+
{
|
386 |
+
"epoch": 4.25,
|
387 |
+
"eval_loss": 2.012432336807251,
|
388 |
+
"eval_runtime": 2.9987,
|
389 |
+
"eval_samples_per_second": 7.003,
|
390 |
+
"eval_steps_per_second": 1.0,
|
391 |
+
"step": 34
|
392 |
+
},
|
393 |
+
{
|
394 |
+
"epoch": 4.38,
|
395 |
+
"grad_norm": 1.4676241516417539,
|
396 |
+
"learning_rate": 0.0001239315664287558,
|
397 |
+
"loss": 1.7496,
|
398 |
+
"step": 35
|
399 |
+
},
|
400 |
+
{
|
401 |
+
"epoch": 4.5,
|
402 |
+
"grad_norm": 1.4772602834377506,
|
403 |
+
"learning_rate": 0.00012000256937760445,
|
404 |
+
"loss": 1.9357,
|
405 |
+
"step": 36
|
406 |
+
},
|
407 |
+
{
|
408 |
+
"epoch": 4.5,
|
409 |
+
"eval_loss": 1.9945744276046753,
|
410 |
+
"eval_runtime": 3.0019,
|
411 |
+
"eval_samples_per_second": 6.995,
|
412 |
+
"eval_steps_per_second": 0.999,
|
413 |
+
"step": 36
|
414 |
+
},
|
415 |
+
{
|
416 |
+
"epoch": 4.62,
|
417 |
+
"grad_norm": 0.8198622785029981,
|
418 |
+
"learning_rate": 0.00011604112808577603,
|
419 |
+
"loss": 1.8365,
|
420 |
+
"step": 37
|
421 |
+
},
|
422 |
+
{
|
423 |
+
"epoch": 4.75,
|
424 |
+
"grad_norm": 2.5267989029749556,
|
425 |
+
"learning_rate": 0.0001120536680255323,
|
426 |
+
"loss": 1.8147,
|
427 |
+
"step": 38
|
428 |
+
},
|
429 |
+
{
|
430 |
+
"epoch": 4.75,
|
431 |
+
"eval_loss": 1.9979486465454102,
|
432 |
+
"eval_runtime": 2.9865,
|
433 |
+
"eval_samples_per_second": 7.032,
|
434 |
+
"eval_steps_per_second": 1.005,
|
435 |
+
"step": 38
|
436 |
+
},
|
437 |
+
{
|
438 |
+
"epoch": 4.88,
|
439 |
+
"grad_norm": 1.2889515222114942,
|
440 |
+
"learning_rate": 0.00010804665687167262,
|
441 |
+
"loss": 1.6703,
|
442 |
+
"step": 39
|
443 |
+
},
|
444 |
+
{
|
445 |
+
"epoch": 5.0,
|
446 |
+
"grad_norm": 1.3474067788797102,
|
447 |
+
"learning_rate": 0.00010402659401094152,
|
448 |
+
"loss": 1.9084,
|
449 |
+
"step": 40
|
450 |
+
},
|
451 |
+
{
|
452 |
+
"epoch": 5.0,
|
453 |
+
"eval_loss": 1.9750508069992065,
|
454 |
+
"eval_runtime": 2.9945,
|
455 |
+
"eval_samples_per_second": 7.013,
|
456 |
+
"eval_steps_per_second": 1.002,
|
457 |
+
"step": 40
|
458 |
+
}
|
459 |
+
],
|
460 |
+
"logging_steps": 1,
|
461 |
+
"max_steps": 80,
|
462 |
+
"num_input_tokens_seen": 0,
|
463 |
+
"num_train_epochs": 10,
|
464 |
+
"save_steps": 8,
|
465 |
+
"total_flos": 1.8523438033403904e+17,
|
466 |
+
"train_batch_size": 2,
|
467 |
+
"trial_name": null,
|
468 |
+
"trial_params": null
|
469 |
+
}
|
checkpoint-40/training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bbd3cdf0c7e847516177c465407e4f8b9cbcc9b8664e3b64c39191721cf5ef99
|
3 |
+
size 6776
|
checkpoint-40/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-64/README.md
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: peft
|
3 |
+
base_model: google/gemma-7b
|
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.9.0
|
checkpoint-64/adapter_config.json
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"alpha_pattern": {},
|
3 |
+
"auto_mapping": null,
|
4 |
+
"base_model_name_or_path": "google/gemma-7b",
|
5 |
+
"bias": "none",
|
6 |
+
"fan_in_fan_out": null,
|
7 |
+
"inference_mode": true,
|
8 |
+
"init_lora_weights": true,
|
9 |
+
"layers_pattern": null,
|
10 |
+
"layers_to_transform": null,
|
11 |
+
"loftq_config": {},
|
12 |
+
"lora_alpha": 16,
|
13 |
+
"lora_dropout": 0.05,
|
14 |
+
"megatron_config": null,
|
15 |
+
"megatron_core": "megatron.core",
|
16 |
+
"modules_to_save": null,
|
17 |
+
"peft_type": "LORA",
|
18 |
+
"r": 32,
|
19 |
+
"rank_pattern": {},
|
20 |
+
"revision": null,
|
21 |
+
"target_modules": [
|
22 |
+
"o_proj",
|
23 |
+
"up_proj",
|
24 |
+
"k_proj",
|
25 |
+
"q_proj",
|
26 |
+
"v_proj",
|
27 |
+
"gate_proj",
|
28 |
+
"down_proj"
|
29 |
+
],
|
30 |
+
"task_type": "CAUSAL_LM",
|
31 |
+
"use_dora": false,
|
32 |
+
"use_rslora": false
|
33 |
+
}
|
checkpoint-64/adapter_model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e3a309ee2731ba474e8a0458bdcea156d55a66ebac666c29ad3fe07d60d64949
|
3 |
+
size 200068904
|
checkpoint-64/global_step64/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:69020befe25ce201249ca288824b860ccdd3a97b0dd6ddd5b05d33cd916509f2
|
3 |
+
size 150126608
|
checkpoint-64/global_step64/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:51e2d6a8023dd55f29d5046f0a69aab1551a7139a1b644f60bc25a2a01b8a2a1
|
3 |
+
size 150126672
|
checkpoint-64/global_step64/bf16_zero_pp_rank_2_mp_rank_00_optim_states.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ea33fc3eff7e1857897f2d9f6a166c00b0a4bf9e7f116c99878ca648cab421a0
|
3 |
+
size 150126736
|
checkpoint-64/global_step64/bf16_zero_pp_rank_3_mp_rank_00_optim_states.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b5425cbcd7924377570973efd1db89165c62bcc2fc5a3fae5bad6f9e621f9e18
|
3 |
+
size 150126736
|
checkpoint-64/global_step64/mp_rank_00_model_states.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:67f8431e72b92e00e8c035cce5cffc86e5601219db4c20919cfec992381dd225
|
3 |
+
size 1896781478
|
checkpoint-64/latest
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
global_step64
|
checkpoint-64/rng_state_0.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9527b9b5ae29ac374c87db2096874998096d81acfc9d70d4bbaf48795fad788f
|
3 |
+
size 15024
|
checkpoint-64/rng_state_1.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8ffb943cf7bf621beffa16bb82712d440c7f94be3b7d0d0d4da79e0f0a2feac0
|
3 |
+
size 15024
|
checkpoint-64/rng_state_2.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:81a4e19888f9eb3b62dac0a0242272d66796d01b3f3212243c7701aa65eebf3c
|
3 |
+
size 15024
|
checkpoint-64/rng_state_3.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cd08e343faf2a38113c34dca2fd8802aaee14dc414d6e81008bf8ab9d8855859
|
3 |
+
size 15024
|
checkpoint-64/scheduler.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:81667d34dc03f7a0b89cbca2d657bfead11ac055747074bc43cccaf1feb58bbc
|
3 |
+
size 1064
|
checkpoint-64/trainer_state.json
ADDED
@@ -0,0 +1,733 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"best_metric": 1.9750508069992065,
|
3 |
+
"best_model_checkpoint": "./gemma-python/checkpoint-40",
|
4 |
+
"epoch": 8.0,
|
5 |
+
"eval_steps": 2,
|
6 |
+
"global_step": 64,
|
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.12,
|
13 |
+
"grad_norm": 40.636978402335416,
|
14 |
+
"learning_rate": 0.0001,
|
15 |
+
"loss": 19.0016,
|
16 |
+
"step": 1
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"epoch": 0.12,
|
20 |
+
"eval_loss": 18.6992130279541,
|
21 |
+
"eval_runtime": 2.881,
|
22 |
+
"eval_samples_per_second": 7.289,
|
23 |
+
"eval_steps_per_second": 1.041,
|
24 |
+
"step": 1
|
25 |
+
},
|
26 |
+
{
|
27 |
+
"epoch": 0.25,
|
28 |
+
"grad_norm": 41.61053527062362,
|
29 |
+
"learning_rate": 0.0002,
|
30 |
+
"loss": 19.4686,
|
31 |
+
"step": 2
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"epoch": 0.25,
|
35 |
+
"eval_loss": 16.257802963256836,
|
36 |
+
"eval_runtime": 2.9111,
|
37 |
+
"eval_samples_per_second": 7.214,
|
38 |
+
"eval_steps_per_second": 1.031,
|
39 |
+
"step": 2
|
40 |
+
},
|
41 |
+
{
|
42 |
+
"epoch": 0.38,
|
43 |
+
"grad_norm": 28.704819713850974,
|
44 |
+
"learning_rate": 0.00019991889981715698,
|
45 |
+
"loss": 13.2303,
|
46 |
+
"step": 3
|
47 |
+
},
|
48 |
+
{
|
49 |
+
"epoch": 0.5,
|
50 |
+
"grad_norm": 26.40444243073739,
|
51 |
+
"learning_rate": 0.00019967573081342103,
|
52 |
+
"loss": 11.468,
|
53 |
+
"step": 4
|
54 |
+
},
|
55 |
+
{
|
56 |
+
"epoch": 0.5,
|
57 |
+
"eval_loss": 8.28911018371582,
|
58 |
+
"eval_runtime": 2.9257,
|
59 |
+
"eval_samples_per_second": 7.178,
|
60 |
+
"eval_steps_per_second": 1.025,
|
61 |
+
"step": 4
|
62 |
+
},
|
63 |
+
{
|
64 |
+
"epoch": 0.62,
|
65 |
+
"grad_norm": 12.912981323843146,
|
66 |
+
"learning_rate": 0.0001992708874098054,
|
67 |
+
"loss": 9.3107,
|
68 |
+
"step": 5
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"epoch": 0.75,
|
72 |
+
"grad_norm": 7.943058500648636,
|
73 |
+
"learning_rate": 0.00019870502626379127,
|
74 |
+
"loss": 7.5305,
|
75 |
+
"step": 6
|
76 |
+
},
|
77 |
+
{
|
78 |
+
"epoch": 0.75,
|
79 |
+
"eval_loss": 5.884701728820801,
|
80 |
+
"eval_runtime": 2.9479,
|
81 |
+
"eval_samples_per_second": 7.124,
|
82 |
+
"eval_steps_per_second": 1.018,
|
83 |
+
"step": 6
|
84 |
+
},
|
85 |
+
{
|
86 |
+
"epoch": 0.88,
|
87 |
+
"grad_norm": 6.267657551985817,
|
88 |
+
"learning_rate": 0.00019797906520422677,
|
89 |
+
"loss": 6.6492,
|
90 |
+
"step": 7
|
91 |
+
},
|
92 |
+
{
|
93 |
+
"epoch": 1.0,
|
94 |
+
"grad_norm": 5.0825555341832365,
|
95 |
+
"learning_rate": 0.0001970941817426052,
|
96 |
+
"loss": 5.7572,
|
97 |
+
"step": 8
|
98 |
+
},
|
99 |
+
{
|
100 |
+
"epoch": 1.0,
|
101 |
+
"eval_loss": 4.363473892211914,
|
102 |
+
"eval_runtime": 2.9653,
|
103 |
+
"eval_samples_per_second": 7.082,
|
104 |
+
"eval_steps_per_second": 1.012,
|
105 |
+
"step": 8
|
106 |
+
},
|
107 |
+
{
|
108 |
+
"epoch": 1.12,
|
109 |
+
"grad_norm": 4.88565620317727,
|
110 |
+
"learning_rate": 0.00019605181116313724,
|
111 |
+
"loss": 4.5414,
|
112 |
+
"step": 9
|
113 |
+
},
|
114 |
+
{
|
115 |
+
"epoch": 1.25,
|
116 |
+
"grad_norm": 5.0847008955317605,
|
117 |
+
"learning_rate": 0.00019485364419471454,
|
118 |
+
"loss": 4.3903,
|
119 |
+
"step": 10
|
120 |
+
},
|
121 |
+
{
|
122 |
+
"epoch": 1.25,
|
123 |
+
"eval_loss": 3.284867763519287,
|
124 |
+
"eval_runtime": 2.9746,
|
125 |
+
"eval_samples_per_second": 7.06,
|
126 |
+
"eval_steps_per_second": 1.009,
|
127 |
+
"step": 10
|
128 |
+
},
|
129 |
+
{
|
130 |
+
"epoch": 1.38,
|
131 |
+
"grad_norm": 3.424587898800574,
|
132 |
+
"learning_rate": 0.0001935016242685415,
|
133 |
+
"loss": 3.79,
|
134 |
+
"step": 11
|
135 |
+
},
|
136 |
+
{
|
137 |
+
"epoch": 1.5,
|
138 |
+
"grad_norm": 2.7255824385278506,
|
139 |
+
"learning_rate": 0.00019199794436588243,
|
140 |
+
"loss": 2.9497,
|
141 |
+
"step": 12
|
142 |
+
},
|
143 |
+
{
|
144 |
+
"epoch": 1.5,
|
145 |
+
"eval_loss": 2.853942394256592,
|
146 |
+
"eval_runtime": 2.9866,
|
147 |
+
"eval_samples_per_second": 7.031,
|
148 |
+
"eval_steps_per_second": 1.004,
|
149 |
+
"step": 12
|
150 |
+
},
|
151 |
+
{
|
152 |
+
"epoch": 1.62,
|
153 |
+
"grad_norm": 2.1001906898750624,
|
154 |
+
"learning_rate": 0.00019034504346103823,
|
155 |
+
"loss": 2.7728,
|
156 |
+
"step": 13
|
157 |
+
},
|
158 |
+
{
|
159 |
+
"epoch": 1.75,
|
160 |
+
"grad_norm": 1.9200021565941778,
|
161 |
+
"learning_rate": 0.000188545602565321,
|
162 |
+
"loss": 2.8738,
|
163 |
+
"step": 14
|
164 |
+
},
|
165 |
+
{
|
166 |
+
"epoch": 1.75,
|
167 |
+
"eval_loss": 2.62028431892395,
|
168 |
+
"eval_runtime": 2.9982,
|
169 |
+
"eval_samples_per_second": 7.004,
|
170 |
+
"eval_steps_per_second": 1.001,
|
171 |
+
"step": 14
|
172 |
+
},
|
173 |
+
{
|
174 |
+
"epoch": 1.88,
|
175 |
+
"grad_norm": 1.8837224890225774,
|
176 |
+
"learning_rate": 0.00018660254037844388,
|
177 |
+
"loss": 3.0787,
|
178 |
+
"step": 15
|
179 |
+
},
|
180 |
+
{
|
181 |
+
"epoch": 2.0,
|
182 |
+
"grad_norm": 1.8929687978608318,
|
183 |
+
"learning_rate": 0.0001845190085543795,
|
184 |
+
"loss": 2.7298,
|
185 |
+
"step": 16
|
186 |
+
},
|
187 |
+
{
|
188 |
+
"epoch": 2.0,
|
189 |
+
"eval_loss": 2.453444242477417,
|
190 |
+
"eval_runtime": 2.9964,
|
191 |
+
"eval_samples_per_second": 7.008,
|
192 |
+
"eval_steps_per_second": 1.001,
|
193 |
+
"step": 16
|
194 |
+
},
|
195 |
+
{
|
196 |
+
"epoch": 2.12,
|
197 |
+
"grad_norm": 1.3652069569291694,
|
198 |
+
"learning_rate": 0.00018229838658936564,
|
199 |
+
"loss": 2.5967,
|
200 |
+
"step": 17
|
201 |
+
},
|
202 |
+
{
|
203 |
+
"epoch": 2.25,
|
204 |
+
"grad_norm": 2.4263600812149417,
|
205 |
+
"learning_rate": 0.00017994427634035015,
|
206 |
+
"loss": 2.4284,
|
207 |
+
"step": 18
|
208 |
+
},
|
209 |
+
{
|
210 |
+
"epoch": 2.25,
|
211 |
+
"eval_loss": 2.307706832885742,
|
212 |
+
"eval_runtime": 2.9963,
|
213 |
+
"eval_samples_per_second": 7.009,
|
214 |
+
"eval_steps_per_second": 1.001,
|
215 |
+
"step": 18
|
216 |
+
},
|
217 |
+
{
|
218 |
+
"epoch": 2.38,
|
219 |
+
"grad_norm": 2.5673391658400053,
|
220 |
+
"learning_rate": 0.00017746049618276545,
|
221 |
+
"loss": 2.6721,
|
222 |
+
"step": 19
|
223 |
+
},
|
224 |
+
{
|
225 |
+
"epoch": 2.5,
|
226 |
+
"grad_norm": 2.2252437500899656,
|
227 |
+
"learning_rate": 0.00017485107481711012,
|
228 |
+
"loss": 2.394,
|
229 |
+
"step": 20
|
230 |
+
},
|
231 |
+
{
|
232 |
+
"epoch": 2.5,
|
233 |
+
"eval_loss": 2.187636137008667,
|
234 |
+
"eval_runtime": 2.9975,
|
235 |
+
"eval_samples_per_second": 7.006,
|
236 |
+
"eval_steps_per_second": 1.001,
|
237 |
+
"step": 20
|
238 |
+
},
|
239 |
+
{
|
240 |
+
"epoch": 2.62,
|
241 |
+
"grad_norm": 2.345233295279928,
|
242 |
+
"learning_rate": 0.00017212024473438147,
|
243 |
+
"loss": 2.3972,
|
244 |
+
"step": 21
|
245 |
+
},
|
246 |
+
{
|
247 |
+
"epoch": 2.75,
|
248 |
+
"grad_norm": 1.1122620317353238,
|
249 |
+
"learning_rate": 0.00016927243535095997,
|
250 |
+
"loss": 2.069,
|
251 |
+
"step": 22
|
252 |
+
},
|
253 |
+
{
|
254 |
+
"epoch": 2.75,
|
255 |
+
"eval_loss": 2.1294100284576416,
|
256 |
+
"eval_runtime": 2.993,
|
257 |
+
"eval_samples_per_second": 7.016,
|
258 |
+
"eval_steps_per_second": 1.002,
|
259 |
+
"step": 22
|
260 |
+
},
|
261 |
+
{
|
262 |
+
"epoch": 2.88,
|
263 |
+
"grad_norm": 2.8270209249093803,
|
264 |
+
"learning_rate": 0.00016631226582407952,
|
265 |
+
"loss": 2.211,
|
266 |
+
"step": 23
|
267 |
+
},
|
268 |
+
{
|
269 |
+
"epoch": 3.0,
|
270 |
+
"grad_norm": 7.323169716541166,
|
271 |
+
"learning_rate": 0.00016324453755953773,
|
272 |
+
"loss": 1.9355,
|
273 |
+
"step": 24
|
274 |
+
},
|
275 |
+
{
|
276 |
+
"epoch": 3.0,
|
277 |
+
"eval_loss": 2.1047682762145996,
|
278 |
+
"eval_runtime": 2.9871,
|
279 |
+
"eval_samples_per_second": 7.03,
|
280 |
+
"eval_steps_per_second": 1.004,
|
281 |
+
"step": 24
|
282 |
+
},
|
283 |
+
{
|
284 |
+
"epoch": 3.12,
|
285 |
+
"grad_norm": 1.9938311808450486,
|
286 |
+
"learning_rate": 0.0001600742264237979,
|
287 |
+
"loss": 2.1962,
|
288 |
+
"step": 25
|
289 |
+
},
|
290 |
+
{
|
291 |
+
"epoch": 3.25,
|
292 |
+
"grad_norm": 3.330986691029466,
|
293 |
+
"learning_rate": 0.00015680647467311557,
|
294 |
+
"loss": 1.9635,
|
295 |
+
"step": 26
|
296 |
+
},
|
297 |
+
{
|
298 |
+
"epoch": 3.25,
|
299 |
+
"eval_loss": 2.0707101821899414,
|
300 |
+
"eval_runtime": 2.9895,
|
301 |
+
"eval_samples_per_second": 7.025,
|
302 |
+
"eval_steps_per_second": 1.004,
|
303 |
+
"step": 26
|
304 |
+
},
|
305 |
+
{
|
306 |
+
"epoch": 3.38,
|
307 |
+
"grad_norm": 2.0371854480792178,
|
308 |
+
"learning_rate": 0.0001534465826127801,
|
309 |
+
"loss": 2.2319,
|
310 |
+
"step": 27
|
311 |
+
},
|
312 |
+
{
|
313 |
+
"epoch": 3.5,
|
314 |
+
"grad_norm": 3.2163831286077653,
|
315 |
+
"learning_rate": 0.00015000000000000001,
|
316 |
+
"loss": 2.092,
|
317 |
+
"step": 28
|
318 |
+
},
|
319 |
+
{
|
320 |
+
"epoch": 3.5,
|
321 |
+
"eval_loss": 2.059619426727295,
|
322 |
+
"eval_runtime": 2.9996,
|
323 |
+
"eval_samples_per_second": 7.001,
|
324 |
+
"eval_steps_per_second": 1.0,
|
325 |
+
"step": 28
|
326 |
+
},
|
327 |
+
{
|
328 |
+
"epoch": 3.62,
|
329 |
+
"grad_norm": 2.853987323853131,
|
330 |
+
"learning_rate": 0.00014647231720437686,
|
331 |
+
"loss": 1.9182,
|
332 |
+
"step": 29
|
333 |
+
},
|
334 |
+
{
|
335 |
+
"epoch": 3.75,
|
336 |
+
"grad_norm": 2.2997509863024352,
|
337 |
+
"learning_rate": 0.00014286925614030542,
|
338 |
+
"loss": 1.9675,
|
339 |
+
"step": 30
|
340 |
+
},
|
341 |
+
{
|
342 |
+
"epoch": 3.75,
|
343 |
+
"eval_loss": 2.0287458896636963,
|
344 |
+
"eval_runtime": 2.9966,
|
345 |
+
"eval_samples_per_second": 7.008,
|
346 |
+
"eval_steps_per_second": 1.001,
|
347 |
+
"step": 30
|
348 |
+
},
|
349 |
+
{
|
350 |
+
"epoch": 3.88,
|
351 |
+
"grad_norm": 2.2770679758385244,
|
352 |
+
"learning_rate": 0.00013919666098600753,
|
353 |
+
"loss": 1.9815,
|
354 |
+
"step": 31
|
355 |
+
},
|
356 |
+
{
|
357 |
+
"epoch": 4.0,
|
358 |
+
"grad_norm": 0.8553765652252152,
|
359 |
+
"learning_rate": 0.00013546048870425356,
|
360 |
+
"loss": 1.9693,
|
361 |
+
"step": 32
|
362 |
+
},
|
363 |
+
{
|
364 |
+
"epoch": 4.0,
|
365 |
+
"eval_loss": 2.022012710571289,
|
366 |
+
"eval_runtime": 2.9895,
|
367 |
+
"eval_samples_per_second": 7.025,
|
368 |
+
"eval_steps_per_second": 1.004,
|
369 |
+
"step": 32
|
370 |
+
},
|
371 |
+
{
|
372 |
+
"epoch": 4.12,
|
373 |
+
"grad_norm": 3.8094922067262336,
|
374 |
+
"learning_rate": 0.00013166679938014726,
|
375 |
+
"loss": 1.6479,
|
376 |
+
"step": 33
|
377 |
+
},
|
378 |
+
{
|
379 |
+
"epoch": 4.25,
|
380 |
+
"grad_norm": 3.5435911597121277,
|
381 |
+
"learning_rate": 0.0001278217463916453,
|
382 |
+
"loss": 2.0198,
|
383 |
+
"step": 34
|
384 |
+
},
|
385 |
+
{
|
386 |
+
"epoch": 4.25,
|
387 |
+
"eval_loss": 2.012432336807251,
|
388 |
+
"eval_runtime": 2.9987,
|
389 |
+
"eval_samples_per_second": 7.003,
|
390 |
+
"eval_steps_per_second": 1.0,
|
391 |
+
"step": 34
|
392 |
+
},
|
393 |
+
{
|
394 |
+
"epoch": 4.38,
|
395 |
+
"grad_norm": 1.4676241516417539,
|
396 |
+
"learning_rate": 0.0001239315664287558,
|
397 |
+
"loss": 1.7496,
|
398 |
+
"step": 35
|
399 |
+
},
|
400 |
+
{
|
401 |
+
"epoch": 4.5,
|
402 |
+
"grad_norm": 1.4772602834377506,
|
403 |
+
"learning_rate": 0.00012000256937760445,
|
404 |
+
"loss": 1.9357,
|
405 |
+
"step": 36
|
406 |
+
},
|
407 |
+
{
|
408 |
+
"epoch": 4.5,
|
409 |
+
"eval_loss": 1.9945744276046753,
|
410 |
+
"eval_runtime": 3.0019,
|
411 |
+
"eval_samples_per_second": 6.995,
|
412 |
+
"eval_steps_per_second": 0.999,
|
413 |
+
"step": 36
|
414 |
+
},
|
415 |
+
{
|
416 |
+
"epoch": 4.62,
|
417 |
+
"grad_norm": 0.8198622785029981,
|
418 |
+
"learning_rate": 0.00011604112808577603,
|
419 |
+
"loss": 1.8365,
|
420 |
+
"step": 37
|
421 |
+
},
|
422 |
+
{
|
423 |
+
"epoch": 4.75,
|
424 |
+
"grad_norm": 2.5267989029749556,
|
425 |
+
"learning_rate": 0.0001120536680255323,
|
426 |
+
"loss": 1.8147,
|
427 |
+
"step": 38
|
428 |
+
},
|
429 |
+
{
|
430 |
+
"epoch": 4.75,
|
431 |
+
"eval_loss": 1.9979486465454102,
|
432 |
+
"eval_runtime": 2.9865,
|
433 |
+
"eval_samples_per_second": 7.032,
|
434 |
+
"eval_steps_per_second": 1.005,
|
435 |
+
"step": 38
|
436 |
+
},
|
437 |
+
{
|
438 |
+
"epoch": 4.88,
|
439 |
+
"grad_norm": 1.2889515222114942,
|
440 |
+
"learning_rate": 0.00010804665687167262,
|
441 |
+
"loss": 1.6703,
|
442 |
+
"step": 39
|
443 |
+
},
|
444 |
+
{
|
445 |
+
"epoch": 5.0,
|
446 |
+
"grad_norm": 1.3474067788797102,
|
447 |
+
"learning_rate": 0.00010402659401094152,
|
448 |
+
"loss": 1.9084,
|
449 |
+
"step": 40
|
450 |
+
},
|
451 |
+
{
|
452 |
+
"epoch": 5.0,
|
453 |
+
"eval_loss": 1.9750508069992065,
|
454 |
+
"eval_runtime": 2.9945,
|
455 |
+
"eval_samples_per_second": 7.013,
|
456 |
+
"eval_steps_per_second": 1.002,
|
457 |
+
"step": 40
|
458 |
+
},
|
459 |
+
{
|
460 |
+
"epoch": 5.12,
|
461 |
+
"grad_norm": 1.320063776368443,
|
462 |
+
"learning_rate": 0.0001,
|
463 |
+
"loss": 1.6233,
|
464 |
+
"step": 41
|
465 |
+
},
|
466 |
+
{
|
467 |
+
"epoch": 5.25,
|
468 |
+
"grad_norm": 0.7858628087737163,
|
469 |
+
"learning_rate": 9.597340598905852e-05,
|
470 |
+
"loss": 1.6678,
|
471 |
+
"step": 42
|
472 |
+
},
|
473 |
+
{
|
474 |
+
"epoch": 5.25,
|
475 |
+
"eval_loss": 2.004897356033325,
|
476 |
+
"eval_runtime": 2.9946,
|
477 |
+
"eval_samples_per_second": 7.013,
|
478 |
+
"eval_steps_per_second": 1.002,
|
479 |
+
"step": 42
|
480 |
+
},
|
481 |
+
{
|
482 |
+
"epoch": 5.38,
|
483 |
+
"grad_norm": 1.149181462350102,
|
484 |
+
"learning_rate": 9.195334312832742e-05,
|
485 |
+
"loss": 1.5673,
|
486 |
+
"step": 43
|
487 |
+
},
|
488 |
+
{
|
489 |
+
"epoch": 5.5,
|
490 |
+
"grad_norm": 1.961547695831496,
|
491 |
+
"learning_rate": 8.79463319744677e-05,
|
492 |
+
"loss": 1.7639,
|
493 |
+
"step": 44
|
494 |
+
},
|
495 |
+
{
|
496 |
+
"epoch": 5.5,
|
497 |
+
"eval_loss": 1.9885122776031494,
|
498 |
+
"eval_runtime": 2.9905,
|
499 |
+
"eval_samples_per_second": 7.022,
|
500 |
+
"eval_steps_per_second": 1.003,
|
501 |
+
"step": 44
|
502 |
+
},
|
503 |
+
{
|
504 |
+
"epoch": 5.62,
|
505 |
+
"grad_norm": 0.794217334050356,
|
506 |
+
"learning_rate": 8.395887191422397e-05,
|
507 |
+
"loss": 1.6191,
|
508 |
+
"step": 45
|
509 |
+
},
|
510 |
+
{
|
511 |
+
"epoch": 5.75,
|
512 |
+
"grad_norm": 1.5568588659062292,
|
513 |
+
"learning_rate": 7.999743062239557e-05,
|
514 |
+
"loss": 1.7475,
|
515 |
+
"step": 46
|
516 |
+
},
|
517 |
+
{
|
518 |
+
"epoch": 5.75,
|
519 |
+
"eval_loss": 1.9777300357818604,
|
520 |
+
"eval_runtime": 2.9821,
|
521 |
+
"eval_samples_per_second": 7.042,
|
522 |
+
"eval_steps_per_second": 1.006,
|
523 |
+
"step": 46
|
524 |
+
},
|
525 |
+
{
|
526 |
+
"epoch": 5.88,
|
527 |
+
"grad_norm": 0.9110203190054421,
|
528 |
+
"learning_rate": 7.606843357124426e-05,
|
529 |
+
"loss": 1.5998,
|
530 |
+
"step": 47
|
531 |
+
},
|
532 |
+
{
|
533 |
+
"epoch": 6.0,
|
534 |
+
"grad_norm": 1.4501990937976796,
|
535 |
+
"learning_rate": 7.217825360835473e-05,
|
536 |
+
"loss": 1.4848,
|
537 |
+
"step": 48
|
538 |
+
},
|
539 |
+
{
|
540 |
+
"epoch": 6.0,
|
541 |
+
"eval_loss": 1.9939006567001343,
|
542 |
+
"eval_runtime": 2.9785,
|
543 |
+
"eval_samples_per_second": 7.05,
|
544 |
+
"eval_steps_per_second": 1.007,
|
545 |
+
"step": 48
|
546 |
+
},
|
547 |
+
{
|
548 |
+
"epoch": 6.12,
|
549 |
+
"grad_norm": 1.3413384555399062,
|
550 |
+
"learning_rate": 6.833320061985277e-05,
|
551 |
+
"loss": 1.5343,
|
552 |
+
"step": 49
|
553 |
+
},
|
554 |
+
{
|
555 |
+
"epoch": 6.25,
|
556 |
+
"grad_norm": 0.9844954583473513,
|
557 |
+
"learning_rate": 6.453951129574644e-05,
|
558 |
+
"loss": 1.3065,
|
559 |
+
"step": 50
|
560 |
+
},
|
561 |
+
{
|
562 |
+
"epoch": 6.25,
|
563 |
+
"eval_loss": 2.0264320373535156,
|
564 |
+
"eval_runtime": 2.9839,
|
565 |
+
"eval_samples_per_second": 7.038,
|
566 |
+
"eval_steps_per_second": 1.005,
|
567 |
+
"step": 50
|
568 |
+
},
|
569 |
+
{
|
570 |
+
"epoch": 6.38,
|
571 |
+
"grad_norm": 1.268663878876962,
|
572 |
+
"learning_rate": 6.080333901399251e-05,
|
573 |
+
"loss": 1.4153,
|
574 |
+
"step": 51
|
575 |
+
},
|
576 |
+
{
|
577 |
+
"epoch": 6.5,
|
578 |
+
"grad_norm": 1.1638516740810099,
|
579 |
+
"learning_rate": 5.713074385969457e-05,
|
580 |
+
"loss": 1.4792,
|
581 |
+
"step": 52
|
582 |
+
},
|
583 |
+
{
|
584 |
+
"epoch": 6.5,
|
585 |
+
"eval_loss": 2.012540817260742,
|
586 |
+
"eval_runtime": 2.9954,
|
587 |
+
"eval_samples_per_second": 7.011,
|
588 |
+
"eval_steps_per_second": 1.002,
|
589 |
+
"step": 52
|
590 |
+
},
|
591 |
+
{
|
592 |
+
"epoch": 6.62,
|
593 |
+
"grad_norm": 0.8956974540095054,
|
594 |
+
"learning_rate": 5.3527682795623146e-05,
|
595 |
+
"loss": 1.5184,
|
596 |
+
"step": 53
|
597 |
+
},
|
598 |
+
{
|
599 |
+
"epoch": 6.75,
|
600 |
+
"grad_norm": 0.8166104294104601,
|
601 |
+
"learning_rate": 5.000000000000002e-05,
|
602 |
+
"loss": 1.4233,
|
603 |
+
"step": 54
|
604 |
+
},
|
605 |
+
{
|
606 |
+
"epoch": 6.75,
|
607 |
+
"eval_loss": 2.0203704833984375,
|
608 |
+
"eval_runtime": 2.9966,
|
609 |
+
"eval_samples_per_second": 7.008,
|
610 |
+
"eval_steps_per_second": 1.001,
|
611 |
+
"step": 54
|
612 |
+
},
|
613 |
+
{
|
614 |
+
"epoch": 6.88,
|
615 |
+
"grad_norm": 1.2567309830006292,
|
616 |
+
"learning_rate": 4.6553417387219886e-05,
|
617 |
+
"loss": 1.5766,
|
618 |
+
"step": 55
|
619 |
+
},
|
620 |
+
{
|
621 |
+
"epoch": 7.0,
|
622 |
+
"grad_norm": 1.202021898168564,
|
623 |
+
"learning_rate": 4.3193525326884435e-05,
|
624 |
+
"loss": 1.2534,
|
625 |
+
"step": 56
|
626 |
+
},
|
627 |
+
{
|
628 |
+
"epoch": 7.0,
|
629 |
+
"eval_loss": 2.0317745208740234,
|
630 |
+
"eval_runtime": 2.9887,
|
631 |
+
"eval_samples_per_second": 7.027,
|
632 |
+
"eval_steps_per_second": 1.004,
|
633 |
+
"step": 56
|
634 |
+
},
|
635 |
+
{
|
636 |
+
"epoch": 7.12,
|
637 |
+
"grad_norm": 1.0179404054971375,
|
638 |
+
"learning_rate": 3.99257735762021e-05,
|
639 |
+
"loss": 1.3538,
|
640 |
+
"step": 57
|
641 |
+
},
|
642 |
+
{
|
643 |
+
"epoch": 7.25,
|
644 |
+
"grad_norm": 0.8024465225797554,
|
645 |
+
"learning_rate": 3.675546244046228e-05,
|
646 |
+
"loss": 1.2409,
|
647 |
+
"step": 58
|
648 |
+
},
|
649 |
+
{
|
650 |
+
"epoch": 7.25,
|
651 |
+
"eval_loss": 2.0444860458374023,
|
652 |
+
"eval_runtime": 2.9957,
|
653 |
+
"eval_samples_per_second": 7.01,
|
654 |
+
"eval_steps_per_second": 1.001,
|
655 |
+
"step": 58
|
656 |
+
},
|
657 |
+
{
|
658 |
+
"epoch": 7.38,
|
659 |
+
"grad_norm": 1.0938821440297672,
|
660 |
+
"learning_rate": 3.36877341759205e-05,
|
661 |
+
"loss": 1.2446,
|
662 |
+
"step": 59
|
663 |
+
},
|
664 |
+
{
|
665 |
+
"epoch": 7.5,
|
666 |
+
"grad_norm": 1.4397725924431397,
|
667 |
+
"learning_rate": 3.072756464904006e-05,
|
668 |
+
"loss": 1.4309,
|
669 |
+
"step": 60
|
670 |
+
},
|
671 |
+
{
|
672 |
+
"epoch": 7.5,
|
673 |
+
"eval_loss": 2.0641307830810547,
|
674 |
+
"eval_runtime": 3.0002,
|
675 |
+
"eval_samples_per_second": 6.999,
|
676 |
+
"eval_steps_per_second": 1.0,
|
677 |
+
"step": 60
|
678 |
+
},
|
679 |
+
{
|
680 |
+
"epoch": 7.62,
|
681 |
+
"grad_norm": 1.084317322881849,
|
682 |
+
"learning_rate": 2.7879755265618555e-05,
|
683 |
+
"loss": 1.4057,
|
684 |
+
"step": 61
|
685 |
+
},
|
686 |
+
{
|
687 |
+
"epoch": 7.75,
|
688 |
+
"grad_norm": 0.8921847488708302,
|
689 |
+
"learning_rate": 2.514892518288988e-05,
|
690 |
+
"loss": 1.1622,
|
691 |
+
"step": 62
|
692 |
+
},
|
693 |
+
{
|
694 |
+
"epoch": 7.75,
|
695 |
+
"eval_loss": 2.0632762908935547,
|
696 |
+
"eval_runtime": 2.9934,
|
697 |
+
"eval_samples_per_second": 7.015,
|
698 |
+
"eval_steps_per_second": 1.002,
|
699 |
+
"step": 62
|
700 |
+
},
|
701 |
+
{
|
702 |
+
"epoch": 7.88,
|
703 |
+
"grad_norm": 1.2733235220422945,
|
704 |
+
"learning_rate": 2.2539503817234553e-05,
|
705 |
+
"loss": 1.2667,
|
706 |
+
"step": 63
|
707 |
+
},
|
708 |
+
{
|
709 |
+
"epoch": 8.0,
|
710 |
+
"grad_norm": 1.01591405423162,
|
711 |
+
"learning_rate": 2.0055723659649904e-05,
|
712 |
+
"loss": 1.228,
|
713 |
+
"step": 64
|
714 |
+
},
|
715 |
+
{
|
716 |
+
"epoch": 8.0,
|
717 |
+
"eval_loss": 2.09301495552063,
|
718 |
+
"eval_runtime": 2.9938,
|
719 |
+
"eval_samples_per_second": 7.014,
|
720 |
+
"eval_steps_per_second": 1.002,
|
721 |
+
"step": 64
|
722 |
+
}
|
723 |
+
],
|
724 |
+
"logging_steps": 1,
|
725 |
+
"max_steps": 80,
|
726 |
+
"num_input_tokens_seen": 0,
|
727 |
+
"num_train_epochs": 10,
|
728 |
+
"save_steps": 8,
|
729 |
+
"total_flos": 2.9637500853446246e+17,
|
730 |
+
"train_batch_size": 2,
|
731 |
+
"trial_name": null,
|
732 |
+
"trial_params": null
|
733 |
+
}
|
checkpoint-64/training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bbd3cdf0c7e847516177c465407e4f8b9cbcc9b8664e3b64c39191721cf5ef99
|
3 |
+
size 6776
|
checkpoint-64/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-72/README.md
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: peft
|
3 |
+
base_model: google/gemma-7b
|
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.9.0
|
checkpoint-72/adapter_config.json
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"alpha_pattern": {},
|
3 |
+
"auto_mapping": null,
|
4 |
+
"base_model_name_or_path": "google/gemma-7b",
|
5 |
+
"bias": "none",
|
6 |
+
"fan_in_fan_out": null,
|
7 |
+
"inference_mode": true,
|
8 |
+
"init_lora_weights": true,
|
9 |
+
"layers_pattern": null,
|
10 |
+
"layers_to_transform": null,
|
11 |
+
"loftq_config": {},
|
12 |
+
"lora_alpha": 16,
|
13 |
+
"lora_dropout": 0.05,
|
14 |
+
"megatron_config": null,
|
15 |
+
"megatron_core": "megatron.core",
|
16 |
+
"modules_to_save": null,
|
17 |
+
"peft_type": "LORA",
|
18 |
+
"r": 32,
|
19 |
+
"rank_pattern": {},
|
20 |
+
"revision": null,
|
21 |
+
"target_modules": [
|
22 |
+
"o_proj",
|
23 |
+
"up_proj",
|
24 |
+
"k_proj",
|
25 |
+
"q_proj",
|
26 |
+
"v_proj",
|
27 |
+
"gate_proj",
|
28 |
+
"down_proj"
|
29 |
+
],
|
30 |
+
"task_type": "CAUSAL_LM",
|
31 |
+
"use_dora": false,
|
32 |
+
"use_rslora": false
|
33 |
+
}
|
checkpoint-72/adapter_model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:44954d71c44b0b3a77c82c4e61cb154f0620626427991da9edec48e2006b123a
|
3 |
+
size 200068904
|
checkpoint-72/global_step72/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:81fd6d1854d4065202f5faaf517a529c9babc13cbcdb54cfe6e80f75c3e68591
|
3 |
+
size 150126608
|
checkpoint-72/global_step72/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:9ddde495ae8fee1b1af3e50c77935ce1d2760a49a5fe0e32d48f88f54c6d4bad
|
3 |
+
size 150126672
|
checkpoint-72/global_step72/bf16_zero_pp_rank_2_mp_rank_00_optim_states.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bfc74a5b5403785a3a238055defca1048acbeb8766ed3e1a7aa600ebd4408864
|
3 |
+
size 150126736
|
checkpoint-72/global_step72/bf16_zero_pp_rank_3_mp_rank_00_optim_states.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6f4fcc5ebe0bd0b28c13562346884763ed07438fa1a6c030fce64c64395b3671
|
3 |
+
size 150126736
|
checkpoint-72/global_step72/mp_rank_00_model_states.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:20a1e69a9ab961b6a4dd5f7cb8f604b17f89050e4fa1bf8665a541186272ede7
|
3 |
+
size 1896781478
|
checkpoint-72/latest
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
global_step72
|
checkpoint-72/rng_state_0.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:668b3c267070e4954cf0fb4816322e2dc903d37f5a7200afaeffc177308dba71
|
3 |
+
size 15024
|
checkpoint-72/rng_state_1.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ac91d0dff53f6ec4da985ead857c455f6a2b5328e0d8d6d1b5c52db53d8b6dba
|
3 |
+
size 15024
|
checkpoint-72/rng_state_2.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:29312515ecdeb078acf20cc2c79eee00742f44ea4a3b75ff7112ede39ce6c19d
|
3 |
+
size 15024
|