abhinavkulkarni
commited on
Commit
•
6aa0aeb
1
Parent(s):
ee92af0
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-nc-sa-4.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
library_name: transformers
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
tags:
|
8 |
+
- Orca
|
9 |
+
- AWQ
|
10 |
+
inference: false
|
11 |
+
---
|
12 |
+
|
13 |
+
# orca_mini_v2_13b
|
14 |
+
An **Uncensored** LLaMA-13b model in collaboration with [Eric Hartford](https://huggingface.co/ehartford), trained on explain tuned datasets, created using Instructions and Input from WizardLM, Alpaca & Dolly-V2 datasets and applying Orca Research Paper dataset construction approaches.
|
15 |
+
|
16 |
+
This model is a 4-bit 128 group size AWQ quantized model. For more information about AWQ quantization, please click [here](https://github.com/mit-han-lab/llm-awq).
|
17 |
+
|
18 |
+
## Model Date
|
19 |
+
|
20 |
+
July 8, 2023
|
21 |
+
|
22 |
+
## Model License
|
23 |
+
|
24 |
+
Please refer to original Orca Mini v2 model license ([link](https://huggingface.co/psmathur/orca_mini_v2_13b)).
|
25 |
+
|
26 |
+
Please refer to the AWQ quantization license ([link](https://github.com/llm-awq/blob/main/LICENSE)).
|
27 |
+
|
28 |
+
## CUDA Version
|
29 |
+
|
30 |
+
This model was successfully tested on CUDA driver v530.30.02 and runtime v11.7 with Python v3.10.11. Please note that AWQ requires NVIDIA GPUs with compute capability of 80 or higher.
|
31 |
+
|
32 |
+
## How to Use
|
33 |
+
|
34 |
+
```bash
|
35 |
+
git clone https://github.com/mit-han-lab/llm-awq \
|
36 |
+
&& cd llm-awq \
|
37 |
+
&& git checkout 71d8e68df78de6c0c817b029a568c064bf22132d \
|
38 |
+
&& pip install -e . \
|
39 |
+
&& cd awq/kernels \
|
40 |
+
&& python setup.py install
|
41 |
+
```
|
42 |
+
|
43 |
+
```python
|
44 |
+
import torch
|
45 |
+
from awq.quantize.quantizer import real_quantize_model_weight
|
46 |
+
from transformers import AutoModelForCausalLM, AutoConfig, AutoTokenizer
|
47 |
+
from accelerate import init_empty_weights, load_checkpoint_and_dispatch
|
48 |
+
from huggingface_hub import hf_hub_download
|
49 |
+
|
50 |
+
model_name = "psmathur/orca_mini_v2_13b"
|
51 |
+
|
52 |
+
# Config
|
53 |
+
config = AutoConfig.from_pretrained(model_name, trust_remote_code=True)
|
54 |
+
|
55 |
+
# Tokenizer
|
56 |
+
tokenizer = AutoTokenizer.from_pretrained(config.tokenizer_name)
|
57 |
+
|
58 |
+
# Model
|
59 |
+
w_bit = 4
|
60 |
+
q_config = {
|
61 |
+
"zero_point": True,
|
62 |
+
"q_group_size": 128,
|
63 |
+
}
|
64 |
+
|
65 |
+
load_quant = hf_hub_download('abhinavkulkarni/psmathur-orca_mini_v2_13b-w4-g128-awq', 'pytorch_model.bin')
|
66 |
+
|
67 |
+
with init_empty_weights():
|
68 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, config=config,
|
69 |
+
torch_dtype=torch.float16, trust_remote_code=True)
|
70 |
+
|
71 |
+
real_quantize_model_weight(model, w_bit=w_bit, q_config=q_config, init_only=True)
|
72 |
+
|
73 |
+
model = load_checkpoint_and_dispatch(model, load_quant, device_map="balanced")
|
74 |
+
|
75 |
+
# Inference
|
76 |
+
prompt = f'''What is the difference between nuclear fusion and fission?
|
77 |
+
###Response:'''
|
78 |
+
|
79 |
+
input_ids = tokenizer(prompt, return_tensors='pt').input_ids.cuda()
|
80 |
+
output = model.generate(
|
81 |
+
inputs=input_ids,
|
82 |
+
temperature=0.7,
|
83 |
+
max_new_tokens=512,
|
84 |
+
top_p=0.15,
|
85 |
+
top_k=0,
|
86 |
+
repetition_penalty=1.1,
|
87 |
+
eos_token_id=tokenizer.eos_token_id
|
88 |
+
)
|
89 |
+
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
90 |
+
```
|
91 |
+
|
92 |
+
## Evaluation
|
93 |
+
|
94 |
+
This evaluation was done using [LM-Eval](https://github.com/EleutherAI/lm-evaluation-harness).
|
95 |
+
|
96 |
+
[orca_mini_v2_13b](https://huggingface.co/psmathur/orca_mini_v2_13b)
|
97 |
+
|
98 |
+
| Task |Version| Metric | Value | |Stderr|
|
99 |
+
|--------|------:|---------------|------:|---|------|
|
100 |
+
|wikitext| 1|word_perplexity|23.8997| | |
|
101 |
+
| | |byte_perplexity| 1.8104| | |
|
102 |
+
| | |bits_per_byte | 0.8563| | |
|
103 |
+
|
104 |
+
[orca_mini_v2_13b (4-bit 128-group AWQ)](https://huggingface.co/abhinavkulkarni/psmathur-orca_mini_v2_13b-w4-g128-awq)
|
105 |
+
|
106 |
+
| Task |Version| Metric | Value | |Stderr|
|
107 |
+
|--------|------:|---------------|------:|---|------|
|
108 |
+
|wikitext| 1|word_perplexity|27.4695| | |
|
109 |
+
| | |byte_perplexity| 1.8581| | |
|
110 |
+
| | |bits_per_byte | 0.8938| | |
|
111 |
+
|
112 |
+
## Acknowledgements
|
113 |
+
|
114 |
+
If you found `orca_mini_v2_13b` useful in your research or applications, please kindly cite using the following BibTeX:
|
115 |
+
|
116 |
+
```
|
117 |
+
@misc{orca_mini_v2_13b,
|
118 |
+
author = {Pankaj Mathur},
|
119 |
+
title = {orca_mini_v2_13b: An explain tuned LLaMA-13b model on uncensored wizardlm, alpaca, & dolly datasets},
|
120 |
+
year = {2023},
|
121 |
+
publisher = {GitHub, HuggingFace},
|
122 |
+
journal = {GitHub repository, HuggingFace repository},
|
123 |
+
howpublished = {\url{https://https://huggingface.co/psmathur/orca_mini_v2_13b},
|
124 |
+
}
|
125 |
+
```
|
126 |
+
```
|
127 |
+
@software{touvron2023llama,
|
128 |
+
title={LLaMA: Open and Efficient Foundation Language Models},
|
129 |
+
author={Touvron, Hugo and Lavril, Thibaut and Izacard, Gautier and Martinet, Xavier and Lachaux, Marie-Anne and Lacroix, Timoth{\'e}e and Rozi{\`e}re, Baptiste and Goyal, Naman and Hambro, Eric and Azhar, Faisal and Rodriguez, Aurelien and Joulin, Armand and Grave, Edouard and Lample, Guillaume},
|
130 |
+
journal={arXiv preprint arXiv:2302.13971},
|
131 |
+
year={2023}
|
132 |
+
}
|
133 |
+
```
|
134 |
+
```
|
135 |
+
@misc{openalpaca,
|
136 |
+
author = {Yixuan Su and Tian Lan and Deng Cai},
|
137 |
+
title = {OpenAlpaca: A Fully Open-Source Instruction-Following Model Based On OpenLLaMA},
|
138 |
+
year = {2023},
|
139 |
+
publisher = {GitHub},
|
140 |
+
journal = {GitHub repository},
|
141 |
+
howpublished = {\url{https://github.com/yxuansu/OpenAlpaca}},
|
142 |
+
}
|
143 |
+
```
|
144 |
+
```
|
145 |
+
@misc{alpaca,
|
146 |
+
author = {Rohan Taori and Ishaan Gulrajani and Tianyi Zhang and Yann Dubois and Xuechen Li and Carlos Guestrin and Percy Liang and Tatsunori B. Hashimoto },
|
147 |
+
title = {Stanford Alpaca: An Instruction-following LLaMA model},
|
148 |
+
year = {2023},
|
149 |
+
publisher = {GitHub},
|
150 |
+
journal = {GitHub repository},
|
151 |
+
howpublished = {\url{https://github.com/tatsu-lab/stanford_alpaca}},
|
152 |
+
}
|
153 |
+
```
|
154 |
+
```
|
155 |
+
@online{DatabricksBlog2023DollyV2,
|
156 |
+
author = {Mike Conover and Matt Hayes and Ankit Mathur and Jianwei Xie and Jun Wan and Sam Shah and Ali Ghodsi and Patrick Wendell and Matei Zaharia and Reynold Xin},
|
157 |
+
title = {Free Dolly: Introducing the World's First Truly Open Instruction-Tuned LLM},
|
158 |
+
year = {2023},
|
159 |
+
url = {https://www.databricks.com/blog/2023/04/12/dolly-first-open-commercially-viable-instruction-tuned-llm},
|
160 |
+
urldate = {2023-06-30}
|
161 |
+
}
|
162 |
+
```
|
163 |
+
```
|
164 |
+
@misc{xu2023wizardlm,
|
165 |
+
title={WizardLM: Empowering Large Language Models to Follow Complex Instructions},
|
166 |
+
author={Can Xu and Qingfeng Sun and Kai Zheng and Xiubo Geng and Pu Zhao and Jiazhan Feng and Chongyang Tao and Daxin Jiang},
|
167 |
+
year={2023},
|
168 |
+
eprint={2304.12244},
|
169 |
+
archivePrefix={arXiv},
|
170 |
+
primaryClass={cs.CL}
|
171 |
+
}
|
172 |
+
```
|
173 |
+
|
174 |
+
The model was quantized with AWQ technique. If you find AWQ useful or relevant to your research, please kindly cite the paper:
|
175 |
+
|
176 |
+
```
|
177 |
+
@article{lin2023awq,
|
178 |
+
title={AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration},
|
179 |
+
author={Lin, Ji and Tang, Jiaming and Tang, Haotian and Yang, Shang and Dang, Xingyu and Han, Song},
|
180 |
+
journal={arXiv},
|
181 |
+
year={2023}
|
182 |
+
}
|
183 |
+
```
|