TheBloke commited on
Commit
91dd290
1 Parent(s): ae4dd50

Initial GPTQ model commit

Browse files
Files changed (1) hide show
  1. README.md +301 -0
README.md ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - conceptofmind/cot_submix_original
4
+ - conceptofmind/flan2021_submix_original
5
+ - conceptofmind/t0_submix_original
6
+ - conceptofmind/niv2_submix_original
7
+ inference: false
8
+ language:
9
+ - en
10
+ license: other
11
+ model_creator: Stability AI
12
+ model_link: https://huggingface.co/stabilityai/StableBeluga-7b
13
+ model_name: StableBeluga 7B
14
+ model_type: llama
15
+ pipeline_tag: text-generation
16
+ quantized_by: TheBloke
17
+ ---
18
+
19
+ <!-- header start -->
20
+ <div style="width: 100%;">
21
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
22
+ </div>
23
+ <div style="display: flex; justify-content: space-between; width: 100%;">
24
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
25
+ <p><a href="https://discord.gg/theblokeai">Chat & support: my new Discord server</a></p>
26
+ </div>
27
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
28
+ <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
29
+ </div>
30
+ </div>
31
+ <!-- header end -->
32
+
33
+ # StableBeluga 7B - GPTQ
34
+ - Model creator: [Stability AI](https://huggingface.co/stabilityai)
35
+ - Original model: [StableBeluga 7B](https://huggingface.co/stabilityai/StableBeluga-7b)
36
+
37
+ ## Description
38
+
39
+ This repo contains GPTQ model files for [Stability AI's StableBeluga 7B](https://huggingface.co/stabilityai/StableBeluga-7b).
40
+
41
+ Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
42
+
43
+ ## Repositories available
44
+
45
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/StableBeluga-7B-GPTQ)
46
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/StableBeluga-7B-GGML)
47
+ * [Stability AI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/stabilityai/StableBeluga-7b)
48
+
49
+ ## Prompt template: Orca-Hashes
50
+
51
+ ```
52
+ ### System:
53
+ This is a system prompt, please behave and help the user.
54
+
55
+ ### User:
56
+ {prompt}
57
+
58
+ ### Assistant:
59
+ ```
60
+
61
+ ## Provided files
62
+
63
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
64
+
65
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
66
+
67
+ | Branch | Bits | Group Size | Act Order (desc_act) | File Size | ExLlama Compatible? | Made With | Description |
68
+ | ------ | ---- | ---------- | -------------------- | --------- | ------------------- | --------- | ----------- |
69
+ | [main](https://huggingface.co/TheBloke/StableBeluga-7B-GPTQ/tree/main) | 4 | 128 | False | 3.90 GB | True | AutoGPTQ | Most compatible option. Good inference speed in AutoGPTQ and GPTQ-for-LLaMa. Lower inference quality than other options. |
70
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/StableBeluga-7B-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | True | 4.28 GB | True | AutoGPTQ | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. Poor AutoGPTQ CUDA speed. |
71
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/StableBeluga-7B-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | True | 4.02 GB | True | AutoGPTQ | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
72
+ | [gptq-4bit-128g-actorder_True](https://huggingface.co/TheBloke/StableBeluga-7B-GPTQ/tree/gptq-4bit-128g-actorder_True) | 4 | 128 | True | 3.90 GB | True | AutoGPTQ | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
73
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/StableBeluga-7B-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | True | 7.01 GB | False | AutoGPTQ | 8-bit, with Act Order. No group size, to lower VRAM requirements and to improve AutoGPTQ speed. |
74
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/StableBeluga-7B-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | True | 7.16 GB | False | AutoGPTQ | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. Poor AutoGPTQ CUDA speed. |
75
+
76
+ ## How to download from branches
77
+
78
+ - In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/StableBeluga-7B-GPTQ:gptq-4bit-32g-actorder_True`
79
+ - With Git, you can clone a branch with:
80
+ ```
81
+ git clone --branch --single-branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/StableBeluga-7B-GPTQ
82
+ ```
83
+ - In Python Transformers code, the branch is the `revision` parameter; see below.
84
+
85
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
86
+
87
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
88
+
89
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you know how to make a manual install.
90
+
91
+ 1. Click the **Model tab**.
92
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/StableBeluga-7B-GPTQ`.
93
+ - To download from a specific branch, enter for example `TheBloke/StableBeluga-7B-GPTQ:gptq-4bit-32g-actorder_True`
94
+ - see Provided Files above for the list of branches for each option.
95
+ 3. Click **Download**.
96
+ 4. The model will start downloading. Once it's finished it will say "Done"
97
+ 5. In the top left, click the refresh icon next to **Model**.
98
+ 6. In the **Model** dropdown, choose the model you just downloaded: `StableBeluga-7B-GPTQ`
99
+ 7. The model will automatically load, and is now ready for use!
100
+ 8. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
101
+ * Note that you do not need to set GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
102
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
103
+
104
+ ## How to use this GPTQ model from Python code
105
+
106
+ First make sure you have [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) installed:
107
+
108
+ `GITHUB_ACTIONS=true pip install auto-gptq`
109
+
110
+ Then try the following example code:
111
+
112
+ ```python
113
+ from transformers import AutoTokenizer, pipeline, logging
114
+ from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
115
+
116
+ model_name_or_path = "TheBloke/StableBeluga-7B-GPTQ"
117
+ model_basename = "gptq_model-4bit-128g"
118
+
119
+ use_triton = False
120
+
121
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
122
+
123
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
124
+ model_basename=model_basename,
125
+ use_safetensors=True,
126
+ trust_remote_code=False,
127
+ device="cuda:0",
128
+ use_triton=use_triton,
129
+ quantize_config=None)
130
+
131
+ """
132
+ To download from a specific branch, use the revision parameter, as in this example:
133
+
134
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
135
+ revision="gptq-4bit-32g-actorder_True",
136
+ model_basename=model_basename,
137
+ use_safetensors=True,
138
+ trust_remote_code=False,
139
+ device="cuda:0",
140
+ quantize_config=None)
141
+ """
142
+
143
+ prompt = "Tell me about AI"
144
+ prompt_template=f'''### System:
145
+ This is a system prompt, please behave and help the user.
146
+
147
+ ### User:
148
+ {prompt}
149
+
150
+ ### Assistant:
151
+ '''
152
+
153
+ print("\n\n*** Generate:")
154
+
155
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
156
+ output = model.generate(inputs=input_ids, temperature=0.7, max_new_tokens=512)
157
+ print(tokenizer.decode(output[0]))
158
+
159
+ # Inference can also be done using transformers' pipeline
160
+
161
+ # Prevent printing spurious transformers error when using pipeline with AutoGPTQ
162
+ logging.set_verbosity(logging.CRITICAL)
163
+
164
+ print("*** Pipeline:")
165
+ pipe = pipeline(
166
+ "text-generation",
167
+ model=model,
168
+ tokenizer=tokenizer,
169
+ max_new_tokens=512,
170
+ temperature=0.7,
171
+ top_p=0.95,
172
+ repetition_penalty=1.15
173
+ )
174
+
175
+ print(pipe(prompt_template)[0]['generated_text'])
176
+ ```
177
+
178
+ ## Compatibility
179
+
180
+ The files provided will work with AutoGPTQ (CUDA and Triton modes), GPTQ-for-LLaMa (only CUDA has been tested), and Occ4m's GPTQ-for-LLaMa fork.
181
+
182
+ ExLlama works with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
183
+
184
+ <!-- footer start -->
185
+ ## Discord
186
+
187
+ For further support, and discussions on these models and AI in general, join us at:
188
+
189
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
190
+
191
+ ## Thanks, and how to contribute.
192
+
193
+ Thanks to the [chirper.ai](https://chirper.ai) team!
194
+
195
+ 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.
196
+
197
+ 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.
198
+
199
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
200
+
201
+ * Patreon: https://patreon.com/TheBlokeAI
202
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
203
+
204
+ **Special thanks to**: Luke from CarbonQuill, Aemon Algiz.
205
+
206
+ **Patreon special mentions**: Slarti, Chadd, John Detwiler, Pieter, zynix, K, Mano Prime, ReadyPlayerEmma, Ai Maven, Leonard Tan, Edmond Seymore, Joseph William Delisle, Luke @flexchar, Fred von Graf, Viktor Bowallius, Rishabh Srivastava, Nikolai Manek, Matthew Berman, Johann-Peter Hartmann, ya boyyy, Greatston Gnanesh, Femi Adebogun, Talal Aujan, Jonathan Leane, terasurfer, David Flickinger, William Sang, Ajan Kanaga, Vadim, Artur Olbinski, Raven Klaugh, Michael Levine, Oscar Rangel, Randy H, Cory Kujawski, RoA, Dave, Alex, Alexandros Triantafyllidis, Fen Risland, Eugene Pentland, vamX, Elle, Nathan LeClaire, Khalefa Al-Ahmad, Rainer Wilmers, subjectnull, Junyu Yang, Daniel P. Andersen, SuperWojo, LangChain4j, Mandus, Kalila, Illia Dulskyi, Trenton Dambrowitz, Asp the Wyvern, Derek Yates, Jeffrey Morgan, Deep Realms, Imad Khwaja, Pyrater, Preetika Verma, biorpg, Gabriel Tamborski, Stephen Murray, Spiking Neurons AB, Iucharbius, Chris Smitley, Willem Michiel, Luke Pendergrass, Sebastain Graf, senxiiz, Will Dee, Space Cruiser, Karl Bernard, Clay Pascal, Lone Striker, transmissions 11, webtim, WelcomeToTheClub, Sam, theTransient, Pierre Kircher, chris gileta, John Villwock, Sean Connelly, Willian Hasse
207
+
208
+
209
+ Thank you to all my generous patrons and donaters!
210
+
211
+ <!-- footer end -->
212
+
213
+ # Original model card: Stability AI's StableBeluga 7B
214
+
215
+ # Stable Beluga 7B
216
+
217
+ ## Model Description
218
+
219
+ `Stable Beluga 7B` is a Llama2 7B model finetuned on an Orca style Dataset
220
+
221
+ ## Usage
222
+
223
+ Start chatting with `Stable Beluga 7B` using the following code snippet:
224
+
225
+ ```python
226
+ import torch
227
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
228
+
229
+ tokenizer = AutoTokenizer.from_pretrained("stabilityai/StableBeluga-7B", use_fast=False)
230
+ model = AutoModelForCausalLM.from_pretrained("stabilityai/StableBeluga-7B", torch_dtype=torch.float16, low_cpu_mem_usage=True, device_map="auto")
231
+ system_prompt = "### System:\nYou are StableBeluga, an AI that follows instructions extremely well. Help as much as you can. Remember, be safe, and don't do anything illegal.\n\n"
232
+
233
+ message = "Write me a poem please"
234
+ prompt = f"{system_prompt}### User: {message}\n\n### Assistant:\n"
235
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
236
+ output = model.generate(**inputs, do_sample=True, top_p=0.95, top_k=0, max_new_tokens=256)
237
+
238
+ print(tokenizer.decode(output[0], skip_special_tokens=True))
239
+ ```
240
+
241
+ Stable Beluga 7B should be used with this prompt format:
242
+ ```
243
+ ### System:
244
+ This is a system prompt, please behave and help the user.
245
+
246
+ ### User:
247
+ Your prompt here
248
+
249
+ ### Assistant:
250
+ The output of Stable Beluga 7B
251
+ ```
252
+
253
+ ## Model Details
254
+
255
+ * **Developed by**: [Stability AI](https://stability.ai/)
256
+ * **Model type**: Stable Beluga 7B is an auto-regressive language model fine-tuned on Llama2 7B.
257
+ * **Language(s)**: English
258
+ * **Library**: [HuggingFace Transformers](https://github.com/huggingface/transformers)
259
+ * **License**: Fine-tuned checkpoints (`Stable Beluga 7B`) is licensed under the [STABLE BELUGA NON-COMMERCIAL COMMUNITY LICENSE AGREEMENT](https://huggingface.co/stabilityai/StableBeluga-7B/blob/main/LICENSE.txt)
260
+ * **Contact**: For questions and comments about the model, please email `lm@stability.ai`
261
+
262
+ ### Training Dataset
263
+
264
+ ` Stable Beluga 7B` is trained on our internal Orca-style dataset
265
+
266
+ ### Training Procedure
267
+
268
+ 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:
269
+
270
+ | Dataset | Batch Size | Learning Rate |Learning Rate Decay| Warm-up | Weight Decay | Betas |
271
+ |-------------------|------------|---------------|-------------------|---------|--------------|-------------|
272
+ | Orca pt1 packed | 256 | 3e-5 | Cosine to 3e-6 | 100 | 1e-6 | (0.9, 0.95) |
273
+ | Orca pt2 unpacked | 512 | 3e-5 | Cosine to 3e-6 | 100 | 1e-6 | (0.9, 0.95) |
274
+
275
+ ## Ethical Considerations and Limitations
276
+
277
+ 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.
278
+
279
+ ## Citations
280
+
281
+ ```bibtext
282
+ @misc{touvron2023llama,
283
+ title={Llama 2: Open Foundation and Fine-Tuned Chat Models},
284
+ 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},
285
+ year={2023},
286
+ eprint={2307.09288},
287
+ archivePrefix={arXiv},
288
+ primaryClass={cs.CL}
289
+ }
290
+ ```
291
+
292
+ ```bibtext
293
+ @misc{mukherjee2023orca,
294
+ title={Orca: Progressive Learning from Complex Explanation Traces of GPT-4},
295
+ author={Subhabrata Mukherjee and Arindam Mitra and Ganesh Jawahar and Sahaj Agarwal and Hamid Palangi and Ahmed Awadallah},
296
+ year={2023},
297
+ eprint={2306.02707},
298
+ archivePrefix={arXiv},
299
+ primaryClass={cs.CL}
300
+ }
301
+ ```