Abhinav Kulkarni commited on
Commit
d870c36
1 Parent(s): cc5dd9e

Updated README

Browse files
Files changed (2) hide show
  1. README.md +150 -0
  2. pytorch_model.bin +0 -3
README.md ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ language:
2
+ - en
3
+ pipeline_tag: text-generation
4
+ tags:
5
+ - AWQ
6
+ inference: false
7
+ ---
8
+
9
+ # Stable Beluga 7B
10
+
11
+ `Stable Beluga 7B` is a Llama2 7B model finetuned on an Orca style Dataset.
12
+
13
+ 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).
14
+
15
+ ## Model Date
16
+
17
+ July 29, 2023
18
+
19
+ ## Model License
20
+
21
+ Please refer to original MPT model license ([link](https://huggingface.co/stabilityai/StableBeluga-7B)).
22
+
23
+ Please refer to the AWQ quantization license ([link](https://github.com/llm-awq/blob/main/LICENSE)).
24
+
25
+ ## CUDA Version
26
+
27
+ 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.
28
+
29
+ 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.
30
+
31
+ ## How to Use
32
+
33
+ ```bash
34
+ git clone https://github.com/mit-han-lab/llm-awq \
35
+ && cd llm-awq \
36
+ && git checkout ce4a6bb1c238c014a06672cb74f6865573494d66 \
37
+ && pip install -e . \
38
+ && cd awq/kernels \
39
+ && python setup.py install
40
+ ```
41
+
42
+ ```python
43
+ import torch
44
+ from awq.quantize.quantizer import real_quantize_model_weight
45
+ from transformers import AutoModelForCausalLM, AutoConfig, AutoTokenizer, TextStreamer
46
+ from accelerate import init_empty_weights, load_checkpoint_and_dispatch
47
+ from huggingface_hub import snapshot_download
48
+
49
+ model_name = "abhinavkulkarni/stabilityai-StableBeluga-7B-w4-g128-awq"
50
+
51
+ # Config
52
+ config = AutoConfig.from_pretrained(model_name, trust_remote_code=True)
53
+
54
+ # Tokenizer
55
+ try:
56
+ tokenizer = AutoTokenizer.from_pretrained(config.tokenizer_name, trust_remote_code=True)
57
+ except:
58
+ tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False, trust_remote_code=True)
59
+ streamer = TextStreamer(tokenizer, skip_special_tokens=True)
60
+
61
+ # Model
62
+ w_bit = 4
63
+ q_config = {
64
+ "zero_point": True,
65
+ "q_group_size": 128,
66
+ }
67
+
68
+ load_quant = snapshot_download(model_name)
69
+
70
+ with init_empty_weights():
71
+ model = AutoModelForCausalLM.from_config(config=config,
72
+ torch_dtype=torch.float16, trust_remote_code=True)
73
+
74
+ real_quantize_model_weight(model, w_bit=w_bit, q_config=q_config, init_only=True)
75
+ model.tie_weights()
76
+
77
+ model = load_checkpoint_and_dispatch(model, load_quant, device_map="balanced")
78
+
79
+ # Inference
80
+ prompt = f'''What is the difference between nuclear fusion and fission?
81
+ ###Response:'''
82
+
83
+ input_ids = tokenizer(prompt, return_tensors='pt').input_ids.cuda()
84
+ output = model.generate(
85
+ inputs=input_ids,
86
+ temperature=0.7,
87
+ max_new_tokens=512,
88
+ top_p=0.15,
89
+ top_k=0,
90
+ repetition_penalty=1.1,
91
+ eos_token_id=tokenizer.eos_token_id,
92
+ streamer=streamer)
93
+ ```
94
+
95
+ ## Evaluation
96
+
97
+ This evaluation was done using [LM-Eval](https://github.com/EleutherAI/lm-evaluation-harness).
98
+
99
+ [MPT-7B-Chat](https://huggingface.co/stabilityai/StableBeluga-7B)
100
+
101
+ | Task |Version| Metric |Value | |Stderr|
102
+ |--------|------:|---------------|-----:|---|------|
103
+ |wikitext| 1|word_perplexity|9.5097| | |
104
+ | | |byte_perplexity|1.5238| | |
105
+ | | |bits_per_byte |0.6077| | |
106
+
107
+ [MPT-7B-Chat (4-bit 128-group AWQ)](https://huggingface.co/abhinavkulkarni/stabilityai-StableBeluga-7B-w4-g128-awq)
108
+
109
+ | Task |Version| Metric |Value | |Stderr|
110
+ |--------|------:|---------------|-----:|---|------|
111
+ |wikitext| 1|word_perplexity|9.7783| | |
112
+ | | |byte_perplexity|1.5317| | |
113
+ | | |bits_per_byte |0.6152| | |
114
+
115
+ ## Acknowledgements
116
+
117
+ Please cite this model using the following format:
118
+
119
+ ```bibtext
120
+ @misc{touvron2023llama,
121
+ title={Llama 2: Open Foundation and Fine-Tuned Chat Models},
122
+ 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},
123
+ year={2023},
124
+ eprint={2307.09288},
125
+ archivePrefix={arXiv},
126
+ primaryClass={cs.CL}
127
+ }
128
+ ```
129
+
130
+ ```bibtext
131
+ @misc{mukherjee2023orca,
132
+ title={Orca: Progressive Learning from Complex Explanation Traces of GPT-4},
133
+ author={Subhabrata Mukherjee and Arindam Mitra and Ganesh Jawahar and Sahaj Agarwal and Hamid Palangi and Ahmed Awadallah},
134
+ year={2023},
135
+ eprint={2306.02707},
136
+ archivePrefix={arXiv},
137
+ primaryClass={cs.CL}
138
+ }
139
+ ```
140
+
141
+ The model was quantized with AWQ technique. If you find AWQ useful or relevant to your research, please kindly cite the paper:
142
+
143
+ ```
144
+ @article{lin2023awq,
145
+ title={AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration},
146
+ author={Lin, Ji and Tang, Jiaming and Tang, Haotian and Yang, Shang and Dang, Xingyu and Han, Song},
147
+ journal={arXiv},
148
+ year={2023}
149
+ }
150
+ ```
pytorch_model.bin DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:885a753094b877d484e43dbbdbcce6c172ca436b38fc6dfbebfee2389d86fc23
3
- size 3889575897