TheBloke commited on
Commit
580f636
1 Parent(s): 564aa76

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +375 -0
README.md ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Undi95/Amethyst-13B-Mistral
3
+ inference: false
4
+ license: cc-by-nc-4.0
5
+ model_creator: Undi
6
+ model_name: Amethyst 13B Mistral
7
+ model_type: llama
8
+ prompt_template: 'Below is an instruction that describes a task. Write a response
9
+ that appropriately completes the request.
10
+
11
+
12
+ ### Instruction:
13
+
14
+ {prompt}
15
+
16
+
17
+ ### Response:
18
+
19
+ '
20
+ quantized_by: TheBloke
21
+ tags:
22
+ - not-for-all-audiences
23
+ - nsfw
24
+ ---
25
+
26
+ <!-- header start -->
27
+ <!-- 200823 -->
28
+ <div style="width: auto; margin-left: auto; margin-right: auto">
29
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
30
+ </div>
31
+ <div style="display: flex; justify-content: space-between; width: 100%;">
32
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
33
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
34
+ </div>
35
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
36
+ <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>
37
+ </div>
38
+ </div>
39
+ <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>
40
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
41
+ <!-- header end -->
42
+
43
+ # Amethyst 13B Mistral - AWQ
44
+ - Model creator: [Undi](https://huggingface.co/Undi95)
45
+ - Original model: [Amethyst 13B Mistral](https://huggingface.co/Undi95/Amethyst-13B-Mistral)
46
+
47
+ <!-- description start -->
48
+ ## Description
49
+
50
+ This repo contains AWQ model files for [Undi's Amethyst 13B Mistral](https://huggingface.co/Undi95/Amethyst-13B-Mistral).
51
+
52
+
53
+ ### About AWQ
54
+
55
+ 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.
56
+
57
+ 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.
58
+
59
+ 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).
60
+
61
+ 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.
62
+ <!-- description end -->
63
+ <!-- repositories-available start -->
64
+ ## Repositories available
65
+
66
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Amethyst-13B-Mistral-AWQ)
67
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Amethyst-13B-Mistral-GPTQ)
68
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Amethyst-13B-Mistral-GGUF)
69
+ * [Undi's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/Undi95/Amethyst-13B-Mistral)
70
+ <!-- repositories-available end -->
71
+
72
+ <!-- prompt-template start -->
73
+ ## Prompt template: Alpaca
74
+
75
+ ```
76
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
77
+
78
+ ### Instruction:
79
+ {prompt}
80
+
81
+ ### Response:
82
+
83
+ ```
84
+
85
+ <!-- prompt-template end -->
86
+ <!-- licensing start -->
87
+ ## Licensing
88
+
89
+ The creator of the source model has listed its license as `cc-by-nc-4.0`, and this quantization has therefore used that same license.
90
+
91
+ As this model is based on Llama 2, it is also subject to the Meta Llama 2 license terms, and the license files for that are additionally included. It should therefore be considered as being claimed to be licensed under both licenses. I contacted Hugging Face for clarification on dual licensing but they do not yet have an official position. Should this change, or should Meta provide any feedback on this situation, I will update this section accordingly.
92
+
93
+ In the meantime, any questions regarding licensing, and in particular how these two licenses might interact, should be directed to the original model repository: [Undi's Amethyst 13B Mistral](https://huggingface.co/Undi95/Amethyst-13B-Mistral).
94
+ <!-- licensing end -->
95
+ <!-- README_AWQ.md-provided-files start -->
96
+ ## Provided files, and AWQ parameters
97
+
98
+ 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.
99
+
100
+ Models are released as sharded safetensors files.
101
+
102
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
103
+ | ------ | ---- | -- | ----------- | ------- | ---- |
104
+ | [main](https://huggingface.co/TheBloke/Amethyst-13B-Mistral-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 7.25 GB
105
+
106
+ <!-- README_AWQ.md-provided-files end -->
107
+
108
+ <!-- README_AWQ.md-use-from-vllm start -->
109
+ ## Serving this model from vLLM
110
+
111
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
112
+
113
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
114
+
115
+ 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.
116
+
117
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
118
+
119
+ ```shell
120
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Amethyst-13B-Mistral-AWQ --quantization awq --dtype half
121
+ ```
122
+
123
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
124
+
125
+ ```python
126
+ from vllm import LLM, SamplingParams
127
+
128
+ prompts = [
129
+ "Hello, my name is",
130
+ "The president of the United States is",
131
+ "The capital of France is",
132
+ "The future of AI is",
133
+ ]
134
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
135
+
136
+ llm = LLM(model="TheBloke/Amethyst-13B-Mistral-AWQ", quantization="awq", dtype="half")
137
+
138
+ outputs = llm.generate(prompts, sampling_params)
139
+
140
+ # Print the outputs.
141
+ for output in outputs:
142
+ prompt = output.prompt
143
+ generated_text = output.outputs[0].text
144
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
145
+ ```
146
+ <!-- README_AWQ.md-use-from-vllm start -->
147
+
148
+ <!-- README_AWQ.md-use-from-tgi start -->
149
+ ## Serving this model from Text Generation Inference (TGI)
150
+
151
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
152
+
153
+ Example Docker parameters:
154
+
155
+ ```shell
156
+ --model-id TheBloke/Amethyst-13B-Mistral-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
157
+ ```
158
+
159
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
160
+
161
+ ```shell
162
+ pip3 install huggingface-hub
163
+ ```
164
+
165
+ ```python
166
+ from huggingface_hub import InferenceClient
167
+
168
+ endpoint_url = "https://your-endpoint-url-here"
169
+
170
+ prompt = "Tell me about AI"
171
+ prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
172
+
173
+ ### Instruction:
174
+ {prompt}
175
+
176
+ ### Response:
177
+
178
+ '''
179
+
180
+ client = InferenceClient(endpoint_url)
181
+ response = client.text_generation(prompt,
182
+ max_new_tokens=128,
183
+ do_sample=True,
184
+ temperature=0.7,
185
+ top_p=0.95,
186
+ top_k=40,
187
+ repetition_penalty=1.1)
188
+
189
+ print(f"Model output: {response}")
190
+ ```
191
+ <!-- README_AWQ.md-use-from-tgi end -->
192
+
193
+ <!-- README_AWQ.md-use-from-python start -->
194
+ ## How to use this AWQ model from Python code
195
+
196
+ ### Install the necessary packages
197
+
198
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later
199
+
200
+ ```shell
201
+ pip3 install autoawq
202
+ ```
203
+
204
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
205
+
206
+ ```shell
207
+ pip3 uninstall -y autoawq
208
+ git clone https://github.com/casper-hansen/AutoAWQ
209
+ cd AutoAWQ
210
+ pip3 install .
211
+ ```
212
+
213
+ ### You can then try the following example code
214
+
215
+ ```python
216
+ from awq import AutoAWQForCausalLM
217
+ from transformers import AutoTokenizer
218
+
219
+ model_name_or_path = "TheBloke/Amethyst-13B-Mistral-AWQ"
220
+
221
+ # Load model
222
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
223
+ trust_remote_code=False, safetensors=True)
224
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
225
+
226
+ prompt = "Tell me about AI"
227
+ prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
228
+
229
+ ### Instruction:
230
+ {prompt}
231
+
232
+ ### Response:
233
+
234
+ '''
235
+
236
+ print("\n\n*** Generate:")
237
+
238
+ tokens = tokenizer(
239
+ prompt_template,
240
+ return_tensors='pt'
241
+ ).input_ids.cuda()
242
+
243
+ # Generate output
244
+ generation_output = model.generate(
245
+ tokens,
246
+ do_sample=True,
247
+ temperature=0.7,
248
+ top_p=0.95,
249
+ top_k=40,
250
+ max_new_tokens=512
251
+ )
252
+
253
+ print("Output: ", tokenizer.decode(generation_output[0]))
254
+
255
+ """
256
+ # Inference should be possible with transformers pipeline as well in future
257
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
258
+ from transformers import pipeline
259
+
260
+ print("*** Pipeline:")
261
+ pipe = pipeline(
262
+ "text-generation",
263
+ model=model,
264
+ tokenizer=tokenizer,
265
+ max_new_tokens=512,
266
+ do_sample=True,
267
+ temperature=0.7,
268
+ top_p=0.95,
269
+ top_k=40,
270
+ repetition_penalty=1.1
271
+ )
272
+
273
+ print(pipe(prompt_template)[0]['generated_text'])
274
+ """
275
+ ```
276
+ <!-- README_AWQ.md-use-from-python end -->
277
+
278
+ <!-- README_AWQ.md-compatibility start -->
279
+ ## Compatibility
280
+
281
+ The files provided are tested to work with:
282
+
283
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
284
+ - [vLLM](https://github.com/vllm-project/vllm)
285
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
286
+
287
+ 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.
288
+
289
+ <!-- README_AWQ.md-compatibility end -->
290
+
291
+ <!-- footer start -->
292
+ <!-- 200823 -->
293
+ ## Discord
294
+
295
+ For further support, and discussions on these models and AI in general, join us at:
296
+
297
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
298
+
299
+ ## Thanks, and how to contribute
300
+
301
+ Thanks to the [chirper.ai](https://chirper.ai) team!
302
+
303
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
304
+
305
+ 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.
306
+
307
+ 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.
308
+
309
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
310
+
311
+ * Patreon: https://patreon.com/TheBlokeAI
312
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
313
+
314
+ **Special thanks to**: Aemon Algiz.
315
+
316
+ **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
317
+
318
+
319
+ Thank you to all my generous patrons and donaters!
320
+
321
+ And thank you again to a16z for their generous grant.
322
+
323
+ <!-- footer end -->
324
+
325
+ # Original model card: Undi's Amethyst 13B Mistral
326
+
327
+ [THIS WAS A TEST, BUT PEOPLE LIKE IT, SO I ADD IT OFFICIALLY TO MY PROJECTS]
328
+
329
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/63ab1241ad514ca8d1430003/ubc23iUshsXKjx-GBPv3W.png)
330
+ An attempt using [BlockMerge_Gradient](https://github.com/Gryphe/BlockMerge_Gradient) to get better result.
331
+
332
+ In addition, [LimaRP v3](https://huggingface.co/lemonilia/LimaRP-Llama2-13B-v3-EXPERIMENT) was used, is it recommanded to read the documentation.
333
+
334
+ The [llama2-to-mistral-diff](https://huggingface.co/Undi95/llama2-to-mistral-diff) was used on it at weight "1".
335
+
336
+ <!-- description start -->
337
+ ## Description
338
+
339
+ This repo contains fp16 files of Amethyst-13B-Mistral.
340
+
341
+ <!-- description end -->
342
+ <!-- description start -->
343
+ ## Models and loras used
344
+
345
+ - Xwin-LM/Xwin-LM-13B-V0.1
346
+ - The-Face-Of-Goonery/Huginn-13b-FP16
347
+ - zattio770/120-Days-of-LORA-v2-13B
348
+ - lemonilia/LimaRP-Llama2-13B-v3-EXPERIMENT
349
+ - Undi95/llama2-to-mistral-diff
350
+
351
+ <!-- description end -->
352
+ <!-- prompt-template start -->
353
+ ## Prompt template: Alpaca
354
+
355
+ ```
356
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
357
+
358
+ ### Instruction:
359
+ {prompt}
360
+
361
+ ### Response:
362
+
363
+ ```
364
+
365
+ ## LimaRP v3 usage and suggested settings
366
+
367
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/63ab1241ad514ca8d1430003/ZC_iP2KkcEcRdgG_iyxYE.png)
368
+
369
+ You can follow these instruction format settings in SillyTavern. Replace tiny with your desired response length:
370
+
371
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/63ab1241ad514ca8d1430003/PIn8_HSPTJEMdSEpNVSdm.png)
372
+
373
+ Special thanks to Sushi.
374
+
375
+ If you want to support me, you can [here](https://ko-fi.com/undiai).