Abhinav Kulkarni commited on
Commit
2a82a09
1 Parent(s): 86aaedd

Updated README

Browse files
Files changed (1) hide show
  1. README.md +151 -0
README.md ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - AWQ
7
+ inference: false
8
+ ---
9
+
10
+ # Stable Beluga 13B
11
+
12
+ `Stable Beluga 13B` is a Llama2 13B model finetuned on an Orca style Dataset.
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 29, 2023
19
+
20
+ ## Model License
21
+
22
+ Please refer to original MPT model license ([link](https://huggingface.co/stabilityai/StableBeluga-13B)).
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 `8.0` or higher.
29
+
30
+ For Docker users, the `nvcr.io/nvidia/pytorch:23.06-py3` image is runtime v12.1 but otherwise the same as the configuration above and has also been verified to work.
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 ce4a6bb1c238c014a06672cb74f6865573494d66 \
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, TextStreamer
47
+ from accelerate import init_empty_weights, load_checkpoint_and_dispatch
48
+ from huggingface_hub import snapshot_download
49
+
50
+ model_name = "abhinavkulkarni/stabilityai-StableBeluga-13B-w4-g128-awq"
51
+
52
+ # Config
53
+ config = AutoConfig.from_pretrained(model_name, trust_remote_code=True)
54
+
55
+ # Tokenizer
56
+ try:
57
+ tokenizer = AutoTokenizer.from_pretrained(config.tokenizer_name, trust_remote_code=True)
58
+ except:
59
+ tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False, trust_remote_code=True)
60
+ streamer = TextStreamer(tokenizer, skip_special_tokens=True)
61
+
62
+ # Model
63
+ w_bit = 4
64
+ q_config = {
65
+ "zero_point": True,
66
+ "q_group_size": 128,
67
+ }
68
+
69
+ load_quant = snapshot_download(model_name)
70
+
71
+ with init_empty_weights():
72
+ model = AutoModelForCausalLM.from_config(config=config,
73
+ torch_dtype=torch.float16, trust_remote_code=True)
74
+
75
+ real_quantize_model_weight(model, w_bit=w_bit, q_config=q_config, init_only=True)
76
+ model.tie_weights()
77
+
78
+ model = load_checkpoint_and_dispatch(model, load_quant, device_map="balanced")
79
+
80
+ # Inference
81
+ prompt = f'''What is the difference between nuclear fusion and fission?
82
+ ###Response:'''
83
+
84
+ input_ids = tokenizer(prompt, return_tensors='pt').input_ids.cuda()
85
+ output = model.generate(
86
+ inputs=input_ids,
87
+ temperature=0.7,
88
+ max_new_tokens=512,
89
+ top_p=0.15,
90
+ top_k=0,
91
+ repetition_penalty=1.1,
92
+ eos_token_id=tokenizer.eos_token_id,
93
+ streamer=streamer)
94
+ ```
95
+
96
+ ## Evaluation
97
+
98
+ This evaluation was done using [LM-Eval](https://github.com/EleutherAI/lm-evaluation-harness).
99
+
100
+ [StableBeluga-13B](https://huggingface.co/stabilityai/StableBeluga-13B)
101
+
102
+ | Task |Version| Metric |Value | |Stderr|
103
+ |--------|------:|---------------|-----:|---|------|
104
+ |wikitext| 1|word_perplexity|8.4681| | |
105
+ | | |byte_perplexity|1.4911| | |
106
+ | | |bits_per_byte |0.5764| | |
107
+
108
+ [StableBeluga-13B (4-bit 128-group AWQ)](https://huggingface.co/abhinavkulkarni/stabilityai-StableBeluga-13B-w4-g128-awq)
109
+
110
+ | Task |Version| Metric |Value | |Stderr|
111
+ |--------|------:|---------------|-----:|---|------|
112
+ |wikitext| 1|word_perplexity|8.6765| | |
113
+ | | |byte_perplexity|1.4979| | |
114
+ | | |bits_per_byte |0.5829| | |
115
+
116
+ ## Acknowledgements
117
+
118
+ Please cite this model using the following format:
119
+
120
+ ```bibtext
121
+ @misc{touvron2023llama,
122
+ title={Llama 2: Open Foundation and Fine-Tuned Chat Models},
123
+ author={Hugo Touvron and Louis Martin and Kevin Stone and Peter Albert and Amjad Almahairi and Yasmine Babaei and Nikolay Bashlykov and Soumya Batra and Prajjwal Bhargava and Shruti Bhosale and Dan Bikel and Lukas Blecher and Cristian Canton Ferrer and Moya Chen and Guillem Cucurull and David Esiobu and Jude Fernandes and Jeremy Fu and Wenyin Fu and Brian Fuller and Cynthia Gao and Vedanuj Goswami and Naman Goyal and Anthony Hartshorn and Saghar Hosseini and Rui Hou and Hakan Inan and Marcin Kardas and Viktor Kerkez and Madian Khabsa and Isabel Kloumann and Artem Korenev and Punit Singh Koura and Marie-Anne Lachaux and Thibaut Lavril and Jenya Lee and Diana Liskovich and Yinghai Lu and Yuning Mao and Xavier Martinet and Todor Mihaylov and Pushkar Mishra and Igor Molybog and Yixin Nie and Andrew Poulton and Jeremy Reizenstein and Rashi Rungta and Kalyan Saladi and Alan Schelten and Ruan Silva and Eric Michael Smith and Ranjan Subramanian and Xiaoqing Ellen Tan and Binh Tang and Ross Taylor and Adina Williams and Jian Xiang Kuan and Puxin Xu and Zheng Yan and Iliyan Zarov and Yuchen Zhang and Angela Fan and Melanie Kambadur and Sharan Narang and Aurelien Rodriguez and Robert Stojnic and Sergey Edunov and Thomas Scialom},
124
+ year={2023},
125
+ eprint={2307.09288},
126
+ archivePrefix={arXiv},
127
+ primaryClass={cs.CL}
128
+ }
129
+ ```
130
+
131
+ ```bibtext
132
+ @misc{mukherjee2023orca,
133
+ title={Orca: Progressive Learning from Complex Explanation Traces of GPT-4},
134
+ author={Subhabrata Mukherjee and Arindam Mitra and Ganesh Jawahar and Sahaj Agarwal and Hamid Palangi and Ahmed Awadallah},
135
+ year={2023},
136
+ eprint={2306.02707},
137
+ archivePrefix={arXiv},
138
+ primaryClass={cs.CL}
139
+ }
140
+ ```
141
+
142
+ The model was quantized with AWQ technique. If you find AWQ useful or relevant to your research, please kindly cite the paper:
143
+
144
+ ```
145
+ @article{lin2023awq,
146
+ title={AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration},
147
+ author={Lin, Ji and Tang, Jiaming and Tang, Haotian and Yang, Shang and Dang, Xingyu and Han, Song},
148
+ journal={arXiv},
149
+ year={2023}
150
+ }
151
+ ```