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ral-11B-OmniMix-bf16
3
+ inference: false
4
+ license: cc-by-nc-4.0
5
+ model_creator: NeverSleep
6
+ model_name: Mistral 11B OmniMix
7
+ model_type: mistral
8
+ prompt_template: '<|system|>
9
+
10
+ Below is an instruction that describes a task. Write a response that appropriately
11
+ completes the request.
12
+
13
+ <|user|>
14
+
15
+ {prompt}
16
+
17
+ <|assistant|>
18
+
19
+ '
20
+ quantized_by: TheBloke
21
+ ---
22
+
23
+ <!-- header start -->
24
+ <!-- 200823 -->
25
+ <div style="width: auto; margin-left: auto; margin-right: auto">
26
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
27
+ </div>
28
+ <div style="display: flex; justify-content: space-between; width: 100%;">
29
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
30
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
31
+ </div>
32
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
33
+ <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>
34
+ </div>
35
+ </div>
36
+ <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>
37
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
38
+ <!-- header end -->
39
+
40
+ # Mistral 11B OmniMix - AWQ
41
+ - Model creator: [NeverSleep](https://huggingface.co/NeverSleep)
42
+ - Original model: [Mistral 11B OmniMix](https://huggingface.co/NeverSleep/Mistral-11B-OmniMix-bf16)
43
+
44
+ <!-- description start -->
45
+ ## Description
46
+
47
+ This repo contains AWQ model files for [NeverSleep's Mistral 11B OmniMix](https://huggingface.co/NeverSleep/Mistral-11B-OmniMix-bf16).
48
+
49
+
50
+ ### About AWQ
51
+
52
+ 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.
53
+
54
+ 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.
55
+
56
+ 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).
57
+
58
+ 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.
59
+ <!-- description end -->
60
+ <!-- repositories-available start -->
61
+ ## Repositories available
62
+
63
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Mistral-11B-OmniMix-AWQ)
64
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Mistral-11B-OmniMix-GPTQ)
65
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Mistral-11B-OmniMix-GGUF)
66
+ * [NeverSleep's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/NeverSleep/Mistral-11B-OmniMix-bf16)
67
+ <!-- repositories-available end -->
68
+
69
+ <!-- prompt-template start -->
70
+ ## Prompt template: Alpaca-S-U-A
71
+
72
+ ```
73
+ <|system|>
74
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
75
+ <|user|>
76
+ {prompt}
77
+ <|assistant|>
78
+
79
+ ```
80
+
81
+ <!-- prompt-template end -->
82
+
83
+
84
+ <!-- README_AWQ.md-provided-files start -->
85
+ ## Provided files, and AWQ parameters
86
+
87
+ 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.
88
+
89
+ Models are released as sharded safetensors files.
90
+
91
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
92
+ | ------ | ---- | -- | ----------- | ------- | ---- |
93
+ | [main](https://huggingface.co/TheBloke/Mistral-11B-OmniMix-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 5.96 GB
94
+
95
+ <!-- README_AWQ.md-provided-files end -->
96
+
97
+ <!-- README_AWQ.md-use-from-vllm start -->
98
+ ## Serving this model from vLLM
99
+
100
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
101
+
102
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
103
+
104
+ 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.
105
+
106
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
107
+
108
+ ```shell
109
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Mistral-11B-OmniMix-AWQ --quantization awq --dtype half
110
+ ```
111
+
112
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
113
+
114
+ ```python
115
+ from vllm import LLM, SamplingParams
116
+
117
+ prompts = [
118
+ "Hello, my name is",
119
+ "The president of the United States is",
120
+ "The capital of France is",
121
+ "The future of AI is",
122
+ ]
123
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
124
+
125
+ llm = LLM(model="TheBloke/Mistral-11B-OmniMix-AWQ", quantization="awq", dtype="half")
126
+
127
+ outputs = llm.generate(prompts, sampling_params)
128
+
129
+ # Print the outputs.
130
+ for output in outputs:
131
+ prompt = output.prompt
132
+ generated_text = output.outputs[0].text
133
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
134
+ ```
135
+ <!-- README_AWQ.md-use-from-vllm start -->
136
+
137
+ <!-- README_AWQ.md-use-from-tgi start -->
138
+ ## Serving this model from Text Generation Inference (TGI)
139
+
140
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
141
+
142
+ Example Docker parameters:
143
+
144
+ ```shell
145
+ --model-id TheBloke/Mistral-11B-OmniMix-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
146
+ ```
147
+
148
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
149
+
150
+ ```shell
151
+ pip3 install huggingface-hub
152
+ ```
153
+
154
+ ```python
155
+ from huggingface_hub import InferenceClient
156
+
157
+ endpoint_url = "https://your-endpoint-url-here"
158
+
159
+ prompt = "Tell me about AI"
160
+ prompt_template=f'''<|system|>
161
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
162
+ <|user|>
163
+ {prompt}
164
+ <|assistant|>
165
+
166
+ '''
167
+
168
+ client = InferenceClient(endpoint_url)
169
+ response = client.text_generation(prompt,
170
+ max_new_tokens=128,
171
+ do_sample=True,
172
+ temperature=0.7,
173
+ top_p=0.95,
174
+ top_k=40,
175
+ repetition_penalty=1.1)
176
+
177
+ print(f"Model output: {response}")
178
+ ```
179
+ <!-- README_AWQ.md-use-from-tgi end -->
180
+
181
+ <!-- README_AWQ.md-use-from-python start -->
182
+ ## How to use this AWQ model from Python code
183
+
184
+ ### Install the necessary packages
185
+
186
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later
187
+
188
+ ```shell
189
+ pip3 install autoawq
190
+ ```
191
+
192
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
193
+
194
+ ```shell
195
+ pip3 uninstall -y autoawq
196
+ git clone https://github.com/casper-hansen/AutoAWQ
197
+ cd AutoAWQ
198
+ pip3 install .
199
+ ```
200
+
201
+ ### You can then try the following example code
202
+
203
+ ```python
204
+ from awq import AutoAWQForCausalLM
205
+ from transformers import AutoTokenizer
206
+
207
+ model_name_or_path = "TheBloke/Mistral-11B-OmniMix-AWQ"
208
+
209
+ # Load model
210
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
211
+ trust_remote_code=False, safetensors=True)
212
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
213
+
214
+ prompt = "Tell me about AI"
215
+ prompt_template=f'''<|system|>
216
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
217
+ <|user|>
218
+ {prompt}
219
+ <|assistant|>
220
+
221
+ '''
222
+
223
+ print("\n\n*** Generate:")
224
+
225
+ tokens = tokenizer(
226
+ prompt_template,
227
+ return_tensors='pt'
228
+ ).input_ids.cuda()
229
+
230
+ # Generate output
231
+ generation_output = model.generate(
232
+ tokens,
233
+ do_sample=True,
234
+ temperature=0.7,
235
+ top_p=0.95,
236
+ top_k=40,
237
+ max_new_tokens=512
238
+ )
239
+
240
+ print("Output: ", tokenizer.decode(generation_output[0]))
241
+
242
+ """
243
+ # Inference should be possible with transformers pipeline as well in future
244
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
245
+ from transformers import pipeline
246
+
247
+ print("*** Pipeline:")
248
+ pipe = pipeline(
249
+ "text-generation",
250
+ model=model,
251
+ tokenizer=tokenizer,
252
+ max_new_tokens=512,
253
+ do_sample=True,
254
+ temperature=0.7,
255
+ top_p=0.95,
256
+ top_k=40,
257
+ repetition_penalty=1.1
258
+ )
259
+
260
+ print(pipe(prompt_template)[0]['generated_text'])
261
+ """
262
+ ```
263
+ <!-- README_AWQ.md-use-from-python end -->
264
+
265
+ <!-- README_AWQ.md-compatibility start -->
266
+ ## Compatibility
267
+
268
+ The files provided are tested to work with:
269
+
270
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
271
+ - [vLLM](https://github.com/vllm-project/vllm)
272
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
273
+
274
+ 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.
275
+
276
+ <!-- README_AWQ.md-compatibility end -->
277
+
278
+ <!-- footer start -->
279
+ <!-- 200823 -->
280
+ ## Discord
281
+
282
+ For further support, and discussions on these models and AI in general, join us at:
283
+
284
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
285
+
286
+ ## Thanks, and how to contribute
287
+
288
+ Thanks to the [chirper.ai](https://chirper.ai) team!
289
+
290
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
291
+
292
+ 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.
293
+
294
+ 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.
295
+
296
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
297
+
298
+ * Patreon: https://patreon.com/TheBlokeAI
299
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
300
+
301
+ **Special thanks to**: Aemon Algiz.
302
+
303
+ **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
304
+
305
+
306
+ Thank you to all my generous patrons and donaters!
307
+
308
+ And thank you again to a16z for their generous grant.
309
+
310
+ <!-- footer end -->
311
+
312
+ # Original model card: NeverSleep's Mistral 11B OmniMix
313
+
314
+ This model should be fixed, it was MEANT to be BF16.
315
+
316
+ Don't mind this one at the moment, I need to finetune it for RP, it's just a test.
317
+
318
+ ## Description
319
+
320
+ This repo contains fp16 files of Mistral-11B-OmniMix-bf16.
321
+
322
+ My goal for this model was only to make it score the highest possible with merge and layer toying, proving that:
323
+ - Benchmark are objective
324
+ - You should try a model yourself and don't go blindly to the highest rated one
325
+ - Merge/Layer toying CAN be usable to do better model (maybe?)
326
+
327
+
328
+ ## Model used
329
+ - [Mistral-7B-OpenOrca](https://huggingface.co/Open-Orca/Mistral-7B-OpenOrca)
330
+ - [Mistral-7B-v0.1-Open-Platypus](https://huggingface.co/akjindal53244/Mistral-7B-v0.1-Open-Platypus)
331
+ - [CollectiveCognition-v1.1-Mistral-7B](https://huggingface.co/teknium/CollectiveCognition-v1.1-Mistral-7B)
332
+ - [zephyr-7b-alpha](https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha)
333
+
334
+
335
+
336
+ ## Prompt template
337
+
338
+ The best one after further testing is this one:
339
+
340
+ ```
341
+ <|system|>
342
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
343
+ <|user|>
344
+ {prompt}
345
+ <|assistant|>
346
+ ```
347
+
348
+
349
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/63ab1241ad514ca8d1430003/tWIx8yeoallv94zrhN6L-.png)
350
+
351
+ But these one work too:
352
+
353
+ ```
354
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
355
+
356
+ ### Instruction:
357
+ {prompt}
358
+
359
+ ### Response:
360
+
361
+ ```
362
+
363
+ ```
364
+ USER: <prompt>
365
+ ASSISTANT:
366
+ ```
367
+
368
+ Or use any prompting system from one of the 4 source model, should work.
369
+
370
+ ## The secret sauce
371
+
372
+ Mistral-11B-OpenOrcaPlatypus :
373
+ ```
374
+ slices:
375
+ - sources:
376
+ - model: Open-Orca/Mistral-7B-OpenOrca
377
+ layer_range: [0, 24]
378
+ - sources:
379
+ - model: akjindal53244/Mistral-7B-v0.1-Open-Platypus
380
+ layer_range: [8, 32]
381
+ merge_method: passthrough
382
+ dtype: bfloat16
383
+ ```
384
+
385
+ Mistral-11B-CC-Zephyr :
386
+ ```
387
+ slices:
388
+ - sources:
389
+ - model: "/content/drive/MyDrive/CC-v1.1-7B-bf16"
390
+ layer_range: [0, 24]
391
+ - sources:
392
+ - model: "/content/drive/MyDrive/Zephyr-7B"
393
+ layer_range: [8, 32]
394
+ merge_method: passthrough
395
+ dtype: bfloat16
396
+ ```
397
+
398
+ Mistral-11B-OmniMix :
399
+ ```
400
+ slices:
401
+ - sources:
402
+ - model: Mistral-11B-OpenOrcaPlatypus
403
+ layer_range: [0, 48]
404
+ - model: Mistral-11B-CC-Zephyr
405
+ layer_range: [0, 48]
406
+ merge_method: slerp
407
+ base_model: Mistral-11B-OpenOrcaPlatypus
408
+ parameters:
409
+ t:
410
+ - filter: lm_head
411
+ value: [0.75]
412
+ - filter: embed_tokens
413
+ value: [0.75]
414
+ - filter: self_attn
415
+ value: [0.75, 0.25]
416
+ - filter: mlp
417
+ value: [0.25, 0.75]
418
+ - filter: layernorm
419
+ value: [0.5, 0.5]
420
+ - filter: modelnorm
421
+ value: [0.75]
422
+ - value: 0.5 # fallback for rest of tensors
423
+ dtype: bfloat16
424
+ ```
425
+ I use [mergekit](https://github.com/cg123/mergekit) for all the manipulation told here.
426
+
427
+ ## Some scoring I done myself
428
+
429
+
430
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/63ab1241ad514ca8d1430003/rnraBZz-I9CUD1GVNVF00.png)
431
+
432
+ hf-causal-experimental (pretrained=/content/drive/MyDrive/Mistral-11B-OmniMix-bf16), limit: None, provide_description: False, num_fewshot: 0, batch_size: 4
433
+ | Task |Version| Metric |Value | |Stderr|
434
+ |-------------|------:|--------|-----:|---|-----:|
435
+ |arc_challenge| 0|acc |0.5580|± |0.0145|
436
+ | | |acc_norm|0.5819|± |0.0144|
437
+ |arc_easy | 0|acc |0.8300|± |0.0077|
438
+ | | |acc_norm|0.8211|± |0.0079|
439
+ |hellaswag | 0|acc |0.6372|± |0.0048|
440
+ | | |acc_norm|0.8209|± |0.0038|
441
+ |piqa | 0|acc |0.8145|± |0.0091|
442
+ | | |acc_norm|0.8286|± |0.0088|
443
+ |truthfulqa_mc| 1|mc1 |0.3978|± |0.0171|
444
+ | | |mc2 |0.5680|± |0.0155|
445
+ |winogrande | 0|acc |0.7427|± |0.0123|
446
+
447
+ ## Others
448
+
449
+ Special thanks to Sushi, [Henky](https://github.com/KoboldAI/KoboldAI-Client) for the machine he give me for big task, and [Charles Goddard](https://github.com/cg123) for his amazing tool.
450
+
451
+ If you want to support me, you can [here](https://ko-fi.com/undiai).