LoftQ commited on
Commit
bba2eb9
1 Parent(s): 923b112

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +67 -0
README.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - 'quantization '
8
+ - lora
9
+ - loftq
10
+ - llama
11
+ ---
12
+ # LoftQ Initialization
13
+
14
+ | [Paper](https://arxiv.org/abs/2310.08659) | [Code](https://github.com/yxli2123/LoftQ) | [PEFT Example](https://github.com/huggingface/peft/tree/main/examples/loftq_finetuning) |
15
+
16
+ LoftQ (LoRA-fine-tuning-aware Quantization) provides a quantized backbone Q and LoRA adapters A and B, given a full-precision pre-trained weight W.
17
+
18
+ This model, `Meta-Llama-3-70B-4bit-64rank`, is obtained from [LLAMA-3-70B](https://huggingface.co/meta-llama/Meta-Llama-3-70B).
19
+ The backbone is under `LoftQ/Meta-Llama-3-70B-4bit-64rank` and LoRA adapters are under the `subfolder='loftq_init'`.
20
+
21
+ ## Model Info
22
+ ### Backbone
23
+ - Size: ~ 36 GiB
24
+ - Loaded format: bitsandbytes nf4
25
+ - Size loaded on GPU: ~36 GiB
26
+
27
+ ### LoRA adapters
28
+ - rank: 64
29
+ - lora_alpha: 16
30
+ - target_modules: ["down_proj", "up_proj", "q_proj", "k_proj", "v_proj", "o_proj", "gate_proj"]
31
+
32
+ ## Usage
33
+
34
+ ### Training
35
+ Here's an example of loading this model and preparing for the LoRA fine-tuning.
36
+
37
+ ```python
38
+ import torch
39
+ from transformers import AutoModelForCausalLM, BitsAndBytesConfig
40
+ from peft import PeftModel
41
+
42
+ MODEL_ID = "LoftQ/Meta-Llama-3-70B-4bit-64rank"
43
+
44
+ base_model = AutoModelForCausalLM.from_pretrained(MODEL_ID)
45
+ peft_model = PeftModel.from_pretrained(
46
+ base_model,
47
+ MODEL_ID,
48
+ subfolder="loftq_init",
49
+ is_trainable=True,
50
+ )
51
+
52
+ # Do training with peft_model ...
53
+ ```
54
+
55
+ See the full code at our [Github Repo]((https://github.com/yxli2123/LoftQ))
56
+
57
+
58
+ ## Citation
59
+
60
+ ```bibtex
61
+ @article{li2023loftq,
62
+ title={Loftq: Lora-fine-tuning-aware quantization for large language models},
63
+ author={Li, Yixiao and Yu, Yifan and Liang, Chen and He, Pengcheng and Karampatziakis, Nikos and Chen, Weizhu and Zhao, Tuo},
64
+ journal={arXiv preprint arXiv:2310.08659},
65
+ year={2023}
66
+ }
67
+ ```