Text Generation
Transformers
Safetensors
English
llama
text-generation-inference
4-bit precision
gptq
TheBloke commited on
Commit
97e0c44
1 Parent(s): e052d07

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_type: llama
12
+ pipeline_tag: text-generation
13
+ ---
14
+
15
+ <!-- header start -->
16
+ <div style="width: 100%;">
17
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
18
+ </div>
19
+ <div style="display: flex; justify-content: space-between; width: 100%;">
20
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
21
+ <p><a href="https://discord.gg/theblokeai">Chat & support: my new Discord server</a></p>
22
+ </div>
23
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
24
+ <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
25
+ </div>
26
+ </div>
27
+ <!-- header end -->
28
+
29
+ # Stability AI's FreeWilly 2 GPTQ
30
+
31
+ These files are GPTQ model files for [Stability AI's FreeWilly 2](https://huggingface.co/stabilityai/FreeWilly2).
32
+
33
+ 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.
34
+
35
+
36
+ ## Repositories available
37
+
38
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/FreeWilly2-GPTQ)
39
+ * [Original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/stabilityai/FreeWilly2)
40
+
41
+ ## Prompt template: Orca-Hashes
42
+
43
+ ```
44
+ ### System:
45
+ This is a system prompt, please behave and help the user.
46
+
47
+ ### User:
48
+ {prompt}
49
+
50
+ ### Assistant:
51
+ ```
52
+
53
+ ## Provided files
54
+
55
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
56
+
57
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
58
+
59
+ | Branch | Bits | Group Size | Act Order (desc_act) | File Size | ExLlama Compatible? | Made With | Description |
60
+ | ------ | ---- | ---------- | -------------------- | --------- | ------------------- | --------- | ----------- |
61
+ | main | 4 | 128 | False | 36.65 GB | True | AutoGPTQ | Most compatible option. Good inference speed in AutoGPTQ and GPTQ-for-LLaMa. Lower inference quality than other options. |
62
+ | gptq-4bit-32g-actorder_True | 4 | 32 | True | Processing, coming soon | True | AutoGPTQ | 4-bit, with Act Order and group size. 32g gives highest possible inference quality, with maximum VRAM usage. Poor AutoGPTQ CUDA speed. |
63
+ | gptq-4bit-64g-actorder_True | 4 | 64 | True | 37.99 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. |
64
+ | gptq-4bit-128g-actorder_True | 4 | 128 | True | Processing, coming soon | True | AutoGPTQ | 4-bit, with Act Order and group size. 128g uses even less VRAM, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
65
+ | gptq-3bit--1g-actorder_True | 3 | None | True | Processing, coming soon | False | AutoGPTQ | 3-bit, with Act Order and no group size. Lowest possible VRAM requirements. May be lower quality than 3-bit 128g. |
66
+ | gptq-3bit-128g-actorder_False | 3 | 128 | False | Processing, coming soon | False | AutoGPTQ | 3-bit, with group size 128g but no act-order. Slightly higher VRAM requirements than 3-bit None. |
67
+ | gptq-3bit-128g-actorder_True | 3 | 128 | True | Processing, coming soon | False | AutoGPTQ | 3-bit, with group size 128g and act-order. Higher quality than 128g-False but poor AutoGPTQ CUDA speed. |
68
+ | gptq-3bit-64g-actorder_True | 3 | 64 | True | Processing, coming soon | False | AutoGPTQ | 3-bit, with group size 64g and act-order. Highest quality 3-bit option. Poor AutoGPTQ CUDA speed. |
69
+
70
+ ## How to download from branches
71
+
72
+ - In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/FreeWilly2-GPTQ:gptq-4bit-32g-actorder_True`
73
+ - With Git, you can clone a branch with:
74
+ ```
75
+ git clone --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/FreeWilly2-GPTQ`
76
+ ```
77
+ - In Python Transformers code, the branch is the `revision` parameter; see below.
78
+
79
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
80
+
81
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
82
+
83
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you know how to make a manual install.
84
+
85
+ 1. Click the **Model tab**.
86
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/FreeWilly2-GPTQ`.
87
+ - To download from a specific branch, enter for example `TheBloke/FreeWilly2-GPTQ:gptq-4bit-32g-actorder_True`
88
+ - see Provided Files above for the list of branches for each option.
89
+ 3. Click **Download**.
90
+ 4. The model will start downloading. Once it's finished it will say "Done"
91
+ 5. In the top left, click the refresh icon next to **Model**.
92
+ 6. In the **Model** dropdown, choose the model you just downloaded: `FreeWilly2-GPTQ`
93
+ 7. The model will automatically load, and is now ready for use!
94
+ 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.
95
+ * Note that you do not need to set GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
96
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
97
+
98
+ ## How to use this GPTQ model from Python code
99
+
100
+ First make sure you have [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) installed:
101
+
102
+ `GITHUB_ACTIONS=true pip install auto-gptq`
103
+
104
+ Then try the following example code:
105
+
106
+ ```python
107
+ from transformers import AutoTokenizer, pipeline, logging
108
+ from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
109
+
110
+ model_name_or_path = "TheBloke/FreeWilly2-GPTQ"
111
+ model_basename = "gptq_model-4bit-128g"
112
+
113
+ use_triton = False
114
+
115
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
116
+
117
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
118
+ model_basename=model_basename,
119
+ use_safetensors=True,
120
+ trust_remote_code=False,
121
+ device="cuda:0",
122
+ use_triton=use_triton,
123
+ quantize_config=None)
124
+
125
+ """
126
+ To download from a specific branch, use the revision parameter, as in this example:
127
+
128
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
129
+ revision="gptq-4bit-32g-actorder_True",
130
+ model_basename=model_basename,
131
+ use_safetensors=True,
132
+ trust_remote_code=False,
133
+ device="cuda:0",
134
+ quantize_config=None)
135
+ """
136
+
137
+ prompt = "Tell me about AI"
138
+ prompt_template=f'''### System:
139
+ This is a system prompt, please behave and help the user.
140
+
141
+ ### User:
142
+ {prompt}
143
+
144
+ ### Assistant:
145
+ '''
146
+
147
+ print("\n\n*** Generate:")
148
+
149
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
150
+ output = model.generate(inputs=input_ids, temperature=0.7, max_new_tokens=512)
151
+ print(tokenizer.decode(output[0]))
152
+
153
+ # Inference can also be done using transformers' pipeline
154
+
155
+ # Prevent printing spurious transformers error when using pipeline with AutoGPTQ
156
+ logging.set_verbosity(logging.CRITICAL)
157
+
158
+ print("*** Pipeline:")
159
+ pipe = pipeline(
160
+ "text-generation",
161
+ model=model,
162
+ tokenizer=tokenizer,
163
+ max_new_tokens=512,
164
+ temperature=0.7,
165
+ top_p=0.95,
166
+ repetition_penalty=1.15
167
+ )
168
+
169
+ print(pipe(prompt_template)[0]['generated_text'])
170
+ ```
171
+
172
+ ## Compatibility
173
+
174
+ 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.
175
+
176
+ ExLlama works with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
177
+
178
+ <!-- footer start -->
179
+ ## Discord
180
+
181
+ For further support, and discussions on these models and AI in general, join us at:
182
+
183
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
184
+
185
+ ## Thanks, and how to contribute.
186
+
187
+ Thanks to the [chirper.ai](https://chirper.ai) team!
188
+
189
+ 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.
190
+
191
+ 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.
192
+
193
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
194
+
195
+ * Patreon: https://patreon.com/TheBlokeAI
196
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
197
+
198
+ **Special thanks to**: Luke from CarbonQuill, Aemon Algiz.
199
+
200
+ **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
201
+
202
+
203
+ Thank you to all my generous patrons and donaters!
204
+
205
+ <!-- footer end -->
206
+
207
+ # Original model card: Stability AI's FreeWilly 2
208
+
209
+ # FreeWilly
210
+
211
+ ## Model Description
212
+
213
+ `FreeWilly2` is a Llama2 70B model finetuned on an Orca style Dataset
214
+
215
+ ## Usage
216
+
217
+ Start chatting with `FreeWilly2` using the following code snippet:
218
+
219
+ ```python
220
+ import torch
221
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
222
+
223
+ tokenizer = AutoTokenizer.from_pretrained("stabilityai/FreeWilly2", use_fast=False)
224
+ model = AutoModelForCausalLM.from_pretrained("stabilityai/FreeWilly2", torch_dtype=torch.float16, low_cpu_mem_usage=True, device_map="auto")
225
+ system_prompt = "### System:\nYou are Free Willy, an AI that follows instructions extremely well. Help as much as you can. Remember, be safe, and don't do anything illegal.\n\n"
226
+
227
+ message = "Write me a poem please"
228
+ prompt = f"{system_prompt}### User: {message}\n\n### Assistant:\n"
229
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
230
+ output = model.generate(**inputs, do_sample=True, top_p=0.95, top_k=0, max_new_tokens=256)
231
+
232
+ print(tokenizer.decode(output[0], skip_special_tokens=True))
233
+ ```
234
+
235
+ FreeWilly should be used with this prompt format:
236
+ ```
237
+ ### System:
238
+ This is a system prompt, please behave and help the user.
239
+
240
+ ### User:
241
+ Your prompt here
242
+
243
+ ### Assistant
244
+ The output of FreeWilly2
245
+ ```
246
+
247
+ ## Model Details
248
+
249
+ * **Developed by**: [Stability AI](https://stability.ai/)
250
+ * **Model type**: FreeWilly is an auto-regressive language model fine-tuned on Llama2 70B.
251
+ * **Language(s)**: English
252
+ * **Library**: [HuggingFace Transformers](https://github.com/huggingface/transformers)
253
+ * **License**: Fine-tuned checkpoints (`FreeWilly2`) is licensed under the Non-Commercial Creative Commons license ([CC BY-NC-4.0](https://creativecommons.org/licenses/by-nc/4.0/))
254
+ * **Contact**: For questions and comments about the model, please email `lm@stability.ai`
255
+
256
+ ### Training Dataset
257
+
258
+ `FreeWilly2` is trained on our internal Orca-style dataset
259
+
260
+ ### Training Procedure
261
+
262
+ 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:
263
+
264
+ | Dataset | Batch Size | Learning Rate |Learning Rate Decay| Warm-up | Weight Decay | Betas |
265
+ |-------------------|------------|---------------|-------------------|---------|--------------|-------------|
266
+ | Orca pt1 packed | 256 | 3e-5 | Cosine to 3e-6 | 100 | 1e-6 | (0.9, 0.95) |
267
+ | Orca pt2 unpacked | 512 | 3e-5 | Cosine to 3e-6 | 100 | 1e-6 | (0.9, 0.95) |
268
+
269
+ ## Use and Limitations
270
+
271
+ ### Intended Use
272
+
273
+ These models are intended for research only, in adherence with the [CC BY-NC-4.0](https://creativecommons.org/licenses/by-nc/4.0/) license.
274
+
275
+ ### Limitations and bias
276
+
277
+ Although the aforementioned dataset helps to steer the base language models into "safer" distributions of text, not all biases and toxicity can be mitigated through fine-tuning. We ask that users be mindful of such potential issues that can arise in generated responses. Do not treat model outputs as substitutes for human judgment or as sources of truth. Please use it responsibly.
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
+ ```