minhchuxuan commited on
Commit
4199d48
·
verified ·
1 Parent(s): e31df2e

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +222 -0
README.md ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: meta-llama/Llama-2-7b-hf
4
+ tags:
5
+ - llama
6
+ - lora
7
+ - instruction-tuning
8
+ - dolly
9
+ - minillm
10
+ datasets:
11
+ - databricks/databricks-dolly-15k
12
+ language:
13
+ - en
14
+ ---
15
+
16
+ # LLaMA-7B LoRA Fine-tuned on Dolly
17
+
18
+ This is a LoRA adapter for LLaMA-7B, fine-tuned on the Databricks Dolly dataset using the MiniLLM framework.
19
+
20
+ ## Model Details
21
+
22
+ - **Base Model**: LLaMA-7B
23
+ - **Training Method**: LoRA (Low-Rank Adaptation)
24
+ - **Dataset**: Databricks Dolly 15k
25
+ - **Framework**: MiniLLM
26
+
27
+ ## Training Configuration
28
+
29
+ ```json
30
+ {
31
+ "model_path": "/workspace/LMOps/minillm/checkpoints/llama-7b/",
32
+ "ckpt_name": "llama-7b",
33
+ "model_type": "llama",
34
+ "teacher_model_type": null,
35
+ "n_gpu": 2,
36
+ "n_nodes": 1,
37
+ "teacher_model_path": null,
38
+ "teacher_ckpt_name": null,
39
+ "teacher_model_fp16": false,
40
+ "model_parallel": false,
41
+ "model_parallel_size": null,
42
+ "no_value": false,
43
+ "dropout_path_rate": null,
44
+ "dtype": "torch.float16",
45
+ "type": "lm",
46
+ "do_train": true,
47
+ "do_valid": true,
48
+ "do_eval": false,
49
+ "base_path": "/workspace/LMOps/minillm",
50
+ "load": null,
51
+ "save": "/workspace/LMOps/minillm/results/llama/train/sft/e20-bs4-lr0.0005-G1-N2-NN1-lora-8-32-0.1",
52
+ "log_interval": 4,
53
+ "mid_log_num": 1,
54
+ "save_interval": -1,
55
+ "eval_interval": -1,
56
+ "local_rank": 0,
57
+ "save_additional_suffix": "",
58
+ "save_rollout": false,
59
+ "eb_sample_times": 3,
60
+ "data_dir": "/workspace/LMOps/minillm/processed_data/dolly/",
61
+ "processed_data_dir": null,
62
+ "force_process": false,
63
+ "force_process_demo": false,
64
+ "data_process_workers": -1,
65
+ "train_num": -1,
66
+ "train_ratio": 1,
67
+ "dev_num": 1000,
68
+ "dev_ratio": 1,
69
+ "gen_num": -1,
70
+ "data_names": null,
71
+ "prompt_type": null,
72
+ "num_workers": 0,
73
+ "max_prompt_length": 256,
74
+ "min_prompt_length": 128,
75
+ "json_data": false,
76
+ "bin_data": false,
77
+ "txt_data": false,
78
+ "prompt_data_dir": null,
79
+ "lm_data_dir": null,
80
+ "eval_ppl": false,
81
+ "eval_rw": false,
82
+ "eval_gen": true,
83
+ "only_prompt": false,
84
+ "batch_size": 4,
85
+ "eval_batch_size": 8,
86
+ "clip_grad": 1.0,
87
+ "total_iters": null,
88
+ "train_iters_per_epoch": -1,
89
+ "max_length": 512,
90
+ "seed": 20,
91
+ "seed_order": 10,
92
+ "seed_data": 42,
93
+ "seed_ppo": 42,
94
+ "seed_lm": 7,
95
+ "epochs": 20,
96
+ "training_epochs": 10000,
97
+ "gradient_accumulation_steps": 1,
98
+ "gradient_checkpointing": true,
99
+ "attn_dtype": null,
100
+ "lr": 0.0005,
101
+ "lr_min": 1e-07,
102
+ "weight_decay": 0.01,
103
+ "loss_scale": 65536,
104
+ "kd_ratio": null,
105
+ "warmup_iters": 0,
106
+ "lr_decay_iters": null,
107
+ "lr_decay_style": "cosine",
108
+ "scheduler_name": "constant_trm",
109
+ "reward_scaling": null,
110
+ "cliprange_reward": 1,
111
+ "ppo_epochs": null,
112
+ "num_rollouts": 256,
113
+ "num_rollouts_per_device": null,
114
+ "cliprange": 0.2,
115
+ "chunk_size": null,
116
+ "gamma": 0.95,
117
+ "length_norm": false,
118
+ "single_step_reg": false,
119
+ "teacher_mixed_alpha": null,
120
+ "lm_coef": 1,
121
+ "top_k": 0,
122
+ "top_p": 1.0,
123
+ "do_sample": true,
124
+ "no_repeat_ngram_size": 6,
125
+ "repetition_penalty": null,
126
+ "num_beams": 1,
127
+ "temperature": 1.0,
128
+ "peft": "lora",
129
+ "peft_lora_r": 8,
130
+ "peft_lora_alpha": 32,
131
+ "peft_lora_dropout": 0.1,
132
+ "peft_name": null,
133
+ "peft_path": null,
134
+ "teacher_peft_name": null,
135
+ "teacher_peft_path": null,
136
+ "deepspeed": true,
137
+ "deepspeed_config": "/workspace/LMOps/minillm/configs/deepspeed/ds_config_zero2_fp16.json",
138
+ "deepscale": false,
139
+ "deepscale_config": null,
140
+ "rank": 0,
141
+ "world_size": 2
142
+ }
143
+ ```
144
+
145
+ ## LoRA Configuration
146
+
147
+ - **Rank (r)**: 8
148
+ - **Alpha**: 32
149
+ - **Dropout**: 0.1
150
+ - **Target Modules**: q_proj, v_proj
151
+ - **Trainable Parameters**: ~8.4M (LoRA adapters only)
152
+
153
+ ## Performance
154
+
155
+ Based on validation set (1000 samples):
156
+
157
+ - **Final Loss**: 2.63
158
+ - **Exact Match**: 7.5%
159
+ - **RougeL**: 32.04%
160
+
161
+ ## Usage
162
+
163
+ ```python
164
+ from transformers import AutoModelForCausalLM, AutoTokenizer
165
+ from peft import PeftModel
166
+
167
+ # Load base model
168
+ base_model = AutoModelForCausalLM.from_pretrained(
169
+ "meta-llama/Llama-2-7b-hf",
170
+ torch_dtype=torch.float16,
171
+ device_map="auto"
172
+ )
173
+
174
+ # Load LoRA adapter
175
+ model = PeftModel.from_pretrained(
176
+ base_model,
177
+ "minhchuxuan/llama-7b-dolly-lora"
178
+ )
179
+
180
+ tokenizer = AutoTokenizer.from_pretrained("minhchuxuan/llama-7b-dolly-lora")
181
+
182
+ # Generate
183
+ inputs = tokenizer("Instruction: Explain what is machine learning.\n\nResponse:", return_tensors="pt")
184
+ outputs = model.generate(**inputs, max_length=256)
185
+ print(tokenizer.decode(outputs[0]))
186
+ ```
187
+
188
+ ## Training Details
189
+
190
+ - **Epochs**: 20
191
+ - **Batch Size**: 4
192
+ - **Learning Rate**: 0.0005
193
+ - **Gradient Accumulation**: 1
194
+ - **GPUs**: 2
195
+ - **Total Training Steps**: 27,240
196
+ - **Optimizer**: AdamW with cosine decay
197
+ - **Weight Decay**: 0.01
198
+ - **Gradient Clipping**: 1.0
199
+
200
+ ## Limitations
201
+
202
+ - This model inherits the limitations of LLaMA-7B
203
+ - Fine-tuned on English instruction-following tasks only
204
+ - May generate biased or incorrect responses
205
+ - Requires the base LLaMA-7B model to use
206
+
207
+ ## Citation
208
+
209
+ If you use this model, please cite the MiniLLM paper:
210
+
211
+ ```bibtex
212
+ @inproceedings{minillm,
213
+ title={MiniLLM: Knowledge Distillation of Large Language Models},
214
+ author={Gu, Yuxian and Dong, Li and Wei, Furu and Huang, Minlie},
215
+ booktitle={Proceedings of ICLR},
216
+ year={2024}
217
+ }
218
+ ```
219
+
220
+ ## License
221
+
222
+ This model is released under Apache 2.0 license. Note that LLaMA models have specific usage terms from Meta.