Instructions to use cragtmp/taskgt705-50 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use cragtmp/taskgt705-50 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("/data1/chenjiazun/LLM/Llama-3.2-11B-Vision-Instruct") model = PeftModel.from_pretrained(base_model, "cragtmp/taskgt705-50") - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- README.md +202 -0
- adapter_config.json +31 -0
- adapter_model.safetensors +3 -0
- additional_config.json +1 -0
- args.json +438 -0
- latest +1 -0
- rng_state.pth +3 -0
- scheduler.pt +3 -0
- trainer_state.json +934 -0
- training_args.bin +3 -0
- zero_to_fp32.py +760 -0
README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: meta-llama/Llama-3.2-11B-Vision-Instruct
|
| 3 |
+
library_name: peft
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# Model Card for Model ID
|
| 7 |
+
|
| 8 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
## Model Details
|
| 13 |
+
|
| 14 |
+
### Model Description
|
| 15 |
+
|
| 16 |
+
<!-- Provide a longer summary of what this model is. -->
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
- **Developed by:** [More Information Needed]
|
| 21 |
+
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
+
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
+
- **Model type:** [More Information Needed]
|
| 24 |
+
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
+
- **License:** [More Information Needed]
|
| 26 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
+
|
| 28 |
+
### Model Sources [optional]
|
| 29 |
+
|
| 30 |
+
<!-- Provide the basic links for the model. -->
|
| 31 |
+
|
| 32 |
+
- **Repository:** [More Information Needed]
|
| 33 |
+
- **Paper [optional]:** [More Information Needed]
|
| 34 |
+
- **Demo [optional]:** [More Information Needed]
|
| 35 |
+
|
| 36 |
+
## Uses
|
| 37 |
+
|
| 38 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
+
|
| 40 |
+
### Direct Use
|
| 41 |
+
|
| 42 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 43 |
+
|
| 44 |
+
[More Information Needed]
|
| 45 |
+
|
| 46 |
+
### Downstream Use [optional]
|
| 47 |
+
|
| 48 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 49 |
+
|
| 50 |
+
[More Information Needed]
|
| 51 |
+
|
| 52 |
+
### Out-of-Scope Use
|
| 53 |
+
|
| 54 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
+
|
| 56 |
+
[More Information Needed]
|
| 57 |
+
|
| 58 |
+
## Bias, Risks, and Limitations
|
| 59 |
+
|
| 60 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 61 |
+
|
| 62 |
+
[More Information Needed]
|
| 63 |
+
|
| 64 |
+
### Recommendations
|
| 65 |
+
|
| 66 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 67 |
+
|
| 68 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
+
|
| 70 |
+
## How to Get Started with the Model
|
| 71 |
+
|
| 72 |
+
Use the code below to get started with the model.
|
| 73 |
+
|
| 74 |
+
[More Information Needed]
|
| 75 |
+
|
| 76 |
+
## Training Details
|
| 77 |
+
|
| 78 |
+
### Training Data
|
| 79 |
+
|
| 80 |
+
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 81 |
+
|
| 82 |
+
[More Information Needed]
|
| 83 |
+
|
| 84 |
+
### Training Procedure
|
| 85 |
+
|
| 86 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 87 |
+
|
| 88 |
+
#### Preprocessing [optional]
|
| 89 |
+
|
| 90 |
+
[More Information Needed]
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
#### Training Hyperparameters
|
| 94 |
+
|
| 95 |
+
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 96 |
+
|
| 97 |
+
#### Speeds, Sizes, Times [optional]
|
| 98 |
+
|
| 99 |
+
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 100 |
+
|
| 101 |
+
[More Information Needed]
|
| 102 |
+
|
| 103 |
+
## Evaluation
|
| 104 |
+
|
| 105 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
+
|
| 107 |
+
### Testing Data, Factors & Metrics
|
| 108 |
+
|
| 109 |
+
#### Testing Data
|
| 110 |
+
|
| 111 |
+
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
+
|
| 113 |
+
[More Information Needed]
|
| 114 |
+
|
| 115 |
+
#### Factors
|
| 116 |
+
|
| 117 |
+
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
+
|
| 119 |
+
[More Information Needed]
|
| 120 |
+
|
| 121 |
+
#### Metrics
|
| 122 |
+
|
| 123 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
+
|
| 125 |
+
[More Information Needed]
|
| 126 |
+
|
| 127 |
+
### Results
|
| 128 |
+
|
| 129 |
+
[More Information Needed]
|
| 130 |
+
|
| 131 |
+
#### Summary
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
## Model Examination [optional]
|
| 136 |
+
|
| 137 |
+
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
+
|
| 139 |
+
[More Information Needed]
|
| 140 |
+
|
| 141 |
+
## Environmental Impact
|
| 142 |
+
|
| 143 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
+
|
| 145 |
+
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
+
|
| 147 |
+
- **Hardware Type:** [More Information Needed]
|
| 148 |
+
- **Hours used:** [More Information Needed]
|
| 149 |
+
- **Cloud Provider:** [More Information Needed]
|
| 150 |
+
- **Compute Region:** [More Information Needed]
|
| 151 |
+
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
+
|
| 153 |
+
## Technical Specifications [optional]
|
| 154 |
+
|
| 155 |
+
### Model Architecture and Objective
|
| 156 |
+
|
| 157 |
+
[More Information Needed]
|
| 158 |
+
|
| 159 |
+
### Compute Infrastructure
|
| 160 |
+
|
| 161 |
+
[More Information Needed]
|
| 162 |
+
|
| 163 |
+
#### Hardware
|
| 164 |
+
|
| 165 |
+
[More Information Needed]
|
| 166 |
+
|
| 167 |
+
#### Software
|
| 168 |
+
|
| 169 |
+
[More Information Needed]
|
| 170 |
+
|
| 171 |
+
## Citation [optional]
|
| 172 |
+
|
| 173 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
+
|
| 175 |
+
**BibTeX:**
|
| 176 |
+
|
| 177 |
+
[More Information Needed]
|
| 178 |
+
|
| 179 |
+
**APA:**
|
| 180 |
+
|
| 181 |
+
[More Information Needed]
|
| 182 |
+
|
| 183 |
+
## Glossary [optional]
|
| 184 |
+
|
| 185 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
+
|
| 187 |
+
[More Information Needed]
|
| 188 |
+
|
| 189 |
+
## More Information [optional]
|
| 190 |
+
|
| 191 |
+
[More Information Needed]
|
| 192 |
+
|
| 193 |
+
## Model Card Authors [optional]
|
| 194 |
+
|
| 195 |
+
[More Information Needed]
|
| 196 |
+
|
| 197 |
+
## Model Card Contact
|
| 198 |
+
|
| 199 |
+
[More Information Needed]
|
| 200 |
+
### Framework versions
|
| 201 |
+
|
| 202 |
+
- PEFT 0.15.2
|
adapter_config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha_pattern": {},
|
| 3 |
+
"auto_mapping": null,
|
| 4 |
+
"base_model_name_or_path": "/data1/chenjiazun/LLM/Llama-3.2-11B-Vision-Instruct",
|
| 5 |
+
"bias": "none",
|
| 6 |
+
"corda_config": null,
|
| 7 |
+
"eva_config": null,
|
| 8 |
+
"exclude_modules": null,
|
| 9 |
+
"fan_in_fan_out": false,
|
| 10 |
+
"inference_mode": true,
|
| 11 |
+
"init_lora_weights": true,
|
| 12 |
+
"layer_replication": null,
|
| 13 |
+
"layers_pattern": null,
|
| 14 |
+
"layers_to_transform": null,
|
| 15 |
+
"loftq_config": {},
|
| 16 |
+
"lora_alpha": 32,
|
| 17 |
+
"lora_bias": false,
|
| 18 |
+
"lora_dropout": 0.05,
|
| 19 |
+
"megatron_config": null,
|
| 20 |
+
"megatron_core": "megatron.core",
|
| 21 |
+
"modules_to_save": [],
|
| 22 |
+
"peft_type": "LORA",
|
| 23 |
+
"r": 8,
|
| 24 |
+
"rank_pattern": {},
|
| 25 |
+
"revision": null,
|
| 26 |
+
"target_modules": "^(language_model).*\\.(up_proj|o_proj|down_proj|q_proj|k_proj|gate_proj|v_proj)$",
|
| 27 |
+
"task_type": "CAUSAL_LM",
|
| 28 |
+
"trainable_token_indices": null,
|
| 29 |
+
"use_dora": false,
|
| 30 |
+
"use_rslora": false
|
| 31 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:908ab118bd0545b9a4af7a5d1c7692d47ef3264a7587d2e5ee8bc16b84df4aa3
|
| 3 |
+
size 52511776
|
additional_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"lora_dtype": null, "lorap_lr_ratio": null, "lorap_emb_lr": 1e-06}
|
args.json
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "/data1/chenjiazun/LLM/Llama-3.2-11B-Vision-Instruct",
|
| 3 |
+
"model_type": "llama3_2_vision",
|
| 4 |
+
"model_revision": null,
|
| 5 |
+
"task_type": "causal_lm",
|
| 6 |
+
"torch_dtype": "bfloat16",
|
| 7 |
+
"attn_impl": null,
|
| 8 |
+
"num_labels": null,
|
| 9 |
+
"problem_type": null,
|
| 10 |
+
"rope_scaling": null,
|
| 11 |
+
"device_map": null,
|
| 12 |
+
"max_memory": {},
|
| 13 |
+
"local_repo_path": null,
|
| 14 |
+
"template": "llama3_2_vision",
|
| 15 |
+
"system": "You are a helpful assistant that truthfully answers user questions about the provided image.",
|
| 16 |
+
"max_length": 2048,
|
| 17 |
+
"truncation_strategy": "delete",
|
| 18 |
+
"max_pixels": null,
|
| 19 |
+
"agent_template": null,
|
| 20 |
+
"norm_bbox": null,
|
| 21 |
+
"response_prefix": null,
|
| 22 |
+
"padding_side": "right",
|
| 23 |
+
"loss_scale": "last_round",
|
| 24 |
+
"sequence_parallel_size": 1,
|
| 25 |
+
"use_chat_template": true,
|
| 26 |
+
"template_backend": "swift",
|
| 27 |
+
"dataset": [
|
| 28 |
+
"json_files/task1_dpo_absgt7_noidk__pari0.5_0604.json"
|
| 29 |
+
],
|
| 30 |
+
"val_dataset": [],
|
| 31 |
+
"split_dataset_ratio": 0.01,
|
| 32 |
+
"data_seed": 42,
|
| 33 |
+
"dataset_num_proc": 4,
|
| 34 |
+
"dataset_shuffle": true,
|
| 35 |
+
"val_dataset_shuffle": false,
|
| 36 |
+
"streaming": false,
|
| 37 |
+
"interleave_prob": null,
|
| 38 |
+
"stopping_strategy": "first_exhausted",
|
| 39 |
+
"shuffle_buffer_size": 1000,
|
| 40 |
+
"enable_cache": false,
|
| 41 |
+
"download_mode": "reuse_dataset_if_exists",
|
| 42 |
+
"columns": {},
|
| 43 |
+
"strict": false,
|
| 44 |
+
"remove_unused_columns": true,
|
| 45 |
+
"model_name": [
|
| 46 |
+
null,
|
| 47 |
+
null
|
| 48 |
+
],
|
| 49 |
+
"model_author": [
|
| 50 |
+
null,
|
| 51 |
+
null
|
| 52 |
+
],
|
| 53 |
+
"custom_dataset_info": [],
|
| 54 |
+
"quant_method": null,
|
| 55 |
+
"quant_bits": null,
|
| 56 |
+
"hqq_axis": null,
|
| 57 |
+
"bnb_4bit_compute_dtype": "bfloat16",
|
| 58 |
+
"bnb_4bit_quant_type": "nf4",
|
| 59 |
+
"bnb_4bit_use_double_quant": true,
|
| 60 |
+
"bnb_4bit_quant_storage": null,
|
| 61 |
+
"max_new_tokens": 64,
|
| 62 |
+
"temperature": 0.9,
|
| 63 |
+
"top_k": 50,
|
| 64 |
+
"top_p": 0.9,
|
| 65 |
+
"repetition_penalty": 1.0,
|
| 66 |
+
"num_beams": 1,
|
| 67 |
+
"stream": false,
|
| 68 |
+
"stop_words": [],
|
| 69 |
+
"logprobs": false,
|
| 70 |
+
"top_logprobs": null,
|
| 71 |
+
"ckpt_dir": null,
|
| 72 |
+
"load_dataset_config": null,
|
| 73 |
+
"lora_modules": [],
|
| 74 |
+
"tuner_backend": "peft",
|
| 75 |
+
"train_type": "lora",
|
| 76 |
+
"adapters": [],
|
| 77 |
+
"external_plugins": [],
|
| 78 |
+
"seed": 42,
|
| 79 |
+
"model_kwargs": {},
|
| 80 |
+
"load_args": false,
|
| 81 |
+
"load_data_args": false,
|
| 82 |
+
"use_hf": false,
|
| 83 |
+
"hub_token": null,
|
| 84 |
+
"custom_register_path": [],
|
| 85 |
+
"ignore_args_error": false,
|
| 86 |
+
"use_swift_lora": false,
|
| 87 |
+
"output_dir": "/data2/kdd/crag/cjz/output/task1_dpo_absgt7_noidk__pari0.5_0604/v0-20250604-225329",
|
| 88 |
+
"overwrite_output_dir": false,
|
| 89 |
+
"do_train": false,
|
| 90 |
+
"do_eval": false,
|
| 91 |
+
"do_predict": false,
|
| 92 |
+
"eval_strategy": "steps",
|
| 93 |
+
"prediction_loss_only": false,
|
| 94 |
+
"per_device_train_batch_size": 2,
|
| 95 |
+
"per_device_eval_batch_size": 2,
|
| 96 |
+
"per_gpu_train_batch_size": null,
|
| 97 |
+
"per_gpu_eval_batch_size": null,
|
| 98 |
+
"gradient_accumulation_steps": 16,
|
| 99 |
+
"eval_accumulation_steps": null,
|
| 100 |
+
"eval_delay": 0,
|
| 101 |
+
"torch_empty_cache_steps": null,
|
| 102 |
+
"learning_rate": 0.0002,
|
| 103 |
+
"weight_decay": 0.1,
|
| 104 |
+
"adam_beta1": 0.9,
|
| 105 |
+
"adam_beta2": 0.95,
|
| 106 |
+
"adam_epsilon": 1e-08,
|
| 107 |
+
"max_grad_norm": 1.0,
|
| 108 |
+
"num_train_epochs": 2.0,
|
| 109 |
+
"max_steps": -1,
|
| 110 |
+
"lr_scheduler_type": "cosine",
|
| 111 |
+
"lr_scheduler_kwargs": null,
|
| 112 |
+
"warmup_ratio": 0.05,
|
| 113 |
+
"warmup_steps": 0,
|
| 114 |
+
"log_level": "passive",
|
| 115 |
+
"log_level_replica": "warning",
|
| 116 |
+
"log_on_each_node": true,
|
| 117 |
+
"logging_dir": "/data2/kdd/crag/cjz/output/task1_dpo_absgt7_noidk__pari0.5_0604/v0-20250604-225329/runs",
|
| 118 |
+
"logging_strategy": "steps",
|
| 119 |
+
"logging_first_step": true,
|
| 120 |
+
"logging_steps": 1,
|
| 121 |
+
"logging_nan_inf_filter": true,
|
| 122 |
+
"save_strategy": "steps",
|
| 123 |
+
"save_steps": 50.0,
|
| 124 |
+
"save_total_limit": null,
|
| 125 |
+
"save_safetensors": true,
|
| 126 |
+
"save_on_each_node": false,
|
| 127 |
+
"save_only_model": false,
|
| 128 |
+
"restore_callback_states_from_checkpoint": false,
|
| 129 |
+
"no_cuda": false,
|
| 130 |
+
"use_cpu": false,
|
| 131 |
+
"use_mps_device": false,
|
| 132 |
+
"jit_mode_eval": false,
|
| 133 |
+
"use_ipex": false,
|
| 134 |
+
"bf16": true,
|
| 135 |
+
"fp16": false,
|
| 136 |
+
"fp16_opt_level": "O1",
|
| 137 |
+
"half_precision_backend": "auto",
|
| 138 |
+
"bf16_full_eval": false,
|
| 139 |
+
"fp16_full_eval": false,
|
| 140 |
+
"tf32": null,
|
| 141 |
+
"local_rank": 0,
|
| 142 |
+
"ddp_backend": null,
|
| 143 |
+
"tpu_num_cores": null,
|
| 144 |
+
"tpu_metrics_debug": false,
|
| 145 |
+
"debug": null,
|
| 146 |
+
"dataloader_drop_last": false,
|
| 147 |
+
"eval_steps": 300.0,
|
| 148 |
+
"dataloader_num_workers": 4,
|
| 149 |
+
"dataloader_prefetch_factor": null,
|
| 150 |
+
"past_index": -1,
|
| 151 |
+
"run_name": null,
|
| 152 |
+
"disable_tqdm": null,
|
| 153 |
+
"label_names": null,
|
| 154 |
+
"load_best_model_at_end": false,
|
| 155 |
+
"metric_for_best_model": "loss",
|
| 156 |
+
"greater_is_better": false,
|
| 157 |
+
"ignore_data_skip": false,
|
| 158 |
+
"fsdp": "",
|
| 159 |
+
"fsdp_min_num_params": 0,
|
| 160 |
+
"fsdp_config": null,
|
| 161 |
+
"tp_size": 0,
|
| 162 |
+
"fsdp_transformer_layer_cls_to_wrap": null,
|
| 163 |
+
"accelerator_config": {
|
| 164 |
+
"dispatch_batches": false
|
| 165 |
+
},
|
| 166 |
+
"deepspeed": {
|
| 167 |
+
"fp16": {
|
| 168 |
+
"enabled": "auto",
|
| 169 |
+
"loss_scale": 0,
|
| 170 |
+
"loss_scale_window": 1000,
|
| 171 |
+
"initial_scale_power": 16,
|
| 172 |
+
"hysteresis": 2,
|
| 173 |
+
"min_loss_scale": 1
|
| 174 |
+
},
|
| 175 |
+
"bf16": {
|
| 176 |
+
"enabled": "auto"
|
| 177 |
+
},
|
| 178 |
+
"zero_optimization": {
|
| 179 |
+
"stage": 2,
|
| 180 |
+
"offload_optimizer": {
|
| 181 |
+
"device": "none",
|
| 182 |
+
"pin_memory": true
|
| 183 |
+
},
|
| 184 |
+
"allgather_partitions": true,
|
| 185 |
+
"allgather_bucket_size": 200000000.0,
|
| 186 |
+
"overlap_comm": false,
|
| 187 |
+
"reduce_scatter": true,
|
| 188 |
+
"reduce_bucket_size": 200000000.0,
|
| 189 |
+
"contiguous_gradients": true
|
| 190 |
+
},
|
| 191 |
+
"gradient_accumulation_steps": "auto",
|
| 192 |
+
"gradient_clipping": "auto",
|
| 193 |
+
"steps_per_print": 2000,
|
| 194 |
+
"train_batch_size": "auto",
|
| 195 |
+
"train_micro_batch_size_per_gpu": "auto",
|
| 196 |
+
"wall_clock_breakdown": false
|
| 197 |
+
},
|
| 198 |
+
"label_smoothing_factor": 0.0,
|
| 199 |
+
"optim": "adamw_torch",
|
| 200 |
+
"optim_args": null,
|
| 201 |
+
"adafactor": false,
|
| 202 |
+
"group_by_length": false,
|
| 203 |
+
"length_column_name": "length",
|
| 204 |
+
"report_to": [
|
| 205 |
+
"tensorboard"
|
| 206 |
+
],
|
| 207 |
+
"ddp_find_unused_parameters": null,
|
| 208 |
+
"ddp_bucket_cap_mb": null,
|
| 209 |
+
"ddp_broadcast_buffers": null,
|
| 210 |
+
"dataloader_pin_memory": true,
|
| 211 |
+
"dataloader_persistent_workers": false,
|
| 212 |
+
"skip_memory_metrics": true,
|
| 213 |
+
"use_legacy_prediction_loop": false,
|
| 214 |
+
"push_to_hub": false,
|
| 215 |
+
"resume_from_checkpoint": null,
|
| 216 |
+
"hub_model_id": null,
|
| 217 |
+
"hub_strategy": "every_save",
|
| 218 |
+
"hub_private_repo": null,
|
| 219 |
+
"hub_always_push": false,
|
| 220 |
+
"gradient_checkpointing": true,
|
| 221 |
+
"gradient_checkpointing_kwargs": null,
|
| 222 |
+
"include_inputs_for_metrics": false,
|
| 223 |
+
"include_for_metrics": [],
|
| 224 |
+
"eval_do_concat_batches": true,
|
| 225 |
+
"fp16_backend": "auto",
|
| 226 |
+
"push_to_hub_model_id": null,
|
| 227 |
+
"push_to_hub_organization": null,
|
| 228 |
+
"push_to_hub_token": null,
|
| 229 |
+
"mp_parameters": "",
|
| 230 |
+
"auto_find_batch_size": false,
|
| 231 |
+
"full_determinism": false,
|
| 232 |
+
"torchdynamo": null,
|
| 233 |
+
"ray_scope": "last",
|
| 234 |
+
"ddp_timeout": 1800,
|
| 235 |
+
"torch_compile": false,
|
| 236 |
+
"torch_compile_backend": null,
|
| 237 |
+
"torch_compile_mode": null,
|
| 238 |
+
"include_tokens_per_second": false,
|
| 239 |
+
"include_num_input_tokens_seen": false,
|
| 240 |
+
"neftune_noise_alpha": null,
|
| 241 |
+
"optim_target_modules": null,
|
| 242 |
+
"batch_eval_metrics": false,
|
| 243 |
+
"eval_on_start": false,
|
| 244 |
+
"use_liger_kernel": false,
|
| 245 |
+
"eval_use_gather_object": false,
|
| 246 |
+
"average_tokens_across_devices": false,
|
| 247 |
+
"sortish_sampler": false,
|
| 248 |
+
"predict_with_generate": false,
|
| 249 |
+
"generation_max_length": null,
|
| 250 |
+
"generation_num_beams": null,
|
| 251 |
+
"generation_config": null,
|
| 252 |
+
"check_model": true,
|
| 253 |
+
"acc_strategy": "token",
|
| 254 |
+
"train_dataloader_shuffle": true,
|
| 255 |
+
"metric_warmup_step": 0,
|
| 256 |
+
"fsdp_num": 1,
|
| 257 |
+
"acc_steps": 1,
|
| 258 |
+
"eval_use_evalscope": false,
|
| 259 |
+
"eval_datasets": [],
|
| 260 |
+
"eval_limit": null,
|
| 261 |
+
"eval_datasets_args": null,
|
| 262 |
+
"eval_generation_config": null,
|
| 263 |
+
"freeze_parameters": [
|
| 264 |
+
"vision_model",
|
| 265 |
+
"multi_modal_projector"
|
| 266 |
+
],
|
| 267 |
+
"freeze_parameters_ratio": 0.0,
|
| 268 |
+
"trainable_parameters": [],
|
| 269 |
+
"freeze_llm": false,
|
| 270 |
+
"freeze_vit": true,
|
| 271 |
+
"freeze_aligner": true,
|
| 272 |
+
"target_modules": [
|
| 273 |
+
"all-linear"
|
| 274 |
+
],
|
| 275 |
+
"target_regex": null,
|
| 276 |
+
"modules_to_save": [],
|
| 277 |
+
"lora_rank": 8,
|
| 278 |
+
"lora_alpha": 32,
|
| 279 |
+
"lora_dropout": 0.05,
|
| 280 |
+
"lora_bias": "none",
|
| 281 |
+
"lora_dtype": null,
|
| 282 |
+
"lorap_lr_ratio": null,
|
| 283 |
+
"use_rslora": false,
|
| 284 |
+
"use_dora": false,
|
| 285 |
+
"lora_ga_batch_size": 2,
|
| 286 |
+
"lora_ga_iters": 2,
|
| 287 |
+
"lora_ga_max_length": 1024,
|
| 288 |
+
"lora_ga_direction": "ArB2r",
|
| 289 |
+
"lora_ga_scale": "stable",
|
| 290 |
+
"lora_ga_stable_gamma": 16,
|
| 291 |
+
"init_weights": true,
|
| 292 |
+
"fourier_n_frequency": 2000,
|
| 293 |
+
"fourier_scaling": 300.0,
|
| 294 |
+
"boft_block_size": 4,
|
| 295 |
+
"boft_block_num": 0,
|
| 296 |
+
"boft_n_butterfly_factor": 1,
|
| 297 |
+
"boft_dropout": 0.0,
|
| 298 |
+
"vera_rank": 256,
|
| 299 |
+
"vera_projection_prng_key": 0,
|
| 300 |
+
"vera_dropout": 0.0,
|
| 301 |
+
"vera_d_initial": 0.1,
|
| 302 |
+
"adapter_act": "gelu",
|
| 303 |
+
"adapter_length": 128,
|
| 304 |
+
"use_galore": false,
|
| 305 |
+
"galore_target_modules": null,
|
| 306 |
+
"galore_rank": 128,
|
| 307 |
+
"galore_update_proj_gap": 50,
|
| 308 |
+
"galore_scale": 1.0,
|
| 309 |
+
"galore_proj_type": "std",
|
| 310 |
+
"galore_optim_per_parameter": false,
|
| 311 |
+
"galore_with_embedding": false,
|
| 312 |
+
"galore_quantization": false,
|
| 313 |
+
"galore_proj_quant": false,
|
| 314 |
+
"galore_proj_bits": 4,
|
| 315 |
+
"galore_proj_group_size": 256,
|
| 316 |
+
"galore_cos_threshold": 0.4,
|
| 317 |
+
"galore_gamma_proj": 2,
|
| 318 |
+
"galore_queue_size": 5,
|
| 319 |
+
"adalora_target_r": 8,
|
| 320 |
+
"adalora_init_r": 12,
|
| 321 |
+
"adalora_tinit": 0,
|
| 322 |
+
"adalora_tfinal": 0,
|
| 323 |
+
"adalora_deltaT": 1,
|
| 324 |
+
"adalora_beta1": 0.85,
|
| 325 |
+
"adalora_beta2": 0.85,
|
| 326 |
+
"adalora_orth_reg_weight": 0.5,
|
| 327 |
+
"llamapro_num_new_blocks": 4,
|
| 328 |
+
"llamapro_num_groups": null,
|
| 329 |
+
"lisa_activated_layers": 0,
|
| 330 |
+
"lisa_step_interval": 20,
|
| 331 |
+
"reft_layer_key": null,
|
| 332 |
+
"reft_layers": null,
|
| 333 |
+
"reft_rank": 4,
|
| 334 |
+
"reft_intervention_type": "LoreftIntervention",
|
| 335 |
+
"reft_args": null,
|
| 336 |
+
"swanlab_token": null,
|
| 337 |
+
"swanlab_project": null,
|
| 338 |
+
"swanlab_workspace": null,
|
| 339 |
+
"swanlab_exp_name": null,
|
| 340 |
+
"swanlab_mode": "cloud",
|
| 341 |
+
"add_version": true,
|
| 342 |
+
"resume_only_model": false,
|
| 343 |
+
"create_checkpoint_symlink": false,
|
| 344 |
+
"packing": false,
|
| 345 |
+
"lazy_tokenize": true,
|
| 346 |
+
"loss_type": "sigmoid",
|
| 347 |
+
"optimizer": null,
|
| 348 |
+
"metric": null,
|
| 349 |
+
"zero_hpz_partition_size": null,
|
| 350 |
+
"reward_model": null,
|
| 351 |
+
"reward_adapters": [],
|
| 352 |
+
"reward_model_type": null,
|
| 353 |
+
"reward_model_revision": null,
|
| 354 |
+
"num_ppo_epochs": 4,
|
| 355 |
+
"whiten_rewards": false,
|
| 356 |
+
"kl_coef": 0.05,
|
| 357 |
+
"cliprange": 0.2,
|
| 358 |
+
"vf_coef": 0.1,
|
| 359 |
+
"cliprange_value": 0.2,
|
| 360 |
+
"gamma": 1.0,
|
| 361 |
+
"lam": 0.95,
|
| 362 |
+
"num_mini_batches": 1,
|
| 363 |
+
"local_rollout_forward_batch_size": 64,
|
| 364 |
+
"num_sample_generations": 10,
|
| 365 |
+
"response_length": 512,
|
| 366 |
+
"missing_eos_penalty": null,
|
| 367 |
+
"epsilon": 0.2,
|
| 368 |
+
"epsilon_high": null,
|
| 369 |
+
"num_infer_workers": 1,
|
| 370 |
+
"vllm_device": [
|
| 371 |
+
"auto"
|
| 372 |
+
],
|
| 373 |
+
"vllm_gpu_memory_utilization": 0.9,
|
| 374 |
+
"vllm_max_model_len": null,
|
| 375 |
+
"vllm_max_num_seqs": 256,
|
| 376 |
+
"vllm_enforce_eager": false,
|
| 377 |
+
"vllm_limit_mm_per_prompt": null,
|
| 378 |
+
"vllm_enable_prefix_caching": true,
|
| 379 |
+
"cosine_min_len_value_wrong": -0.5,
|
| 380 |
+
"cosine_max_len_value_wrong": 0.0,
|
| 381 |
+
"cosine_min_len_value_correct": 1.0,
|
| 382 |
+
"cosine_max_len_value_correct": 0.5,
|
| 383 |
+
"cosine_max_len": null,
|
| 384 |
+
"repetition_n_grams": 3,
|
| 385 |
+
"repetition_max_penalty": -1.0,
|
| 386 |
+
"use_lmdeploy": false,
|
| 387 |
+
"lmdeploy_device": "auto",
|
| 388 |
+
"lmdeploy_session_len": null,
|
| 389 |
+
"lmdeploy_cache_max_entry_count": 0.8,
|
| 390 |
+
"async_generate": false,
|
| 391 |
+
"tensor_parallel_size": 1,
|
| 392 |
+
"sleep_level": 0,
|
| 393 |
+
"move_model_batches": null,
|
| 394 |
+
"offload_optimizer": false,
|
| 395 |
+
"offload_model": false,
|
| 396 |
+
"gc_collect_after_offload": false,
|
| 397 |
+
"multi_turn_func": null,
|
| 398 |
+
"dynamic_sample": false,
|
| 399 |
+
"max_resample_times": 3,
|
| 400 |
+
"overlong_filter": false,
|
| 401 |
+
"soft_max_length": null,
|
| 402 |
+
"soft_cache_length": null,
|
| 403 |
+
"scale_rewards": true,
|
| 404 |
+
"wandb_log_unique_prompts": null,
|
| 405 |
+
"vllm_server_host": null,
|
| 406 |
+
"vllm_server_port": 8000,
|
| 407 |
+
"vllm_server_timeout": 240.0,
|
| 408 |
+
"num_generations": 8,
|
| 409 |
+
"max_completion_length": 512,
|
| 410 |
+
"ds3_gather_for_generation": true,
|
| 411 |
+
"reward_funcs": [],
|
| 412 |
+
"reward_weights": null,
|
| 413 |
+
"log_completions": false,
|
| 414 |
+
"use_vllm": false,
|
| 415 |
+
"num_iterations": 1,
|
| 416 |
+
"rlhf_type": "dpo",
|
| 417 |
+
"ref_model": null,
|
| 418 |
+
"ref_model_type": null,
|
| 419 |
+
"ref_model_revision": null,
|
| 420 |
+
"beta": 0.1,
|
| 421 |
+
"label_smoothing": 0,
|
| 422 |
+
"rpo_alpha": 1.0,
|
| 423 |
+
"cpo_alpha": 1.0,
|
| 424 |
+
"simpo_gamma": 1,
|
| 425 |
+
"desirable_weight": 1.0,
|
| 426 |
+
"undesirable_weight": 1.0,
|
| 427 |
+
"center_rewards_coefficient": null,
|
| 428 |
+
"rank": 0,
|
| 429 |
+
"global_world_size": 1,
|
| 430 |
+
"local_world_size": 1,
|
| 431 |
+
"model_suffix": "Llama-3.2-11B-Vision-Instruct",
|
| 432 |
+
"model_info": "ModelInfo(model_type='llama3_2_vision', model_dir='/data1/chenjiazun/LLM/Llama-3.2-11B-Vision-Instruct', torch_dtype=torch.bfloat16, max_model_len=131072, quant_method=None, quant_bits=None, rope_scaling={'factor': 8.0, 'high_freq_factor': 4.0, 'low_freq_factor': 1.0, 'original_max_position_embeddings': 8192, 'rope_type': 'llama3'}, config=None, task_type='causal_lm', num_labels=None)",
|
| 433 |
+
"model_meta": "ModelMeta(model_type='llama3_2_vision', model_groups=[ModelGroup(models=[Model(ms_model_id='LLM-Research/Llama-3.2-11B-Vision-Instruct', hf_model_id='meta-llama/Llama-3.2-11B-Vision-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='LLM-Research/Llama-3.2-90B-Vision-Instruct', hf_model_id='meta-llama/Llama-3.2-90B-Vision-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='LLM-Research/Llama-3.2-11B-Vision', hf_model_id='meta-llama/Llama-3.2-11B-Vision', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='LLM-Research/Llama-3.2-90B-Vision', hf_model_id='meta-llama/Llama-3.2-90B-Vision', model_path=None, ms_revision=None, hf_revision=None)], ignore_patterns=None, requires=None, tags=[])], template='llama3_2_vision', get_function=<function get_model_tokenizer_llama3_2_vision at 0x763fc971ef80>, model_arch='llama3_2_vision', architectures=['MllamaForConditionalGeneration'], additional_saved_files=[], torch_dtype=None, is_multimodal=True, is_reward=False, task_type=None, ignore_patterns=None, requires=['transformers>=4.45'], tags=[])",
|
| 434 |
+
"model_dir": "/data1/chenjiazun/LLM/Llama-3.2-11B-Vision-Instruct",
|
| 435 |
+
"hub": "<class 'swift.hub.hub.MSHub'>",
|
| 436 |
+
"evaluation_strategy": "steps",
|
| 437 |
+
"training_args": "DPOConfig(output_dir='/data2/kdd/crag/cjz/output/task1_dpo_absgt7_noidk__pari0.5_0604/v0-20250604-225329', overwrite_output_dir=False, do_train=False, do_eval=True, do_predict=False, eval_strategy=<IntervalStrategy.STEPS: 'steps'>, prediction_loss_only=False, per_device_train_batch_size=2, per_device_eval_batch_size=2, per_gpu_train_batch_size=None, per_gpu_eval_batch_size=None, gradient_accumulation_steps=16, eval_accumulation_steps=None, eval_delay=0, torch_empty_cache_steps=None, learning_rate=0.0002, weight_decay=0.1, adam_beta1=0.9, adam_beta2=0.95, adam_epsilon=1e-08, max_grad_norm=1.0, num_train_epochs=2.0, max_steps=-1, lr_scheduler_type=<SchedulerType.COSINE: 'cosine'>, lr_scheduler_kwargs=None, warmup_ratio=0.05, warmup_steps=0, log_level='passive', log_level_replica='warning', log_on_each_node=True, logging_dir='/data2/kdd/crag/cjz/output/task1_dpo_absgt7_noidk__pari0.5_0604/v0-20250604-225329/runs', logging_strategy=<IntervalStrategy.STEPS: 'steps'>, logging_first_step=True, logging_steps=1, logging_nan_inf_filter=True, save_strategy=<SaveStrategy.STEPS: 'steps'>, save_steps=50, save_total_limit=None, save_safetensors=True, save_on_each_node=False, save_only_model=False, restore_callback_states_from_checkpoint=False, no_cuda=False, use_cpu=False, use_mps_device=False, seed=42, data_seed=42, jit_mode_eval=False, use_ipex=False, bf16=True, fp16=False, fp16_opt_level='O1', half_precision_backend='auto', bf16_full_eval=False, fp16_full_eval=False, tf32=None, local_rank=0, ddp_backend=None, tpu_num_cores=None, tpu_metrics_debug=False, debug=[], dataloader_drop_last=False, eval_steps=300, dataloader_num_workers=4, dataloader_prefetch_factor=10, past_index=-1, run_name='/data2/kdd/crag/cjz/output/task1_dpo_absgt7_noidk__pari0.5_0604/v0-20250604-225329', disable_tqdm=False, remove_unused_columns=False, label_names=None, load_best_model_at_end=False, metric_for_best_model='loss', greater_is_better=False, ignore_data_skip=False, fsdp=[], fsdp_min_num_params=0, fsdp_config={'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}, tp_size=0, fsdp_transformer_layer_cls_to_wrap=None, accelerator_config=AcceleratorConfig(split_batches=False, dispatch_batches=False, even_batches=True, use_seedable_sampler=True, non_blocking=False, gradient_accumulation_kwargs=None, use_configured_state=False), deepspeed={'fp16': {'enabled': 'auto', 'loss_scale': 0, 'loss_scale_window': 1000, 'initial_scale_power': 16, 'hysteresis': 2, 'min_loss_scale': 1}, 'bf16': {'enabled': 'auto'}, 'zero_optimization': {'stage': 2, 'offload_optimizer': {'device': 'none', 'pin_memory': True}, 'allgather_partitions': True, 'allgather_bucket_size': 200000000.0, 'overlap_comm': False, 'reduce_scatter': True, 'reduce_bucket_size': 200000000.0, 'contiguous_gradients': True}, 'gradient_accumulation_steps': 'auto', 'gradient_clipping': 'auto', 'steps_per_print': 2000, 'train_batch_size': 'auto', 'train_micro_batch_size_per_gpu': 'auto', 'wall_clock_breakdown': False}, label_smoothing_factor=0.0, optim=<OptimizerNames.ADAMW_TORCH: 'adamw_torch'>, optim_args=None, adafactor=False, group_by_length=False, length_column_name='length', report_to=['tensorboard'], ddp_find_unused_parameters=None, ddp_bucket_cap_mb=None, ddp_broadcast_buffers=None, dataloader_pin_memory=True, dataloader_persistent_workers=False, skip_memory_metrics=True, use_legacy_prediction_loop=False, push_to_hub=False, resume_from_checkpoint=None, hub_model_id=None, hub_strategy=<HubStrategy.EVERY_SAVE: 'every_save'>, hub_token=None, hub_private_repo=None, hub_always_push=False, gradient_checkpointing=True, gradient_checkpointing_kwargs=None, include_inputs_for_metrics=False, include_for_metrics=[], eval_do_concat_batches=True, fp16_backend='auto', push_to_hub_model_id=None, push_to_hub_organization=None, push_to_hub_token=None, mp_parameters='', auto_find_batch_size=False, full_determinism=False, torchdynamo=None, ray_scope='last', ddp_timeout=1800, torch_compile=False, torch_compile_backend=None, torch_compile_mode=None, include_tokens_per_second=None, include_num_input_tokens_seen=None, neftune_noise_alpha=None, optim_target_modules=None, batch_eval_metrics=False, eval_on_start=False, use_liger_kernel=False, eval_use_gather_object=False, average_tokens_across_devices=None, model_init_kwargs=None, ref_model_init_kwargs=None, model_adapter_name=None, ref_adapter_name=None, force_use_ref_model=False, disable_dropout=True, use_logits_to_keep=False, dataset_num_proc=4, padding_value=None, label_pad_token_id=None, max_prompt_length=512, max_completion_length=512, max_length=2048, truncation_mode='keep_end', padding_free=False, precompute_ref_log_probs=False, precompute_ref_batch_size=None, tools=None, loss_type='sigmoid', beta=0.1, f_divergence_type=<FDivergenceType.REVERSE_KL: 'reverse_kl'>, f_alpha_divergence_coef=1.0, reference_free=False, label_smoothing=0, use_weighting=False, rpo_alpha=1.0, discopop_tau=0.05, sync_ref_model=False, ref_model_mixup_alpha=0.6, ref_model_sync_steps=512, generate_during_eval=False, check_model=True, acc_strategy='token', train_dataloader_shuffle=True, metric_warmup_step=0, fsdp_num=1, acc_steps=1, eval_use_evalscope=False, eval_datasets=[], eval_limit=None, eval_datasets_args=None, eval_generation_config=None, train_type='lora', optimizer=None, local_repo_path=None, galore_config=None)"
|
| 438 |
+
}
|
latest
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
global_step50
|
rng_state.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:835f869ea325fd6edf27b48b589309fb66641cb92b45f2fc13d1bb6e8814106c
|
| 3 |
+
size 14244
|
scheduler.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:05bd8698350835fff0c8d6f1fd752d5d3598c200e9cd3cef613baf99386ff5da
|
| 3 |
+
size 1064
|
trainer_state.json
ADDED
|
@@ -0,0 +1,934 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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4 |
+
"best_model_checkpoint": null,
|
| 5 |
+
"epoch": 0.11157601115760112,
|
| 6 |
+
"eval_steps": 300,
|
| 7 |
+
"global_step": 50,
|
| 8 |
+
"is_hyper_param_search": false,
|
| 9 |
+
"is_local_process_zero": true,
|
| 10 |
+
"is_world_process_zero": true,
|
| 11 |
+
"log_history": [
|
| 12 |
+
{
|
| 13 |
+
"epoch": 0.0022315202231520223,
|
| 14 |
+
"grad_norm": 11.248553276062012,
|
| 15 |
+
"learning_rate": 4.444444444444445e-06,
|
| 16 |
+
"logits/chosen": -0.48349103331565857,
|
| 17 |
+
"logits/rejected": -0.652603030204773,
|
| 18 |
+
"logps/chosen": -8.859519004821777,
|
| 19 |
+
"logps/rejected": -16.016435623168945,
|
| 20 |
+
"loss": 1.3468515872955322,
|
| 21 |
+
"memory(GiB)": 33.34,
|
| 22 |
+
"nll_loss": 0.6537042856216431,
|
| 23 |
+
"rewards/accuracies": 0.0,
|
| 24 |
+
"rewards/chosen": 0.0,
|
| 25 |
+
"rewards/margins": 0.0,
|
| 26 |
+
"rewards/rejected": 0.0,
|
| 27 |
+
"step": 1,
|
| 28 |
+
"train_speed(iter/s)": 0.010678
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"epoch": 0.004463040446304045,
|
| 32 |
+
"grad_norm": 8.97808837890625,
|
| 33 |
+
"learning_rate": 8.88888888888889e-06,
|
| 34 |
+
"logits/chosen": -0.5174899101257324,
|
| 35 |
+
"logits/rejected": -0.6262180805206299,
|
| 36 |
+
"logps/chosen": -9.287378311157227,
|
| 37 |
+
"logps/rejected": -13.981985092163086,
|
| 38 |
+
"loss": 1.290852665901184,
|
| 39 |
+
"memory(GiB)": 36.2,
|
| 40 |
+
"nll_loss": 0.5977055430412292,
|
| 41 |
+
"rewards/accuracies": 0.0,
|
| 42 |
+
"rewards/chosen": 0.0,
|
| 43 |
+
"rewards/margins": 0.0,
|
| 44 |
+
"rewards/rejected": 0.0,
|
| 45 |
+
"step": 2,
|
| 46 |
+
"train_speed(iter/s)": 0.010974
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"epoch": 0.0066945606694560665,
|
| 50 |
+
"grad_norm": 7.36937141418457,
|
| 51 |
+
"learning_rate": 1.3333333333333333e-05,
|
| 52 |
+
"logits/chosen": -0.42612141370773315,
|
| 53 |
+
"logits/rejected": -0.6118584871292114,
|
| 54 |
+
"logps/chosen": -6.56147575378418,
|
| 55 |
+
"logps/rejected": -16.162681579589844,
|
| 56 |
+
"loss": 1.1864153146743774,
|
| 57 |
+
"memory(GiB)": 36.2,
|
| 58 |
+
"nll_loss": 0.492550790309906,
|
| 59 |
+
"rewards/accuracies": 0.53125,
|
| 60 |
+
"rewards/chosen": -0.0009138870518654585,
|
| 61 |
+
"rewards/margins": -0.0012306026183068752,
|
| 62 |
+
"rewards/rejected": 0.00031671510078012943,
|
| 63 |
+
"step": 3,
|
| 64 |
+
"train_speed(iter/s)": 0.011052
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"epoch": 0.00892608089260809,
|
| 68 |
+
"grad_norm": 7.918132305145264,
|
| 69 |
+
"learning_rate": 1.777777777777778e-05,
|
| 70 |
+
"logits/chosen": -0.5244420170783997,
|
| 71 |
+
"logits/rejected": -0.6519989371299744,
|
| 72 |
+
"logps/chosen": -7.461406707763672,
|
| 73 |
+
"logps/rejected": -17.006786346435547,
|
| 74 |
+
"loss": 1.3234074115753174,
|
| 75 |
+
"memory(GiB)": 39.28,
|
| 76 |
+
"nll_loss": 0.6342031359672546,
|
| 77 |
+
"rewards/accuracies": 0.625,
|
| 78 |
+
"rewards/chosen": 0.0032776433508843184,
|
| 79 |
+
"rewards/margins": 0.008089437149465084,
|
| 80 |
+
"rewards/rejected": -0.004811794031411409,
|
| 81 |
+
"step": 4,
|
| 82 |
+
"train_speed(iter/s)": 0.011094
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"epoch": 0.011157601115760111,
|
| 86 |
+
"grad_norm": 9.900442123413086,
|
| 87 |
+
"learning_rate": 2.2222222222222223e-05,
|
| 88 |
+
"logits/chosen": -0.5073186159133911,
|
| 89 |
+
"logits/rejected": -0.6049282550811768,
|
| 90 |
+
"logps/chosen": -7.057607650756836,
|
| 91 |
+
"logps/rejected": -15.16832447052002,
|
| 92 |
+
"loss": 1.071779489517212,
|
| 93 |
+
"memory(GiB)": 39.28,
|
| 94 |
+
"nll_loss": 0.40041351318359375,
|
| 95 |
+
"rewards/accuracies": 0.75,
|
| 96 |
+
"rewards/chosen": 0.022623565047979355,
|
| 97 |
+
"rewards/margins": 0.04467733949422836,
|
| 98 |
+
"rewards/rejected": -0.02205377072095871,
|
| 99 |
+
"step": 5,
|
| 100 |
+
"train_speed(iter/s)": 0.011121
|
| 101 |
+
},
|
| 102 |
+
{
|
| 103 |
+
"epoch": 0.013389121338912133,
|
| 104 |
+
"grad_norm": 5.12174129486084,
|
| 105 |
+
"learning_rate": 2.6666666666666667e-05,
|
| 106 |
+
"logits/chosen": -0.48164039850234985,
|
| 107 |
+
"logits/rejected": -0.5844419002532959,
|
| 108 |
+
"logps/chosen": -6.2985005378723145,
|
| 109 |
+
"logps/rejected": -16.83810043334961,
|
| 110 |
+
"loss": 1.2731884717941284,
|
| 111 |
+
"memory(GiB)": 39.28,
|
| 112 |
+
"nll_loss": 0.600845992565155,
|
| 113 |
+
"rewards/accuracies": 0.65625,
|
| 114 |
+
"rewards/chosen": 0.010373853147029877,
|
| 115 |
+
"rewards/margins": 0.046181634068489075,
|
| 116 |
+
"rewards/rejected": -0.0358077809214592,
|
| 117 |
+
"step": 6,
|
| 118 |
+
"train_speed(iter/s)": 0.011143
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
"epoch": 0.015620641562064157,
|
| 122 |
+
"grad_norm": 4.1249213218688965,
|
| 123 |
+
"learning_rate": 3.111111111111111e-05,
|
| 124 |
+
"logits/chosen": -0.5566272735595703,
|
| 125 |
+
"logits/rejected": -0.6051127910614014,
|
| 126 |
+
"logps/chosen": -5.424515724182129,
|
| 127 |
+
"logps/rejected": -11.893548011779785,
|
| 128 |
+
"loss": 1.1159045696258545,
|
| 129 |
+
"memory(GiB)": 39.28,
|
| 130 |
+
"nll_loss": 0.46413302421569824,
|
| 131 |
+
"rewards/accuracies": 0.65625,
|
| 132 |
+
"rewards/chosen": 0.009653191082179546,
|
| 133 |
+
"rewards/margins": 0.11444520205259323,
|
| 134 |
+
"rewards/rejected": -0.10479200631380081,
|
| 135 |
+
"step": 7,
|
| 136 |
+
"train_speed(iter/s)": 0.011163
|
| 137 |
+
},
|
| 138 |
+
{
|
| 139 |
+
"epoch": 0.01785216178521618,
|
| 140 |
+
"grad_norm": 3.8928415775299072,
|
| 141 |
+
"learning_rate": 3.555555555555556e-05,
|
| 142 |
+
"logits/chosen": -0.5597310662269592,
|
| 143 |
+
"logits/rejected": -0.6341894268989563,
|
| 144 |
+
"logps/chosen": -6.350505352020264,
|
| 145 |
+
"logps/rejected": -20.239299774169922,
|
| 146 |
+
"loss": 0.8606890439987183,
|
| 147 |
+
"memory(GiB)": 39.28,
|
| 148 |
+
"nll_loss": 0.3352409899234772,
|
| 149 |
+
"rewards/accuracies": 0.8125,
|
| 150 |
+
"rewards/chosen": -0.018700765445828438,
|
| 151 |
+
"rewards/margins": 0.419380784034729,
|
| 152 |
+
"rewards/rejected": -0.4380815923213959,
|
| 153 |
+
"step": 8,
|
| 154 |
+
"train_speed(iter/s)": 0.011179
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
"epoch": 0.0200836820083682,
|
| 158 |
+
"grad_norm": 7.264344692230225,
|
| 159 |
+
"learning_rate": 4e-05,
|
| 160 |
+
"logits/chosen": -0.500182569026947,
|
| 161 |
+
"logits/rejected": -0.595187246799469,
|
| 162 |
+
"logps/chosen": -16.194358825683594,
|
| 163 |
+
"logps/rejected": -20.5479793548584,
|
| 164 |
+
"loss": 1.6191558837890625,
|
| 165 |
+
"memory(GiB)": 39.28,
|
| 166 |
+
"nll_loss": 1.0435733795166016,
|
| 167 |
+
"rewards/accuracies": 0.71875,
|
| 168 |
+
"rewards/chosen": -0.21446219086647034,
|
| 169 |
+
"rewards/margins": 0.40107572078704834,
|
| 170 |
+
"rewards/rejected": -0.6155378818511963,
|
| 171 |
+
"step": 9,
|
| 172 |
+
"train_speed(iter/s)": 0.011188
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"epoch": 0.022315202231520222,
|
| 176 |
+
"grad_norm": 7.542423725128174,
|
| 177 |
+
"learning_rate": 4.4444444444444447e-05,
|
| 178 |
+
"logits/chosen": -0.41380318999290466,
|
| 179 |
+
"logits/rejected": -0.5418319702148438,
|
| 180 |
+
"logps/chosen": -10.30124568939209,
|
| 181 |
+
"logps/rejected": -26.6314697265625,
|
| 182 |
+
"loss": 1.2661710977554321,
|
| 183 |
+
"memory(GiB)": 39.28,
|
| 184 |
+
"nll_loss": 0.6692220568656921,
|
| 185 |
+
"rewards/accuracies": 0.65625,
|
| 186 |
+
"rewards/chosen": -0.29620301723480225,
|
| 187 |
+
"rewards/margins": 0.5043031573295593,
|
| 188 |
+
"rewards/rejected": -0.8005062341690063,
|
| 189 |
+
"step": 10,
|
| 190 |
+
"train_speed(iter/s)": 0.01119
|
| 191 |
+
},
|
| 192 |
+
{
|
| 193 |
+
"epoch": 0.024546722454672244,
|
| 194 |
+
"grad_norm": 12.055508613586426,
|
| 195 |
+
"learning_rate": 4.888888888888889e-05,
|
| 196 |
+
"logits/chosen": -0.45050907135009766,
|
| 197 |
+
"logits/rejected": -0.5843921899795532,
|
| 198 |
+
"logps/chosen": -15.530860900878906,
|
| 199 |
+
"logps/rejected": -27.80389976501465,
|
| 200 |
+
"loss": 1.6187087297439575,
|
| 201 |
+
"memory(GiB)": 39.28,
|
| 202 |
+
"nll_loss": 1.0532186031341553,
|
| 203 |
+
"rewards/accuracies": 0.71875,
|
| 204 |
+
"rewards/chosen": -0.47808465361595154,
|
| 205 |
+
"rewards/margins": 0.41364309191703796,
|
| 206 |
+
"rewards/rejected": -0.8917278051376343,
|
| 207 |
+
"step": 11,
|
| 208 |
+
"train_speed(iter/s)": 0.011193
|
| 209 |
+
},
|
| 210 |
+
{
|
| 211 |
+
"epoch": 0.026778242677824266,
|
| 212 |
+
"grad_norm": 6.556560516357422,
|
| 213 |
+
"learning_rate": 5.333333333333333e-05,
|
| 214 |
+
"logits/chosen": -0.4449861943721771,
|
| 215 |
+
"logits/rejected": -0.5602853894233704,
|
| 216 |
+
"logps/chosen": -10.715709686279297,
|
| 217 |
+
"logps/rejected": -27.810680389404297,
|
| 218 |
+
"loss": 1.2998032569885254,
|
| 219 |
+
"memory(GiB)": 42.68,
|
| 220 |
+
"nll_loss": 0.6746751070022583,
|
| 221 |
+
"rewards/accuracies": 0.5625,
|
| 222 |
+
"rewards/chosen": -0.33532828092575073,
|
| 223 |
+
"rewards/margins": 0.39097556471824646,
|
| 224 |
+
"rewards/rejected": -0.7263038754463196,
|
| 225 |
+
"step": 12,
|
| 226 |
+
"train_speed(iter/s)": 0.011193
|
| 227 |
+
},
|
| 228 |
+
{
|
| 229 |
+
"epoch": 0.02900976290097629,
|
| 230 |
+
"grad_norm": 6.815319061279297,
|
| 231 |
+
"learning_rate": 5.7777777777777776e-05,
|
| 232 |
+
"logits/chosen": -0.45461201667785645,
|
| 233 |
+
"logits/rejected": -0.5696772933006287,
|
| 234 |
+
"logps/chosen": -8.947586059570312,
|
| 235 |
+
"logps/rejected": -23.452707290649414,
|
| 236 |
+
"loss": 1.347914218902588,
|
| 237 |
+
"memory(GiB)": 42.68,
|
| 238 |
+
"nll_loss": 0.7918389439582825,
|
| 239 |
+
"rewards/accuracies": 0.75,
|
| 240 |
+
"rewards/chosen": -0.14807622134685516,
|
| 241 |
+
"rewards/margins": 0.4436675012111664,
|
| 242 |
+
"rewards/rejected": -0.5917437076568604,
|
| 243 |
+
"step": 13,
|
| 244 |
+
"train_speed(iter/s)": 0.011196
|
| 245 |
+
},
|
| 246 |
+
{
|
| 247 |
+
"epoch": 0.031241283124128313,
|
| 248 |
+
"grad_norm": 4.015015125274658,
|
| 249 |
+
"learning_rate": 6.222222222222222e-05,
|
| 250 |
+
"logits/chosen": -0.4277312457561493,
|
| 251 |
+
"logits/rejected": -0.5162039995193481,
|
| 252 |
+
"logps/chosen": -7.859683513641357,
|
| 253 |
+
"logps/rejected": -25.14496612548828,
|
| 254 |
+
"loss": 1.1709389686584473,
|
| 255 |
+
"memory(GiB)": 46.13,
|
| 256 |
+
"nll_loss": 0.5424311757087708,
|
| 257 |
+
"rewards/accuracies": 0.6875,
|
| 258 |
+
"rewards/chosen": -0.09304673224687576,
|
| 259 |
+
"rewards/margins": 0.27104437351226807,
|
| 260 |
+
"rewards/rejected": -0.36409106850624084,
|
| 261 |
+
"step": 14,
|
| 262 |
+
"train_speed(iter/s)": 0.011191
|
| 263 |
+
},
|
| 264 |
+
{
|
| 265 |
+
"epoch": 0.03347280334728033,
|
| 266 |
+
"grad_norm": 2.5992424488067627,
|
| 267 |
+
"learning_rate": 6.666666666666667e-05,
|
| 268 |
+
"logits/chosen": -0.4692430794239044,
|
| 269 |
+
"logits/rejected": -0.5111399292945862,
|
| 270 |
+
"logps/chosen": -8.574230194091797,
|
| 271 |
+
"logps/rejected": -16.565174102783203,
|
| 272 |
+
"loss": 1.1323829889297485,
|
| 273 |
+
"memory(GiB)": 46.13,
|
| 274 |
+
"nll_loss": 0.5113993287086487,
|
| 275 |
+
"rewards/accuracies": 0.6875,
|
| 276 |
+
"rewards/chosen": -0.08413823693990707,
|
| 277 |
+
"rewards/margins": 0.19407325983047485,
|
| 278 |
+
"rewards/rejected": -0.27821147441864014,
|
| 279 |
+
"step": 15,
|
| 280 |
+
"train_speed(iter/s)": 0.011195
|
| 281 |
+
},
|
| 282 |
+
{
|
| 283 |
+
"epoch": 0.03570432357043236,
|
| 284 |
+
"grad_norm": 2.479030132293701,
|
| 285 |
+
"learning_rate": 7.111111111111112e-05,
|
| 286 |
+
"logits/chosen": -0.38820019364356995,
|
| 287 |
+
"logits/rejected": -0.5241715908050537,
|
| 288 |
+
"logps/chosen": -4.694685935974121,
|
| 289 |
+
"logps/rejected": -19.62047576904297,
|
| 290 |
+
"loss": 1.052955985069275,
|
| 291 |
+
"memory(GiB)": 46.13,
|
| 292 |
+
"nll_loss": 0.47422000765800476,
|
| 293 |
+
"rewards/accuracies": 0.8125,
|
| 294 |
+
"rewards/chosen": 0.06994247436523438,
|
| 295 |
+
"rewards/margins": 0.2729727327823639,
|
| 296 |
+
"rewards/rejected": -0.2030302733182907,
|
| 297 |
+
"step": 16,
|
| 298 |
+
"train_speed(iter/s)": 0.011196
|
| 299 |
+
},
|
| 300 |
+
{
|
| 301 |
+
"epoch": 0.03793584379358438,
|
| 302 |
+
"grad_norm": 2.1875240802764893,
|
| 303 |
+
"learning_rate": 7.555555555555556e-05,
|
| 304 |
+
"logits/chosen": -0.4483625292778015,
|
| 305 |
+
"logits/rejected": -0.5458305478096008,
|
| 306 |
+
"logps/chosen": -9.014262199401855,
|
| 307 |
+
"logps/rejected": -18.748149871826172,
|
| 308 |
+
"loss": 1.2149709463119507,
|
| 309 |
+
"memory(GiB)": 46.13,
|
| 310 |
+
"nll_loss": 0.6185500621795654,
|
| 311 |
+
"rewards/accuracies": 0.75,
|
| 312 |
+
"rewards/chosen": 0.1215842068195343,
|
| 313 |
+
"rewards/margins": 0.24843284487724304,
|
| 314 |
+
"rewards/rejected": -0.12684863805770874,
|
| 315 |
+
"step": 17,
|
| 316 |
+
"train_speed(iter/s)": 0.011197
|
| 317 |
+
},
|
| 318 |
+
{
|
| 319 |
+
"epoch": 0.0401673640167364,
|
| 320 |
+
"grad_norm": 2.639186382293701,
|
| 321 |
+
"learning_rate": 8e-05,
|
| 322 |
+
"logits/chosen": -0.4394489824771881,
|
| 323 |
+
"logits/rejected": -0.48552829027175903,
|
| 324 |
+
"logps/chosen": -9.954276084899902,
|
| 325 |
+
"logps/rejected": -14.681390762329102,
|
| 326 |
+
"loss": 1.1648714542388916,
|
| 327 |
+
"memory(GiB)": 46.13,
|
| 328 |
+
"nll_loss": 0.46223676204681396,
|
| 329 |
+
"rewards/accuracies": 0.5625,
|
| 330 |
+
"rewards/chosen": 0.011617322452366352,
|
| 331 |
+
"rewards/margins": 0.034979358315467834,
|
| 332 |
+
"rewards/rejected": -0.02336202934384346,
|
| 333 |
+
"step": 18,
|
| 334 |
+
"train_speed(iter/s)": 0.011199
|
| 335 |
+
},
|
| 336 |
+
{
|
| 337 |
+
"epoch": 0.042398884239888426,
|
| 338 |
+
"grad_norm": 2.351567029953003,
|
| 339 |
+
"learning_rate": 8.444444444444444e-05,
|
| 340 |
+
"logits/chosen": -0.4882590174674988,
|
| 341 |
+
"logits/rejected": -0.5300821661949158,
|
| 342 |
+
"logps/chosen": -7.595667362213135,
|
| 343 |
+
"logps/rejected": -17.29962921142578,
|
| 344 |
+
"loss": 1.1524200439453125,
|
| 345 |
+
"memory(GiB)": 46.13,
|
| 346 |
+
"nll_loss": 0.5075826644897461,
|
| 347 |
+
"rewards/accuracies": 0.59375,
|
| 348 |
+
"rewards/chosen": 0.06894361972808838,
|
| 349 |
+
"rewards/margins": 0.13017994165420532,
|
| 350 |
+
"rewards/rejected": -0.061236318200826645,
|
| 351 |
+
"step": 19,
|
| 352 |
+
"train_speed(iter/s)": 0.011201
|
| 353 |
+
},
|
| 354 |
+
{
|
| 355 |
+
"epoch": 0.044630404463040445,
|
| 356 |
+
"grad_norm": 2.8206121921539307,
|
| 357 |
+
"learning_rate": 8.888888888888889e-05,
|
| 358 |
+
"logits/chosen": -0.4782502055168152,
|
| 359 |
+
"logits/rejected": -0.5565172433853149,
|
| 360 |
+
"logps/chosen": -6.507530212402344,
|
| 361 |
+
"logps/rejected": -13.604747772216797,
|
| 362 |
+
"loss": 1.089160442352295,
|
| 363 |
+
"memory(GiB)": 46.13,
|
| 364 |
+
"nll_loss": 0.45874831080436707,
|
| 365 |
+
"rewards/accuracies": 0.53125,
|
| 366 |
+
"rewards/chosen": 0.06730557233095169,
|
| 367 |
+
"rewards/margins": 0.18410882353782654,
|
| 368 |
+
"rewards/rejected": -0.11680323630571365,
|
| 369 |
+
"step": 20,
|
| 370 |
+
"train_speed(iter/s)": 0.011206
|
| 371 |
+
},
|
| 372 |
+
{
|
| 373 |
+
"epoch": 0.04686192468619247,
|
| 374 |
+
"grad_norm": 2.452335834503174,
|
| 375 |
+
"learning_rate": 9.333333333333334e-05,
|
| 376 |
+
"logits/chosen": -0.4106925129890442,
|
| 377 |
+
"logits/rejected": -0.48896345496177673,
|
| 378 |
+
"logps/chosen": -7.722554683685303,
|
| 379 |
+
"logps/rejected": -22.094852447509766,
|
| 380 |
+
"loss": 1.153997540473938,
|
| 381 |
+
"memory(GiB)": 46.71,
|
| 382 |
+
"nll_loss": 0.5091268420219421,
|
| 383 |
+
"rewards/accuracies": 0.71875,
|
| 384 |
+
"rewards/chosen": 0.060057930648326874,
|
| 385 |
+
"rewards/margins": 0.16068722307682037,
|
| 386 |
+
"rewards/rejected": -0.1006293073296547,
|
| 387 |
+
"step": 21,
|
| 388 |
+
"train_speed(iter/s)": 0.011203
|
| 389 |
+
},
|
| 390 |
+
{
|
| 391 |
+
"epoch": 0.04909344490934449,
|
| 392 |
+
"grad_norm": 2.3324975967407227,
|
| 393 |
+
"learning_rate": 9.777777777777778e-05,
|
| 394 |
+
"logits/chosen": -0.4366399943828583,
|
| 395 |
+
"logits/rejected": -0.4600733816623688,
|
| 396 |
+
"logps/chosen": -9.774506568908691,
|
| 397 |
+
"logps/rejected": -14.850456237792969,
|
| 398 |
+
"loss": 1.185971975326538,
|
| 399 |
+
"memory(GiB)": 46.71,
|
| 400 |
+
"nll_loss": 0.5413804650306702,
|
| 401 |
+
"rewards/accuracies": 0.5,
|
| 402 |
+
"rewards/chosen": 0.08716820925474167,
|
| 403 |
+
"rewards/margins": 0.17242644727230072,
|
| 404 |
+
"rewards/rejected": -0.08525823801755905,
|
| 405 |
+
"step": 22,
|
| 406 |
+
"train_speed(iter/s)": 0.011203
|
| 407 |
+
},
|
| 408 |
+
{
|
| 409 |
+
"epoch": 0.051324965132496514,
|
| 410 |
+
"grad_norm": 2.7291500568389893,
|
| 411 |
+
"learning_rate": 0.00010222222222222222,
|
| 412 |
+
"logits/chosen": -0.4168204665184021,
|
| 413 |
+
"logits/rejected": -0.5373830795288086,
|
| 414 |
+
"logps/chosen": -7.675040245056152,
|
| 415 |
+
"logps/rejected": -20.635356903076172,
|
| 416 |
+
"loss": 1.1511971950531006,
|
| 417 |
+
"memory(GiB)": 46.71,
|
| 418 |
+
"nll_loss": 0.4784548282623291,
|
| 419 |
+
"rewards/accuracies": 0.46875,
|
| 420 |
+
"rewards/chosen": 0.05419651046395302,
|
| 421 |
+
"rewards/margins": 0.0959930419921875,
|
| 422 |
+
"rewards/rejected": -0.04179652780294418,
|
| 423 |
+
"step": 23,
|
| 424 |
+
"train_speed(iter/s)": 0.011204
|
| 425 |
+
},
|
| 426 |
+
{
|
| 427 |
+
"epoch": 0.05355648535564853,
|
| 428 |
+
"grad_norm": 2.6357204914093018,
|
| 429 |
+
"learning_rate": 0.00010666666666666667,
|
| 430 |
+
"logits/chosen": -0.39612719416618347,
|
| 431 |
+
"logits/rejected": -0.4547193944454193,
|
| 432 |
+
"logps/chosen": -9.427398681640625,
|
| 433 |
+
"logps/rejected": -20.611848831176758,
|
| 434 |
+
"loss": 1.0459527969360352,
|
| 435 |
+
"memory(GiB)": 46.71,
|
| 436 |
+
"nll_loss": 0.42900872230529785,
|
| 437 |
+
"rewards/accuracies": 0.59375,
|
| 438 |
+
"rewards/chosen": 0.0577767938375473,
|
| 439 |
+
"rewards/margins": 0.24017955362796783,
|
| 440 |
+
"rewards/rejected": -0.18240275979042053,
|
| 441 |
+
"step": 24,
|
| 442 |
+
"train_speed(iter/s)": 0.011203
|
| 443 |
+
},
|
| 444 |
+
{
|
| 445 |
+
"epoch": 0.05578800557880056,
|
| 446 |
+
"grad_norm": 2.7458126544952393,
|
| 447 |
+
"learning_rate": 0.00011111111111111112,
|
| 448 |
+
"logits/chosen": -0.3978196978569031,
|
| 449 |
+
"logits/rejected": -0.4898090958595276,
|
| 450 |
+
"logps/chosen": -9.801487922668457,
|
| 451 |
+
"logps/rejected": -21.7921199798584,
|
| 452 |
+
"loss": 1.1577973365783691,
|
| 453 |
+
"memory(GiB)": 46.71,
|
| 454 |
+
"nll_loss": 0.5382578372955322,
|
| 455 |
+
"rewards/accuracies": 0.71875,
|
| 456 |
+
"rewards/chosen": 0.03896612673997879,
|
| 457 |
+
"rewards/margins": 0.24017201364040375,
|
| 458 |
+
"rewards/rejected": -0.20120586454868317,
|
| 459 |
+
"step": 25,
|
| 460 |
+
"train_speed(iter/s)": 0.011205
|
| 461 |
+
},
|
| 462 |
+
{
|
| 463 |
+
"epoch": 0.05801952580195258,
|
| 464 |
+
"grad_norm": 4.185514450073242,
|
| 465 |
+
"learning_rate": 0.00011555555555555555,
|
| 466 |
+
"logits/chosen": -0.43978849053382874,
|
| 467 |
+
"logits/rejected": -0.5358645915985107,
|
| 468 |
+
"logps/chosen": -4.664649963378906,
|
| 469 |
+
"logps/rejected": -18.568632125854492,
|
| 470 |
+
"loss": 0.9911558032035828,
|
| 471 |
+
"memory(GiB)": 46.71,
|
| 472 |
+
"nll_loss": 0.39514851570129395,
|
| 473 |
+
"rewards/accuracies": 0.6875,
|
| 474 |
+
"rewards/chosen": -0.01693350076675415,
|
| 475 |
+
"rewards/margins": 0.28997230529785156,
|
| 476 |
+
"rewards/rejected": -0.3069058060646057,
|
| 477 |
+
"step": 26,
|
| 478 |
+
"train_speed(iter/s)": 0.011208
|
| 479 |
+
},
|
| 480 |
+
{
|
| 481 |
+
"epoch": 0.0602510460251046,
|
| 482 |
+
"grad_norm": 2.983151912689209,
|
| 483 |
+
"learning_rate": 0.00012,
|
| 484 |
+
"logits/chosen": -0.46957868337631226,
|
| 485 |
+
"logits/rejected": -0.5086190700531006,
|
| 486 |
+
"logps/chosen": -14.16710376739502,
|
| 487 |
+
"logps/rejected": -15.19424819946289,
|
| 488 |
+
"loss": 1.3119632005691528,
|
| 489 |
+
"memory(GiB)": 46.71,
|
| 490 |
+
"nll_loss": 0.732680082321167,
|
| 491 |
+
"rewards/accuracies": 0.8125,
|
| 492 |
+
"rewards/chosen": 0.1205766424536705,
|
| 493 |
+
"rewards/margins": 0.2763415277004242,
|
| 494 |
+
"rewards/rejected": -0.1557648628950119,
|
| 495 |
+
"step": 27,
|
| 496 |
+
"train_speed(iter/s)": 0.01121
|
| 497 |
+
},
|
| 498 |
+
{
|
| 499 |
+
"epoch": 0.06248256624825663,
|
| 500 |
+
"grad_norm": 3.7991929054260254,
|
| 501 |
+
"learning_rate": 0.00012444444444444444,
|
| 502 |
+
"logits/chosen": -0.3287929892539978,
|
| 503 |
+
"logits/rejected": -0.46299535036087036,
|
| 504 |
+
"logps/chosen": -6.527912616729736,
|
| 505 |
+
"logps/rejected": -23.983104705810547,
|
| 506 |
+
"loss": 1.0033739805221558,
|
| 507 |
+
"memory(GiB)": 46.71,
|
| 508 |
+
"nll_loss": 0.44460976123809814,
|
| 509 |
+
"rewards/accuracies": 0.78125,
|
| 510 |
+
"rewards/chosen": 0.07841134071350098,
|
| 511 |
+
"rewards/margins": 0.3698306679725647,
|
| 512 |
+
"rewards/rejected": -0.29141926765441895,
|
| 513 |
+
"step": 28,
|
| 514 |
+
"train_speed(iter/s)": 0.011207
|
| 515 |
+
},
|
| 516 |
+
{
|
| 517 |
+
"epoch": 0.06471408647140865,
|
| 518 |
+
"grad_norm": 3.0063183307647705,
|
| 519 |
+
"learning_rate": 0.00012888888888888892,
|
| 520 |
+
"logits/chosen": -0.3735123574733734,
|
| 521 |
+
"logits/rejected": -0.458845853805542,
|
| 522 |
+
"logps/chosen": -7.325934886932373,
|
| 523 |
+
"logps/rejected": -21.65030288696289,
|
| 524 |
+
"loss": 1.0098869800567627,
|
| 525 |
+
"memory(GiB)": 46.71,
|
| 526 |
+
"nll_loss": 0.477042555809021,
|
| 527 |
+
"rewards/accuracies": 0.875,
|
| 528 |
+
"rewards/chosen": 0.025919266045093536,
|
| 529 |
+
"rewards/margins": 0.47939103841781616,
|
| 530 |
+
"rewards/rejected": -0.4534717798233032,
|
| 531 |
+
"step": 29,
|
| 532 |
+
"train_speed(iter/s)": 0.011208
|
| 533 |
+
},
|
| 534 |
+
{
|
| 535 |
+
"epoch": 0.06694560669456066,
|
| 536 |
+
"grad_norm": 2.6957406997680664,
|
| 537 |
+
"learning_rate": 0.00013333333333333334,
|
| 538 |
+
"logits/chosen": -0.3790513873100281,
|
| 539 |
+
"logits/rejected": -0.4815320372581482,
|
| 540 |
+
"logps/chosen": -6.8280110359191895,
|
| 541 |
+
"logps/rejected": -22.987621307373047,
|
| 542 |
+
"loss": 1.0349267721176147,
|
| 543 |
+
"memory(GiB)": 46.71,
|
| 544 |
+
"nll_loss": 0.5045362114906311,
|
| 545 |
+
"rewards/accuracies": 0.8125,
|
| 546 |
+
"rewards/chosen": 0.09961891919374466,
|
| 547 |
+
"rewards/margins": 0.4102502763271332,
|
| 548 |
+
"rewards/rejected": -0.3106313645839691,
|
| 549 |
+
"step": 30,
|
| 550 |
+
"train_speed(iter/s)": 0.011209
|
| 551 |
+
},
|
| 552 |
+
{
|
| 553 |
+
"epoch": 0.06917712691771269,
|
| 554 |
+
"grad_norm": 2.7142391204833984,
|
| 555 |
+
"learning_rate": 0.0001377777777777778,
|
| 556 |
+
"logits/chosen": -0.36308056116104126,
|
| 557 |
+
"logits/rejected": -0.44216084480285645,
|
| 558 |
+
"logps/chosen": -5.850837230682373,
|
| 559 |
+
"logps/rejected": -21.365463256835938,
|
| 560 |
+
"loss": 0.9850523471832275,
|
| 561 |
+
"memory(GiB)": 46.71,
|
| 562 |
+
"nll_loss": 0.43448853492736816,
|
| 563 |
+
"rewards/accuracies": 0.71875,
|
| 564 |
+
"rewards/chosen": 0.0431375615298748,
|
| 565 |
+
"rewards/margins": 0.3983423113822937,
|
| 566 |
+
"rewards/rejected": -0.3552047610282898,
|
| 567 |
+
"step": 31,
|
| 568 |
+
"train_speed(iter/s)": 0.011211
|
| 569 |
+
},
|
| 570 |
+
{
|
| 571 |
+
"epoch": 0.07140864714086471,
|
| 572 |
+
"grad_norm": 3.897137403488159,
|
| 573 |
+
"learning_rate": 0.00014222222222222224,
|
| 574 |
+
"logits/chosen": -0.3979527950286865,
|
| 575 |
+
"logits/rejected": -0.43778184056282043,
|
| 576 |
+
"logps/chosen": -10.285924911499023,
|
| 577 |
+
"logps/rejected": -18.7073974609375,
|
| 578 |
+
"loss": 1.1233854293823242,
|
| 579 |
+
"memory(GiB)": 46.71,
|
| 580 |
+
"nll_loss": 0.5153944492340088,
|
| 581 |
+
"rewards/accuracies": 0.625,
|
| 582 |
+
"rewards/chosen": 0.026699109002947807,
|
| 583 |
+
"rewards/margins": 0.23945647478103638,
|
| 584 |
+
"rewards/rejected": -0.21275737881660461,
|
| 585 |
+
"step": 32,
|
| 586 |
+
"train_speed(iter/s)": 0.011213
|
| 587 |
+
},
|
| 588 |
+
{
|
| 589 |
+
"epoch": 0.07364016736401674,
|
| 590 |
+
"grad_norm": 3.93380069732666,
|
| 591 |
+
"learning_rate": 0.00014666666666666666,
|
| 592 |
+
"logits/chosen": -0.2758394777774811,
|
| 593 |
+
"logits/rejected": -0.37545740604400635,
|
| 594 |
+
"logps/chosen": -12.159762382507324,
|
| 595 |
+
"logps/rejected": -24.926610946655273,
|
| 596 |
+
"loss": 1.2487003803253174,
|
| 597 |
+
"memory(GiB)": 46.71,
|
| 598 |
+
"nll_loss": 0.6138952970504761,
|
| 599 |
+
"rewards/accuracies": 0.6875,
|
| 600 |
+
"rewards/chosen": -0.09166956692934036,
|
| 601 |
+
"rewards/margins": 0.2808037996292114,
|
| 602 |
+
"rewards/rejected": -0.3724733591079712,
|
| 603 |
+
"step": 33,
|
| 604 |
+
"train_speed(iter/s)": 0.011211
|
| 605 |
+
},
|
| 606 |
+
{
|
| 607 |
+
"epoch": 0.07587168758716877,
|
| 608 |
+
"grad_norm": 3.21878981590271,
|
| 609 |
+
"learning_rate": 0.0001511111111111111,
|
| 610 |
+
"logits/chosen": -0.24420826137065887,
|
| 611 |
+
"logits/rejected": -0.38765522837638855,
|
| 612 |
+
"logps/chosen": -6.041399955749512,
|
| 613 |
+
"logps/rejected": -22.503984451293945,
|
| 614 |
+
"loss": 0.9895752668380737,
|
| 615 |
+
"memory(GiB)": 46.71,
|
| 616 |
+
"nll_loss": 0.44009482860565186,
|
| 617 |
+
"rewards/accuracies": 0.6875,
|
| 618 |
+
"rewards/chosen": 0.010253368876874447,
|
| 619 |
+
"rewards/margins": 0.5208209753036499,
|
| 620 |
+
"rewards/rejected": -0.5105676054954529,
|
| 621 |
+
"step": 34,
|
| 622 |
+
"train_speed(iter/s)": 0.01121
|
| 623 |
+
},
|
| 624 |
+
{
|
| 625 |
+
"epoch": 0.07810320781032078,
|
| 626 |
+
"grad_norm": 5.1504316329956055,
|
| 627 |
+
"learning_rate": 0.00015555555555555556,
|
| 628 |
+
"logits/chosen": -0.2664889693260193,
|
| 629 |
+
"logits/rejected": -0.40212178230285645,
|
| 630 |
+
"logps/chosen": -5.9132609367370605,
|
| 631 |
+
"logps/rejected": -24.527639389038086,
|
| 632 |
+
"loss": 0.8355879187583923,
|
| 633 |
+
"memory(GiB)": 46.71,
|
| 634 |
+
"nll_loss": 0.4006969928741455,
|
| 635 |
+
"rewards/accuracies": 0.84375,
|
| 636 |
+
"rewards/chosen": -0.03980417177081108,
|
| 637 |
+
"rewards/margins": 0.8774286508560181,
|
| 638 |
+
"rewards/rejected": -0.9172328114509583,
|
| 639 |
+
"step": 35,
|
| 640 |
+
"train_speed(iter/s)": 0.011211
|
| 641 |
+
},
|
| 642 |
+
{
|
| 643 |
+
"epoch": 0.0803347280334728,
|
| 644 |
+
"grad_norm": 3.388197660446167,
|
| 645 |
+
"learning_rate": 0.00016,
|
| 646 |
+
"logits/chosen": -0.25354304909706116,
|
| 647 |
+
"logits/rejected": -0.33330878615379333,
|
| 648 |
+
"logps/chosen": -9.807186126708984,
|
| 649 |
+
"logps/rejected": -22.963045120239258,
|
| 650 |
+
"loss": 1.1024540662765503,
|
| 651 |
+
"memory(GiB)": 46.71,
|
| 652 |
+
"nll_loss": 0.6454060673713684,
|
| 653 |
+
"rewards/accuracies": 0.84375,
|
| 654 |
+
"rewards/chosen": -0.001722879707813263,
|
| 655 |
+
"rewards/margins": 0.8297844529151917,
|
| 656 |
+
"rewards/rejected": -0.8315073847770691,
|
| 657 |
+
"step": 36,
|
| 658 |
+
"train_speed(iter/s)": 0.011211
|
| 659 |
+
},
|
| 660 |
+
{
|
| 661 |
+
"epoch": 0.08256624825662483,
|
| 662 |
+
"grad_norm": 2.596273899078369,
|
| 663 |
+
"learning_rate": 0.00016444444444444444,
|
| 664 |
+
"logits/chosen": -0.21093566715717316,
|
| 665 |
+
"logits/rejected": -0.3617200553417206,
|
| 666 |
+
"logps/chosen": -2.8380072116851807,
|
| 667 |
+
"logps/rejected": -30.42251968383789,
|
| 668 |
+
"loss": 0.6882003545761108,
|
| 669 |
+
"memory(GiB)": 46.71,
|
| 670 |
+
"nll_loss": 0.2877930700778961,
|
| 671 |
+
"rewards/accuracies": 0.84375,
|
| 672 |
+
"rewards/chosen": 0.06296033412218094,
|
| 673 |
+
"rewards/margins": 1.0582321882247925,
|
| 674 |
+
"rewards/rejected": -0.9952719211578369,
|
| 675 |
+
"step": 37,
|
| 676 |
+
"train_speed(iter/s)": 0.01121
|
| 677 |
+
},
|
| 678 |
+
{
|
| 679 |
+
"epoch": 0.08479776847977685,
|
| 680 |
+
"grad_norm": 2.358452796936035,
|
| 681 |
+
"learning_rate": 0.00016888888888888889,
|
| 682 |
+
"logits/chosen": -0.2989475429058075,
|
| 683 |
+
"logits/rejected": -0.37469911575317383,
|
| 684 |
+
"logps/chosen": -6.1970534324646,
|
| 685 |
+
"logps/rejected": -19.100358963012695,
|
| 686 |
+
"loss": 0.8981406092643738,
|
| 687 |
+
"memory(GiB)": 46.71,
|
| 688 |
+
"nll_loss": 0.3934318423271179,
|
| 689 |
+
"rewards/accuracies": 0.84375,
|
| 690 |
+
"rewards/chosen": 0.002394435927271843,
|
| 691 |
+
"rewards/margins": 0.6755657196044922,
|
| 692 |
+
"rewards/rejected": -0.6731712818145752,
|
| 693 |
+
"step": 38,
|
| 694 |
+
"train_speed(iter/s)": 0.011211
|
| 695 |
+
},
|
| 696 |
+
{
|
| 697 |
+
"epoch": 0.08702928870292886,
|
| 698 |
+
"grad_norm": 2.9299051761627197,
|
| 699 |
+
"learning_rate": 0.00017333333333333334,
|
| 700 |
+
"logits/chosen": -0.2796667516231537,
|
| 701 |
+
"logits/rejected": -0.34129300713539124,
|
| 702 |
+
"logps/chosen": -8.498173713684082,
|
| 703 |
+
"logps/rejected": -26.264965057373047,
|
| 704 |
+
"loss": 1.012364387512207,
|
| 705 |
+
"memory(GiB)": 46.71,
|
| 706 |
+
"nll_loss": 0.586083173751831,
|
| 707 |
+
"rewards/accuracies": 0.875,
|
| 708 |
+
"rewards/chosen": 0.07207094132900238,
|
| 709 |
+
"rewards/margins": 1.1341111660003662,
|
| 710 |
+
"rewards/rejected": -1.0620403289794922,
|
| 711 |
+
"step": 39,
|
| 712 |
+
"train_speed(iter/s)": 0.011212
|
| 713 |
+
},
|
| 714 |
+
{
|
| 715 |
+
"epoch": 0.08926080892608089,
|
| 716 |
+
"grad_norm": 3.547189474105835,
|
| 717 |
+
"learning_rate": 0.00017777777777777779,
|
| 718 |
+
"logits/chosen": -0.28194305300712585,
|
| 719 |
+
"logits/rejected": -0.33060967922210693,
|
| 720 |
+
"logps/chosen": -7.982609748840332,
|
| 721 |
+
"logps/rejected": -20.187652587890625,
|
| 722 |
+
"loss": 0.9403265118598938,
|
| 723 |
+
"memory(GiB)": 46.71,
|
| 724 |
+
"nll_loss": 0.42783123254776,
|
| 725 |
+
"rewards/accuracies": 0.6875,
|
| 726 |
+
"rewards/chosen": 0.002833280712366104,
|
| 727 |
+
"rewards/margins": 0.7690448760986328,
|
| 728 |
+
"rewards/rejected": -0.7662116289138794,
|
| 729 |
+
"step": 40,
|
| 730 |
+
"train_speed(iter/s)": 0.011213
|
| 731 |
+
},
|
| 732 |
+
{
|
| 733 |
+
"epoch": 0.09149232914923291,
|
| 734 |
+
"grad_norm": 3.4967706203460693,
|
| 735 |
+
"learning_rate": 0.00018222222222222224,
|
| 736 |
+
"logits/chosen": -0.21270643174648285,
|
| 737 |
+
"logits/rejected": -0.3004887104034424,
|
| 738 |
+
"logps/chosen": -5.226779937744141,
|
| 739 |
+
"logps/rejected": -22.208778381347656,
|
| 740 |
+
"loss": 0.8620257377624512,
|
| 741 |
+
"memory(GiB)": 46.71,
|
| 742 |
+
"nll_loss": 0.3914262056350708,
|
| 743 |
+
"rewards/accuracies": 0.71875,
|
| 744 |
+
"rewards/chosen": 0.018529795110225677,
|
| 745 |
+
"rewards/margins": 0.9286664128303528,
|
| 746 |
+
"rewards/rejected": -0.9101365804672241,
|
| 747 |
+
"step": 41,
|
| 748 |
+
"train_speed(iter/s)": 0.011213
|
| 749 |
+
},
|
| 750 |
+
{
|
| 751 |
+
"epoch": 0.09372384937238494,
|
| 752 |
+
"grad_norm": 6.100057601928711,
|
| 753 |
+
"learning_rate": 0.0001866666666666667,
|
| 754 |
+
"logits/chosen": -0.29974937438964844,
|
| 755 |
+
"logits/rejected": -0.36353808641433716,
|
| 756 |
+
"logps/chosen": -10.446137428283691,
|
| 757 |
+
"logps/rejected": -22.973119735717773,
|
| 758 |
+
"loss": 1.2477580308914185,
|
| 759 |
+
"memory(GiB)": 46.71,
|
| 760 |
+
"nll_loss": 0.6882976293563843,
|
| 761 |
+
"rewards/accuracies": 0.65625,
|
| 762 |
+
"rewards/chosen": -0.2526606023311615,
|
| 763 |
+
"rewards/margins": 0.5461662411689758,
|
| 764 |
+
"rewards/rejected": -0.7988268136978149,
|
| 765 |
+
"step": 42,
|
| 766 |
+
"train_speed(iter/s)": 0.011214
|
| 767 |
+
},
|
| 768 |
+
{
|
| 769 |
+
"epoch": 0.09595536959553697,
|
| 770 |
+
"grad_norm": 4.625721454620361,
|
| 771 |
+
"learning_rate": 0.00019111111111111114,
|
| 772 |
+
"logits/chosen": -0.21875600516796112,
|
| 773 |
+
"logits/rejected": -0.3691503405570984,
|
| 774 |
+
"logps/chosen": -8.029109001159668,
|
| 775 |
+
"logps/rejected": -33.986671447753906,
|
| 776 |
+
"loss": 0.9927695989608765,
|
| 777 |
+
"memory(GiB)": 46.71,
|
| 778 |
+
"nll_loss": 0.6190873384475708,
|
| 779 |
+
"rewards/accuracies": 0.78125,
|
| 780 |
+
"rewards/chosen": -0.10942590236663818,
|
| 781 |
+
"rewards/margins": 1.7278107404708862,
|
| 782 |
+
"rewards/rejected": -1.837236762046814,
|
| 783 |
+
"step": 43,
|
| 784 |
+
"train_speed(iter/s)": 0.011215
|
| 785 |
+
},
|
| 786 |
+
{
|
| 787 |
+
"epoch": 0.09818688981868898,
|
| 788 |
+
"grad_norm": 4.994227886199951,
|
| 789 |
+
"learning_rate": 0.00019555555555555556,
|
| 790 |
+
"logits/chosen": -0.25192195177078247,
|
| 791 |
+
"logits/rejected": -0.32522761821746826,
|
| 792 |
+
"logps/chosen": -9.805305480957031,
|
| 793 |
+
"logps/rejected": -34.161895751953125,
|
| 794 |
+
"loss": 0.9997942447662354,
|
| 795 |
+
"memory(GiB)": 46.71,
|
| 796 |
+
"nll_loss": 0.6020480990409851,
|
| 797 |
+
"rewards/accuracies": 0.75,
|
| 798 |
+
"rewards/chosen": -0.30676746368408203,
|
| 799 |
+
"rewards/margins": 1.7450387477874756,
|
| 800 |
+
"rewards/rejected": -2.0518062114715576,
|
| 801 |
+
"step": 44,
|
| 802 |
+
"train_speed(iter/s)": 0.011214
|
| 803 |
+
},
|
| 804 |
+
{
|
| 805 |
+
"epoch": 0.100418410041841,
|
| 806 |
+
"grad_norm": 4.717008590698242,
|
| 807 |
+
"learning_rate": 0.0002,
|
| 808 |
+
"logits/chosen": -0.33617067337036133,
|
| 809 |
+
"logits/rejected": -0.35846105217933655,
|
| 810 |
+
"logps/chosen": -9.175792694091797,
|
| 811 |
+
"logps/rejected": -21.536231994628906,
|
| 812 |
+
"loss": 1.014683485031128,
|
| 813 |
+
"memory(GiB)": 46.71,
|
| 814 |
+
"nll_loss": 0.5040097236633301,
|
| 815 |
+
"rewards/accuracies": 0.625,
|
| 816 |
+
"rewards/chosen": 0.014129618182778358,
|
| 817 |
+
"rewards/margins": 0.7111825942993164,
|
| 818 |
+
"rewards/rejected": -0.6970530152320862,
|
| 819 |
+
"step": 45,
|
| 820 |
+
"train_speed(iter/s)": 0.011215
|
| 821 |
+
},
|
| 822 |
+
{
|
| 823 |
+
"epoch": 0.10264993026499303,
|
| 824 |
+
"grad_norm": 3.089895248413086,
|
| 825 |
+
"learning_rate": 0.0001999993185874369,
|
| 826 |
+
"logits/chosen": -0.3643554747104645,
|
| 827 |
+
"logits/rejected": -0.3828020393848419,
|
| 828 |
+
"logps/chosen": -11.385210990905762,
|
| 829 |
+
"logps/rejected": -27.30405044555664,
|
| 830 |
+
"loss": 0.9333115220069885,
|
| 831 |
+
"memory(GiB)": 46.71,
|
| 832 |
+
"nll_loss": 0.5031883120536804,
|
| 833 |
+
"rewards/accuracies": 0.6875,
|
| 834 |
+
"rewards/chosen": -0.08416246622800827,
|
| 835 |
+
"rewards/margins": 1.1319228410720825,
|
| 836 |
+
"rewards/rejected": -1.216085433959961,
|
| 837 |
+
"step": 46,
|
| 838 |
+
"train_speed(iter/s)": 0.011215
|
| 839 |
+
},
|
| 840 |
+
{
|
| 841 |
+
"epoch": 0.10488145048814505,
|
| 842 |
+
"grad_norm": 4.295483589172363,
|
| 843 |
+
"learning_rate": 0.00019999727435903407,
|
| 844 |
+
"logits/chosen": -0.3375833332538605,
|
| 845 |
+
"logits/rejected": -0.44685542583465576,
|
| 846 |
+
"logps/chosen": -4.36940336227417,
|
| 847 |
+
"logps/rejected": -21.149555206298828,
|
| 848 |
+
"loss": 0.959221601486206,
|
| 849 |
+
"memory(GiB)": 46.71,
|
| 850 |
+
"nll_loss": 0.42982059717178345,
|
| 851 |
+
"rewards/accuracies": 0.8125,
|
| 852 |
+
"rewards/chosen": 0.15477100014686584,
|
| 853 |
+
"rewards/margins": 0.5941969752311707,
|
| 854 |
+
"rewards/rejected": -0.4394259452819824,
|
| 855 |
+
"step": 47,
|
| 856 |
+
"train_speed(iter/s)": 0.011216
|
| 857 |
+
},
|
| 858 |
+
{
|
| 859 |
+
"epoch": 0.10711297071129706,
|
| 860 |
+
"grad_norm": 2.4132261276245117,
|
| 861 |
+
"learning_rate": 0.0001999938673426507,
|
| 862 |
+
"logits/chosen": -0.3103625178337097,
|
| 863 |
+
"logits/rejected": -0.4320617616176605,
|
| 864 |
+
"logps/chosen": -5.777155876159668,
|
| 865 |
+
"logps/rejected": -20.897228240966797,
|
| 866 |
+
"loss": 0.9094122648239136,
|
| 867 |
+
"memory(GiB)": 46.71,
|
| 868 |
+
"nll_loss": 0.41829684376716614,
|
| 869 |
+
"rewards/accuracies": 0.8125,
|
| 870 |
+
"rewards/chosen": 0.18217116594314575,
|
| 871 |
+
"rewards/margins": 0.714988112449646,
|
| 872 |
+
"rewards/rejected": -0.5328169465065002,
|
| 873 |
+
"step": 48,
|
| 874 |
+
"train_speed(iter/s)": 0.011216
|
| 875 |
+
},
|
| 876 |
+
{
|
| 877 |
+
"epoch": 0.10934449093444909,
|
| 878 |
+
"grad_norm": 2.716282367706299,
|
| 879 |
+
"learning_rate": 0.00019998909758471852,
|
| 880 |
+
"logits/chosen": -0.3802068829536438,
|
| 881 |
+
"logits/rejected": -0.4424472749233246,
|
| 882 |
+
"logps/chosen": -7.844504356384277,
|
| 883 |
+
"logps/rejected": -21.755281448364258,
|
| 884 |
+
"loss": 1.0127230882644653,
|
| 885 |
+
"memory(GiB)": 46.71,
|
| 886 |
+
"nll_loss": 0.5032894611358643,
|
| 887 |
+
"rewards/accuracies": 0.6875,
|
| 888 |
+
"rewards/chosen": 0.07639233767986298,
|
| 889 |
+
"rewards/margins": 0.79319167137146,
|
| 890 |
+
"rewards/rejected": -0.7167993187904358,
|
| 891 |
+
"step": 49,
|
| 892 |
+
"train_speed(iter/s)": 0.011217
|
| 893 |
+
},
|
| 894 |
+
{
|
| 895 |
+
"epoch": 0.11157601115760112,
|
| 896 |
+
"grad_norm": 3.5755205154418945,
|
| 897 |
+
"learning_rate": 0.000199982965150241,
|
| 898 |
+
"logits/chosen": -0.32785969972610474,
|
| 899 |
+
"logits/rejected": -0.384295791387558,
|
| 900 |
+
"logps/chosen": -12.152947425842285,
|
| 901 |
+
"logps/rejected": -21.354625701904297,
|
| 902 |
+
"loss": 1.1883673667907715,
|
| 903 |
+
"memory(GiB)": 46.71,
|
| 904 |
+
"nll_loss": 0.6465156674385071,
|
| 905 |
+
"rewards/accuracies": 0.6875,
|
| 906 |
+
"rewards/chosen": -0.11994989961385727,
|
| 907 |
+
"rewards/margins": 0.5093130469322205,
|
| 908 |
+
"rewards/rejected": -0.6292628645896912,
|
| 909 |
+
"step": 50,
|
| 910 |
+
"train_speed(iter/s)": 0.011217
|
| 911 |
+
}
|
| 912 |
+
],
|
| 913 |
+
"logging_steps": 1,
|
| 914 |
+
"max_steps": 896,
|
| 915 |
+
"num_input_tokens_seen": 0,
|
| 916 |
+
"num_train_epochs": 2,
|
| 917 |
+
"save_steps": 50,
|
| 918 |
+
"stateful_callbacks": {
|
| 919 |
+
"TrainerControl": {
|
| 920 |
+
"args": {
|
| 921 |
+
"should_epoch_stop": false,
|
| 922 |
+
"should_evaluate": false,
|
| 923 |
+
"should_log": false,
|
| 924 |
+
"should_save": true,
|
| 925 |
+
"should_training_stop": false
|
| 926 |
+
},
|
| 927 |
+
"attributes": {}
|
| 928 |
+
}
|
| 929 |
+
},
|
| 930 |
+
"total_flos": 2.728739939863757e+16,
|
| 931 |
+
"train_batch_size": 2,
|
| 932 |
+
"trial_name": null,
|
| 933 |
+
"trial_params": null
|
| 934 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
|
| 3 |
+
# Copyright (c) Microsoft Corporation.
|
| 4 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 5 |
+
|
| 6 |
+
# DeepSpeed Team
|
| 7 |
+
|
| 8 |
+
# This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
|
| 9 |
+
# copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
|
| 10 |
+
# the future. Once extracted, the weights don't require DeepSpeed and can be used in any
|
| 11 |
+
# application.
|
| 12 |
+
#
|
| 13 |
+
# example:
|
| 14 |
+
# python zero_to_fp32.py . output_dir/
|
| 15 |
+
# or
|
| 16 |
+
# python zero_to_fp32.py . output_dir/ --safe_serialization
|
| 17 |
+
|
| 18 |
+
import argparse
|
| 19 |
+
import torch
|
| 20 |
+
import glob
|
| 21 |
+
import math
|
| 22 |
+
import os
|
| 23 |
+
import re
|
| 24 |
+
import gc
|
| 25 |
+
import json
|
| 26 |
+
import numpy as np
|
| 27 |
+
from tqdm import tqdm
|
| 28 |
+
from collections import OrderedDict
|
| 29 |
+
from dataclasses import dataclass
|
| 30 |
+
|
| 31 |
+
# while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
|
| 32 |
+
# DeepSpeed data structures it has to be available in the current python environment.
|
| 33 |
+
from deepspeed.utils import logger
|
| 34 |
+
from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
|
| 35 |
+
FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
|
| 36 |
+
FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
@dataclass
|
| 40 |
+
class zero_model_state:
|
| 41 |
+
buffers: dict()
|
| 42 |
+
param_shapes: dict()
|
| 43 |
+
shared_params: list
|
| 44 |
+
ds_version: int
|
| 45 |
+
frozen_param_shapes: dict()
|
| 46 |
+
frozen_param_fragments: dict()
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
debug = 0
|
| 50 |
+
|
| 51 |
+
# load to cpu
|
| 52 |
+
device = torch.device('cpu')
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def atoi(text):
|
| 56 |
+
return int(text) if text.isdigit() else text
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def natural_keys(text):
|
| 60 |
+
'''
|
| 61 |
+
alist.sort(key=natural_keys) sorts in human order
|
| 62 |
+
http://nedbatchelder.com/blog/200712/human_sorting.html
|
| 63 |
+
(See Toothy's implementation in the comments)
|
| 64 |
+
'''
|
| 65 |
+
return [atoi(c) for c in re.split(r'(\d+)', text)]
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def get_model_state_file(checkpoint_dir, zero_stage):
|
| 69 |
+
if not os.path.isdir(checkpoint_dir):
|
| 70 |
+
raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
|
| 71 |
+
|
| 72 |
+
# there should be only one file
|
| 73 |
+
if zero_stage <= 2:
|
| 74 |
+
file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
|
| 75 |
+
elif zero_stage == 3:
|
| 76 |
+
file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
|
| 77 |
+
|
| 78 |
+
if not os.path.exists(file):
|
| 79 |
+
raise FileNotFoundError(f"can't find model states file at '{file}'")
|
| 80 |
+
|
| 81 |
+
return file
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def get_checkpoint_files(checkpoint_dir, glob_pattern):
|
| 85 |
+
# XXX: need to test that this simple glob rule works for multi-node setup too
|
| 86 |
+
ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
|
| 87 |
+
|
| 88 |
+
if len(ckpt_files) == 0:
|
| 89 |
+
raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
|
| 90 |
+
|
| 91 |
+
return ckpt_files
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def get_optim_files(checkpoint_dir):
|
| 95 |
+
return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def get_model_state_files(checkpoint_dir):
|
| 99 |
+
return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def parse_model_states(files):
|
| 103 |
+
zero_model_states = []
|
| 104 |
+
for file in files:
|
| 105 |
+
state_dict = torch.load(file, map_location=device, weights_only=False)
|
| 106 |
+
|
| 107 |
+
if BUFFER_NAMES not in state_dict:
|
| 108 |
+
raise ValueError(f"{file} is not a model state checkpoint")
|
| 109 |
+
buffer_names = state_dict[BUFFER_NAMES]
|
| 110 |
+
if debug:
|
| 111 |
+
print("Found buffers:", buffer_names)
|
| 112 |
+
|
| 113 |
+
# recover just the buffers while restoring them to fp32 if they were saved in fp16
|
| 114 |
+
buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
|
| 115 |
+
param_shapes = state_dict[PARAM_SHAPES]
|
| 116 |
+
|
| 117 |
+
# collect parameters that are included in param_shapes
|
| 118 |
+
param_names = []
|
| 119 |
+
for s in param_shapes:
|
| 120 |
+
for name in s.keys():
|
| 121 |
+
param_names.append(name)
|
| 122 |
+
|
| 123 |
+
# update with frozen parameters
|
| 124 |
+
frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
|
| 125 |
+
if frozen_param_shapes is not None:
|
| 126 |
+
if debug:
|
| 127 |
+
print(f"Found frozen_param_shapes: {frozen_param_shapes}")
|
| 128 |
+
param_names += list(frozen_param_shapes.keys())
|
| 129 |
+
|
| 130 |
+
# handle shared params
|
| 131 |
+
shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
|
| 132 |
+
|
| 133 |
+
ds_version = state_dict.get(DS_VERSION, None)
|
| 134 |
+
|
| 135 |
+
frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
|
| 136 |
+
|
| 137 |
+
z_model_state = zero_model_state(buffers=buffers,
|
| 138 |
+
param_shapes=param_shapes,
|
| 139 |
+
shared_params=shared_params,
|
| 140 |
+
ds_version=ds_version,
|
| 141 |
+
frozen_param_shapes=frozen_param_shapes,
|
| 142 |
+
frozen_param_fragments=frozen_param_fragments)
|
| 143 |
+
zero_model_states.append(z_model_state)
|
| 144 |
+
|
| 145 |
+
return zero_model_states
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def parse_optim_states(files, ds_checkpoint_dir):
|
| 149 |
+
total_files = len(files)
|
| 150 |
+
state_dicts = []
|
| 151 |
+
for f in tqdm(files, desc='Loading checkpoint shards'):
|
| 152 |
+
state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
|
| 153 |
+
# immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
|
| 154 |
+
# and also handle the case where it was already removed by another helper script
|
| 155 |
+
state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
|
| 156 |
+
state_dicts.append(state_dict)
|
| 157 |
+
|
| 158 |
+
if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
|
| 159 |
+
raise ValueError(f"{files[0]} is not a zero checkpoint")
|
| 160 |
+
zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
|
| 161 |
+
world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
|
| 162 |
+
|
| 163 |
+
# For ZeRO-2 each param group can have different partition_count as data parallelism for expert
|
| 164 |
+
# parameters can be different from data parallelism for non-expert parameters. So we can just
|
| 165 |
+
# use the max of the partition_count to get the dp world_size.
|
| 166 |
+
|
| 167 |
+
if type(world_size) is list:
|
| 168 |
+
world_size = max(world_size)
|
| 169 |
+
|
| 170 |
+
if world_size != total_files:
|
| 171 |
+
raise ValueError(
|
| 172 |
+
f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
|
| 173 |
+
"Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
# the groups are named differently in each stage
|
| 177 |
+
if zero_stage <= 2:
|
| 178 |
+
fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
|
| 179 |
+
elif zero_stage == 3:
|
| 180 |
+
fp32_groups_key = FP32_FLAT_GROUPS
|
| 181 |
+
else:
|
| 182 |
+
raise ValueError(f"unknown zero stage {zero_stage}")
|
| 183 |
+
|
| 184 |
+
fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
|
| 185 |
+
return zero_stage, world_size, fp32_flat_groups
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
|
| 189 |
+
"""
|
| 190 |
+
Returns fp32 state_dict reconstructed from ds checkpoint
|
| 191 |
+
|
| 192 |
+
Args:
|
| 193 |
+
- ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
|
| 194 |
+
|
| 195 |
+
"""
|
| 196 |
+
print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
|
| 197 |
+
|
| 198 |
+
optim_files = get_optim_files(ds_checkpoint_dir)
|
| 199 |
+
zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
|
| 200 |
+
print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
|
| 201 |
+
|
| 202 |
+
model_files = get_model_state_files(ds_checkpoint_dir)
|
| 203 |
+
|
| 204 |
+
zero_model_states = parse_model_states(model_files)
|
| 205 |
+
print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
|
| 206 |
+
|
| 207 |
+
if zero_stage <= 2:
|
| 208 |
+
return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 209 |
+
exclude_frozen_parameters)
|
| 210 |
+
elif zero_stage == 3:
|
| 211 |
+
return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 212 |
+
exclude_frozen_parameters)
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
def _zero2_merge_frozen_params(state_dict, zero_model_states):
|
| 216 |
+
if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
|
| 217 |
+
return
|
| 218 |
+
|
| 219 |
+
frozen_param_shapes = zero_model_states[0].frozen_param_shapes
|
| 220 |
+
frozen_param_fragments = zero_model_states[0].frozen_param_fragments
|
| 221 |
+
|
| 222 |
+
if debug:
|
| 223 |
+
num_elem = sum(s.numel() for s in frozen_param_shapes.values())
|
| 224 |
+
print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
|
| 225 |
+
|
| 226 |
+
wanted_params = len(frozen_param_shapes)
|
| 227 |
+
wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
|
| 228 |
+
avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
|
| 229 |
+
print(f'Frozen params: Have {avail_numel} numels to process.')
|
| 230 |
+
print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
|
| 231 |
+
|
| 232 |
+
total_params = 0
|
| 233 |
+
total_numel = 0
|
| 234 |
+
for name, shape in frozen_param_shapes.items():
|
| 235 |
+
total_params += 1
|
| 236 |
+
unpartitioned_numel = shape.numel()
|
| 237 |
+
total_numel += unpartitioned_numel
|
| 238 |
+
|
| 239 |
+
state_dict[name] = frozen_param_fragments[name]
|
| 240 |
+
|
| 241 |
+
if debug:
|
| 242 |
+
print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
|
| 243 |
+
|
| 244 |
+
print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
def _has_callable(obj, fn):
|
| 248 |
+
attr = getattr(obj, fn, None)
|
| 249 |
+
return callable(attr)
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
|
| 253 |
+
param_shapes = zero_model_states[0].param_shapes
|
| 254 |
+
|
| 255 |
+
# Reconstruction protocol:
|
| 256 |
+
#
|
| 257 |
+
# XXX: document this
|
| 258 |
+
|
| 259 |
+
if debug:
|
| 260 |
+
for i in range(world_size):
|
| 261 |
+
for j in range(len(fp32_flat_groups[0])):
|
| 262 |
+
print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
|
| 263 |
+
|
| 264 |
+
# XXX: memory usage doubles here (zero2)
|
| 265 |
+
num_param_groups = len(fp32_flat_groups[0])
|
| 266 |
+
merged_single_partition_of_fp32_groups = []
|
| 267 |
+
for i in range(num_param_groups):
|
| 268 |
+
merged_partitions = [sd[i] for sd in fp32_flat_groups]
|
| 269 |
+
full_single_fp32_vector = torch.cat(merged_partitions, 0)
|
| 270 |
+
merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
|
| 271 |
+
avail_numel = sum(
|
| 272 |
+
[full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
|
| 273 |
+
|
| 274 |
+
if debug:
|
| 275 |
+
wanted_params = sum([len(shapes) for shapes in param_shapes])
|
| 276 |
+
wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
|
| 277 |
+
# not asserting if there is a mismatch due to possible padding
|
| 278 |
+
print(f"Have {avail_numel} numels to process.")
|
| 279 |
+
print(f"Need {wanted_numel} numels in {wanted_params} params.")
|
| 280 |
+
|
| 281 |
+
# params
|
| 282 |
+
# XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
|
| 283 |
+
# out-of-core computing solution
|
| 284 |
+
total_numel = 0
|
| 285 |
+
total_params = 0
|
| 286 |
+
for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
|
| 287 |
+
offset = 0
|
| 288 |
+
avail_numel = full_single_fp32_vector.numel()
|
| 289 |
+
for name, shape in shapes.items():
|
| 290 |
+
|
| 291 |
+
unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
|
| 292 |
+
total_numel += unpartitioned_numel
|
| 293 |
+
total_params += 1
|
| 294 |
+
|
| 295 |
+
if debug:
|
| 296 |
+
print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
|
| 297 |
+
state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
|
| 298 |
+
offset += unpartitioned_numel
|
| 299 |
+
|
| 300 |
+
# Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
|
| 301 |
+
# avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
|
| 302 |
+
# paddings performed in the code it's almost impossible to predict the exact numbers w/o the
|
| 303 |
+
# live optimizer object, so we are checking that the numbers are within the right range
|
| 304 |
+
align_to = 2 * world_size
|
| 305 |
+
|
| 306 |
+
def zero2_align(x):
|
| 307 |
+
return align_to * math.ceil(x / align_to)
|
| 308 |
+
|
| 309 |
+
if debug:
|
| 310 |
+
print(f"original offset={offset}, avail_numel={avail_numel}")
|
| 311 |
+
|
| 312 |
+
offset = zero2_align(offset)
|
| 313 |
+
avail_numel = zero2_align(avail_numel)
|
| 314 |
+
|
| 315 |
+
if debug:
|
| 316 |
+
print(f"aligned offset={offset}, avail_numel={avail_numel}")
|
| 317 |
+
|
| 318 |
+
# Sanity check
|
| 319 |
+
if offset != avail_numel:
|
| 320 |
+
raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
|
| 321 |
+
|
| 322 |
+
print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
|
| 323 |
+
|
| 324 |
+
|
| 325 |
+
def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 326 |
+
exclude_frozen_parameters):
|
| 327 |
+
state_dict = OrderedDict()
|
| 328 |
+
|
| 329 |
+
# buffers
|
| 330 |
+
buffers = zero_model_states[0].buffers
|
| 331 |
+
state_dict.update(buffers)
|
| 332 |
+
if debug:
|
| 333 |
+
print(f"added {len(buffers)} buffers")
|
| 334 |
+
|
| 335 |
+
if not exclude_frozen_parameters:
|
| 336 |
+
_zero2_merge_frozen_params(state_dict, zero_model_states)
|
| 337 |
+
|
| 338 |
+
_zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
|
| 339 |
+
|
| 340 |
+
# recover shared parameters
|
| 341 |
+
for pair in zero_model_states[0].shared_params:
|
| 342 |
+
if pair[1] in state_dict:
|
| 343 |
+
state_dict[pair[0]] = state_dict[pair[1]]
|
| 344 |
+
|
| 345 |
+
return state_dict
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
def zero3_partitioned_param_info(unpartitioned_numel, world_size):
|
| 349 |
+
remainder = unpartitioned_numel % world_size
|
| 350 |
+
padding_numel = (world_size - remainder) if remainder else 0
|
| 351 |
+
partitioned_numel = math.ceil(unpartitioned_numel / world_size)
|
| 352 |
+
return partitioned_numel, padding_numel
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
|
| 356 |
+
if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
|
| 357 |
+
return
|
| 358 |
+
|
| 359 |
+
if debug:
|
| 360 |
+
for i in range(world_size):
|
| 361 |
+
num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
|
| 362 |
+
print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
|
| 363 |
+
|
| 364 |
+
frozen_param_shapes = zero_model_states[0].frozen_param_shapes
|
| 365 |
+
wanted_params = len(frozen_param_shapes)
|
| 366 |
+
wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
|
| 367 |
+
avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
|
| 368 |
+
print(f'Frozen params: Have {avail_numel} numels to process.')
|
| 369 |
+
print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
|
| 370 |
+
|
| 371 |
+
total_params = 0
|
| 372 |
+
total_numel = 0
|
| 373 |
+
for name, shape in zero_model_states[0].frozen_param_shapes.items():
|
| 374 |
+
total_params += 1
|
| 375 |
+
unpartitioned_numel = shape.numel()
|
| 376 |
+
total_numel += unpartitioned_numel
|
| 377 |
+
|
| 378 |
+
param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
|
| 379 |
+
state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
|
| 380 |
+
|
| 381 |
+
partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
|
| 382 |
+
|
| 383 |
+
if debug:
|
| 384 |
+
print(
|
| 385 |
+
f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
|
| 386 |
+
)
|
| 387 |
+
|
| 388 |
+
print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
class GatheredTensor:
|
| 392 |
+
"""
|
| 393 |
+
A pseudo tensor that collects partitioned weights.
|
| 394 |
+
It is more memory efficient when there are multiple groups.
|
| 395 |
+
"""
|
| 396 |
+
|
| 397 |
+
def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
|
| 398 |
+
self.flat_groups = flat_groups
|
| 399 |
+
self.flat_groups_offset = flat_groups_offset
|
| 400 |
+
self.offset = offset
|
| 401 |
+
self.partitioned_numel = partitioned_numel
|
| 402 |
+
self.shape = shape
|
| 403 |
+
self.dtype = self.flat_groups[0][0].dtype
|
| 404 |
+
|
| 405 |
+
def contiguous(self):
|
| 406 |
+
"""
|
| 407 |
+
Merge partitioned weights from flat_groups into a single tensor.
|
| 408 |
+
"""
|
| 409 |
+
end_idx = self.offset + self.partitioned_numel
|
| 410 |
+
world_size = len(self.flat_groups)
|
| 411 |
+
pad_flat_param_chunks = []
|
| 412 |
+
|
| 413 |
+
for rank_i in range(world_size):
|
| 414 |
+
# for each rank, we need to collect weights from related group/groups
|
| 415 |
+
flat_groups_at_rank_i = self.flat_groups[rank_i]
|
| 416 |
+
start_group_id = None
|
| 417 |
+
end_group_id = None
|
| 418 |
+
for group_id in range(len(self.flat_groups_offset)):
|
| 419 |
+
if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
|
| 420 |
+
start_group_id = group_id
|
| 421 |
+
if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
|
| 422 |
+
end_group_id = group_id
|
| 423 |
+
break
|
| 424 |
+
# collect weights from related group/groups
|
| 425 |
+
for group_id in range(start_group_id, end_group_id + 1):
|
| 426 |
+
flat_tensor = flat_groups_at_rank_i[group_id]
|
| 427 |
+
start_offset = self.offset - self.flat_groups_offset[group_id]
|
| 428 |
+
end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
|
| 429 |
+
pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
|
| 430 |
+
|
| 431 |
+
# collect weights from all ranks
|
| 432 |
+
pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
|
| 433 |
+
param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
|
| 434 |
+
return param
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
|
| 438 |
+
param_shapes = zero_model_states[0].param_shapes
|
| 439 |
+
avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
|
| 440 |
+
|
| 441 |
+
# Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
|
| 442 |
+
# param, re-consolidating each param, while dealing with padding if any
|
| 443 |
+
|
| 444 |
+
# merge list of dicts, preserving order
|
| 445 |
+
param_shapes = {k: v for d in param_shapes for k, v in d.items()}
|
| 446 |
+
|
| 447 |
+
if debug:
|
| 448 |
+
for i in range(world_size):
|
| 449 |
+
print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
|
| 450 |
+
|
| 451 |
+
wanted_params = len(param_shapes)
|
| 452 |
+
wanted_numel = sum(shape.numel() for shape in param_shapes.values())
|
| 453 |
+
# not asserting if there is a mismatch due to possible padding
|
| 454 |
+
avail_numel = fp32_flat_groups[0].numel() * world_size
|
| 455 |
+
print(f"Trainable params: Have {avail_numel} numels to process.")
|
| 456 |
+
print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
|
| 457 |
+
|
| 458 |
+
# params
|
| 459 |
+
# XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
|
| 460 |
+
# out-of-core computing solution
|
| 461 |
+
offset = 0
|
| 462 |
+
total_numel = 0
|
| 463 |
+
total_params = 0
|
| 464 |
+
flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
|
| 465 |
+
for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
|
| 466 |
+
unpartitioned_numel = shape.numel()
|
| 467 |
+
total_numel += unpartitioned_numel
|
| 468 |
+
total_params += 1
|
| 469 |
+
partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
|
| 470 |
+
|
| 471 |
+
if debug:
|
| 472 |
+
print(
|
| 473 |
+
f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
|
| 474 |
+
)
|
| 475 |
+
|
| 476 |
+
# memory efficient tensor
|
| 477 |
+
tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
|
| 478 |
+
state_dict[name] = tensor
|
| 479 |
+
offset += partitioned_numel
|
| 480 |
+
|
| 481 |
+
offset *= world_size
|
| 482 |
+
|
| 483 |
+
# Sanity check
|
| 484 |
+
if offset != avail_numel:
|
| 485 |
+
raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
|
| 486 |
+
|
| 487 |
+
print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
|
| 488 |
+
|
| 489 |
+
|
| 490 |
+
def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 491 |
+
exclude_frozen_parameters):
|
| 492 |
+
state_dict = OrderedDict()
|
| 493 |
+
|
| 494 |
+
# buffers
|
| 495 |
+
buffers = zero_model_states[0].buffers
|
| 496 |
+
state_dict.update(buffers)
|
| 497 |
+
if debug:
|
| 498 |
+
print(f"added {len(buffers)} buffers")
|
| 499 |
+
|
| 500 |
+
if not exclude_frozen_parameters:
|
| 501 |
+
_zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
|
| 502 |
+
|
| 503 |
+
_zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
|
| 504 |
+
|
| 505 |
+
# recover shared parameters
|
| 506 |
+
for pair in zero_model_states[0].shared_params:
|
| 507 |
+
if pair[1] in state_dict:
|
| 508 |
+
state_dict[pair[0]] = state_dict[pair[1]]
|
| 509 |
+
|
| 510 |
+
return state_dict
|
| 511 |
+
|
| 512 |
+
|
| 513 |
+
def to_torch_tensor(state_dict, return_empty_tensor=False):
|
| 514 |
+
"""
|
| 515 |
+
Convert state_dict of GatheredTensor to torch tensor
|
| 516 |
+
"""
|
| 517 |
+
torch_state_dict = {}
|
| 518 |
+
converted_tensors = {}
|
| 519 |
+
for name, tensor in state_dict.items():
|
| 520 |
+
tensor_id = id(tensor)
|
| 521 |
+
if tensor_id in converted_tensors: # shared tensors
|
| 522 |
+
shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
|
| 523 |
+
torch_state_dict[name] = shared_tensor
|
| 524 |
+
else:
|
| 525 |
+
converted_tensors[tensor_id] = name
|
| 526 |
+
if return_empty_tensor:
|
| 527 |
+
torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
|
| 528 |
+
else:
|
| 529 |
+
torch_state_dict[name] = tensor.contiguous()
|
| 530 |
+
return torch_state_dict
|
| 531 |
+
|
| 532 |
+
|
| 533 |
+
def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
|
| 534 |
+
tag=None,
|
| 535 |
+
exclude_frozen_parameters=False,
|
| 536 |
+
lazy_mode=False):
|
| 537 |
+
"""
|
| 538 |
+
Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
|
| 539 |
+
``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
|
| 540 |
+
via a model hub.
|
| 541 |
+
|
| 542 |
+
Args:
|
| 543 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder
|
| 544 |
+
- ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
|
| 545 |
+
- ``exclude_frozen_parameters``: exclude frozen parameters
|
| 546 |
+
- ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
|
| 547 |
+
Convert the pesduo tensor to torch tensor by ``.contiguous()``
|
| 548 |
+
|
| 549 |
+
Returns:
|
| 550 |
+
- pytorch ``state_dict``
|
| 551 |
+
|
| 552 |
+
A typical usage might be ::
|
| 553 |
+
|
| 554 |
+
from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
|
| 555 |
+
# do the training and checkpoint saving
|
| 556 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
|
| 557 |
+
model = model.cpu() # move to cpu
|
| 558 |
+
model.load_state_dict(state_dict)
|
| 559 |
+
# submit to model hub or save the model to share with others
|
| 560 |
+
|
| 561 |
+
In this example the ``model`` will no longer be usable in the deepspeed context of the same
|
| 562 |
+
application. i.e. you will need to re-initialize the deepspeed engine, since
|
| 563 |
+
``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
|
| 564 |
+
|
| 565 |
+
If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
|
| 566 |
+
|
| 567 |
+
Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
|
| 568 |
+
You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
|
| 569 |
+
the checkpoint. Or you can load state_dict in lazy mode ::
|
| 570 |
+
|
| 571 |
+
from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
|
| 572 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
|
| 573 |
+
for name, lazy_tensor in state_dict.item():
|
| 574 |
+
tensor = lazy_tensor.contiguous() # to cpu
|
| 575 |
+
print(name, tensor)
|
| 576 |
+
# del tensor to release memory if it no longer in use
|
| 577 |
+
"""
|
| 578 |
+
if tag is None:
|
| 579 |
+
latest_path = os.path.join(checkpoint_dir, 'latest')
|
| 580 |
+
if os.path.isfile(latest_path):
|
| 581 |
+
with open(latest_path, 'r') as fd:
|
| 582 |
+
tag = fd.read().strip()
|
| 583 |
+
else:
|
| 584 |
+
raise ValueError(f"Unable to find 'latest' file at {latest_path}")
|
| 585 |
+
|
| 586 |
+
ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
|
| 587 |
+
|
| 588 |
+
if not os.path.isdir(ds_checkpoint_dir):
|
| 589 |
+
raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
|
| 590 |
+
|
| 591 |
+
state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
|
| 592 |
+
if lazy_mode:
|
| 593 |
+
return state_dict
|
| 594 |
+
else:
|
| 595 |
+
return to_torch_tensor(state_dict)
|
| 596 |
+
|
| 597 |
+
|
| 598 |
+
def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
|
| 599 |
+
output_dir,
|
| 600 |
+
max_shard_size="5GB",
|
| 601 |
+
safe_serialization=False,
|
| 602 |
+
tag=None,
|
| 603 |
+
exclude_frozen_parameters=False):
|
| 604 |
+
"""
|
| 605 |
+
Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
|
| 606 |
+
loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
|
| 607 |
+
|
| 608 |
+
Args:
|
| 609 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
|
| 610 |
+
- ``output_dir``: directory to the pytorch fp32 state_dict output files
|
| 611 |
+
- ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
|
| 612 |
+
- ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
|
| 613 |
+
- ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
|
| 614 |
+
- ``exclude_frozen_parameters``: exclude frozen parameters
|
| 615 |
+
"""
|
| 616 |
+
|
| 617 |
+
# Dependency pre-check
|
| 618 |
+
if safe_serialization:
|
| 619 |
+
try:
|
| 620 |
+
from safetensors.torch import save_file
|
| 621 |
+
except ImportError:
|
| 622 |
+
print('If you want to use `safe_serialization`, please `pip install safetensors`')
|
| 623 |
+
raise
|
| 624 |
+
if max_shard_size is not None:
|
| 625 |
+
try:
|
| 626 |
+
from huggingface_hub import split_torch_state_dict_into_shards
|
| 627 |
+
except ImportError:
|
| 628 |
+
print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
|
| 629 |
+
raise
|
| 630 |
+
|
| 631 |
+
# Convert zero checkpoint to state_dict
|
| 632 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
|
| 633 |
+
tag,
|
| 634 |
+
exclude_frozen_parameters,
|
| 635 |
+
lazy_mode=True)
|
| 636 |
+
|
| 637 |
+
# Shard the model if it is too big.
|
| 638 |
+
weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
|
| 639 |
+
if max_shard_size is not None:
|
| 640 |
+
filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
|
| 641 |
+
# an memory-efficient approach for sharding
|
| 642 |
+
empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
|
| 643 |
+
state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
|
| 644 |
+
filename_pattern=filename_pattern,
|
| 645 |
+
max_shard_size=max_shard_size)
|
| 646 |
+
else:
|
| 647 |
+
from collections import namedtuple
|
| 648 |
+
StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
|
| 649 |
+
state_dict_split = StateDictSplit(is_sharded=False,
|
| 650 |
+
filename_to_tensors={weights_name: list(state_dict.keys())})
|
| 651 |
+
|
| 652 |
+
# Save the model by shard
|
| 653 |
+
os.makedirs(output_dir, exist_ok=True)
|
| 654 |
+
filename_to_tensors = state_dict_split.filename_to_tensors.items()
|
| 655 |
+
for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
|
| 656 |
+
shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
|
| 657 |
+
shard_state_dict = to_torch_tensor(shard_state_dict)
|
| 658 |
+
output_path = os.path.join(output_dir, shard_file)
|
| 659 |
+
if safe_serialization:
|
| 660 |
+
save_file(shard_state_dict, output_path, metadata={"format": "pt"})
|
| 661 |
+
else:
|
| 662 |
+
torch.save(shard_state_dict, output_path)
|
| 663 |
+
# release the memory of current shard
|
| 664 |
+
for tensor_name in list(shard_state_dict.keys()):
|
| 665 |
+
del state_dict[tensor_name]
|
| 666 |
+
del shard_state_dict[tensor_name]
|
| 667 |
+
del shard_state_dict
|
| 668 |
+
gc.collect()
|
| 669 |
+
|
| 670 |
+
# Save index if sharded
|
| 671 |
+
if state_dict_split.is_sharded:
|
| 672 |
+
index = {
|
| 673 |
+
"metadata": state_dict_split.metadata,
|
| 674 |
+
"weight_map": state_dict_split.tensor_to_filename,
|
| 675 |
+
}
|
| 676 |
+
save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
|
| 677 |
+
save_index_file = os.path.join(output_dir, save_index_file)
|
| 678 |
+
with open(save_index_file, "w", encoding="utf-8") as f:
|
| 679 |
+
content = json.dumps(index, indent=2, sort_keys=True) + "\n"
|
| 680 |
+
f.write(content)
|
| 681 |
+
|
| 682 |
+
|
| 683 |
+
def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
|
| 684 |
+
"""
|
| 685 |
+
1. Put the provided model to cpu
|
| 686 |
+
2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
|
| 687 |
+
3. Load it into the provided model
|
| 688 |
+
|
| 689 |
+
Args:
|
| 690 |
+
- ``model``: the model object to update
|
| 691 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
|
| 692 |
+
- ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
|
| 693 |
+
|
| 694 |
+
Returns:
|
| 695 |
+
- ``model`: modified model
|
| 696 |
+
|
| 697 |
+
Make sure you have plenty of CPU memory available before you call this function. If you don't
|
| 698 |
+
have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
|
| 699 |
+
conveniently placed for you in the checkpoint folder.
|
| 700 |
+
|
| 701 |
+
A typical usage might be ::
|
| 702 |
+
|
| 703 |
+
from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
|
| 704 |
+
model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
|
| 705 |
+
# submit to model hub or save the model to share with others
|
| 706 |
+
|
| 707 |
+
Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
|
| 708 |
+
of the same application. i.e. you will need to re-initialize the deepspeed engine, since
|
| 709 |
+
``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
|
| 710 |
+
|
| 711 |
+
"""
|
| 712 |
+
logger.info(f"Extracting fp32 weights")
|
| 713 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
|
| 714 |
+
|
| 715 |
+
logger.info(f"Overwriting model with fp32 weights")
|
| 716 |
+
model = model.cpu()
|
| 717 |
+
model.load_state_dict(state_dict, strict=False)
|
| 718 |
+
|
| 719 |
+
return model
|
| 720 |
+
|
| 721 |
+
|
| 722 |
+
if __name__ == "__main__":
|
| 723 |
+
parser = argparse.ArgumentParser()
|
| 724 |
+
parser.add_argument("checkpoint_dir",
|
| 725 |
+
type=str,
|
| 726 |
+
help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
|
| 727 |
+
parser.add_argument("output_dir",
|
| 728 |
+
type=str,
|
| 729 |
+
help="directory to the pytorch fp32 state_dict output files"
|
| 730 |
+
"(e.g. path/checkpoint-12-output/)")
|
| 731 |
+
parser.add_argument(
|
| 732 |
+
"--max_shard_size",
|
| 733 |
+
type=str,
|
| 734 |
+
default="5GB",
|
| 735 |
+
help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
|
| 736 |
+
"lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
|
| 737 |
+
"We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
|
| 738 |
+
"without CPU OOM issues.")
|
| 739 |
+
parser.add_argument(
|
| 740 |
+
"--safe_serialization",
|
| 741 |
+
default=False,
|
| 742 |
+
action='store_true',
|
| 743 |
+
help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
|
| 744 |
+
parser.add_argument("-t",
|
| 745 |
+
"--tag",
|
| 746 |
+
type=str,
|
| 747 |
+
default=None,
|
| 748 |
+
help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
|
| 749 |
+
parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
|
| 750 |
+
parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
|
| 751 |
+
args = parser.parse_args()
|
| 752 |
+
|
| 753 |
+
debug = args.debug
|
| 754 |
+
|
| 755 |
+
convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
|
| 756 |
+
args.output_dir,
|
| 757 |
+
max_shard_size=args.max_shard_size,
|
| 758 |
+
safe_serialization=args.safe_serialization,
|
| 759 |
+
tag=args.tag,
|
| 760 |
+
exclude_frozen_parameters=args.exclude_frozen_parameters)
|