TheBloke commited on
Commit
5097dcc
1 Parent(s): a08a569

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +359 -0
README.md ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Norquinal/Mistral-7B-claude-chat
3
+ datasets:
4
+ - Norquinal/claude_multiround_chat_1k
5
+ inference: false
6
+ license: cc-by-nc-4.0
7
+ model_creator: Andy B. Norquinal
8
+ model_name: Mistral 7B Claude Chat
9
+ model_type: mistral
10
+ prompt_template: 'A chat between a curious user and an artificial intelligence assistant.
11
+ The assistant gives helpful, detailed, and polite answers to the user''s questions.
12
+ USER: {prompt} ASSISTANT:
13
+
14
+ '
15
+ quantized_by: TheBloke
16
+ ---
17
+ <!-- markdownlint-disable MD041 -->
18
+
19
+ <!-- header start -->
20
+ <!-- 200823 -->
21
+ <div style="width: auto; margin-left: auto; margin-right: auto">
22
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
23
+ </div>
24
+ <div style="display: flex; justify-content: space-between; width: 100%;">
25
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
26
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
27
+ </div>
28
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
29
+ <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>
30
+ </div>
31
+ </div>
32
+ <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>
33
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
34
+ <!-- header end -->
35
+
36
+ # Mistral 7B Claude Chat - AWQ
37
+ - Model creator: [Andy B. Norquinal](https://huggingface.co/Norquinal)
38
+ - Original model: [Mistral 7B Claude Chat](https://huggingface.co/Norquinal/Mistral-7B-claude-chat)
39
+
40
+ <!-- description start -->
41
+ ## Description
42
+
43
+ This repo contains AWQ model files for [Andy B. Norquinal's Mistral 7B Claude Chat](https://huggingface.co/Norquinal/Mistral-7B-claude-chat).
44
+
45
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
46
+
47
+
48
+ ### About AWQ
49
+
50
+ 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.
51
+
52
+ It is supported by:
53
+
54
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
55
+ - [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
56
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
57
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
58
+
59
+ <!-- description end -->
60
+ <!-- repositories-available start -->
61
+ ## Repositories available
62
+
63
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Mistral-7B-Claude-Chat-AWQ)
64
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Mistral-7B-Claude-Chat-GPTQ)
65
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Mistral-7B-Claude-Chat-GGUF)
66
+ * [Andy B. Norquinal's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/Norquinal/Mistral-7B-claude-chat)
67
+ <!-- repositories-available end -->
68
+
69
+ <!-- prompt-template start -->
70
+ ## Prompt template: Vicuna
71
+
72
+ ```
73
+ A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: {prompt} ASSISTANT:
74
+
75
+ ```
76
+
77
+ <!-- prompt-template end -->
78
+
79
+
80
+ <!-- README_AWQ.md-provided-files start -->
81
+ ## Provided files, and AWQ parameters
82
+
83
+ 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.
84
+
85
+ Models are released as sharded safetensors files.
86
+
87
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
88
+ | ------ | ---- | -- | ----------- | ------- | ---- |
89
+ | [main](https://huggingface.co/TheBloke/Mistral-7B-Claude-Chat-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 4.15 GB
90
+
91
+ <!-- README_AWQ.md-provided-files end -->
92
+
93
+ <!-- README_AWQ.md-text-generation-webui start -->
94
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
95
+
96
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
97
+
98
+ 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.
99
+
100
+ 1. Click the **Model tab**.
101
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Mistral-7B-Claude-Chat-AWQ`.
102
+ 3. Click **Download**.
103
+ 4. The model will start downloading. Once it's finished it will say "Done".
104
+ 5. In the top left, click the refresh icon next to **Model**.
105
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Mistral-7B-Claude-Chat-AWQ`
106
+ 7. Select **Loader: AutoAWQ**.
107
+ 8. Click Load, and the model will load and is now ready for use.
108
+ 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.
109
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
110
+ <!-- README_AWQ.md-text-generation-webui end -->
111
+
112
+ <!-- README_AWQ.md-use-from-vllm start -->
113
+ ## Multi-user inference server: vLLM
114
+
115
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
116
+
117
+ - Please ensure you are using vLLM version 0.2 or later.
118
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
119
+
120
+ For example:
121
+
122
+ ```shell
123
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Mistral-7B-Claude-Chat-AWQ --quantization awq
124
+ ```
125
+
126
+ - When using vLLM from Python code, again set `quantization=awq`.
127
+
128
+ For example:
129
+
130
+ ```python
131
+ from vllm import LLM, SamplingParams
132
+
133
+ prompts = [
134
+ "Tell me about AI",
135
+ "Write a story about llamas",
136
+ "What is 291 - 150?",
137
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
138
+ ]
139
+ prompt_template=f'''A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: {prompt} ASSISTANT:
140
+ '''
141
+
142
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
143
+
144
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
145
+
146
+ llm = LLM(model="TheBloke/Mistral-7B-Claude-Chat-AWQ", quantization="awq", dtype="auto")
147
+
148
+ outputs = llm.generate(prompts, sampling_params)
149
+
150
+ # Print the outputs.
151
+ for output in outputs:
152
+ prompt = output.prompt
153
+ generated_text = output.outputs[0].text
154
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
155
+ ```
156
+ <!-- README_AWQ.md-use-from-vllm start -->
157
+
158
+ <!-- README_AWQ.md-use-from-tgi start -->
159
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
160
+
161
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
162
+
163
+ Example Docker parameters:
164
+
165
+ ```shell
166
+ --model-id TheBloke/Mistral-7B-Claude-Chat-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
167
+ ```
168
+
169
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
170
+
171
+ ```shell
172
+ pip3 install huggingface-hub
173
+ ```
174
+
175
+ ```python
176
+ from huggingface_hub import InferenceClient
177
+
178
+ endpoint_url = "https://your-endpoint-url-here"
179
+
180
+ prompt = "Tell me about AI"
181
+ prompt_template=f'''A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: {prompt} ASSISTANT:
182
+ '''
183
+
184
+ client = InferenceClient(endpoint_url)
185
+ response = client.text_generation(prompt,
186
+ max_new_tokens=128,
187
+ do_sample=True,
188
+ temperature=0.7,
189
+ top_p=0.95,
190
+ top_k=40,
191
+ repetition_penalty=1.1)
192
+
193
+ print(f"Model output: ", response)
194
+ ```
195
+ <!-- README_AWQ.md-use-from-tgi end -->
196
+
197
+ <!-- README_AWQ.md-use-from-python start -->
198
+ ## Inference from Python code using AutoAWQ
199
+
200
+ ### Install the AutoAWQ package
201
+
202
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later.
203
+
204
+ ```shell
205
+ pip3 install autoawq
206
+ ```
207
+
208
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
209
+
210
+ ```shell
211
+ pip3 uninstall -y autoawq
212
+ git clone https://github.com/casper-hansen/AutoAWQ
213
+ cd AutoAWQ
214
+ pip3 install .
215
+ ```
216
+
217
+ ### AutoAWQ example code
218
+
219
+ ```python
220
+ from awq import AutoAWQForCausalLM
221
+ from transformers import AutoTokenizer
222
+
223
+ model_name_or_path = "TheBloke/Mistral-7B-Claude-Chat-AWQ"
224
+
225
+ # Load tokenizer
226
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
227
+ # Load model
228
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
229
+ trust_remote_code=False, safetensors=True)
230
+
231
+ prompt = "Tell me about AI"
232
+ prompt_template=f'''A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: {prompt} ASSISTANT:
233
+ '''
234
+
235
+ print("*** Running model.generate:")
236
+
237
+ token_input = tokenizer(
238
+ prompt_template,
239
+ return_tensors='pt'
240
+ ).input_ids.cuda()
241
+
242
+ # Generate output
243
+ generation_output = model.generate(
244
+ token_input,
245
+ do_sample=True,
246
+ temperature=0.7,
247
+ top_p=0.95,
248
+ top_k=40,
249
+ max_new_tokens=512
250
+ )
251
+
252
+ # Get the tokens from the output, decode them, print them
253
+ token_output = generation_output[0]
254
+ text_output = tokenizer.decode(token_output)
255
+ print("LLM output: ", text_output)
256
+
257
+ """
258
+ # Inference should be possible with transformers pipeline as well in future
259
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
260
+ from transformers import pipeline
261
+
262
+ print("*** Pipeline:")
263
+ pipe = pipeline(
264
+ "text-generation",
265
+ model=model,
266
+ tokenizer=tokenizer,
267
+ max_new_tokens=512,
268
+ do_sample=True,
269
+ temperature=0.7,
270
+ top_p=0.95,
271
+ top_k=40,
272
+ repetition_penalty=1.1
273
+ )
274
+
275
+ print(pipe(prompt_template)[0]['generated_text'])
276
+ """
277
+ ```
278
+ <!-- README_AWQ.md-use-from-python end -->
279
+
280
+ <!-- README_AWQ.md-compatibility start -->
281
+ ## Compatibility
282
+
283
+ The files provided are tested to work with:
284
+
285
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
286
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
287
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
288
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
289
+
290
+ <!-- README_AWQ.md-compatibility end -->
291
+
292
+ <!-- footer start -->
293
+ <!-- 200823 -->
294
+ ## Discord
295
+
296
+ For further support, and discussions on these models and AI in general, join us at:
297
+
298
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
299
+
300
+ ## Thanks, and how to contribute
301
+
302
+ Thanks to the [chirper.ai](https://chirper.ai) team!
303
+
304
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
305
+
306
+ 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.
307
+
308
+ 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.
309
+
310
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
311
+
312
+ * Patreon: https://patreon.com/TheBlokeAI
313
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
314
+
315
+ **Special thanks to**: Aemon Algiz.
316
+
317
+ **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
318
+
319
+
320
+ Thank you to all my generous patrons and donaters!
321
+
322
+ And thank you again to a16z for their generous grant.
323
+
324
+ <!-- footer end -->
325
+
326
+ # Original model card: Andy B. Norquinal's Mistral 7B Claude Chat
327
+
328
+ This is the [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) model fine-tuned using QLoRA (4-bit precision) on my [claude_multiround_chat_1k](https://huggingface.co/datasets/Norquinal/claude_multiround_chat_1k) dataset, which is a randomized subset of ~1000 samples from my [claude_multiround_chat_30k](https://huggingface.co/datasets/Norquinal/claude_multiround_chat_30k) dataset.
329
+
330
+ ## Prompt Format
331
+ The model was finetuned with the Vicuna 1.1 prompt format:
332
+ ```
333
+ A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.
334
+
335
+ USER: {instruction}
336
+ ASSISTANT:
337
+ ```
338
+
339
+ ## Use in Text Generation Web UI
340
+ Install the bleeding-edge version of `transformers` from source:
341
+ ```
342
+ pip install git+https://github.com/huggingface/transformers
343
+ ```
344
+ Or, alternatively, change `model_type` in `config.json` from `mistral` to `llama`.
345
+
346
+ ## Example Usage
347
+ >USER: First, give a brief overview of Chinese cuisine, including its regional diversity. next, describe the importance of the five flavors in Chinese cooking. Then, mention three popular Chinese dishes and their main ingredients. After that, provide a popular Chinese cooking technique and an example of a dish prepared using that technique. Finally, discuss the role of tea in traditional Chinese culture.
348
+
349
+ >ASSISTANT: Chinese cuisine is incredibly diverse due to its large geographic area with different climates and resources available. Regional specialties include Sichuan spicy hot pot, Cantonese dim sum and seafood dishes, Beijing roast duck, and Hunan stir-fries.
350
+ >
351
+ >The five basic tastes that guide Chinese cookery are sweetness, sourness, bitterness, saltiness, and pungency (spiciness). These contrasting flavors are used together to create balance in each dish.
352
+ >
353
+ >Some classic Chinese dishes include dumplings filled with meat or vegetables, spring rolls stuffed with vegetables and meat wrapped in thin pastry, and noodles served in soups or stir fried with sauces and vegetables.
354
+ >
355
+ >A common Chinese cooking technique is braising, where food is slowly cooked in a small amount of liquid until tender and flavorful. An example would be beef brisket braised in soy sauce, ginger and star anise for hours until falling apart.
356
+ >
357
+ >Tea plays a central role in Chinese culture as it represents hospitality, relaxation and socializing. Green teas are most commonly consumed but black, oolong and white varieties also exist. Tea drinking rituals involve preparing and serving tea in specific ways depending on context and occasion.
358
+ >
359
+ >In summary, Chinese cuisine offers a rich culinary tradition influenced by regional differences, an emphasis on balancing the five basic flavors, and a focus on simple yet flavorful preparations using fresh seasonal produce and high quality meats. Tea acts as both a refreshment and symbol of cultural refinement within Chinese society. I hope this overview provides an interesting starting point for further exploration into the fascinating world of Chinese gastronomy!