Instructions to use cragtmp/pairgt1408-50 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use cragtmp/pairgt1408-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/pairgt1408-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).*\\.(down_proj|up_proj|gate_proj|o_proj|k_proj|v_proj|q_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:9e08068f143f1e88511cfee65aa4ccc688712c8f4b78191adb6428a1e6aff3b9
|
| 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": 1024,
|
| 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 |
+
"task1_dpo_absgt14_noidk__pari0.8_0608.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_absgt14_noidk__pari0.8/v0-20250608-161639",
|
| 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": 4,
|
| 95 |
+
"per_device_eval_batch_size": 4,
|
| 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_absgt14_noidk__pari0.8/v0-20250608-161639/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 0x730abfe2ad40>, 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_absgt14_noidk__pari0.8/v0-20250608-161639', 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=4, per_device_eval_batch_size=4, 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_absgt14_noidk__pari0.8/v0-20250608-161639/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_absgt14_noidk__pari0.8/v0-20250608-161639', 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=1024, 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:63035231f17e15abd8eef92c81faf1684b3d3d944d59f27afc3c3b20621993a9
|
| 3 |
+
size 1064
|
trainer_state.json
ADDED
|
@@ -0,0 +1,934 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
| 5 |
+
"epoch": 0.409626216077829,
|
| 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.00819252432155658,
|
| 14 |
+
"grad_norm": 6.9504547119140625,
|
| 15 |
+
"learning_rate": 1.5384615384615387e-05,
|
| 16 |
+
"logits/chosen": -0.368751585483551,
|
| 17 |
+
"logits/rejected": -0.5192137956619263,
|
| 18 |
+
"logps/chosen": -6.009060859680176,
|
| 19 |
+
"logps/rejected": -15.29100513458252,
|
| 20 |
+
"loss": 1.2444509267807007,
|
| 21 |
+
"memory(GiB)": 45.94,
|
| 22 |
+
"nll_loss": 0.5513038039207458,
|
| 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.005419
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"epoch": 0.01638504864311316,
|
| 32 |
+
"grad_norm": 4.338643550872803,
|
| 33 |
+
"learning_rate": 3.0769230769230774e-05,
|
| 34 |
+
"logits/chosen": -0.28789153695106506,
|
| 35 |
+
"logits/rejected": -0.44838714599609375,
|
| 36 |
+
"logps/chosen": -7.449802398681641,
|
| 37 |
+
"logps/rejected": -18.95979881286621,
|
| 38 |
+
"loss": 1.2916792631149292,
|
| 39 |
+
"memory(GiB)": 45.94,
|
| 40 |
+
"nll_loss": 0.59853196144104,
|
| 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.005497
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"epoch": 0.02457757296466974,
|
| 50 |
+
"grad_norm": 5.146463394165039,
|
| 51 |
+
"learning_rate": 4.615384615384616e-05,
|
| 52 |
+
"logits/chosen": -0.37533068656921387,
|
| 53 |
+
"logits/rejected": -0.5269488096237183,
|
| 54 |
+
"logps/chosen": -4.474628925323486,
|
| 55 |
+
"logps/rejected": -17.257675170898438,
|
| 56 |
+
"loss": 1.0800914764404297,
|
| 57 |
+
"memory(GiB)": 45.94,
|
| 58 |
+
"nll_loss": 0.3937700092792511,
|
| 59 |
+
"rewards/accuracies": 0.65625,
|
| 60 |
+
"rewards/chosen": 0.005001109093427658,
|
| 61 |
+
"rewards/margins": 0.01398632675409317,
|
| 62 |
+
"rewards/rejected": -0.008985218591988087,
|
| 63 |
+
"step": 3,
|
| 64 |
+
"train_speed(iter/s)": 0.005544
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"epoch": 0.03277009728622632,
|
| 68 |
+
"grad_norm": 3.9697017669677734,
|
| 69 |
+
"learning_rate": 6.153846153846155e-05,
|
| 70 |
+
"logits/chosen": -0.3554455041885376,
|
| 71 |
+
"logits/rejected": -0.4836651384830475,
|
| 72 |
+
"logps/chosen": -7.087220191955566,
|
| 73 |
+
"logps/rejected": -16.969388961791992,
|
| 74 |
+
"loss": 1.2551683187484741,
|
| 75 |
+
"memory(GiB)": 45.94,
|
| 76 |
+
"nll_loss": 0.5823322534561157,
|
| 77 |
+
"rewards/accuracies": 0.59375,
|
| 78 |
+
"rewards/chosen": -0.01054135151207447,
|
| 79 |
+
"rewards/margins": 0.04771733283996582,
|
| 80 |
+
"rewards/rejected": -0.05825868248939514,
|
| 81 |
+
"step": 4,
|
| 82 |
+
"train_speed(iter/s)": 0.005563
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"epoch": 0.0409626216077829,
|
| 86 |
+
"grad_norm": 7.601996421813965,
|
| 87 |
+
"learning_rate": 7.692307692307693e-05,
|
| 88 |
+
"logits/chosen": -0.3477073013782501,
|
| 89 |
+
"logits/rejected": -0.46865567564964294,
|
| 90 |
+
"logps/chosen": -8.432049751281738,
|
| 91 |
+
"logps/rejected": -20.41954231262207,
|
| 92 |
+
"loss": 1.2856180667877197,
|
| 93 |
+
"memory(GiB)": 45.94,
|
| 94 |
+
"nll_loss": 0.6360925436019897,
|
| 95 |
+
"rewards/accuracies": 0.609375,
|
| 96 |
+
"rewards/chosen": -0.10297518223524094,
|
| 97 |
+
"rewards/margins": 0.15188881754875183,
|
| 98 |
+
"rewards/rejected": -0.25486400723457336,
|
| 99 |
+
"step": 5,
|
| 100 |
+
"train_speed(iter/s)": 0.005571
|
| 101 |
+
},
|
| 102 |
+
{
|
| 103 |
+
"epoch": 0.04915514592933948,
|
| 104 |
+
"grad_norm": 6.308995246887207,
|
| 105 |
+
"learning_rate": 9.230769230769232e-05,
|
| 106 |
+
"logits/chosen": -0.3014591932296753,
|
| 107 |
+
"logits/rejected": -0.4142557978630066,
|
| 108 |
+
"logps/chosen": -8.621772766113281,
|
| 109 |
+
"logps/rejected": -19.327842712402344,
|
| 110 |
+
"loss": 1.2817319631576538,
|
| 111 |
+
"memory(GiB)": 46.69,
|
| 112 |
+
"nll_loss": 0.6402445435523987,
|
| 113 |
+
"rewards/accuracies": 0.609375,
|
| 114 |
+
"rewards/chosen": -0.10090938210487366,
|
| 115 |
+
"rewards/margins": 0.18325890600681305,
|
| 116 |
+
"rewards/rejected": -0.2841682732105255,
|
| 117 |
+
"step": 6,
|
| 118 |
+
"train_speed(iter/s)": 0.005566
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
"epoch": 0.05734767025089606,
|
| 122 |
+
"grad_norm": 4.3832902908325195,
|
| 123 |
+
"learning_rate": 0.0001076923076923077,
|
| 124 |
+
"logits/chosen": -0.3800317347049713,
|
| 125 |
+
"logits/rejected": -0.4671918749809265,
|
| 126 |
+
"logps/chosen": -5.921639442443848,
|
| 127 |
+
"logps/rejected": -15.812642097473145,
|
| 128 |
+
"loss": 1.0748225450515747,
|
| 129 |
+
"memory(GiB)": 46.69,
|
| 130 |
+
"nll_loss": 0.42862600088119507,
|
| 131 |
+
"rewards/accuracies": 0.609375,
|
| 132 |
+
"rewards/chosen": -0.07157032936811447,
|
| 133 |
+
"rewards/margins": 0.1520296335220337,
|
| 134 |
+
"rewards/rejected": -0.22359995543956757,
|
| 135 |
+
"step": 7,
|
| 136 |
+
"train_speed(iter/s)": 0.005576
|
| 137 |
+
},
|
| 138 |
+
{
|
| 139 |
+
"epoch": 0.06554019457245264,
|
| 140 |
+
"grad_norm": 2.131096601486206,
|
| 141 |
+
"learning_rate": 0.0001230769230769231,
|
| 142 |
+
"logits/chosen": -0.326383113861084,
|
| 143 |
+
"logits/rejected": -0.4235616624355316,
|
| 144 |
+
"logps/chosen": -7.039735317230225,
|
| 145 |
+
"logps/rejected": -15.89234733581543,
|
| 146 |
+
"loss": 1.1329768896102905,
|
| 147 |
+
"memory(GiB)": 46.69,
|
| 148 |
+
"nll_loss": 0.4950546622276306,
|
| 149 |
+
"rewards/accuracies": 0.640625,
|
| 150 |
+
"rewards/chosen": 0.02736004814505577,
|
| 151 |
+
"rewards/margins": 0.13636186718940735,
|
| 152 |
+
"rewards/rejected": -0.10900183022022247,
|
| 153 |
+
"step": 8,
|
| 154 |
+
"train_speed(iter/s)": 0.00558
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
"epoch": 0.07373271889400922,
|
| 158 |
+
"grad_norm": 3.154919147491455,
|
| 159 |
+
"learning_rate": 0.00013846153846153847,
|
| 160 |
+
"logits/chosen": -0.3660247027873993,
|
| 161 |
+
"logits/rejected": -0.4395582675933838,
|
| 162 |
+
"logps/chosen": -7.082914352416992,
|
| 163 |
+
"logps/rejected": -12.765766143798828,
|
| 164 |
+
"loss": 1.1050751209259033,
|
| 165 |
+
"memory(GiB)": 46.69,
|
| 166 |
+
"nll_loss": 0.44545602798461914,
|
| 167 |
+
"rewards/accuracies": 0.6875,
|
| 168 |
+
"rewards/chosen": 0.05931762978434563,
|
| 169 |
+
"rewards/margins": 0.0759875625371933,
|
| 170 |
+
"rewards/rejected": -0.016669925302267075,
|
| 171 |
+
"step": 9,
|
| 172 |
+
"train_speed(iter/s)": 0.005582
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"epoch": 0.0819252432155658,
|
| 176 |
+
"grad_norm": 2.322492837905884,
|
| 177 |
+
"learning_rate": 0.00015384615384615385,
|
| 178 |
+
"logits/chosen": -0.3979243040084839,
|
| 179 |
+
"logits/rejected": -0.4425738453865051,
|
| 180 |
+
"logps/chosen": -8.025144577026367,
|
| 181 |
+
"logps/rejected": -15.784225463867188,
|
| 182 |
+
"loss": 1.075645089149475,
|
| 183 |
+
"memory(GiB)": 46.69,
|
| 184 |
+
"nll_loss": 0.4679878056049347,
|
| 185 |
+
"rewards/accuracies": 0.828125,
|
| 186 |
+
"rewards/chosen": 0.048429328948259354,
|
| 187 |
+
"rewards/margins": 0.1987656205892563,
|
| 188 |
+
"rewards/rejected": -0.15033629536628723,
|
| 189 |
+
"step": 10,
|
| 190 |
+
"train_speed(iter/s)": 0.005587
|
| 191 |
+
},
|
| 192 |
+
{
|
| 193 |
+
"epoch": 0.09011776753712238,
|
| 194 |
+
"grad_norm": 2.226271152496338,
|
| 195 |
+
"learning_rate": 0.00016923076923076923,
|
| 196 |
+
"logits/chosen": -0.2428550124168396,
|
| 197 |
+
"logits/rejected": -0.4068838357925415,
|
| 198 |
+
"logps/chosen": -5.73712682723999,
|
| 199 |
+
"logps/rejected": -23.750782012939453,
|
| 200 |
+
"loss": 0.9072864651679993,
|
| 201 |
+
"memory(GiB)": 46.69,
|
| 202 |
+
"nll_loss": 0.4175054132938385,
|
| 203 |
+
"rewards/accuracies": 0.890625,
|
| 204 |
+
"rewards/chosen": 0.0929398313164711,
|
| 205 |
+
"rewards/margins": 0.5025829672813416,
|
| 206 |
+
"rewards/rejected": -0.40964314341545105,
|
| 207 |
+
"step": 11,
|
| 208 |
+
"train_speed(iter/s)": 0.005584
|
| 209 |
+
},
|
| 210 |
+
{
|
| 211 |
+
"epoch": 0.09831029185867896,
|
| 212 |
+
"grad_norm": 9.130071640014648,
|
| 213 |
+
"learning_rate": 0.00018461538461538463,
|
| 214 |
+
"logits/chosen": -0.3092227280139923,
|
| 215 |
+
"logits/rejected": -0.4145185053348541,
|
| 216 |
+
"logps/chosen": -9.414848327636719,
|
| 217 |
+
"logps/rejected": -22.3564395904541,
|
| 218 |
+
"loss": 1.266426920890808,
|
| 219 |
+
"memory(GiB)": 46.69,
|
| 220 |
+
"nll_loss": 0.6574685573577881,
|
| 221 |
+
"rewards/accuracies": 0.65625,
|
| 222 |
+
"rewards/chosen": -0.27316582202911377,
|
| 223 |
+
"rewards/margins": 0.5058421492576599,
|
| 224 |
+
"rewards/rejected": -0.7790080308914185,
|
| 225 |
+
"step": 12,
|
| 226 |
+
"train_speed(iter/s)": 0.005586
|
| 227 |
+
},
|
| 228 |
+
{
|
| 229 |
+
"epoch": 0.10650281618023553,
|
| 230 |
+
"grad_norm": 8.017046928405762,
|
| 231 |
+
"learning_rate": 0.0002,
|
| 232 |
+
"logits/chosen": -0.3036244809627533,
|
| 233 |
+
"logits/rejected": -0.43275412917137146,
|
| 234 |
+
"logps/chosen": -8.467231750488281,
|
| 235 |
+
"logps/rejected": -26.61805534362793,
|
| 236 |
+
"loss": 1.2604392766952515,
|
| 237 |
+
"memory(GiB)": 46.69,
|
| 238 |
+
"nll_loss": 0.7518106698989868,
|
| 239 |
+
"rewards/accuracies": 0.78125,
|
| 240 |
+
"rewards/chosen": -0.2612573206424713,
|
| 241 |
+
"rewards/margins": 0.6518616676330566,
|
| 242 |
+
"rewards/rejected": -0.9131190180778503,
|
| 243 |
+
"step": 13,
|
| 244 |
+
"train_speed(iter/s)": 0.005587
|
| 245 |
+
},
|
| 246 |
+
{
|
| 247 |
+
"epoch": 0.11469534050179211,
|
| 248 |
+
"grad_norm": 2.1487388610839844,
|
| 249 |
+
"learning_rate": 0.00019999075218579183,
|
| 250 |
+
"logits/chosen": -0.2624781131744385,
|
| 251 |
+
"logits/rejected": -0.3863448202610016,
|
| 252 |
+
"logps/chosen": -8.31130313873291,
|
| 253 |
+
"logps/rejected": -26.065853118896484,
|
| 254 |
+
"loss": 0.9567878246307373,
|
| 255 |
+
"memory(GiB)": 46.69,
|
| 256 |
+
"nll_loss": 0.4835919439792633,
|
| 257 |
+
"rewards/accuracies": 0.8125,
|
| 258 |
+
"rewards/chosen": 0.02007860317826271,
|
| 259 |
+
"rewards/margins": 0.6282916069030762,
|
| 260 |
+
"rewards/rejected": -0.6082130074501038,
|
| 261 |
+
"step": 14,
|
| 262 |
+
"train_speed(iter/s)": 0.005584
|
| 263 |
+
},
|
| 264 |
+
{
|
| 265 |
+
"epoch": 0.1228878648233487,
|
| 266 |
+
"grad_norm": 3.114581823348999,
|
| 267 |
+
"learning_rate": 0.00019996301045360873,
|
| 268 |
+
"logits/chosen": -0.32559511065483093,
|
| 269 |
+
"logits/rejected": -0.40920543670654297,
|
| 270 |
+
"logps/chosen": -7.523581027984619,
|
| 271 |
+
"logps/rejected": -18.561134338378906,
|
| 272 |
+
"loss": 1.0775632858276367,
|
| 273 |
+
"memory(GiB)": 46.69,
|
| 274 |
+
"nll_loss": 0.5253046751022339,
|
| 275 |
+
"rewards/accuracies": 0.71875,
|
| 276 |
+
"rewards/chosen": -0.007055876310914755,
|
| 277 |
+
"rewards/margins": 0.419503390789032,
|
| 278 |
+
"rewards/rejected": -0.42655929923057556,
|
| 279 |
+
"step": 15,
|
| 280 |
+
"train_speed(iter/s)": 0.005586
|
| 281 |
+
},
|
| 282 |
+
{
|
| 283 |
+
"epoch": 0.13108038914490527,
|
| 284 |
+
"grad_norm": 3.7939462661743164,
|
| 285 |
+
"learning_rate": 0.0001999167799344583,
|
| 286 |
+
"logits/chosen": -0.2907140851020813,
|
| 287 |
+
"logits/rejected": -0.3809354901313782,
|
| 288 |
+
"logps/chosen": -6.864745616912842,
|
| 289 |
+
"logps/rejected": -20.829776763916016,
|
| 290 |
+
"loss": 1.0188764333724976,
|
| 291 |
+
"memory(GiB)": 46.69,
|
| 292 |
+
"nll_loss": 0.5191283822059631,
|
| 293 |
+
"rewards/accuracies": 0.765625,
|
| 294 |
+
"rewards/chosen": 0.03652028366923332,
|
| 295 |
+
"rewards/margins": 0.6273013353347778,
|
| 296 |
+
"rewards/rejected": -0.5907810926437378,
|
| 297 |
+
"step": 16,
|
| 298 |
+
"train_speed(iter/s)": 0.005586
|
| 299 |
+
},
|
| 300 |
+
{
|
| 301 |
+
"epoch": 0.13927291346646187,
|
| 302 |
+
"grad_norm": 2.7766926288604736,
|
| 303 |
+
"learning_rate": 0.00019985206917896563,
|
| 304 |
+
"logits/chosen": -0.3052994906902313,
|
| 305 |
+
"logits/rejected": -0.37751495838165283,
|
| 306 |
+
"logps/chosen": -8.09772777557373,
|
| 307 |
+
"logps/rejected": -18.549510955810547,
|
| 308 |
+
"loss": 1.1308537721633911,
|
| 309 |
+
"memory(GiB)": 46.69,
|
| 310 |
+
"nll_loss": 0.564860999584198,
|
| 311 |
+
"rewards/accuracies": 0.71875,
|
| 312 |
+
"rewards/chosen": 0.022659722715616226,
|
| 313 |
+
"rewards/margins": 0.4622555077075958,
|
| 314 |
+
"rewards/rejected": -0.4395957589149475,
|
| 315 |
+
"step": 17,
|
| 316 |
+
"train_speed(iter/s)": 0.005587
|
| 317 |
+
},
|
| 318 |
+
{
|
| 319 |
+
"epoch": 0.14746543778801843,
|
| 320 |
+
"grad_norm": 3.9402501583099365,
|
| 321 |
+
"learning_rate": 0.00019976889015579165,
|
| 322 |
+
"logits/chosen": -0.2790537476539612,
|
| 323 |
+
"logits/rejected": -0.3640768229961395,
|
| 324 |
+
"logps/chosen": -10.8331298828125,
|
| 325 |
+
"logps/rejected": -25.086530685424805,
|
| 326 |
+
"loss": 1.1370517015457153,
|
| 327 |
+
"memory(GiB)": 46.69,
|
| 328 |
+
"nll_loss": 0.6662458777427673,
|
| 329 |
+
"rewards/accuracies": 0.796875,
|
| 330 |
+
"rewards/chosen": -0.06523045897483826,
|
| 331 |
+
"rewards/margins": 0.8811236619949341,
|
| 332 |
+
"rewards/rejected": -0.9463540315628052,
|
| 333 |
+
"step": 18,
|
| 334 |
+
"train_speed(iter/s)": 0.005586
|
| 335 |
+
},
|
| 336 |
+
{
|
| 337 |
+
"epoch": 0.15565796210957503,
|
| 338 |
+
"grad_norm": 4.501293659210205,
|
| 339 |
+
"learning_rate": 0.00019966725824941932,
|
| 340 |
+
"logits/chosen": -0.3320932686328888,
|
| 341 |
+
"logits/rejected": -0.44169852137565613,
|
| 342 |
+
"logps/chosen": -10.038064956665039,
|
| 343 |
+
"logps/rejected": -25.767019271850586,
|
| 344 |
+
"loss": 1.2291309833526611,
|
| 345 |
+
"memory(GiB)": 46.69,
|
| 346 |
+
"nll_loss": 0.7401180267333984,
|
| 347 |
+
"rewards/accuracies": 0.765625,
|
| 348 |
+
"rewards/chosen": -0.24555523693561554,
|
| 349 |
+
"rewards/margins": 0.8229343891143799,
|
| 350 |
+
"rewards/rejected": -1.068489670753479,
|
| 351 |
+
"step": 19,
|
| 352 |
+
"train_speed(iter/s)": 0.005589
|
| 353 |
+
},
|
| 354 |
+
{
|
| 355 |
+
"epoch": 0.1638504864311316,
|
| 356 |
+
"grad_norm": 1.8677138090133667,
|
| 357 |
+
"learning_rate": 0.00019954719225730847,
|
| 358 |
+
"logits/chosen": -0.28071457147598267,
|
| 359 |
+
"logits/rejected": -0.4227759838104248,
|
| 360 |
+
"logps/chosen": -7.934963703155518,
|
| 361 |
+
"logps/rejected": -24.492511749267578,
|
| 362 |
+
"loss": 0.956333339214325,
|
| 363 |
+
"memory(GiB)": 46.69,
|
| 364 |
+
"nll_loss": 0.4845323860645294,
|
| 365 |
+
"rewards/accuracies": 0.765625,
|
| 366 |
+
"rewards/chosen": -0.04675678163766861,
|
| 367 |
+
"rewards/margins": 0.7908064126968384,
|
| 368 |
+
"rewards/rejected": -0.8375633358955383,
|
| 369 |
+
"step": 20,
|
| 370 |
+
"train_speed(iter/s)": 0.005589
|
| 371 |
+
},
|
| 372 |
+
{
|
| 373 |
+
"epoch": 0.17204301075268819,
|
| 374 |
+
"grad_norm": 1.5877766609191895,
|
| 375 |
+
"learning_rate": 0.00019940871438641882,
|
| 376 |
+
"logits/chosen": -0.3024439215660095,
|
| 377 |
+
"logits/rejected": -0.43745386600494385,
|
| 378 |
+
"logps/chosen": -6.4543776512146,
|
| 379 |
+
"logps/rejected": -22.530338287353516,
|
| 380 |
+
"loss": 0.9309813380241394,
|
| 381 |
+
"memory(GiB)": 46.69,
|
| 382 |
+
"nll_loss": 0.4551314115524292,
|
| 383 |
+
"rewards/accuracies": 0.828125,
|
| 384 |
+
"rewards/chosen": 0.04532763361930847,
|
| 385 |
+
"rewards/margins": 0.6945431232452393,
|
| 386 |
+
"rewards/rejected": -0.6492154598236084,
|
| 387 |
+
"step": 21,
|
| 388 |
+
"train_speed(iter/s)": 0.005589
|
| 389 |
+
},
|
| 390 |
+
{
|
| 391 |
+
"epoch": 0.18023553507424475,
|
| 392 |
+
"grad_norm": 1.7120730876922607,
|
| 393 |
+
"learning_rate": 0.00019925185024910277,
|
| 394 |
+
"logits/chosen": -0.2665388584136963,
|
| 395 |
+
"logits/rejected": -0.39961740374565125,
|
| 396 |
+
"logps/chosen": -7.612581729888916,
|
| 397 |
+
"logps/rejected": -24.12154769897461,
|
| 398 |
+
"loss": 1.017120599746704,
|
| 399 |
+
"memory(GiB)": 46.69,
|
| 400 |
+
"nll_loss": 0.5679780840873718,
|
| 401 |
+
"rewards/accuracies": 0.8125,
|
| 402 |
+
"rewards/chosen": 0.12790349125862122,
|
| 403 |
+
"rewards/margins": 0.8537773489952087,
|
| 404 |
+
"rewards/rejected": -0.7258739471435547,
|
| 405 |
+
"step": 22,
|
| 406 |
+
"train_speed(iter/s)": 0.005587
|
| 407 |
+
},
|
| 408 |
+
{
|
| 409 |
+
"epoch": 0.18842805939580134,
|
| 410 |
+
"grad_norm": 1.8607813119888306,
|
| 411 |
+
"learning_rate": 0.00019907662885836836,
|
| 412 |
+
"logits/chosen": -0.29434627294540405,
|
| 413 |
+
"logits/rejected": -0.38500675559043884,
|
| 414 |
+
"logps/chosen": -9.917289733886719,
|
| 415 |
+
"logps/rejected": -20.862939834594727,
|
| 416 |
+
"loss": 1.072438359260559,
|
| 417 |
+
"memory(GiB)": 46.69,
|
| 418 |
+
"nll_loss": 0.5891656875610352,
|
| 419 |
+
"rewards/accuracies": 0.84375,
|
| 420 |
+
"rewards/chosen": 0.050024691969156265,
|
| 421 |
+
"rewards/margins": 0.6231139302253723,
|
| 422 |
+
"rewards/rejected": -0.5730893015861511,
|
| 423 |
+
"step": 23,
|
| 424 |
+
"train_speed(iter/s)": 0.005586
|
| 425 |
+
},
|
| 426 |
+
{
|
| 427 |
+
"epoch": 0.1966205837173579,
|
| 428 |
+
"grad_norm": 2.2947323322296143,
|
| 429 |
+
"learning_rate": 0.00019888308262251285,
|
| 430 |
+
"logits/chosen": -0.2984248995780945,
|
| 431 |
+
"logits/rejected": -0.4263286292552948,
|
| 432 |
+
"logps/chosen": -5.695917129516602,
|
| 433 |
+
"logps/rejected": -27.542821884155273,
|
| 434 |
+
"loss": 0.8626710176467896,
|
| 435 |
+
"memory(GiB)": 46.69,
|
| 436 |
+
"nll_loss": 0.4990408718585968,
|
| 437 |
+
"rewards/accuracies": 0.859375,
|
| 438 |
+
"rewards/chosen": 0.05305299907922745,
|
| 439 |
+
"rewards/margins": 1.2556676864624023,
|
| 440 |
+
"rewards/rejected": -1.2026147842407227,
|
| 441 |
+
"step": 24,
|
| 442 |
+
"train_speed(iter/s)": 0.005587
|
| 443 |
+
},
|
| 444 |
+
{
|
| 445 |
+
"epoch": 0.2048131080389145,
|
| 446 |
+
"grad_norm": 2.453016996383667,
|
| 447 |
+
"learning_rate": 0.0001986712473391289,
|
| 448 |
+
"logits/chosen": -0.37013769149780273,
|
| 449 |
+
"logits/rejected": -0.4342552423477173,
|
| 450 |
+
"logps/chosen": -5.276243209838867,
|
| 451 |
+
"logps/rejected": -23.596858978271484,
|
| 452 |
+
"loss": 0.8703887462615967,
|
| 453 |
+
"memory(GiB)": 46.69,
|
| 454 |
+
"nll_loss": 0.45367568731307983,
|
| 455 |
+
"rewards/accuracies": 0.78125,
|
| 456 |
+
"rewards/chosen": -0.010003786534070969,
|
| 457 |
+
"rewards/margins": 1.1414563655853271,
|
| 458 |
+
"rewards/rejected": -1.1514601707458496,
|
| 459 |
+
"step": 25,
|
| 460 |
+
"train_speed(iter/s)": 0.005589
|
| 461 |
+
},
|
| 462 |
+
{
|
| 463 |
+
"epoch": 0.21300563236047107,
|
| 464 |
+
"grad_norm": 3.131953477859497,
|
| 465 |
+
"learning_rate": 0.00019844116218848334,
|
| 466 |
+
"logits/chosen": -0.3483574688434601,
|
| 467 |
+
"logits/rejected": -0.4867978096008301,
|
| 468 |
+
"logps/chosen": -6.131460666656494,
|
| 469 |
+
"logps/rejected": -25.60129165649414,
|
| 470 |
+
"loss": 0.8633096814155579,
|
| 471 |
+
"memory(GiB)": 46.69,
|
| 472 |
+
"nll_loss": 0.4731563329696655,
|
| 473 |
+
"rewards/accuracies": 0.890625,
|
| 474 |
+
"rewards/chosen": 0.08134596049785614,
|
| 475 |
+
"rewards/margins": 1.066148042678833,
|
| 476 |
+
"rewards/rejected": -0.9848020076751709,
|
| 477 |
+
"step": 26,
|
| 478 |
+
"train_speed(iter/s)": 0.005591
|
| 479 |
+
},
|
| 480 |
+
{
|
| 481 |
+
"epoch": 0.22119815668202766,
|
| 482 |
+
"grad_norm": 2.4780352115631104,
|
| 483 |
+
"learning_rate": 0.00019819286972627066,
|
| 484 |
+
"logits/chosen": -0.36855828762054443,
|
| 485 |
+
"logits/rejected": -0.49951156973838806,
|
| 486 |
+
"logps/chosen": -5.627861499786377,
|
| 487 |
+
"logps/rejected": -31.835105895996094,
|
| 488 |
+
"loss": 0.7191118597984314,
|
| 489 |
+
"memory(GiB)": 46.69,
|
| 490 |
+
"nll_loss": 0.39769047498703003,
|
| 491 |
+
"rewards/accuracies": 0.859375,
|
| 492 |
+
"rewards/chosen": -0.007685612887144089,
|
| 493 |
+
"rewards/margins": 1.6878087520599365,
|
| 494 |
+
"rewards/rejected": -1.6954944133758545,
|
| 495 |
+
"step": 27,
|
| 496 |
+
"train_speed(iter/s)": 0.005593
|
| 497 |
+
},
|
| 498 |
+
{
|
| 499 |
+
"epoch": 0.22939068100358423,
|
| 500 |
+
"grad_norm": 2.9881274700164795,
|
| 501 |
+
"learning_rate": 0.00019792641587574212,
|
| 502 |
+
"logits/chosen": -0.2455301731824875,
|
| 503 |
+
"logits/rejected": -0.39179977774620056,
|
| 504 |
+
"logps/chosen": -6.589425563812256,
|
| 505 |
+
"logps/rejected": -36.522743225097656,
|
| 506 |
+
"loss": 0.7601451277732849,
|
| 507 |
+
"memory(GiB)": 46.69,
|
| 508 |
+
"nll_loss": 0.4516022801399231,
|
| 509 |
+
"rewards/accuracies": 0.890625,
|
| 510 |
+
"rewards/chosen": 0.009008985012769699,
|
| 511 |
+
"rewards/margins": 1.831702709197998,
|
| 512 |
+
"rewards/rejected": -1.8226937055587769,
|
| 513 |
+
"step": 28,
|
| 514 |
+
"train_speed(iter/s)": 0.005593
|
| 515 |
+
},
|
| 516 |
+
{
|
| 517 |
+
"epoch": 0.23758320532514082,
|
| 518 |
+
"grad_norm": 2.97683048248291,
|
| 519 |
+
"learning_rate": 0.00019764184991921178,
|
| 520 |
+
"logits/chosen": -0.30706074833869934,
|
| 521 |
+
"logits/rejected": -0.44865599274635315,
|
| 522 |
+
"logps/chosen": -10.063987731933594,
|
| 523 |
+
"logps/rejected": -31.307193756103516,
|
| 524 |
+
"loss": 1.0377051830291748,
|
| 525 |
+
"memory(GiB)": 46.69,
|
| 526 |
+
"nll_loss": 0.6944084763526917,
|
| 527 |
+
"rewards/accuracies": 0.90625,
|
| 528 |
+
"rewards/chosen": -0.10418727993965149,
|
| 529 |
+
"rewards/margins": 1.5954655408859253,
|
| 530 |
+
"rewards/rejected": -1.6996527910232544,
|
| 531 |
+
"step": 29,
|
| 532 |
+
"train_speed(iter/s)": 0.005594
|
| 533 |
+
},
|
| 534 |
+
{
|
| 535 |
+
"epoch": 0.2457757296466974,
|
| 536 |
+
"grad_norm": 1.9776651859283447,
|
| 537 |
+
"learning_rate": 0.0001973392244889415,
|
| 538 |
+
"logits/chosen": -0.32163313031196594,
|
| 539 |
+
"logits/rejected": -0.4449259042739868,
|
| 540 |
+
"logps/chosen": -8.357927322387695,
|
| 541 |
+
"logps/rejected": -33.13959884643555,
|
| 542 |
+
"loss": 0.880458414554596,
|
| 543 |
+
"memory(GiB)": 46.69,
|
| 544 |
+
"nll_loss": 0.5416579246520996,
|
| 545 |
+
"rewards/accuracies": 0.9375,
|
| 546 |
+
"rewards/chosen": -0.04613646864891052,
|
| 547 |
+
"rewards/margins": 1.6892749071121216,
|
| 548 |
+
"rewards/rejected": -1.735411286354065,
|
| 549 |
+
"step": 30,
|
| 550 |
+
"train_speed(iter/s)": 0.005595
|
| 551 |
+
},
|
| 552 |
+
{
|
| 553 |
+
"epoch": 0.25396825396825395,
|
| 554 |
+
"grad_norm": 2.918856620788574,
|
| 555 |
+
"learning_rate": 0.00019701859555740648,
|
| 556 |
+
"logits/chosen": -0.3250303566455841,
|
| 557 |
+
"logits/rejected": -0.42262473702430725,
|
| 558 |
+
"logps/chosen": -7.8114013671875,
|
| 559 |
+
"logps/rejected": -27.219764709472656,
|
| 560 |
+
"loss": 0.9608601331710815,
|
| 561 |
+
"memory(GiB)": 46.69,
|
| 562 |
+
"nll_loss": 0.5916098356246948,
|
| 563 |
+
"rewards/accuracies": 0.859375,
|
| 564 |
+
"rewards/chosen": 0.02971716970205307,
|
| 565 |
+
"rewards/margins": 1.5878727436065674,
|
| 566 |
+
"rewards/rejected": -1.5581557750701904,
|
| 567 |
+
"step": 31,
|
| 568 |
+
"train_speed(iter/s)": 0.005596
|
| 569 |
+
},
|
| 570 |
+
{
|
| 571 |
+
"epoch": 0.26216077828981055,
|
| 572 |
+
"grad_norm": 1.8905093669891357,
|
| 573 |
+
"learning_rate": 0.00019668002242694238,
|
| 574 |
+
"logits/chosen": -0.2707211673259735,
|
| 575 |
+
"logits/rejected": -0.4425659477710724,
|
| 576 |
+
"logps/chosen": -5.811425685882568,
|
| 577 |
+
"logps/rejected": -30.51934814453125,
|
| 578 |
+
"loss": 0.7490611672401428,
|
| 579 |
+
"memory(GiB)": 46.69,
|
| 580 |
+
"nll_loss": 0.3751787841320038,
|
| 581 |
+
"rewards/accuracies": 0.90625,
|
| 582 |
+
"rewards/chosen": 0.11003397405147552,
|
| 583 |
+
"rewards/margins": 1.2447575330734253,
|
| 584 |
+
"rewards/rejected": -1.134723424911499,
|
| 585 |
+
"step": 32,
|
| 586 |
+
"train_speed(iter/s)": 0.005596
|
| 587 |
+
},
|
| 588 |
+
{
|
| 589 |
+
"epoch": 0.27035330261136714,
|
| 590 |
+
"grad_norm": 3.2241005897521973,
|
| 591 |
+
"learning_rate": 0.00019632356771877735,
|
| 592 |
+
"logits/chosen": -0.31523844599723816,
|
| 593 |
+
"logits/rejected": -0.48877376317977905,
|
| 594 |
+
"logps/chosen": -7.238929271697998,
|
| 595 |
+
"logps/rejected": -24.841379165649414,
|
| 596 |
+
"loss": 0.9657001495361328,
|
| 597 |
+
"memory(GiB)": 46.69,
|
| 598 |
+
"nll_loss": 0.5450810194015503,
|
| 599 |
+
"rewards/accuracies": 0.890625,
|
| 600 |
+
"rewards/chosen": 0.09001664817333221,
|
| 601 |
+
"rewards/margins": 0.8783948421478271,
|
| 602 |
+
"rewards/rejected": -0.7883782386779785,
|
| 603 |
+
"step": 33,
|
| 604 |
+
"train_speed(iter/s)": 0.005596
|
| 605 |
+
},
|
| 606 |
+
{
|
| 607 |
+
"epoch": 0.27854582693292373,
|
| 608 |
+
"grad_norm": 2.6415717601776123,
|
| 609 |
+
"learning_rate": 0.00019594929736144976,
|
| 610 |
+
"logits/chosen": -0.370350182056427,
|
| 611 |
+
"logits/rejected": -0.48758062720298767,
|
| 612 |
+
"logps/chosen": -6.904268741607666,
|
| 613 |
+
"logps/rejected": -27.709651947021484,
|
| 614 |
+
"loss": 0.7636420130729675,
|
| 615 |
+
"memory(GiB)": 46.69,
|
| 616 |
+
"nll_loss": 0.37949565052986145,
|
| 617 |
+
"rewards/accuracies": 0.90625,
|
| 618 |
+
"rewards/chosen": 0.012274645268917084,
|
| 619 |
+
"rewards/margins": 1.4130356311798096,
|
| 620 |
+
"rewards/rejected": -1.4007611274719238,
|
| 621 |
+
"step": 34,
|
| 622 |
+
"train_speed(iter/s)": 0.005596
|
| 623 |
+
},
|
| 624 |
+
{
|
| 625 |
+
"epoch": 0.2867383512544803,
|
| 626 |
+
"grad_norm": 1.870375156402588,
|
| 627 |
+
"learning_rate": 0.0001955572805786141,
|
| 628 |
+
"logits/chosen": -0.32100898027420044,
|
| 629 |
+
"logits/rejected": -0.5096184611320496,
|
| 630 |
+
"logps/chosen": -5.18679666519165,
|
| 631 |
+
"logps/rejected": -32.468994140625,
|
| 632 |
+
"loss": 0.7190079689025879,
|
| 633 |
+
"memory(GiB)": 46.69,
|
| 634 |
+
"nll_loss": 0.4115956127643585,
|
| 635 |
+
"rewards/accuracies": 0.890625,
|
| 636 |
+
"rewards/chosen": 0.07185505330562592,
|
| 637 |
+
"rewards/margins": 1.6462374925613403,
|
| 638 |
+
"rewards/rejected": -1.5743825435638428,
|
| 639 |
+
"step": 35,
|
| 640 |
+
"train_speed(iter/s)": 0.005597
|
| 641 |
+
},
|
| 642 |
+
{
|
| 643 |
+
"epoch": 0.29493087557603687,
|
| 644 |
+
"grad_norm": 6.671431064605713,
|
| 645 |
+
"learning_rate": 0.00019514758987623784,
|
| 646 |
+
"logits/chosen": -0.34625619649887085,
|
| 647 |
+
"logits/rejected": -0.4750059247016907,
|
| 648 |
+
"logps/chosen": -10.31639575958252,
|
| 649 |
+
"logps/rejected": -36.582740783691406,
|
| 650 |
+
"loss": 1.0590507984161377,
|
| 651 |
+
"memory(GiB)": 46.69,
|
| 652 |
+
"nll_loss": 0.6509675979614258,
|
| 653 |
+
"rewards/accuracies": 0.796875,
|
| 654 |
+
"rewards/chosen": -0.20210294425487518,
|
| 655 |
+
"rewards/margins": 1.9486511945724487,
|
| 656 |
+
"rewards/rejected": -2.15075421333313,
|
| 657 |
+
"step": 36,
|
| 658 |
+
"train_speed(iter/s)": 0.005597
|
| 659 |
+
},
|
| 660 |
+
{
|
| 661 |
+
"epoch": 0.30312339989759346,
|
| 662 |
+
"grad_norm": 7.133448123931885,
|
| 663 |
+
"learning_rate": 0.000194720301029191,
|
| 664 |
+
"logits/chosen": -0.3258736729621887,
|
| 665 |
+
"logits/rejected": -0.5075902938842773,
|
| 666 |
+
"logps/chosen": -9.880843162536621,
|
| 667 |
+
"logps/rejected": -39.184967041015625,
|
| 668 |
+
"loss": 1.0690901279449463,
|
| 669 |
+
"memory(GiB)": 46.69,
|
| 670 |
+
"nll_loss": 0.7646387815475464,
|
| 671 |
+
"rewards/accuracies": 0.921875,
|
| 672 |
+
"rewards/chosen": -0.22141867876052856,
|
| 673 |
+
"rewards/margins": 2.19596004486084,
|
| 674 |
+
"rewards/rejected": -2.4173786640167236,
|
| 675 |
+
"step": 37,
|
| 676 |
+
"train_speed(iter/s)": 0.005598
|
| 677 |
+
},
|
| 678 |
+
{
|
| 679 |
+
"epoch": 0.31131592421915005,
|
| 680 |
+
"grad_norm": 3.9345178604125977,
|
| 681 |
+
"learning_rate": 0.00019427549306723097,
|
| 682 |
+
"logits/chosen": -0.32678377628326416,
|
| 683 |
+
"logits/rejected": -0.5091384649276733,
|
| 684 |
+
"logps/chosen": -6.220644950866699,
|
| 685 |
+
"logps/rejected": -38.1715087890625,
|
| 686 |
+
"loss": 0.7903810143470764,
|
| 687 |
+
"memory(GiB)": 46.69,
|
| 688 |
+
"nll_loss": 0.5349410772323608,
|
| 689 |
+
"rewards/accuracies": 0.90625,
|
| 690 |
+
"rewards/chosen": 0.04198794811964035,
|
| 691 |
+
"rewards/margins": 2.360246419906616,
|
| 692 |
+
"rewards/rejected": -2.31825852394104,
|
| 693 |
+
"step": 38,
|
| 694 |
+
"train_speed(iter/s)": 0.005599
|
| 695 |
+
},
|
| 696 |
+
{
|
| 697 |
+
"epoch": 0.3195084485407066,
|
| 698 |
+
"grad_norm": 2.339552402496338,
|
| 699 |
+
"learning_rate": 0.0001938132482603856,
|
| 700 |
+
"logits/chosen": -0.24855449795722961,
|
| 701 |
+
"logits/rejected": -0.46237537264823914,
|
| 702 |
+
"logps/chosen": -4.8696136474609375,
|
| 703 |
+
"logps/rejected": -35.97483825683594,
|
| 704 |
+
"loss": 0.6593115925788879,
|
| 705 |
+
"memory(GiB)": 46.69,
|
| 706 |
+
"nll_loss": 0.3662545680999756,
|
| 707 |
+
"rewards/accuracies": 0.9375,
|
| 708 |
+
"rewards/chosen": 0.0723145455121994,
|
| 709 |
+
"rewards/margins": 1.8895220756530762,
|
| 710 |
+
"rewards/rejected": -1.8172073364257812,
|
| 711 |
+
"step": 39,
|
| 712 |
+
"train_speed(iter/s)": 0.005599
|
| 713 |
+
},
|
| 714 |
+
{
|
| 715 |
+
"epoch": 0.3277009728622632,
|
| 716 |
+
"grad_norm": 2.3479816913604736,
|
| 717 |
+
"learning_rate": 0.0001933336521037367,
|
| 718 |
+
"logits/chosen": -0.3132964074611664,
|
| 719 |
+
"logits/rejected": -0.4357830882072449,
|
| 720 |
+
"logps/chosen": -7.038135528564453,
|
| 721 |
+
"logps/rejected": -29.72612190246582,
|
| 722 |
+
"loss": 0.7142176628112793,
|
| 723 |
+
"memory(GiB)": 46.69,
|
| 724 |
+
"nll_loss": 0.4181695878505707,
|
| 725 |
+
"rewards/accuracies": 0.921875,
|
| 726 |
+
"rewards/chosen": 0.04734823852777481,
|
| 727 |
+
"rewards/margins": 1.5952571630477905,
|
| 728 |
+
"rewards/rejected": -1.5479090213775635,
|
| 729 |
+
"step": 40,
|
| 730 |
+
"train_speed(iter/s)": 0.005599
|
| 731 |
+
},
|
| 732 |
+
{
|
| 733 |
+
"epoch": 0.3358934971838198,
|
| 734 |
+
"grad_norm": 2.551851272583008,
|
| 735 |
+
"learning_rate": 0.00019283679330160726,
|
| 736 |
+
"logits/chosen": -0.32567888498306274,
|
| 737 |
+
"logits/rejected": -0.4566379487514496,
|
| 738 |
+
"logps/chosen": -7.564522743225098,
|
| 739 |
+
"logps/rejected": -29.297645568847656,
|
| 740 |
+
"loss": 0.8506546020507812,
|
| 741 |
+
"memory(GiB)": 46.69,
|
| 742 |
+
"nll_loss": 0.4627075493335724,
|
| 743 |
+
"rewards/accuracies": 0.8125,
|
| 744 |
+
"rewards/chosen": -0.018498025834560394,
|
| 745 |
+
"rewards/margins": 1.5199252367019653,
|
| 746 |
+
"rewards/rejected": -1.5384231805801392,
|
| 747 |
+
"step": 41,
|
| 748 |
+
"train_speed(iter/s)": 0.005599
|
| 749 |
+
},
|
| 750 |
+
{
|
| 751 |
+
"epoch": 0.34408602150537637,
|
| 752 |
+
"grad_norm": 1.9277410507202148,
|
| 753 |
+
"learning_rate": 0.00019232276375115515,
|
| 754 |
+
"logits/chosen": -0.33336636424064636,
|
| 755 |
+
"logits/rejected": -0.4738547205924988,
|
| 756 |
+
"logps/chosen": -6.605499267578125,
|
| 757 |
+
"logps/rejected": -26.275497436523438,
|
| 758 |
+
"loss": 0.7640136480331421,
|
| 759 |
+
"memory(GiB)": 46.69,
|
| 760 |
+
"nll_loss": 0.45767274498939514,
|
| 761 |
+
"rewards/accuracies": 0.953125,
|
| 762 |
+
"rewards/chosen": 0.18768644332885742,
|
| 763 |
+
"rewards/margins": 1.589571237564087,
|
| 764 |
+
"rewards/rejected": -1.4018847942352295,
|
| 765 |
+
"step": 42,
|
| 766 |
+
"train_speed(iter/s)": 0.0056
|
| 767 |
+
},
|
| 768 |
+
{
|
| 769 |
+
"epoch": 0.3522785458269329,
|
| 770 |
+
"grad_norm": 2.7057321071624756,
|
| 771 |
+
"learning_rate": 0.00019179165852537596,
|
| 772 |
+
"logits/chosen": -0.24734170734882355,
|
| 773 |
+
"logits/rejected": -0.4288603663444519,
|
| 774 |
+
"logps/chosen": -8.57066822052002,
|
| 775 |
+
"logps/rejected": -35.444984436035156,
|
| 776 |
+
"loss": 0.9440370798110962,
|
| 777 |
+
"memory(GiB)": 46.69,
|
| 778 |
+
"nll_loss": 0.6365867853164673,
|
| 779 |
+
"rewards/accuracies": 0.8125,
|
| 780 |
+
"rewards/chosen": -0.04400603100657463,
|
| 781 |
+
"rewards/margins": 1.8436404466629028,
|
| 782 |
+
"rewards/rejected": -1.8876465559005737,
|
| 783 |
+
"step": 43,
|
| 784 |
+
"train_speed(iter/s)": 0.0056
|
| 785 |
+
},
|
| 786 |
+
{
|
| 787 |
+
"epoch": 0.3604710701484895,
|
| 788 |
+
"grad_norm": 2.4904823303222656,
|
| 789 |
+
"learning_rate": 0.00019124357585551872,
|
| 790 |
+
"logits/chosen": -0.296947717666626,
|
| 791 |
+
"logits/rejected": -0.43239718675613403,
|
| 792 |
+
"logps/chosen": -8.56611442565918,
|
| 793 |
+
"logps/rejected": -36.052391052246094,
|
| 794 |
+
"loss": 0.8505915403366089,
|
| 795 |
+
"memory(GiB)": 46.69,
|
| 796 |
+
"nll_loss": 0.5557512044906616,
|
| 797 |
+
"rewards/accuracies": 0.875,
|
| 798 |
+
"rewards/chosen": 0.0323612280189991,
|
| 799 |
+
"rewards/margins": 2.1337056159973145,
|
| 800 |
+
"rewards/rejected": -2.1013448238372803,
|
| 801 |
+
"step": 44,
|
| 802 |
+
"train_speed(iter/s)": 0.0056
|
| 803 |
+
},
|
| 804 |
+
{
|
| 805 |
+
"epoch": 0.3686635944700461,
|
| 806 |
+
"grad_norm": 2.8696656227111816,
|
| 807 |
+
"learning_rate": 0.00019067861711291744,
|
| 808 |
+
"logits/chosen": -0.255009263753891,
|
| 809 |
+
"logits/rejected": -0.4662845730781555,
|
| 810 |
+
"logps/chosen": -4.24545431137085,
|
| 811 |
+
"logps/rejected": -36.80644607543945,
|
| 812 |
+
"loss": 0.642361044883728,
|
| 813 |
+
"memory(GiB)": 46.69,
|
| 814 |
+
"nll_loss": 0.373349666595459,
|
| 815 |
+
"rewards/accuracies": 0.921875,
|
| 816 |
+
"rewards/chosen": 0.03832457214593887,
|
| 817 |
+
"rewards/margins": 2.0462074279785156,
|
| 818 |
+
"rewards/rejected": -2.007882833480835,
|
| 819 |
+
"step": 45,
|
| 820 |
+
"train_speed(iter/s)": 0.0056
|
| 821 |
+
},
|
| 822 |
+
{
|
| 823 |
+
"epoch": 0.3768561187916027,
|
| 824 |
+
"grad_norm": 2.3527863025665283,
|
| 825 |
+
"learning_rate": 0.0001900968867902419,
|
| 826 |
+
"logits/chosen": -0.29511338472366333,
|
| 827 |
+
"logits/rejected": -0.4300462305545807,
|
| 828 |
+
"logps/chosen": -6.108550071716309,
|
| 829 |
+
"logps/rejected": -30.907669067382812,
|
| 830 |
+
"loss": 0.8321690559387207,
|
| 831 |
+
"memory(GiB)": 46.69,
|
| 832 |
+
"nll_loss": 0.4702669382095337,
|
| 833 |
+
"rewards/accuracies": 0.84375,
|
| 834 |
+
"rewards/chosen": -0.013932769186794758,
|
| 835 |
+
"rewards/margins": 1.64110267162323,
|
| 836 |
+
"rewards/rejected": -1.6550354957580566,
|
| 837 |
+
"step": 46,
|
| 838 |
+
"train_speed(iter/s)": 0.0056
|
| 839 |
+
},
|
| 840 |
+
{
|
| 841 |
+
"epoch": 0.38504864311315923,
|
| 842 |
+
"grad_norm": 1.8884741067886353,
|
| 843 |
+
"learning_rate": 0.000189498492482171,
|
| 844 |
+
"logits/chosen": -0.28806138038635254,
|
| 845 |
+
"logits/rejected": -0.43808045983314514,
|
| 846 |
+
"logps/chosen": -5.240577697753906,
|
| 847 |
+
"logps/rejected": -29.244850158691406,
|
| 848 |
+
"loss": 0.6651690602302551,
|
| 849 |
+
"memory(GiB)": 46.69,
|
| 850 |
+
"nll_loss": 0.3822129964828491,
|
| 851 |
+
"rewards/accuracies": 0.90625,
|
| 852 |
+
"rewards/chosen": 0.10050319880247116,
|
| 853 |
+
"rewards/margins": 1.6757993698120117,
|
| 854 |
+
"rewards/rejected": -1.5752960443496704,
|
| 855 |
+
"step": 47,
|
| 856 |
+
"train_speed(iter/s)": 0.005601
|
| 857 |
+
},
|
| 858 |
+
{
|
| 859 |
+
"epoch": 0.3932411674347158,
|
| 860 |
+
"grad_norm": 1.7884507179260254,
|
| 861 |
+
"learning_rate": 0.00018888354486549237,
|
| 862 |
+
"logits/chosen": -0.29420942068099976,
|
| 863 |
+
"logits/rejected": -0.43043237924575806,
|
| 864 |
+
"logps/chosen": -6.428597450256348,
|
| 865 |
+
"logps/rejected": -32.303741455078125,
|
| 866 |
+
"loss": 0.700837254524231,
|
| 867 |
+
"memory(GiB)": 46.69,
|
| 868 |
+
"nll_loss": 0.45000576972961426,
|
| 869 |
+
"rewards/accuracies": 0.953125,
|
| 870 |
+
"rewards/chosen": 0.12149131298065186,
|
| 871 |
+
"rewards/margins": 1.8844413757324219,
|
| 872 |
+
"rewards/rejected": -1.7629501819610596,
|
| 873 |
+
"step": 48,
|
| 874 |
+
"train_speed(iter/s)": 0.005601
|
| 875 |
+
},
|
| 876 |
+
{
|
| 877 |
+
"epoch": 0.4014336917562724,
|
| 878 |
+
"grad_norm": 4.318137168884277,
|
| 879 |
+
"learning_rate": 0.00018825215767863214,
|
| 880 |
+
"logits/chosen": -0.18930676579475403,
|
| 881 |
+
"logits/rejected": -0.40716230869293213,
|
| 882 |
+
"logps/chosen": -5.259353160858154,
|
| 883 |
+
"logps/rejected": -37.35228729248047,
|
| 884 |
+
"loss": 0.7124305963516235,
|
| 885 |
+
"memory(GiB)": 46.69,
|
| 886 |
+
"nll_loss": 0.43444421887397766,
|
| 887 |
+
"rewards/accuracies": 0.953125,
|
| 888 |
+
"rewards/chosen": 0.09258248656988144,
|
| 889 |
+
"rewards/margins": 2.3026676177978516,
|
| 890 |
+
"rewards/rejected": -2.210084915161133,
|
| 891 |
+
"step": 49,
|
| 892 |
+
"train_speed(iter/s)": 0.005601
|
| 893 |
+
},
|
| 894 |
+
{
|
| 895 |
+
"epoch": 0.409626216077829,
|
| 896 |
+
"grad_norm": 4.764008522033691,
|
| 897 |
+
"learning_rate": 0.0001876044477006183,
|
| 898 |
+
"logits/chosen": -0.14179718494415283,
|
| 899 |
+
"logits/rejected": -0.313814252614975,
|
| 900 |
+
"logps/chosen": -8.565025329589844,
|
| 901 |
+
"logps/rejected": -39.398197174072266,
|
| 902 |
+
"loss": 1.0041635036468506,
|
| 903 |
+
"memory(GiB)": 46.69,
|
| 904 |
+
"nll_loss": 0.6235343217849731,
|
| 905 |
+
"rewards/accuracies": 0.859375,
|
| 906 |
+
"rewards/chosen": -0.16454477608203888,
|
| 907 |
+
"rewards/margins": 2.0170154571533203,
|
| 908 |
+
"rewards/rejected": -2.1815602779388428,
|
| 909 |
+
"step": 50,
|
| 910 |
+
"train_speed(iter/s)": 0.0056
|
| 911 |
+
}
|
| 912 |
+
],
|
| 913 |
+
"logging_steps": 1,
|
| 914 |
+
"max_steps": 244,
|
| 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": 5.990563570096538e+16,
|
| 931 |
+
"train_batch_size": 4,
|
| 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)
|