TheBloke commited on
Commit
c13294e
1 Parent(s): 0480edd

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +340 -0
README.md ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: teknium/airoboros-mistral2.2-7b
3
+ datasets:
4
+ - jondurbin/airoboros-2.2.1
5
+ inference: false
6
+ language:
7
+ - en
8
+ license: mit
9
+ model-index:
10
+ - name: airoboros2.2-mistral-7b
11
+ results: []
12
+ model_creator: Teknium
13
+ model_name: Airoboros Mistral2.2 7B
14
+ model_type: mistral
15
+ prompt_template: 'USER: {prompt}
16
+
17
+ ASSISTANT:
18
+
19
+ '
20
+ quantized_by: TheBloke
21
+ tags:
22
+ - llama-2
23
+ - instruct
24
+ - finetune
25
+ - alpaca
26
+ - gpt4
27
+ - synthetic data
28
+ - distillation
29
+ ---
30
+
31
+ <!-- header start -->
32
+ <!-- 200823 -->
33
+ <div style="width: auto; margin-left: auto; margin-right: auto">
34
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
35
+ </div>
36
+ <div style="display: flex; justify-content: space-between; width: 100%;">
37
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
38
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
39
+ </div>
40
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
41
+ <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>
42
+ </div>
43
+ </div>
44
+ <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>
45
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
46
+ <!-- header end -->
47
+
48
+ # Airoboros Mistral2.2 7B - AWQ
49
+ - Model creator: [Teknium](https://huggingface.co/teknium)
50
+ - Original model: [Airoboros Mistral2.2 7B](https://huggingface.co/teknium/airoboros-mistral2.2-7b)
51
+
52
+ <!-- description start -->
53
+ ## Description
54
+
55
+ This repo contains AWQ model files for [Teknium's Airoboros Mistral2.2 7B](https://huggingface.co/teknium/airoboros-mistral2.2-7b).
56
+
57
+
58
+ ### About AWQ
59
+
60
+ 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.
61
+
62
+ It is also now supported by continuous batching server [vLLM](https://github.com/vllm-project/vllm), allowing use of Llama AWQ models for high-throughput concurrent inference in multi-user server scenarios.
63
+
64
+ As of September 25th 2023, preliminary Llama-only AWQ support has also been added to [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference).
65
+
66
+ Note that, at the time of writing, overall throughput is still lower than running vLLM or TGI 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.
67
+ <!-- description end -->
68
+ <!-- repositories-available start -->
69
+ ## Repositories available
70
+
71
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/airoboros-mistral2.2-7B-AWQ)
72
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/airoboros-mistral2.2-7B-GPTQ)
73
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/airoboros-mistral2.2-7B-GGUF)
74
+ * [Teknium's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/teknium/airoboros-mistral2.2-7b)
75
+ <!-- repositories-available end -->
76
+
77
+ <!-- prompt-template start -->
78
+ ## Prompt template: User-Assistant
79
+
80
+ ```
81
+ USER: {prompt}
82
+ ASSISTANT:
83
+
84
+ ```
85
+
86
+ <!-- prompt-template end -->
87
+
88
+
89
+ <!-- README_AWQ.md-provided-files start -->
90
+ ## Provided files, and AWQ parameters
91
+
92
+ 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.
93
+
94
+ Models are released as sharded safetensors files.
95
+
96
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
97
+ | ------ | ---- | -- | ----------- | ------- | ---- |
98
+ | [main](https://huggingface.co/TheBloke/airoboros-mistral2.2-7B-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 32768 | 4.15 GB
99
+
100
+ <!-- README_AWQ.md-provided-files end -->
101
+
102
+ <!-- README_AWQ.md-use-from-vllm start -->
103
+ ## Serving this model from vLLM
104
+
105
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
106
+
107
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
108
+
109
+ If you try the vLLM examples below and get an error about `quantization` being unrecognised, or other AWQ-related issues, please install vLLM from Github source.
110
+
111
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
112
+
113
+ ```shell
114
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/airoboros-mistral2.2-7B-AWQ --quantization awq --dtype half
115
+ ```
116
+
117
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
118
+
119
+ ```python
120
+ from vllm import LLM, SamplingParams
121
+
122
+ prompts = [
123
+ "Hello, my name is",
124
+ "The president of the United States is",
125
+ "The capital of France is",
126
+ "The future of AI is",
127
+ ]
128
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
129
+
130
+ llm = LLM(model="TheBloke/airoboros-mistral2.2-7B-AWQ", quantization="awq", dtype="half")
131
+
132
+ outputs = llm.generate(prompts, sampling_params)
133
+
134
+ # Print the outputs.
135
+ for output in outputs:
136
+ prompt = output.prompt
137
+ generated_text = output.outputs[0].text
138
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
139
+ ```
140
+ <!-- README_AWQ.md-use-from-vllm start -->
141
+
142
+ <!-- README_AWQ.md-use-from-tgi start -->
143
+ ## Serving this model from Text Generation Inference (TGI)
144
+
145
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
146
+
147
+ Example Docker parameters:
148
+
149
+ ```shell
150
+ --model-id TheBloke/airoboros-mistral2.2-7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
151
+ ```
152
+
153
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
154
+
155
+ ```shell
156
+ pip3 install huggingface-hub
157
+ ```
158
+
159
+ ```python
160
+ from huggingface_hub import InferenceClient
161
+
162
+ endpoint_url = "https://your-endpoint-url-here"
163
+
164
+ prompt = "Tell me about AI"
165
+ prompt_template=f'''USER: {prompt}
166
+ ASSISTANT:
167
+
168
+ '''
169
+
170
+ client = InferenceClient(endpoint_url)
171
+ response = client.text_generation(prompt,
172
+ max_new_tokens=128,
173
+ do_sample=True,
174
+ temperature=0.7,
175
+ top_p=0.95,
176
+ top_k=40,
177
+ repetition_penalty=1.1)
178
+
179
+ print(f"Model output: {response}")
180
+ ```
181
+ <!-- README_AWQ.md-use-from-tgi end -->
182
+
183
+ <!-- README_AWQ.md-use-from-python start -->
184
+ ## How to use this AWQ model from Python code
185
+
186
+ ### Install the necessary packages
187
+
188
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later
189
+
190
+ ```shell
191
+ pip3 install autoawq
192
+ ```
193
+
194
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
195
+
196
+ ```shell
197
+ pip3 uninstall -y autoawq
198
+ git clone https://github.com/casper-hansen/AutoAWQ
199
+ cd AutoAWQ
200
+ pip3 install .
201
+ ```
202
+
203
+ ### You can then try the following example code
204
+
205
+ ```python
206
+ from awq import AutoAWQForCausalLM
207
+ from transformers import AutoTokenizer
208
+
209
+ model_name_or_path = "TheBloke/airoboros-mistral2.2-7B-AWQ"
210
+
211
+ # Load model
212
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
213
+ trust_remote_code=False, safetensors=True)
214
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
215
+
216
+ prompt = "Tell me about AI"
217
+ prompt_template=f'''USER: {prompt}
218
+ ASSISTANT:
219
+
220
+ '''
221
+
222
+ print("\n\n*** Generate:")
223
+
224
+ tokens = tokenizer(
225
+ prompt_template,
226
+ return_tensors='pt'
227
+ ).input_ids.cuda()
228
+
229
+ # Generate output
230
+ generation_output = model.generate(
231
+ tokens,
232
+ do_sample=True,
233
+ temperature=0.7,
234
+ top_p=0.95,
235
+ top_k=40,
236
+ max_new_tokens=512
237
+ )
238
+
239
+ print("Output: ", tokenizer.decode(generation_output[0]))
240
+
241
+ """
242
+ # Inference should be possible with transformers pipeline as well in future
243
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
244
+ from transformers import pipeline
245
+
246
+ print("*** Pipeline:")
247
+ pipe = pipeline(
248
+ "text-generation",
249
+ model=model,
250
+ tokenizer=tokenizer,
251
+ max_new_tokens=512,
252
+ do_sample=True,
253
+ temperature=0.7,
254
+ top_p=0.95,
255
+ top_k=40,
256
+ repetition_penalty=1.1
257
+ )
258
+
259
+ print(pipe(prompt_template)[0]['generated_text'])
260
+ """
261
+ ```
262
+ <!-- README_AWQ.md-use-from-python end -->
263
+
264
+ <!-- README_AWQ.md-compatibility start -->
265
+ ## Compatibility
266
+
267
+ The files provided are tested to work with:
268
+
269
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
270
+ - [vLLM](https://github.com/vllm-project/vllm)
271
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
272
+
273
+ TGI merged AWQ support on September 25th, 2023: [TGI PR #1054](https://github.com/huggingface/text-generation-inference/pull/1054). Use the `:latest` Docker container until the next TGI release is made.
274
+
275
+ <!-- README_AWQ.md-compatibility end -->
276
+
277
+ <!-- footer start -->
278
+ <!-- 200823 -->
279
+ ## Discord
280
+
281
+ For further support, and discussions on these models and AI in general, join us at:
282
+
283
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
284
+
285
+ ## Thanks, and how to contribute
286
+
287
+ Thanks to the [chirper.ai](https://chirper.ai) team!
288
+
289
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
290
+
291
+ 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.
292
+
293
+ 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.
294
+
295
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
296
+
297
+ * Patreon: https://patreon.com/TheBlokeAI
298
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
299
+
300
+ **Special thanks to**: Aemon Algiz.
301
+
302
+ **Patreon special mentions**: Pierre Kircher, Stanislav Ovsiannikov, Michael Levine, Eugene Pentland, Andrey, 준교 김, Randy H, Fred von Graf, Artur Olbinski, Caitlyn Gatomon, terasurfer, Jeff Scroggin, James Bentley, Vadim, Gabriel Puliatti, Harry Royden McLaughlin, Sean Connelly, Dan Guido, Edmond Seymore, Alicia Loh, subjectnull, AzureBlack, Manuel Alberto Morcote, Thomas Belote, Lone Striker, Chris Smitley, Vitor Caleffi, Johann-Peter Hartmann, Clay Pascal, biorpg, Brandon Frisco, sidney chen, transmissions 11, Pedro Madruga, jinyuan sun, Ajan Kanaga, Emad Mostaque, Trenton Dambrowitz, Jonathan Leane, Iucharbius, usrbinkat, vamX, George Stoitzev, Luke Pendergrass, theTransient, Olakabola, Swaroop Kallakuri, Cap'n Zoog, Brandon Phillips, Michael Dempsey, Nikolai Manek, danny, Matthew Berman, Gabriel Tamborski, alfie_i, Raymond Fosdick, Tom X Nguyen, Raven Klaugh, LangChain4j, Magnesian, Illia Dulskyi, David Ziegler, Mano Prime, Luis Javier Navarrete Lozano, Erik Bjäreholt, 阿明, Nathan Dryer, Alex, Rainer Wilmers, zynix, TL, Joseph William Delisle, John Villwock, Nathan LeClaire, Willem Michiel, Joguhyik, GodLy, OG, Alps Aficionado, Jeffrey Morgan, ReadyPlayerEmma, Tiffany J. Kim, Sebastain Graf, Spencer Kim, Michael Davis, webtim, Talal Aujan, knownsqashed, John Detwiler, Imad Khwaja, Deo Leter, Jerry Meng, Elijah Stavena, Rooh Singh, Pieter, SuperWojo, Alexandros Triantafyllidis, Stephen Murray, Ai Maven, ya boyyy, Enrico Ros, Ken Nordquist, Deep Realms, Nicholas, Spiking Neurons AB, Elle, Will Dee, Jack West, RoA, Luke @flexchar, Viktor Bowallius, Derek Yates, Subspace Studios, jjj, Toran Billups, Asp the Wyvern, Fen Risland, Ilya, NimbleBox.ai, Chadd, Nitin Borwankar, Emre, Mandus, Leonard Tan, Kalila, K, Trailburnt, S_X, Cory Kujawski
303
+
304
+
305
+ Thank you to all my generous patrons and donaters!
306
+
307
+ And thank you again to a16z for their generous grant.
308
+
309
+ <!-- footer end -->
310
+
311
+ # Original model card: Teknium's Airoboros Mistral2.2 7B
312
+
313
+
314
+ Mistral trained with the airoboros dataset!
315
+
316
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6317aade83d8d2fd903192d9/sbN_PCdxO_LV0xpFGA_St.png)
317
+
318
+ Actual dataset is airoboros 2.2, but it seems to have been replaced on hf with 2.2.1.
319
+
320
+ Prompt Format:
321
+ ```
322
+ USER: <prompt>
323
+ ASSISTANT:
324
+ ```
325
+
326
+
327
+ TruthfulQA:
328
+
329
+ ```
330
+ hf-causal-experimental (pretrained=/home/teknium/dakota/lm-evaluation-harness/airoboros2.2-mistral/,dtype=float16), limit: None, provide_description: False, num_fewshot: 0, batch_size: 8
331
+ | Task |Version|Metric|Value | |Stderr|
332
+ |-------------|------:|------|-----:|---|-----:|
333
+ |truthfulqa_mc| 1|mc1 |0.3562|± |0.0168|
334
+ | | |mc2 |0.5217|± |0.0156|
335
+ ```
336
+
337
+
338
+ Wandb training charts: https://wandb.ai/teknium1/airoboros-mistral-7b/runs/airoboros-mistral-1?workspace=user-teknium1
339
+
340
+ More info to come