Text Generation
Transformers
Safetensors
Chinese
English
mistral
text-generation-inference
4-bit precision
awq
TheBloke commited on
Commit
29db8dd
1 Parent(s): 1491f86

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +384 -0
README.md ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Azure99/blossom-v3-mistral-7b
3
+ datasets:
4
+ - Azure99/blossom-chat-v1
5
+ - Azure99/blossom-math-v2
6
+ - Azure99/blossom-wizard-v1
7
+ - Azure99/blossom-orca-v1
8
+ inference: false
9
+ language:
10
+ - zh
11
+ - en
12
+ license: apache-2.0
13
+ model_creator: Azure99
14
+ model_name: Blossom V3 Mistral 7B
15
+ model_type: mistral
16
+ prompt_template: "|Human|: {prompt}\n|Bot|: \n"
17
+ quantized_by: TheBloke
18
+ ---
19
+ <!-- markdownlint-disable MD041 -->
20
+
21
+ <!-- header start -->
22
+ <!-- 200823 -->
23
+ <div style="width: auto; margin-left: auto; margin-right: auto">
24
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
25
+ </div>
26
+ <div style="display: flex; justify-content: space-between; width: 100%;">
27
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
28
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
29
+ </div>
30
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
31
+ <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>
32
+ </div>
33
+ </div>
34
+ <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>
35
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
36
+ <!-- header end -->
37
+
38
+ # Blossom V3 Mistral 7B - AWQ
39
+ - Model creator: [Azure99](https://huggingface.co/Azure99)
40
+ - Original model: [Blossom V3 Mistral 7B](https://huggingface.co/Azure99/blossom-v3-mistral-7b)
41
+
42
+ <!-- description start -->
43
+ ## Description
44
+
45
+ This repo contains AWQ model files for [Azure99's Blossom V3 Mistral 7B](https://huggingface.co/Azure99/blossom-v3-mistral-7b).
46
+
47
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
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 with equivalent or better quality compared to the most commonly used GPTQ settings.
53
+
54
+ It is supported by:
55
+
56
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
57
+ - [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
58
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
59
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
60
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
61
+
62
+ <!-- description end -->
63
+ <!-- repositories-available start -->
64
+ ## Repositories available
65
+
66
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/blossom-v3-mistral-7B-AWQ)
67
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/blossom-v3-mistral-7B-GPTQ)
68
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/blossom-v3-mistral-7B-GGUF)
69
+ * [Azure99's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/Azure99/blossom-v3-mistral-7b)
70
+ <!-- repositories-available end -->
71
+
72
+ <!-- prompt-template start -->
73
+ ## Prompt template: Blossom
74
+
75
+ ```
76
+ |Human|: {prompt}
77
+ |Bot|:
78
+
79
+ ```
80
+
81
+ <!-- prompt-template end -->
82
+
83
+
84
+ <!-- README_AWQ.md-provided-files start -->
85
+ ## Provided files, and AWQ parameters
86
+
87
+ I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
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/blossom-v3-mistral-7B-AWQ/tree/main) | 4 | 128 | [chinese](https://huggingface.co/datasets/TigerResearch/sft_zh/viewer/) | 4096 | 4.15 GB
94
+
95
+ <!-- README_AWQ.md-provided-files end -->
96
+
97
+ <!-- README_AWQ.md-text-generation-webui start -->
98
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
99
+
100
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
101
+
102
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
103
+
104
+ 1. Click the **Model tab**.
105
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/blossom-v3-mistral-7B-AWQ`.
106
+ 3. Click **Download**.
107
+ 4. The model will start downloading. Once it's finished it will say "Done".
108
+ 5. In the top left, click the refresh icon next to **Model**.
109
+ 6. In the **Model** dropdown, choose the model you just downloaded: `blossom-v3-mistral-7B-AWQ`
110
+ 7. Select **Loader: AutoAWQ**.
111
+ 8. Click Load, and the model will load and is now ready for use.
112
+ 9. 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.
113
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
114
+ <!-- README_AWQ.md-text-generation-webui end -->
115
+
116
+ <!-- README_AWQ.md-use-from-vllm start -->
117
+ ## Multi-user inference server: vLLM
118
+
119
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
120
+
121
+ - Please ensure you are using vLLM version 0.2 or later.
122
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
123
+
124
+ For example:
125
+
126
+ ```shell
127
+ python3 -m vllm.entrypoints.api_server --model TheBloke/blossom-v3-mistral-7B-AWQ --quantization awq --dtype auto
128
+ ```
129
+
130
+ - When using vLLM from Python code, again set `quantization=awq`.
131
+
132
+ For example:
133
+
134
+ ```python
135
+ from vllm import LLM, SamplingParams
136
+
137
+ prompts = [
138
+ "Tell me about AI",
139
+ "Write a story about llamas",
140
+ "What is 291 - 150?",
141
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
142
+ ]
143
+ prompt_template=f'''|Human|: {prompt}
144
+ |Bot|:
145
+ '''
146
+
147
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
148
+
149
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
150
+
151
+ llm = LLM(model="TheBloke/blossom-v3-mistral-7B-AWQ", quantization="awq", dtype="auto")
152
+
153
+ outputs = llm.generate(prompts, sampling_params)
154
+
155
+ # Print the outputs.
156
+ for output in outputs:
157
+ prompt = output.prompt
158
+ generated_text = output.outputs[0].text
159
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
160
+ ```
161
+ <!-- README_AWQ.md-use-from-vllm start -->
162
+
163
+ <!-- README_AWQ.md-use-from-tgi start -->
164
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
165
+
166
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
167
+
168
+ Example Docker parameters:
169
+
170
+ ```shell
171
+ --model-id TheBloke/blossom-v3-mistral-7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
172
+ ```
173
+
174
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
175
+
176
+ ```shell
177
+ pip3 install huggingface-hub
178
+ ```
179
+
180
+ ```python
181
+ from huggingface_hub import InferenceClient
182
+
183
+ endpoint_url = "https://your-endpoint-url-here"
184
+
185
+ prompt = "Tell me about AI"
186
+ prompt_template=f'''|Human|: {prompt}
187
+ |Bot|:
188
+ '''
189
+
190
+ client = InferenceClient(endpoint_url)
191
+ response = client.text_generation(prompt,
192
+ max_new_tokens=128,
193
+ do_sample=True,
194
+ temperature=0.7,
195
+ top_p=0.95,
196
+ top_k=40,
197
+ repetition_penalty=1.1)
198
+
199
+ print(f"Model output: ", response)
200
+ ```
201
+ <!-- README_AWQ.md-use-from-tgi end -->
202
+
203
+ <!-- README_AWQ.md-use-from-python start -->
204
+ ## Inference from Python code using Transformers
205
+
206
+ ### Install the necessary packages
207
+
208
+ - Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
209
+ - Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
210
+
211
+ ```shell
212
+ pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
213
+ ```
214
+
215
+ Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
216
+
217
+ If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
218
+
219
+ ```shell
220
+ pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
221
+ ```
222
+
223
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
224
+
225
+ ```shell
226
+ pip3 uninstall -y autoawq
227
+ git clone https://github.com/casper-hansen/AutoAWQ
228
+ cd AutoAWQ
229
+ pip3 install .
230
+ ```
231
+
232
+ ### Transformers example code (requires Transformers 4.35.0 and later)
233
+
234
+ ```python
235
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
236
+
237
+ model_name_or_path = "TheBloke/blossom-v3-mistral-7B-AWQ"
238
+
239
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
240
+ model = AutoModelForCausalLM.from_pretrained(
241
+ model_name_or_path,
242
+ low_cpu_mem_usage=True,
243
+ device_map="cuda:0"
244
+ )
245
+
246
+ # Using the text streamer to stream output one token at a time
247
+ streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
248
+
249
+ prompt = "Tell me about AI"
250
+ prompt_template=f'''|Human|: {prompt}
251
+ |Bot|:
252
+ '''
253
+
254
+ # Convert prompt to tokens
255
+ tokens = tokenizer(
256
+ prompt_template,
257
+ return_tensors='pt'
258
+ ).input_ids.cuda()
259
+
260
+ generation_params = {
261
+ "do_sample": True,
262
+ "temperature": 0.7,
263
+ "top_p": 0.95,
264
+ "top_k": 40,
265
+ "max_new_tokens": 512,
266
+ "repetition_penalty": 1.1
267
+ }
268
+
269
+ # Generate streamed output, visible one token at a time
270
+ generation_output = model.generate(
271
+ tokens,
272
+ streamer=streamer,
273
+ **generation_params
274
+ )
275
+
276
+ # Generation without a streamer, which will include the prompt in the output
277
+ generation_output = model.generate(
278
+ tokens,
279
+ **generation_params
280
+ )
281
+
282
+ # Get the tokens from the output, decode them, print them
283
+ token_output = generation_output[0]
284
+ text_output = tokenizer.decode(token_output)
285
+ print("model.generate output: ", text_output)
286
+
287
+ # Inference is also possible via Transformers' pipeline
288
+ from transformers import pipeline
289
+
290
+ pipe = pipeline(
291
+ "text-generation",
292
+ model=model,
293
+ tokenizer=tokenizer,
294
+ **generation_params
295
+ )
296
+
297
+ pipe_output = pipe(prompt_template)[0]['generated_text']
298
+ print("pipeline output: ", pipe_output)
299
+
300
+ ```
301
+ <!-- README_AWQ.md-use-from-python end -->
302
+
303
+ <!-- README_AWQ.md-compatibility start -->
304
+ ## Compatibility
305
+
306
+ The files provided are tested to work with:
307
+
308
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
309
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
310
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
311
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
312
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
313
+
314
+ <!-- README_AWQ.md-compatibility end -->
315
+
316
+ <!-- footer start -->
317
+ <!-- 200823 -->
318
+ ## Discord
319
+
320
+ For further support, and discussions on these models and AI in general, join us at:
321
+
322
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
323
+
324
+ ## Thanks, and how to contribute
325
+
326
+ Thanks to the [chirper.ai](https://chirper.ai) team!
327
+
328
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
329
+
330
+ 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.
331
+
332
+ 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.
333
+
334
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
335
+
336
+ * Patreon: https://patreon.com/TheBlokeAI
337
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
338
+
339
+ **Special thanks to**: Aemon Algiz.
340
+
341
+ **Patreon special mentions**: Brandon Frisco, LangChain4j, Spiking Neurons AB, transmissions 11, Joseph William Delisle, Nitin Borwankar, Willem Michiel, Michael Dempsey, vamX, Jeffrey Morgan, zynix, jjj, Omer Bin Jawed, Sean Connelly, jinyuan sun, Jeromy Smith, Shadi, Pawan Osman, Chadd, Elijah Stavena, Illia Dulskyi, Sebastain Graf, Stephen Murray, terasurfer, Edmond Seymore, Celu Ramasamy, Mandus, Alex, biorpg, Ajan Kanaga, Clay Pascal, Raven Klaugh, 阿明, K, ya boyyy, usrbinkat, Alicia Loh, John Villwock, ReadyPlayerEmma, Chris Smitley, Cap'n Zoog, fincy, GodLy, S_X, sidney chen, Cory Kujawski, OG, Mano Prime, AzureBlack, Pieter, Kalila, Spencer Kim, Tom X Nguyen, Stanislav Ovsiannikov, Michael Levine, Andrey, Trailburnt, Vadim, Enrico Ros, Talal Aujan, Brandon Phillips, Jack West, Eugene Pentland, Michael Davis, Will Dee, webtim, Jonathan Leane, Alps Aficionado, Rooh Singh, Tiffany J. Kim, theTransient, Luke @flexchar, Elle, Caitlyn Gatomon, Ari Malik, subjectnull, Johann-Peter Hartmann, Trenton Dambrowitz, Imad Khwaja, Asp the Wyvern, Emad Mostaque, Rainer Wilmers, Alexandros Triantafyllidis, Nicholas, Pedro Madruga, SuperWojo, Harry Royden McLaughlin, James Bentley, Olakabola, David Ziegler, Ai Maven, Jeff Scroggin, Nikolai Manek, Deo Leter, Matthew Berman, Fen Risland, Ken Nordquist, Manuel Alberto Morcote, Luke Pendergrass, TL, Fred von Graf, Randy H, Dan Guido, NimbleBox.ai, Vitor Caleffi, Gabriel Tamborski, knownsqashed, Lone Striker, Erik Bjäreholt, John Detwiler, Leonard Tan, Iucharbius
342
+
343
+
344
+ Thank you to all my generous patrons and donaters!
345
+
346
+ And thank you again to a16z for their generous grant.
347
+
348
+ <!-- footer end -->
349
+
350
+ # Original model card: Azure99's Blossom V3 Mistral 7B
351
+
352
+ # **BLOSSOM-v3-mistral-7b**
353
+
354
+ ### 介绍
355
+
356
+ Blossom是一个对话式语言模型,基于Mistral-7B-v0.1预训练模型,在Blossom Orca/Wizard/Chat/Math混合数据集上进行指令精调得来。Blossom拥有强大的通用能力及上下文理解能力,此外,训练使用的高质量中英文数据集也进行了开源。
357
+
358
+ 训练分为两阶段,第一阶段使用100K Wizard、100K Orca单轮指令数据集,训练1个epoch;第二阶段使用2K Blossom math数学推理数据集、50K Blossom chat多轮对话数据集、以及上一阶段中随机采样1%的数据,训练3个epoch。
359
+
360
+ 注意:Mistral-7B-v0.1预训练模型的中文知识较为欠缺,因此对于中文场景,更推荐使用[blossom-v3-baichuan2-7b](https://huggingface.co/Azure99/blossom-v3-baichuan2-7b)
361
+
362
+ ### 推理
363
+
364
+ 推理采用对话续写的形式。
365
+
366
+ 单轮对话
367
+
368
+ ```
369
+ A chat between a human and an artificial intelligence bot. The bot gives helpful, detailed, and polite answers to the human's questions.
370
+ |Human|: 你好
371
+ |Bot|:
372
+ ```
373
+
374
+ 多轮对话
375
+
376
+ ```
377
+ A chat between a human and an artificial intelligence bot. The bot gives helpful, detailed, and polite answers to the human's questions.
378
+ |Human|: 你好
379
+ |Bot|: 你好,有什么我能帮助你的?</s>
380
+ |Human|: 介绍下中国的首都吧
381
+ |Bot|:
382
+ ```
383
+
384
+ 注意:在历史对话的Bot输出结尾,拼接一个&lt;/s&gt;