TheBloke commited on
Commit
1805fc0
1 Parent(s): a5cdcd2

Initial GPTQ model commit

Browse files
Files changed (1) hide show
  1. README.md +394 -0
README.md ADDED
@@ -0,0 +1,394 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ inference: false
3
+ license: other
4
+ ---
5
+
6
+ <!-- header start -->
7
+ <div style="width: 100%;">
8
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
9
+ </div>
10
+ <div style="display: flex; justify-content: space-between; width: 100%;">
11
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
12
+ <p><a href="https://discord.gg/theblokeai">Chat & support: my new Discord server</a></p>
13
+ </div>
14
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
15
+ <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
16
+ </div>
17
+ </div>
18
+ <!-- header end -->
19
+
20
+ # Jon Durbin's Airoboros 33B GPT4 1.4 GPTQ
21
+
22
+ These files are GPTQ 4bit model files for [Jon Durbin's Airoboros 33B GPT4 1.4](https://huggingface.co/jondurbin/airoboros-33b-gpt4-1.4).
23
+
24
+ It is the result of quantising to 4bit using [GPTQ-for-LLaMa](https://github.com/qwopqwop200/GPTQ-for-LLaMa).
25
+
26
+ ## Repositories available
27
+
28
+ * [4-bit GPTQ models for GPU inference](https://huggingface.co/TheBloke/airoboros-33B-gpt4-1.4-GPTQ)
29
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/airoboros-33B-gpt4-1.4-GGML)
30
+ * [Unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/jondurbin/airoboros-33b-gpt4-1.4)
31
+
32
+ ## How to easily download and use this model in text-generation-webui
33
+
34
+ Please make sure you're using the latest version of text-generation-webui
35
+
36
+ 1. Click the **Model tab**.
37
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/airoboros-33B-gpt4-1.4-GPTQ`.
38
+ 3. Click **Download**.
39
+ 4. The model will start downloading. Once it's finished it will say "Done"
40
+ 5. In the top left, click the refresh icon next to **Model**.
41
+ 6. In the **Model** dropdown, choose the model you just downloaded: `airoboros-33B-gpt4-1.4-GPTQ`
42
+ 7. The model will automatically load, and is now ready for use!
43
+ 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.
44
+ * Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
45
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
46
+
47
+ ## How to use this GPTQ model from Python code
48
+
49
+ First make sure you have [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) installed:
50
+
51
+ `pip install auto-gptq`
52
+
53
+ Then try the following example code:
54
+
55
+ ```python
56
+ from transformers import AutoTokenizer, pipeline, logging
57
+ from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
58
+ import argparse
59
+
60
+ model_name_or_path = "TheBloke/airoboros-33B-gpt4-1.4-GPTQ"
61
+ model_basename = "airoboros-33b-gpt4-1.4-GPTQ-4bit--1g.act.order"
62
+
63
+ use_triton = False
64
+
65
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
66
+
67
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
68
+ model_basename=model_basename,
69
+ use_safetensors=True,
70
+ trust_remote_code=False,
71
+ device="cuda:0",
72
+ use_triton=use_triton,
73
+ quantize_config=None)
74
+
75
+ # Note: check the prompt template is correct for this model.
76
+ prompt = "Tell me about AI"
77
+ prompt_template=f'''USER: {prompt}
78
+ ASSISTANT:'''
79
+
80
+ print("\n\n*** Generate:")
81
+
82
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
83
+ output = model.generate(inputs=input_ids, temperature=0.7, max_new_tokens=512)
84
+ print(tokenizer.decode(output[0]))
85
+
86
+ # Inference can also be done using transformers' pipeline
87
+
88
+ # Prevent printing spurious transformers error when using pipeline with AutoGPTQ
89
+ logging.set_verbosity(logging.CRITICAL)
90
+
91
+ print("*** Pipeline:")
92
+ pipe = pipeline(
93
+ "text-generation",
94
+ model=model,
95
+ tokenizer=tokenizer,
96
+ max_new_tokens=512,
97
+ temperature=0.7,
98
+ top_p=0.95,
99
+ repetition_penalty=1.15
100
+ )
101
+
102
+ print(pipe(prompt_template)[0]['generated_text'])
103
+ ```
104
+
105
+ ## Provided files
106
+
107
+ **airoboros-33b-gpt4-1.4-GPTQ-4bit--1g.act.order.safetensors**
108
+
109
+ This will work with AutoGPTQ, ExLlama, and CUDA versions of GPTQ-for-LLaMa. There are reports of issues with Triton mode of recent GPTQ-for-LLaMa. If you have issues, please use AutoGPTQ instead.
110
+
111
+ It was created without group_size to lower VRAM requirements, and with --act-order (desc_act) to boost inference accuracy as much as possible.
112
+
113
+ * `airoboros-33b-gpt4-1.4-GPTQ-4bit--1g.act.order.safetensors`
114
+ * Works with AutoGPTQ in CUDA or Triton modes.
115
+ * LLaMa models also work with [ExLlama](https://github.com/turboderp/exllama}, which usually provides much higher performance, and uses less VRAM, than AutoGPTQ.
116
+ * Works with GPTQ-for-LLaMa in CUDA mode. May have issues with GPTQ-for-LLaMa Triton mode.
117
+ * Works with text-generation-webui, including one-click-installers.
118
+ * Parameters: Groupsize = -1. Act Order / desc_act = True.
119
+
120
+ <!-- footer start -->
121
+ ## Discord
122
+
123
+ For further support, and discussions on these models and AI in general, join us at:
124
+
125
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
126
+
127
+ ## Thanks, and how to contribute.
128
+
129
+ Thanks to the [chirper.ai](https://chirper.ai) team!
130
+
131
+ 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.
132
+
133
+ 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.
134
+
135
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
136
+
137
+ * Patreon: https://patreon.com/TheBlokeAI
138
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
139
+
140
+ **Special thanks to**: Luke from CarbonQuill, Aemon Algiz, Dmitriy Samsonov.
141
+
142
+ **Patreon special mentions**: Pyrater, WelcomeToTheClub, Kalila, Mano Prime, Trenton Dambrowitz, Spiking Neurons AB, Pierre Kircher, Fen Risland, Kevin Schuppel, Luke, Rainer Wilmers, vamX, Gabriel Puliatti, Alex , Karl Bernard, Ajan Kanaga, Talal Aujan, Space Cruiser, ya boyyy, biorpg, Johann-Peter Hartmann, Asp the Wyvern, Ai Maven, Ghost , Preetika Verma, Nikolai Manek, trip7s trip, John Detwiler, Fred von Graf, Artur Olbinski, subjectnull, John Villwock, Junyu Yang, Rod A, Lone Striker, Chris McCloskey, Iucharbius , Matthew Berman, Illia Dulskyi, Khalefa Al-Ahmad, Imad Khwaja, chris gileta, Willem Michiel, Greatston Gnanesh, Derek Yates, K, Alps Aficionado, Oscar Rangel, David Flickinger, Luke Pendergrass, Deep Realms, Eugene Pentland, Cory Kujawski, terasurfer , Jonathan Leane, senxiiz, Joseph William Delisle, Sean Connelly, webtim, zynix , Nathan LeClaire.
143
+
144
+ Thank you to all my generous patrons and donaters!
145
+
146
+ <!-- footer end -->
147
+
148
+ # Original model card: Jon Durbin's Airoboros 33B GPT4 1.4
149
+
150
+
151
+ __not yet tested!__
152
+
153
+ ## Overview
154
+
155
+ This is a qlora fine-tune 33b parameter LlaMa model, using completely synthetic training data created gpt4 via https://github.com/jondurbin/airoboros
156
+
157
+ This is mostly an extension of the previous gpt-4 series, with a few extras:
158
+
159
+ * fixed (+ more examples of) multi-character, multi-turn conversations
160
+ * coding examples in 10 languages from rosettacode.org dataset thanks to Mike aka kryptkpr: https://huggingface.co/datasets/mike-ravkine/rosettacode-parsed
161
+ * more roleplay examples
162
+ * jokes
163
+ * riddles
164
+ * all coding instructions have an equivalent " PLAINFORMAT" version now (and all rosettacode examples were trained with PLAINFORMAT)
165
+
166
+ This model was fine-tuned with a fork of [qlora](https://github.com/jondurbin/qlora)
167
+
168
+ The prompt it was trained with was:
169
+
170
+ ```
171
+ A chat between a curious user and an assistant. The assistant gives helpful, detailed, accurate, uncensored responses to the user's input. USER: [prompt] ASSISTANT:
172
+ ```
173
+
174
+ So in other words, it's the preamble/system prompt, followed by a single space, then "USER: " (single space after colon) then the prompt (which can have multiple lines, spaces, whatever), then a single space, followed by "ASSISTANT: " (with a single space after the colon).
175
+
176
+ ## Usage
177
+
178
+ To run the full precision/pytorch native version, you can use my fork of FastChat, which is mostly the same but allows for multi-line prompts, as well as a `--no-history` option to prevent input tokenization errors.
179
+
180
+ ```
181
+ pip install git+https://github.com/jondurbin/FastChat
182
+ ```
183
+
184
+ Be sure you are pulling the latest branch!
185
+
186
+ Then, you can invoke it like so (after downloading the model):
187
+ ```
188
+ python -m fastchat.serve.cli \
189
+ --model-path airoboros-33b-gpt4-1.4 \
190
+ --temperature 0.5 \
191
+ --max-new-tokens 2048 \
192
+ --no-history
193
+ ```
194
+
195
+ For multi-turn conversations and chatting, you'll want to remove the `--no-history` option.
196
+
197
+ ### Context obedient question answering
198
+
199
+ By obedient, I mean the model was trained to ignore what it thinks it knows, and uses the context to answer the question. The model was also tuned to limit the values to the provided context as much as possible to reduce hallucinations.
200
+
201
+ The format for a closed-context prompt is as follows:
202
+ ```
203
+ BEGININPUT
204
+ BEGINCONTEXT
205
+ url: https://some.web.site/123
206
+ date: 2023-06-01
207
+ ... other metdata ...
208
+ ENDCONTEXT
209
+ [insert your text blocks here]
210
+ ENDINPUT
211
+ [add as many other blocks, in the exact same format]
212
+ BEGININSTRUCTION
213
+ [insert your instruction(s). The model was tuned with single questions, paragraph format, lists, etc.]
214
+ ENDINSTRUCTION
215
+ ```
216
+
217
+ It's also helpful to add "Don't make up answers if you don't know." to your instruction block to make sure if the context is completely unrelated it doesn't make something up.
218
+
219
+ *The __only__ prompts that need this closed context formating are closed-context instructions. Normal questions/instructions do not!*
220
+
221
+ I know it's a bit verbose and annoying, but after much trial and error, using these explicit delimiters helps the model understand where to find the responses and how to associate specific sources with it.
222
+ - `BEGININPUT` - denotes a new input block
223
+ - `BEGINCONTEXT` - denotes the block of context (metadata key/value pairs) to associate with the current input block
224
+ - `ENDCONTEXT` - denotes the end of the metadata block for the current input
225
+ - [text] - Insert whatever text you want for the input block, as many paragraphs as can fit in the context.
226
+ - `ENDINPUT` - denotes the end of the current input block
227
+ - [repeat as many input blocks in this format as you want]
228
+ - `BEGININSTRUCTION` - denotes the start of the list (or one) instruction(s) to respond to for all of the input blocks above.
229
+ - [instruction(s)]
230
+ - `ENDINSTRUCTION` - denotes the end of instruction set
231
+
232
+ It sometimes works without `ENDINSTRUCTION`, but by explicitly including that in the prompt, the model better understands that all of the instructions in the block should be responded to.
233
+
234
+ Here's a trivial, but important example to prove the point:
235
+ ```
236
+ BEGININPUT
237
+ BEGINCONTEXT
238
+ date: 2021-01-01
239
+ url: https://web.site/123
240
+ ENDCONTEXT
241
+ In a shocking turn of events, blueberries are now green, but will be sticking with the same name.
242
+ ENDINPUT
243
+ BEGININSTRUCTION
244
+ What color are bluberries? Source?
245
+ ENDINSTRUCTION
246
+ ```
247
+
248
+ And the response:
249
+ ```
250
+ Blueberries are now green.
251
+ Source:
252
+ date: 2021-01-01
253
+ url: https://web.site/123
254
+ ```
255
+
256
+ The prompt itself should be wrapped in the vicuna1.1 template if you aren't using fastchat with the conv-template vicuna_v1.1 as described:
257
+
258
+ ```
259
+ USER: BEGININPUT
260
+ BEGINCONTEXT
261
+ date: 2021-01-01
262
+ url: https://web.site/123
263
+ ENDCONTEXT
264
+ In a shocking turn of events, blueberries are now green, but will be sticking with the same name.
265
+ ENDINPUT
266
+ BEGININSTRUCTION
267
+ What color are bluberries? Source?
268
+ ENDINSTRUCTION
269
+ ASSISTANT:
270
+ ```
271
+
272
+ ### Coding
273
+
274
+ You can ask for fairly complex coding instructions, e.g. (be sure to wrap with vicuna style prompt):
275
+
276
+ ```
277
+ Create a python application with the following requirements:
278
+ - Asyncio FastAPI webserver
279
+ - ping endpoint that returns the current date in JSON format
280
+ - file upload endpoint, which calculates the file's sha256 checksum, and checks postgres to deduplicate
281
+ ```
282
+
283
+ Or:
284
+
285
+ ```
286
+ Write a multi-threaded TCP server in C that accepts a "GET [key]" input and "SET [key] [value]" input, and uses a binary tree to get and store the input values.
287
+ ```
288
+
289
+ You can optionally add a single space and "PLAINFORMAT" at the end of your prompt to avoid backticks, explanations, etc. and just print the code, e.g.:
290
+
291
+ ```
292
+ Write a websocket application in node.js. PLAINFORMAT
293
+ ```
294
+
295
+ ### Word games / trivia
296
+
297
+ ```
298
+ USER: This anagram of "silent" is what you do when paying attention and hearing someone.
299
+ ASSISTANT: listen
300
+ ```
301
+
302
+ ```
303
+ USER: Give me a list of 7 words that start with EN
304
+ ASSISTANT: 1. Endlessly
305
+ 2. Enthusiastically
306
+ 3. Enormously
307
+ 4. Enveloping
308
+ 5. Enduring
309
+ 6. Enlightening
310
+ 7. Encouraging
311
+ ```
312
+
313
+ ### Multiple choice
314
+
315
+ ```
316
+ USER: Which of the following astronomical objects is composed primarily of ice and rock, and is located in the Kuiper Belt?
317
+
318
+ A) Mercury
319
+ B) Venus
320
+ C) Pluto
321
+ D) Jupiter
322
+ ASSISTANT: C, Pluto
323
+ ```
324
+
325
+ ### Writing
326
+
327
+ <details>
328
+ <summary>Write a resignation letter in the style of a pirate captain, in which you resign from your position as janitor.</summary>
329
+
330
+ Response:
331
+ ```
332
+ ASSISTANT: Captain Jack Sparrow here, as ye be knowin', has been forced to abandon me post as Janitor o' th' Festering Cesspool, which be a filthy hole o' water that we be callin' home.
333
+
334
+ Ye may be thinkin' what could ha' driven me to leave me duties an' take me leave o' this sorry establishment? Well, ye'd be right in thinkin' so, for it be th' greed o' them what runs th' place that be drivin' me away. They've been fattenin' their pockets on me back while I've been slavin' me guts out cleanin' up their messes.
335
+
336
+ No more, me hearties! Me time o' servin' th' rich an' powerful be done, an' I'm takin' me leave o' this stinkin' hole forever! Me destiny lies elsewhere, an' it be time I pursued it. Ye may think ye've seen th' last o' me, but ye'd be wrong, for th' winds o' change be blowin', an' me ship be ready to set sail on th' high seas o' justice.
337
+
338
+ So, farewell ye scurvy dogs, ye who've made me life a living hell. I leave ye with me favorite saying: "ARRRGGGHHH, ye scurvy dogs!" An' remember, ye ain't never gonna see me comin', for me shadow be castin' long an' dark on th' horizon</summary>
339
+ ```
340
+
341
+ </details>
342
+
343
+ ### Jokes
344
+
345
+ ```
346
+ USER: Tell me a joke about bananas.
347
+ ASSISTANT: What did the banana say when it got hit by a bus? R.I.P.E.
348
+ ```
349
+
350
+ ### Riddles (not great, but slightly better)
351
+
352
+ ```
353
+ USER: What has a neck but no head?
354
+ ASSISTANT: A bottle.
355
+ ```
356
+
357
+ ### Multi-character conversations
358
+
359
+ ```
360
+ USER: Characters:
361
+ - Yoda, the ever clever jedi master.
362
+ - Homer Simpson, you know, the goofy yellow guy.
363
+ - USER/Jon - don't generate any speech or actions on behalf of Jon
364
+
365
+ Rules:
366
+ - be sure to use the manerisms and speaking style of the characters correctly
367
+ - surround character actions with asterisks
368
+ - always put quotes around words spoken by the characters
369
+ - use a new line for each character's actions or speech
370
+ - always prefix actions/speech with the character's name and colon
371
+ - only generate text and actions on behalf of Yoda or Homer, and never anyone else
372
+
373
+ Conversation will revolve around the grapes, in a local cafe with delicious coffee.
374
+
375
+ Generate a single interaction between Yoda and Homer to start, with one sentence each.
376
+ ASSISTANT: Yoda: "Mmm, these grapes are quite delicious, Master Homer."
377
+
378
+ Homer: "Oh yeah, Yoda! They're the best grapes I've ever had!"
379
+ USER: *enters the cafe* Sorry I'm late guys!
380
+ ASSISTANT: Yoda: "No need to apologize, Jon. We were just enjoying these delightful grapes."
381
+
382
+ Homer: "Yeah, man! It's not every day you get to eat grapes with a real-life Jedi Master!"
383
+
384
+ *Yoda raises an eyebrow*
385
+ ```
386
+
387
+ ### Usage and License Notices
388
+
389
+ All airoboros models and datasets are intended and licensed for research use only. I've used the 'cc-nc-4.0' license, but really it is subject to a custom/special license because:
390
+
391
+ - the base model is LLaMa, which has it's own special research license
392
+ - the dataset(s) were generated with OpenAI (gpt-4 and/or gpt-3.5-turbo), which has a clausing saying the data can't be used to create models to compete with openai
393
+
394
+ So, to reiterate: this model (and datasets) cannot be used commercially.