TheBloke commited on
Commit
aae9eea
1 Parent(s): b96c492

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +282 -0
README.md ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: mistralai/Mistral-7B-v0.1
3
+ inference: false
4
+ license: apache-2.0
5
+ model_creator: Mistral AI
6
+ model_name: Mistral 7B v0.1
7
+ model_type: mistral
8
+ pipeline_tag: text-generation
9
+ prompt_template: '{prompt}
10
+
11
+ '
12
+ quantized_by: TheBloke
13
+ tags:
14
+ - pretrained
15
+ ---
16
+
17
+ <!-- header start -->
18
+ <!-- 200823 -->
19
+ <div style="width: auto; margin-left: auto; margin-right: auto">
20
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
21
+ </div>
22
+ <div style="display: flex; justify-content: space-between; width: 100%;">
23
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
24
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
25
+ </div>
26
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
27
+ <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>
28
+ </div>
29
+ </div>
30
+ <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>
31
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
32
+ <!-- header end -->
33
+
34
+ # Mistral 7B v0.1 - AWQ
35
+ - Model creator: [Mistral AI](https://huggingface.co/mistralai)
36
+ - Original model: [Mistral 7B v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)
37
+
38
+ <!-- description start -->
39
+ ## Description
40
+
41
+ This repo contains AWQ model files for [Mistral AI's Mistral 7B v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1).
42
+
43
+
44
+ ### About AWQ
45
+
46
+ 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.
47
+
48
+ 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.
49
+
50
+ 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).
51
+
52
+ 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.
53
+ <!-- description end -->
54
+ <!-- repositories-available start -->
55
+ ## Repositories available
56
+
57
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Mistral-7B-v0.1-AWQ)
58
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Mistral-7B-v0.1-GGUF)
59
+ * [Mistral AI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/mistralai/Mistral-7B-v0.1)
60
+ <!-- repositories-available end -->
61
+
62
+ <!-- prompt-template start -->
63
+ ## Prompt template: None
64
+
65
+ ```
66
+ {prompt}
67
+
68
+ ```
69
+
70
+ <!-- prompt-template end -->
71
+
72
+
73
+ <!-- README_AWQ.md-provided-files start -->
74
+ ## Provided files, and AWQ parameters
75
+
76
+ 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.
77
+
78
+ Models are released as sharded safetensors files.
79
+
80
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
81
+ | ------ | ---- | -- | ----------- | ------- | ---- |
82
+ | [main](https://huggingface.co/TheBloke/Mistral-7B-v0.1-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 4.15 GB
83
+
84
+ <!-- README_AWQ.md-provided-files end -->
85
+
86
+ <!-- README_AWQ.md-use-from-vllm start -->
87
+ ## Serving this model from vLLM
88
+
89
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
90
+
91
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
92
+
93
+ ```shell
94
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Mistral-7B-v0.1-AWQ --quantization awq --dtype half
95
+ ```
96
+
97
+ Note: at the time of writing, vLLM has not yet done a new release with support for the `quantization` parameter.
98
+
99
+ If you try the code below and get an error about `quantization` being unrecognised, please install vLLM from Github source.
100
+
101
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
102
+
103
+ ```python
104
+ from vllm import LLM, SamplingParams
105
+
106
+ prompts = [
107
+ "Hello, my name is",
108
+ "The president of the United States is",
109
+ "The capital of France is",
110
+ "The future of AI is",
111
+ ]
112
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
113
+
114
+ llm = LLM(model="TheBloke/Mistral-7B-v0.1-AWQ", quantization="awq", dtype="half")
115
+
116
+ outputs = llm.generate(prompts, sampling_params)
117
+
118
+ # Print the outputs.
119
+ for output in outputs:
120
+ prompt = output.prompt
121
+ generated_text = output.outputs[0].text
122
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
123
+ ```
124
+ <!-- README_AWQ.md-use-from-vllm start -->
125
+
126
+ <!-- README_AWQ.md-use-from-python start -->
127
+ ## Serving this model from TGI
128
+
129
+ TGI merged support for AWQ on September 25th, 2023. At the time of writing you need to use the `:latest` Docker container: `ghcr.io/huggingface/text-generation-inference:latest`
130
+
131
+ Add the parameter `--quantize awq` for AWQ support.
132
+
133
+ Example parameters:
134
+ ```shell
135
+ --model-id TheBloke/Mistral-7B-v0.1-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
136
+ ```
137
+
138
+ ## How to use this AWQ model from Python code
139
+
140
+ ### Install the necessary packages
141
+
142
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
143
+
144
+ ```shell
145
+ pip3 install autoawq
146
+ ```
147
+
148
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
149
+
150
+ ```shell
151
+ pip3 uninstall -y autoawq
152
+ git clone https://github.com/casper-hansen/AutoAWQ
153
+ cd AutoAWQ
154
+ pip3 install .
155
+ ```
156
+
157
+ ### You can then try the following example code
158
+
159
+ ```python
160
+ from awq import AutoAWQForCausalLM
161
+ from transformers import AutoTokenizer
162
+
163
+ model_name_or_path = "TheBloke/Mistral-7B-v0.1-AWQ"
164
+
165
+ # Load model
166
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
167
+ trust_remote_code=False, safetensors=True)
168
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
169
+
170
+ prompt = "Tell me about AI"
171
+ prompt_template=f'''{prompt}
172
+
173
+ '''
174
+
175
+ print("\n\n*** Generate:")
176
+
177
+ tokens = tokenizer(
178
+ prompt_template,
179
+ return_tensors='pt'
180
+ ).input_ids.cuda()
181
+
182
+ # Generate output
183
+ generation_output = model.generate(
184
+ tokens,
185
+ do_sample=True,
186
+ temperature=0.7,
187
+ top_p=0.95,
188
+ top_k=40,
189
+ max_new_tokens=512
190
+ )
191
+
192
+ print("Output: ", tokenizer.decode(generation_output[0]))
193
+
194
+ """
195
+ # Inference should be possible with transformers pipeline as well in future
196
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
197
+ from transformers import pipeline
198
+
199
+ print("*** Pipeline:")
200
+ pipe = pipeline(
201
+ "text-generation",
202
+ model=model,
203
+ tokenizer=tokenizer,
204
+ max_new_tokens=512,
205
+ do_sample=True,
206
+ temperature=0.7,
207
+ top_p=0.95,
208
+ top_k=40,
209
+ repetition_penalty=1.1
210
+ )
211
+
212
+ print(pipe(prompt_template)[0]['generated_text'])
213
+ """
214
+ ```
215
+ <!-- README_AWQ.md-use-from-python end -->
216
+
217
+ <!-- README_AWQ.md-compatibility start -->
218
+ ## Compatibility
219
+
220
+ The files provided are tested to work with:
221
+
222
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
223
+ - [vLLM](https://github.com/vllm-project/vllm)
224
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
225
+
226
+ 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.
227
+
228
+ <!-- README_AWQ.md-compatibility end -->
229
+
230
+ <!-- footer start -->
231
+ <!-- 200823 -->
232
+ ## Discord
233
+
234
+ For further support, and discussions on these models and AI in general, join us at:
235
+
236
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
237
+
238
+ ## Thanks, and how to contribute
239
+
240
+ Thanks to the [chirper.ai](https://chirper.ai) team!
241
+
242
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
243
+
244
+ 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.
245
+
246
+ 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.
247
+
248
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
249
+
250
+ * Patreon: https://patreon.com/TheBlokeAI
251
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
252
+
253
+ **Special thanks to**: Aemon Algiz.
254
+
255
+ **Patreon special mentions**: Alicia Loh, Stephen Murray, K, Ajan Kanaga, RoA, Magnesian, Deo Leter, Olakabola, Eugene Pentland, zynix, Deep Realms, Raymond Fosdick, Elijah Stavena, Iucharbius, Erik Bjäreholt, Luis Javier Navarrete Lozano, Nicholas, theTransient, John Detwiler, alfie_i, knownsqashed, Mano Prime, Willem Michiel, Enrico Ros, LangChain4j, OG, Michael Dempsey, Pierre Kircher, Pedro Madruga, James Bentley, Thomas Belote, Luke @flexchar, Leonard Tan, Johann-Peter Hartmann, Illia Dulskyi, Fen Risland, Chadd, S_X, Jeff Scroggin, Ken Nordquist, Sean Connelly, Artur Olbinski, Swaroop Kallakuri, Jack West, Ai Maven, David Ziegler, Russ Johnson, transmissions 11, John Villwock, Alps Aficionado, Clay Pascal, Viktor Bowallius, Subspace Studios, Rainer Wilmers, Trenton Dambrowitz, vamX, Michael Levine, 준교 김, Brandon Frisco, Kalila, Trailburnt, Randy H, Talal Aujan, Nathan Dryer, Vadim, 阿明, ReadyPlayerEmma, Tiffany J. Kim, George Stoitzev, Spencer Kim, Jerry Meng, Gabriel Tamborski, Cory Kujawski, Jeffrey Morgan, Spiking Neurons AB, Edmond Seymore, Alexandros Triantafyllidis, Lone Striker, Cap'n Zoog, Nikolai Manek, danny, ya boyyy, Derek Yates, usrbinkat, Mandus, TL, Nathan LeClaire, subjectnull, Imad Khwaja, webtim, Raven Klaugh, Asp the Wyvern, Gabriel Puliatti, Caitlyn Gatomon, Joseph William Delisle, Jonathan Leane, Luke Pendergrass, SuperWojo, Sebastain Graf, Will Dee, Fred von Graf, Andrey, Dan Guido, Daniel P. Andersen, Nitin Borwankar, Elle, Vitor Caleffi, biorpg, jjj, NimbleBox.ai, Pieter, Matthew Berman, terasurfer, Michael Davis, Alex, Stanislav Ovsiannikov
256
+
257
+
258
+ Thank you to all my generous patrons and donaters!
259
+
260
+ And thank you again to a16z for their generous grant.
261
+
262
+ <!-- footer end -->
263
+
264
+ # Original model card: Mistral AI's Mistral 7B v0.1
265
+
266
+
267
+ # Model Card for Mistral-7B-v0.1
268
+
269
+ The Mistral-7B-v0.1 Large Language Model (LLM) is a pretrained generative text model with 7 billion parameters.
270
+ Mistral-7B-v0.1 outperforms Llama 2 13B on all benchmarks we tested.
271
+
272
+ For full details of this model please read our [Release blog post](https://mistral.ai/news/announcing-mistral-7b/)
273
+
274
+ ## Model Architecture
275
+ Mistral-7B-v0.1 is a transformer model, with the following architecture choices:
276
+ - Grouped-Query Attention
277
+ - Sliding-Window Attention
278
+ - Byte-fallback BPE tokenizer
279
+
280
+ ## The Mistral AI Team
281
+
282
+ Albert Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lélio Renard Lavaud, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed.