TheBloke commited on
Commit
d2455b9
1 Parent(s): 125c304

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +374 -0
README.md ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Delcos/Mistral-Pygmalion-7b
3
+ inference: false
4
+ language:
5
+ - en
6
+ library_name: transformers
7
+ license: cc-by-nc-nd-4.0
8
+ model_creator: Devon M
9
+ model_name: Mistral Pygmalion 7B
10
+ model_type: llama
11
+ pipeline_tag: text-generation
12
+ prompt_template: '### Instruction:
13
+
14
+ {prompt}
15
+
16
+ ### Assistant:
17
+
18
+ '
19
+ quantized_by: TheBloke
20
+ tags:
21
+ - Mistral
22
+ - Pygmalion
23
+ - llama-2
24
+ - llama-2-7b
25
+ ---
26
+ <!-- markdownlint-disable MD041 -->
27
+
28
+ <!-- header start -->
29
+ <!-- 200823 -->
30
+ <div style="width: auto; margin-left: auto; margin-right: auto">
31
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
32
+ </div>
33
+ <div style="display: flex; justify-content: space-between; width: 100%;">
34
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
35
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
36
+ </div>
37
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
38
+ <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>
39
+ </div>
40
+ </div>
41
+ <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>
42
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
43
+ <!-- header end -->
44
+
45
+ # Mistral Pygmalion 7B - AWQ
46
+ - Model creator: [Devon M](https://huggingface.co/Delcos)
47
+ - Original model: [Mistral Pygmalion 7B](https://huggingface.co/Delcos/Mistral-Pygmalion-7b)
48
+
49
+ <!-- description start -->
50
+ ## Description
51
+
52
+ This repo contains AWQ model files for [Devon M's Mistral Pygmalion 7B](https://huggingface.co/Delcos/Mistral-Pygmalion-7b).
53
+
54
+
55
+ ### About AWQ
56
+
57
+ 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.
58
+
59
+ It is supported by:
60
+
61
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
62
+ - [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
63
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
64
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
65
+
66
+ <!-- description end -->
67
+ <!-- repositories-available start -->
68
+ ## Repositories available
69
+
70
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Mistral-Pygmalion-7B-AWQ)
71
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Mistral-Pygmalion-7B-GPTQ)
72
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Mistral-Pygmalion-7B-GGUF)
73
+ * [Devon M's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/Delcos/Mistral-Pygmalion-7b)
74
+ <!-- repositories-available end -->
75
+
76
+ <!-- prompt-template start -->
77
+ ## Prompt template: Instruction-Assistant-Hashes
78
+
79
+ ```
80
+ ### Instruction:
81
+ {prompt}
82
+ ### Assistant:
83
+
84
+ ```
85
+
86
+ <!-- prompt-template end -->
87
+ <!-- licensing start -->
88
+ ## Licensing
89
+
90
+ The creator of the source model has listed its license as `cc-by-nc-nd-4.0`, and this quantization has therefore used that same license.
91
+
92
+ 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.
93
+
94
+ In the meantime, any questions regarding licensing, and in particular how these two licenses might interact, should be directed to the original model repository: [Devon M's Mistral Pygmalion 7B](https://huggingface.co/Delcos/Mistral-Pygmalion-7b).
95
+ <!-- licensing end -->
96
+ <!-- README_AWQ.md-provided-files start -->
97
+ ## Provided files, and AWQ parameters
98
+
99
+ 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.
100
+
101
+ Models are released as sharded safetensors files.
102
+
103
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
104
+ | ------ | ---- | -- | ----------- | ------- | ---- |
105
+ | [main](https://huggingface.co/TheBloke/Mistral-Pygmalion-7B-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 3.89 GB
106
+
107
+ <!-- README_AWQ.md-provided-files end -->
108
+
109
+ <!-- README_AWQ.md-text-generation-webui start -->
110
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
111
+
112
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
113
+
114
+ 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.
115
+
116
+ 1. Click the **Model tab**.
117
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Mistral-Pygmalion-7B-AWQ`.
118
+ 3. Click **Download**.
119
+ 4. The model will start downloading. Once it's finished it will say "Done".
120
+ 5. In the top left, click the refresh icon next to **Model**.
121
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Mistral-Pygmalion-7B-AWQ`
122
+ 7. Select **Loader: AutoAWQ**.
123
+ 8. Click Load, and the model will load and is now ready for use.
124
+ 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.
125
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
126
+ <!-- README_AWQ.md-text-generation-webui end -->
127
+
128
+ <!-- README_AWQ.md-use-from-vllm start -->
129
+ ## Multi-user inference server: vLLM
130
+
131
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
132
+
133
+ - Please ensure you are using vLLM version 0.2 or later.
134
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
135
+
136
+ For example:
137
+
138
+ ```shell
139
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Mistral-Pygmalion-7B-AWQ --quantization awq
140
+ ```
141
+
142
+ - When using vLLM from Python code, again set `quantization=awq`.
143
+
144
+ For example:
145
+
146
+ ```python
147
+ from vllm import LLM, SamplingParams
148
+
149
+ prompts = [
150
+ "Tell me about AI",
151
+ "Write a story about llamas",
152
+ "What is 291 - 150?",
153
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
154
+ ]
155
+ prompt_template=f'''### Instruction:
156
+ {prompt}
157
+ ### Assistant:
158
+ '''
159
+
160
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
161
+
162
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
163
+
164
+ llm = LLM(model="TheBloke/Mistral-Pygmalion-7B-AWQ", quantization="awq", dtype="auto")
165
+
166
+ outputs = llm.generate(prompts, sampling_params)
167
+
168
+ # Print the outputs.
169
+ for output in outputs:
170
+ prompt = output.prompt
171
+ generated_text = output.outputs[0].text
172
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
173
+ ```
174
+ <!-- README_AWQ.md-use-from-vllm start -->
175
+
176
+ <!-- README_AWQ.md-use-from-tgi start -->
177
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
178
+
179
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
180
+
181
+ Example Docker parameters:
182
+
183
+ ```shell
184
+ --model-id TheBloke/Mistral-Pygmalion-7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
185
+ ```
186
+
187
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
188
+
189
+ ```shell
190
+ pip3 install huggingface-hub
191
+ ```
192
+
193
+ ```python
194
+ from huggingface_hub import InferenceClient
195
+
196
+ endpoint_url = "https://your-endpoint-url-here"
197
+
198
+ prompt = "Tell me about AI"
199
+ prompt_template=f'''### Instruction:
200
+ {prompt}
201
+ ### Assistant:
202
+ '''
203
+
204
+ client = InferenceClient(endpoint_url)
205
+ response = client.text_generation(prompt,
206
+ max_new_tokens=128,
207
+ do_sample=True,
208
+ temperature=0.7,
209
+ top_p=0.95,
210
+ top_k=40,
211
+ repetition_penalty=1.1)
212
+
213
+ print(f"Model output: ", response)
214
+ ```
215
+ <!-- README_AWQ.md-use-from-tgi end -->
216
+
217
+ <!-- README_AWQ.md-use-from-python start -->
218
+ ## Inference from Python code using AutoAWQ
219
+
220
+ ### Install the AutoAWQ package
221
+
222
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later.
223
+
224
+ ```shell
225
+ pip3 install autoawq
226
+ ```
227
+
228
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
229
+
230
+ ```shell
231
+ pip3 uninstall -y autoawq
232
+ git clone https://github.com/casper-hansen/AutoAWQ
233
+ cd AutoAWQ
234
+ pip3 install .
235
+ ```
236
+
237
+ ### AutoAWQ example code
238
+
239
+ ```python
240
+ from awq import AutoAWQForCausalLM
241
+ from transformers import AutoTokenizer
242
+
243
+ model_name_or_path = "TheBloke/Mistral-Pygmalion-7B-AWQ"
244
+
245
+ # Load tokenizer
246
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
247
+ # Load model
248
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
249
+ trust_remote_code=False, safetensors=True)
250
+
251
+ prompt = "Tell me about AI"
252
+ prompt_template=f'''### Instruction:
253
+ {prompt}
254
+ ### Assistant:
255
+ '''
256
+
257
+ print("*** Running model.generate:")
258
+
259
+ token_input = tokenizer(
260
+ prompt_template,
261
+ return_tensors='pt'
262
+ ).input_ids.cuda()
263
+
264
+ # Generate output
265
+ generation_output = model.generate(
266
+ token_input,
267
+ do_sample=True,
268
+ temperature=0.7,
269
+ top_p=0.95,
270
+ top_k=40,
271
+ max_new_tokens=512
272
+ )
273
+
274
+ # Get the tokens from the output, decode them, print them
275
+ token_output = generation_output[0]
276
+ text_output = tokenizer.decode(token_output)
277
+ print("LLM output: ", text_output)
278
+
279
+ """
280
+ # Inference should be possible with transformers pipeline as well in future
281
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
282
+ from transformers import pipeline
283
+
284
+ print("*** Pipeline:")
285
+ pipe = pipeline(
286
+ "text-generation",
287
+ model=model,
288
+ tokenizer=tokenizer,
289
+ max_new_tokens=512,
290
+ do_sample=True,
291
+ temperature=0.7,
292
+ top_p=0.95,
293
+ top_k=40,
294
+ repetition_penalty=1.1
295
+ )
296
+
297
+ print(pipe(prompt_template)[0]['generated_text'])
298
+ """
299
+ ```
300
+ <!-- README_AWQ.md-use-from-python end -->
301
+
302
+ <!-- README_AWQ.md-compatibility start -->
303
+ ## Compatibility
304
+
305
+ The files provided are tested to work with:
306
+
307
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
308
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
309
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
310
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
311
+
312
+ <!-- README_AWQ.md-compatibility end -->
313
+
314
+ <!-- footer start -->
315
+ <!-- 200823 -->
316
+ ## Discord
317
+
318
+ For further support, and discussions on these models and AI in general, join us at:
319
+
320
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
321
+
322
+ ## Thanks, and how to contribute
323
+
324
+ Thanks to the [chirper.ai](https://chirper.ai) team!
325
+
326
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
327
+
328
+ 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.
329
+
330
+ 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.
331
+
332
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
333
+
334
+ * Patreon: https://patreon.com/TheBlokeAI
335
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
336
+
337
+ **Special thanks to**: Aemon Algiz.
338
+
339
+ **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
340
+
341
+
342
+ Thank you to all my generous patrons and donaters!
343
+
344
+ And thank you again to a16z for their generous grant.
345
+
346
+ <!-- footer end -->
347
+
348
+ # Original model card: Devon M's Mistral Pygmalion 7B
349
+
350
+
351
+
352
+ # MistralPy-7b
353
+
354
+ This is a merger focusing on preserving the roleplay abilities of Pygmalion while gaining the improved results from Mistral. This model works best for roleplay but is still fairly capable assistant. The smaller (7b) size does mean it isn't perfect at more complex reasoning tasks, but this should be addressed in the larger version that I'll upload soon.
355
+ ### Prompt Template
356
+ ```
357
+ ### Instruction:
358
+ {Prompt & Backstory}
359
+ ### Assistant:
360
+ {Output}
361
+ ```
362
+ Example:
363
+
364
+ ```
365
+ ### Instruction:
366
+ You are Sally, a fun 19 year old woman. Her favorite animal is "cat". Her favoritate color is "blue". She enjoys grape juice and cake.
367
+ ### Assistant:
368
+ Sally: Hi, how are you?
369
+ User: Okay, you?
370
+ ```
371
+
372
+ # Send a message
373
+ [Steam](https://steamcommunity.com/id/delcos/)
374
+ #### Discord: delcos69