abhinavkulkarni commited on
Commit
609533d
1 Parent(s): 18db3fb

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +181 -0
README.md ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-sa-4.0
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
+ datasets:
8
+ - psmathur/orca_minis_uncensored_dataset
9
+ ---
10
+
11
+ # orca_mini_v2_7b
12
+ An **Uncensored** LLaMA-7b 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.
13
+
14
+ 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).
15
+
16
+ ## Model Date
17
+
18
+ July 8, 2023
19
+
20
+ ## Model License
21
+
22
+ Please refer to original Orca Mini v2 model license ([link](https://huggingface.co/psmathur/orca_mini_v2_7b)).
23
+
24
+ Please refer to the AWQ quantization license ([link](https://github.com/llm-awq/blob/main/LICENSE)).
25
+
26
+ ## CUDA Version
27
+
28
+ 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.
29
+
30
+ ## How to Use
31
+
32
+ ```bash
33
+ git clone https://github.com/mit-han-lab/llm-awq \
34
+ && cd llm-awq \
35
+ && git checkout 71d8e68df78de6c0c817b029a568c064bf22132d \
36
+ && pip install -e . \
37
+ && cd awq/kernels \
38
+ && python setup.py install
39
+ ```
40
+
41
+ ```python
42
+ import torch
43
+ from awq.quantize.quantizer import real_quantize_model_weight
44
+ from transformers import AutoModelForCausalLM, AutoConfig, AutoTokenizer
45
+ from accelerate import init_empty_weights, load_checkpoint_and_dispatch
46
+ from huggingface_hub import hf_hub_download
47
+
48
+ model_name = "psmathur/orca_mini_v2_7b"
49
+
50
+ # Config
51
+ config = AutoConfig.from_pretrained(model_name, trust_remote_code=True)
52
+
53
+ # Tokenizer
54
+ tokenizer = AutoTokenizer.from_pretrained(config.tokenizer_name)
55
+
56
+ # Model
57
+ w_bit = 4
58
+ q_config = {
59
+ "zero_point": True,
60
+ "q_group_size": 128,
61
+ }
62
+
63
+ load_quant = hf_hub_download('abhinavkulkarni/psmathur-orca_mini_v2_7b-w4-g128-awq', 'pytorch_model.bin')
64
+
65
+ with init_empty_weights():
66
+ model = AutoModelForCausalLM.from_pretrained(model_name, config=config,
67
+ torch_dtype=torch.float16, trust_remote_code=True)
68
+
69
+ real_quantize_model_weight(model, w_bit=w_bit, q_config=q_config, init_only=True)
70
+
71
+ model = load_checkpoint_and_dispatch(model, load_quant, device_map="balanced")
72
+
73
+ # Inference
74
+ prompt = f'''What is the difference between nuclear fusion and fission?
75
+ ###Response:'''
76
+
77
+ input_ids = tokenizer(prompt, return_tensors='pt').input_ids.cuda()
78
+ output = model.generate(
79
+ inputs=input_ids,
80
+ temperature=0.7,
81
+ max_new_tokens=512,
82
+ top_p=0.15,
83
+ top_k=0,
84
+ repetition_penalty=1.1,
85
+ eos_token_id=tokenizer.eos_token_id
86
+ )
87
+ print(tokenizer.decode(output[0], skip_special_tokens=True))
88
+ ```
89
+
90
+ ## Evaluation
91
+
92
+ This evaluation was done using [LM-Eval](https://github.com/EleutherAI/lm-evaluation-harness).
93
+
94
+ [orca_mini_v2_7b](https://huggingface.co/psmathur/orca_mini_v2_7b)
95
+
96
+ | Task |Version| Metric | Value | |Stderr|
97
+ |--------|------:|---------------|------:|---|------|
98
+ |wikitext| 1|word_perplexity|13.7024| | |
99
+ | | |byte_perplexity| 1.6315| | |
100
+ | | |bits_per_byte | 0.7062| | |
101
+
102
+ [orca_mini_v2_7b (4-bit 128-group AWQ)](https://huggingface.co/abhinavkulkarni/psmathur-orca_mini_v2_7b-w4-g128-awq)
103
+
104
+ | Task |Version| Metric | Value | |Stderr|
105
+ |--------|------:|---------------|------:|---|------|
106
+ |wikitext| 1|word_perplexity|14.1097| | |
107
+ | | |byte_perplexity| 1.6405| | |
108
+ | | |bits_per_byte | 0.7141| | |
109
+
110
+ ## Acknowledgements
111
+
112
+ If you found `orca_mini_v2_7b` useful in your research or applications, please kindly cite using the following BibTeX:
113
+
114
+ ```
115
+ @misc{orca_mini_v2_7b,
116
+ author = {Pankaj Mathur},
117
+ title = {orca_mini_v2_7b: An explain tuned LLaMA-7b model on uncensored wizardlm, alpaca, & dolly datasets},
118
+ year = {2023},
119
+ publisher = {GitHub, HuggingFace},
120
+ journal = {GitHub repository, HuggingFace repository},
121
+ howpublished = {\url{https://https://huggingface.co/psmathur/orca_mini_v2_7b},
122
+ }
123
+ ```
124
+ ```
125
+ @software{touvron2023llama,
126
+ title={LLaMA: Open and Efficient Foundation Language Models},
127
+ 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},
128
+ journal={arXiv preprint arXiv:2302.13971},
129
+ year={2023}
130
+ }
131
+ ```
132
+ ```
133
+ @misc{openalpaca,
134
+ author = {Yixuan Su and Tian Lan and Deng Cai},
135
+ title = {OpenAlpaca: A Fully Open-Source Instruction-Following Model Based On OpenLLaMA},
136
+ year = {2023},
137
+ publisher = {GitHub},
138
+ journal = {GitHub repository},
139
+ howpublished = {\url{https://github.com/yxuansu/OpenAlpaca}},
140
+ }
141
+ ```
142
+ ```
143
+ @misc{alpaca,
144
+ 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 },
145
+ title = {Stanford Alpaca: An Instruction-following LLaMA model},
146
+ year = {2023},
147
+ publisher = {GitHub},
148
+ journal = {GitHub repository},
149
+ howpublished = {\url{https://github.com/tatsu-lab/stanford_alpaca}},
150
+ }
151
+ ```
152
+ ```
153
+ @online{DatabricksBlog2023DollyV2,
154
+ 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},
155
+ title = {Free Dolly: Introducing the World's First Truly Open Instruction-Tuned LLM},
156
+ year = {2023},
157
+ url = {https://www.databricks.com/blog/2023/04/12/dolly-first-open-commercially-viable-instruction-tuned-llm},
158
+ urldate = {2023-06-30}
159
+ }
160
+ ```
161
+ ```
162
+ @misc{xu2023wizardlm,
163
+ title={WizardLM: Empowering Large Language Models to Follow Complex Instructions},
164
+ author={Can Xu and Qingfeng Sun and Kai Zheng and Xiubo Geng and Pu Zhao and Jiazhan Feng and Chongyang Tao and Daxin Jiang},
165
+ year={2023},
166
+ eprint={2304.12244},
167
+ archivePrefix={arXiv},
168
+ primaryClass={cs.CL}
169
+ }
170
+ ```
171
+
172
+ The model was quantized with AWQ technique. If you find AWQ useful or relevant to your research, please kindly cite the paper:
173
+
174
+ ```
175
+ @article{lin2023awq,
176
+ title={AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration},
177
+ author={Lin, Ji and Tang, Jiaming and Tang, Haotian and Yang, Shang and Dang, Xingyu and Han, Song},
178
+ journal={arXiv},
179
+ year={2023}
180
+ }
181
+ ```