Text Generation
Transformers
Safetensors
English
llama
text-generation-inference
4-bit precision
awq
TheBloke commited on
Commit
5792922
1 Parent(s): 7f8d791

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +371 -0
README.md ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://huggingface.co/stabilityai/StableBeluga2
3
+ datasets:
4
+ - conceptofmind/cot_submix_original
5
+ - conceptofmind/flan2021_submix_original
6
+ - conceptofmind/t0_submix_original
7
+ - conceptofmind/niv2_submix_original
8
+ inference: false
9
+ language:
10
+ - en
11
+ license: llama2
12
+ model_creator: Stability AI
13
+ model_name: StableBeluga2
14
+ model_type: llama
15
+ pipeline_tag: text-generation
16
+ prompt_template: '### System:
17
+
18
+ {system_message}
19
+
20
+
21
+ ### User:
22
+
23
+ {prompt}
24
+
25
+
26
+ ### Assistant:
27
+
28
+ '
29
+ quantized_by: TheBloke
30
+ ---
31
+
32
+ <!-- header start -->
33
+ <!-- 200823 -->
34
+ <div style="width: auto; margin-left: auto; margin-right: auto">
35
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
36
+ </div>
37
+ <div style="display: flex; justify-content: space-between; width: 100%;">
38
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
39
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
40
+ </div>
41
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
42
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
43
+ </div>
44
+ </div>
45
+ <div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
46
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
47
+ <!-- header end -->
48
+
49
+ # StableBeluga2 - AWQ
50
+ - Model creator: [Stability AI](https://huggingface.co/stabilityai)
51
+ - Original model: [StableBeluga2](https://huggingface.co/stabilityai/StableBeluga2)
52
+
53
+ <!-- description start -->
54
+ ## Description
55
+
56
+ This repo contains AWQ model files for [Stability AI's StableBeluga2](https://huggingface.co/stabilityai/StableBeluga2).
57
+
58
+
59
+ ### About AWQ
60
+
61
+ AWQ is an efficient, accurate and blazing-fast low-bit weight quantization method, currently supporting 4-bit quantization. Compared to GPTQ, it offers faster Transformers-based inference.
62
+
63
+ It is also now supported by continuous batching server [vLLM](https://github.com/vllm-project/vllm), allowing use of AWQ models for high-throughput concurrent inference in multi-user server scenarios. Note that, at the time of writing, overall throughput is still lower than running vLLM with unquantised models, however using AWQ enables using much smaller GPUs which can lead to easier deployment and overall cost savings. For example, a 70B model can be run on 1 x 48GB GPU instead of 2 x 80GB.
64
+ <!-- description end -->
65
+ <!-- repositories-available start -->
66
+ ## Repositories available
67
+
68
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/StableBeluga2-70B-AWQ)
69
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/StableBeluga2-70B-GPTQ)
70
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/StableBeluga2-70B-GGUF)
71
+ * [Stability AI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/stabilityai/StableBeluga2)
72
+ <!-- repositories-available end -->
73
+
74
+ <!-- prompt-template start -->
75
+ ## Prompt template: Orca-Hashes
76
+
77
+ ```
78
+ ### System:
79
+ {system_message}
80
+
81
+ ### User:
82
+ {prompt}
83
+
84
+ ### Assistant:
85
+
86
+ ```
87
+
88
+ <!-- prompt-template end -->
89
+
90
+
91
+ <!-- README_AWQ.md-provided-files start -->
92
+ ## Provided files and AWQ parameters
93
+
94
+ For my first release of AWQ models, I am releasing 128g models only. I will consider adding 32g as well if there is interest, and once I have done perplexity and evaluation comparisons, but at this time 32g models are still not fully tested with AutoAWQ and vLLM.
95
+
96
+ Models are released as sharded safetensors files.
97
+
98
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
99
+ | ------ | ---- | -- | ----------- | ------- | ---- |
100
+ | [main](https://huggingface.co/TheBloke/StableBeluga2-70B-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 36.61 GB
101
+
102
+ <!-- README_AWQ.md-provided-files end -->
103
+
104
+ <!-- README_AWQ.md-use-from-vllm start -->
105
+ ## Serving this model from vLLM
106
+
107
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
108
+
109
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
110
+
111
+ ```shell
112
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/StableBeluga2-70B-AWQ --quantization awq
113
+ ```
114
+
115
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
116
+
117
+ ```python
118
+ from vllm import LLM, SamplingParams
119
+
120
+ prompts = [
121
+ "Hello, my name is",
122
+ "The president of the United States is",
123
+ "The capital of France is",
124
+ "The future of AI is",
125
+ ]
126
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
127
+
128
+ llm = LLM(model="TheBloke/StableBeluga2-70B-AWQ", quantization="awq")
129
+
130
+ outputs = llm.generate(prompts, sampling_params)
131
+
132
+ # Print the outputs.
133
+ for output in outputs:
134
+ prompt = output.prompt
135
+ generated_text = output.outputs[0].text
136
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
137
+ ```
138
+ <!-- README_AWQ.md-use-from-vllm start -->
139
+
140
+ <!-- README_AWQ.md-use-from-python start -->
141
+ ## How to use this AWQ model from Python code
142
+
143
+ ### Install the necessary packages
144
+
145
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
146
+
147
+ ```shell
148
+ pip3 install autoawq
149
+ ```
150
+
151
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
152
+
153
+ ```shell
154
+ pip3 uninstall -y autoawq
155
+ git clone https://github.com/casper-hansen/AutoAWQ
156
+ cd AutoAWQ
157
+ pip3 install .
158
+ ```
159
+
160
+ ### You can then try the following example code
161
+
162
+ ```python
163
+ from awq import AutoAWQForCausalLM
164
+ from transformers import AutoTokenizer
165
+
166
+ model_name_or_path = "TheBloke/StableBeluga2-70B-AWQ"
167
+
168
+ # Load model
169
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
170
+ trust_remote_code=False, safetensors=True)
171
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
172
+
173
+ prompt = "Tell me about AI"
174
+ prompt_template=f'''### System:
175
+ {system_message}
176
+
177
+ ### User:
178
+ {prompt}
179
+
180
+ ### Assistant:
181
+
182
+ '''
183
+
184
+ print("\n\n*** Generate:")
185
+
186
+ tokens = tokenizer(
187
+ prompt_template,
188
+ return_tensors='pt'
189
+ ).input_ids.cuda()
190
+
191
+ # Generate output
192
+ generation_output = model.generate(
193
+ tokens,
194
+ do_sample=True,
195
+ temperature=0.7,
196
+ top_p=0.95,
197
+ top_k=40,
198
+ max_new_tokens=512
199
+ )
200
+
201
+ print("Output: ", tokenizer.decode(generation_output[0]))
202
+
203
+ # Inference can also be done using transformers' pipeline
204
+ from transformers import pipeline
205
+
206
+ print("*** Pipeline:")
207
+ pipe = pipeline(
208
+ "text-generation",
209
+ model=model,
210
+ tokenizer=tokenizer,
211
+ max_new_tokens=512,
212
+ do_sample=True,
213
+ temperature=0.7,
214
+ top_p=0.95,
215
+ top_k=40,
216
+ repetition_penalty=1.1
217
+ )
218
+
219
+ print(pipe(prompt_template)[0]['generated_text'])
220
+ ```
221
+ <!-- README_AWQ.md-use-from-python end -->
222
+
223
+ <!-- README_AWQ.md-compatibility start -->
224
+ ## Compatibility
225
+
226
+ The files provided are tested to work with [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), and [vLLM](https://github.com/vllm-project/vllm).
227
+
228
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is not yet compatible with AWQ, but a PR is open which should bring support soon: [TGI PR #781](https://github.com/huggingface/text-generation-inference/issues/781).
229
+ <!-- README_AWQ.md-compatibility end -->
230
+
231
+ <!-- footer start -->
232
+ <!-- 200823 -->
233
+ ## Discord
234
+
235
+ For further support, and discussions on these models and AI in general, join us at:
236
+
237
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
238
+
239
+ ## Thanks, and how to contribute
240
+
241
+ Thanks to the [chirper.ai](https://chirper.ai) team!
242
+
243
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
244
+
245
+ I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
246
+
247
+ If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
248
+
249
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
250
+
251
+ * Patreon: https://patreon.com/TheBlokeAI
252
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
253
+
254
+ **Special thanks to**: Aemon Algiz.
255
+
256
+ **Patreon special mentions**: Alicia Loh, Stephen Murray, K, Ajan Kanaga, RoA, Magnesian, Deo Leter, Olakabola, Eugene Pentland, zynix, Deep Realms, Raymond Fosdick, Elijah Stavena, Iucharbius, Erik Bjäreholt, Luis Javier Navarrete Lozano, Nicholas, theTransient, John Detwiler, alfie_i, knownsqashed, Mano Prime, Willem Michiel, Enrico Ros, LangChain4j, OG, Michael Dempsey, Pierre Kircher, Pedro Madruga, James Bentley, Thomas Belote, Luke @flexchar, Leonard Tan, Johann-Peter Hartmann, Illia Dulskyi, Fen Risland, Chadd, S_X, Jeff Scroggin, Ken Nordquist, Sean Connelly, Artur Olbinski, Swaroop Kallakuri, Jack West, Ai Maven, David Ziegler, Russ Johnson, transmissions 11, John Villwock, Alps Aficionado, Clay Pascal, Viktor Bowallius, Subspace Studios, Rainer Wilmers, Trenton Dambrowitz, vamX, Michael Levine, 준교 김, Brandon Frisco, Kalila, Trailburnt, Randy H, Talal Aujan, Nathan Dryer, Vadim, 阿明, ReadyPlayerEmma, Tiffany J. Kim, George Stoitzev, Spencer Kim, Jerry Meng, Gabriel Tamborski, Cory Kujawski, Jeffrey Morgan, Spiking Neurons AB, Edmond Seymore, Alexandros Triantafyllidis, Lone Striker, Cap'n Zoog, Nikolai Manek, danny, ya boyyy, Derek Yates, usrbinkat, Mandus, TL, Nathan LeClaire, subjectnull, Imad Khwaja, webtim, Raven Klaugh, Asp the Wyvern, Gabriel Puliatti, Caitlyn Gatomon, Joseph William Delisle, Jonathan Leane, Luke Pendergrass, SuperWojo, Sebastain Graf, Will Dee, Fred von Graf, Andrey, Dan Guido, Daniel P. Andersen, Nitin Borwankar, Elle, Vitor Caleffi, biorpg, jjj, NimbleBox.ai, Pieter, Matthew Berman, terasurfer, Michael Davis, Alex, Stanislav Ovsiannikov
257
+
258
+
259
+ Thank you to all my generous patrons and donaters!
260
+
261
+ And thank you again to a16z for their generous grant.
262
+
263
+ <!-- footer end -->
264
+
265
+ # Original model card: Stability AI's StableBeluga2
266
+
267
+ # Stable Beluga 2
268
+
269
+ Use [Stable Chat (Research Preview)](https://chat.stability.ai/chat) to test Stability AI's best language models for free
270
+
271
+ ## Model Description
272
+
273
+ `Stable Beluga 2` is a Llama2 70B model finetuned on an Orca style Dataset
274
+
275
+ ## Usage
276
+
277
+ Start chatting with `Stable Beluga 2` using the following code snippet:
278
+
279
+ ```python
280
+ import torch
281
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
282
+
283
+ tokenizer = AutoTokenizer.from_pretrained("stabilityai/StableBeluga2", use_fast=False)
284
+ model = AutoModelForCausalLM.from_pretrained("stabilityai/StableBeluga2", torch_dtype=torch.float16, low_cpu_mem_usage=True, device_map="auto")
285
+ system_prompt = "### System:\nYou are Stable Beluga, an AI that follows instructions extremely well. Help as much as you can. Remember, be safe, and don't do anything illegal.\n\n"
286
+
287
+ message = "Write me a poem please"
288
+ prompt = f"{system_prompt}### User: {message}\n\n### Assistant:\n"
289
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
290
+ output = model.generate(**inputs, do_sample=True, top_p=0.95, top_k=0, max_new_tokens=256)
291
+
292
+ print(tokenizer.decode(output[0], skip_special_tokens=True))
293
+ ```
294
+
295
+ Stable Beluga 2 should be used with this prompt format:
296
+ ```
297
+ ### System:
298
+ This is a system prompt, please behave and help the user.
299
+
300
+ ### User:
301
+ Your prompt here
302
+
303
+ ### Assistant:
304
+ The output of Stable Beluga 2
305
+ ```
306
+
307
+ ## Other Beluga Models
308
+
309
+ [StableBeluga 1 - Delta](https://huggingface.co/stabilityai/StableBeluga1-Delta)
310
+ [StableBeluga 13B](https://huggingface.co/stabilityai/StableBeluga-13B)
311
+ [StableBeluga 7B](https://huggingface.co/stabilityai/StableBeluga-7B)
312
+
313
+ ## Model Details
314
+
315
+ * **Developed by**: [Stability AI](https://stability.ai/)
316
+ * **Model type**: Stable Beluga 2 is an auto-regressive language model fine-tuned on Llama2 70B.
317
+ * **Language(s)**: English
318
+ * **Library**: [HuggingFace Transformers](https://github.com/huggingface/transformers)
319
+ * **License**: Fine-tuned checkpoints (`Stable Beluga 2`) is licensed under the [STABLE BELUGA NON-COMMERCIAL COMMUNITY LICENSE AGREEMENT](https://huggingface.co/stabilityai/StableBeluga2/blob/main/LICENSE.txt)
320
+ * **Contact**: For questions and comments about the model, please email `lm@stability.ai`
321
+
322
+ ### Training Dataset
323
+
324
+ ` Stable Beluga 2` is trained on our internal Orca-style dataset
325
+
326
+ ### Training Procedure
327
+
328
+ Models are learned via supervised fine-tuning on the aforementioned datasets, trained in mixed-precision (BF16), and optimized with AdamW. We outline the following hyperparameters:
329
+
330
+ | Dataset | Batch Size | Learning Rate |Learning Rate Decay| Warm-up | Weight Decay | Betas |
331
+ |-------------------|------------|---------------|-------------------|---------|--------------|-------------|
332
+ | Orca pt1 packed | 256 | 3e-5 | Cosine to 3e-6 | 100 | 1e-6 | (0.9, 0.95) |
333
+ | Orca pt2 unpacked | 512 | 3e-5 | Cosine to 3e-6 | 100 | 1e-6 | (0.9, 0.95) |
334
+
335
+ ## Ethical Considerations and Limitations
336
+
337
+ Beluga is a new technology that carries risks with use. Testing conducted to date has been in English, and has not covered, nor could it cover all scenarios. For these reasons, as with all LLMs, Beluga's potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses to user prompts. Therefore, before deploying any applications of Beluga, developers should perform safety testing and tuning tailored to their specific applications of the model.
338
+
339
+ ## How to cite
340
+
341
+ ```bibtex
342
+ @misc{StableBelugaModels,
343
+ url={[https://huggingface.co/stabilityai/StableBeluga2](https://huggingface.co/stabilityai/StableBeluga2)},
344
+ title={Stable Beluga models},
345
+ author={Mahan, Dakota and Carlow, Ryan and Castricato, Louis and Cooper, Nathan and Laforte, Christian}
346
+ }
347
+ ```
348
+
349
+ ## Citations
350
+
351
+ ```bibtext
352
+ @misc{touvron2023llama,
353
+ title={Llama 2: Open Foundation and Fine-Tuned Chat Models},
354
+ 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},
355
+ year={2023},
356
+ eprint={2307.09288},
357
+ archivePrefix={arXiv},
358
+ primaryClass={cs.CL}
359
+ }
360
+ ```
361
+
362
+ ```bibtext
363
+ @misc{mukherjee2023orca,
364
+ title={Orca: Progressive Learning from Complex Explanation Traces of GPT-4},
365
+ author={Subhabrata Mukherjee and Arindam Mitra and Ganesh Jawahar and Sahaj Agarwal and Hamid Palangi and Ahmed Awadallah},
366
+ year={2023},
367
+ eprint={2306.02707},
368
+ archivePrefix={arXiv},
369
+ primaryClass={cs.CL}
370
+ }
371
+ ```