Text Generation
Transformers
Safetensors
English
llama
text generation
instruct
text-generation-inference
4-bit precision
awq
TheBloke commited on
Commit
bdf4fdd
1 Parent(s): 485ccce

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +340 -0
README.md ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://huggingface.co/PygmalionAI/pygmalion-2-7b
3
+ datasets:
4
+ - PygmalionAI/PIPPA
5
+ - Open-Orca/OpenOrca
6
+ - Norquinal/claude_multiround_chat_30k
7
+ - jondurbin/airoboros-gpt4-1.4.1
8
+ - databricks/databricks-dolly-15k
9
+ inference: false
10
+ language:
11
+ - en
12
+ license: llama2
13
+ model_creator: PygmalionAI
14
+ model_name: Pygmalion 2 7B
15
+ model_type: llama
16
+ pipeline_tag: text-generation
17
+ prompt_template: 'The model has been trained on prompts using three different roles,
18
+ which are denoted by the following tokens: `<|system|>`, `<|user|>` and `<|model|>`.
19
+
20
+
21
+ The `<|system|>` prompt can be used to inject out-of-channel information behind
22
+ the scenes, while the `<|user|>` prompt should be used to indicate user input.
23
+
24
+ The `<|model|>` token should then be used to indicate that the model should generate
25
+ a response. These tokens can happen multiple times and be chained up to form a conversation
26
+ history.
27
+
28
+
29
+ The system prompt has been designed to allow the model to "enter" various modes
30
+ and dictate the reply length. Here''s an example:
31
+
32
+
33
+ ```
34
+
35
+ <|system|>Enter RP mode. Pretend to be {{char}} whose persona follows:
36
+
37
+ {{persona}}
38
+
39
+
40
+ You shall reply to the user while staying in character, and generate long responses.
41
+
42
+ ```
43
+
44
+ '
45
+ quantized_by: TheBloke
46
+ tags:
47
+ - text generation
48
+ - instruct
49
+ thumbnail: null
50
+ ---
51
+
52
+ <!-- header start -->
53
+ <!-- 200823 -->
54
+ <div style="width: auto; margin-left: auto; margin-right: auto">
55
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
56
+ </div>
57
+ <div style="display: flex; justify-content: space-between; width: 100%;">
58
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
59
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
60
+ </div>
61
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
62
+ <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>
63
+ </div>
64
+ </div>
65
+ <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>
66
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
67
+ <!-- header end -->
68
+
69
+ # Pygmalion 2 7B - AWQ
70
+ - Model creator: [PygmalionAI](https://huggingface.co/PygmalionAI)
71
+ - Original model: [Pygmalion 2 7B](https://huggingface.co/PygmalionAI/pygmalion-2-7b)
72
+
73
+ <!-- description start -->
74
+ ## Description
75
+
76
+ This repo contains AWQ model files for [PygmalionAI's Pygmalion 2 7B](https://huggingface.co/PygmalionAI/pygmalion-2-7b).
77
+
78
+
79
+ ### About AWQ
80
+
81
+ 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.
82
+
83
+ It is also now supported by continuous batching server [vLLM](https://github.com/vllm-project/vllm), allowing use of AWQ models for high-throughput concurrent inference in multi-user server scenarios. Note that, at the time of writing, overall throughput is still lower than running vLLM 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.
84
+ <!-- description end -->
85
+ <!-- repositories-available start -->
86
+ ## Repositories available
87
+
88
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Pygmalion-2-7B-AWQ)
89
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Pygmalion-2-7B-GPTQ)
90
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Pygmalion-2-7B-GGUF)
91
+ * [PygmalionAI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/PygmalionAI/pygmalion-2-7b)
92
+ <!-- repositories-available end -->
93
+
94
+ <!-- prompt-template start -->
95
+ ## Prompt template: Custom
96
+
97
+ The model has been trained on prompts using three different roles, which are denoted by the following tokens: `<|system|>`, `<|user|>` and `<|model|>`.
98
+
99
+ The `<|system|>` prompt can be used to inject out-of-channel information behind the scenes, while the `<|user|>` prompt should be used to indicate user input.
100
+ The `<|model|>` token should then be used to indicate that the model should generate a response. These tokens can happen multiple times and be chained up to form a conversation history.
101
+
102
+ The system prompt has been designed to allow the model to "enter" various modes and dictate the reply length. Here's an example:
103
+
104
+ ```
105
+ <|system|>Enter RP mode. Pretend to be {{char}} whose persona follows:
106
+ {{persona}}
107
+
108
+ You shall reply to the user while staying in character, and generate long responses.
109
+ ```
110
+
111
+
112
+ <!-- prompt-template end -->
113
+
114
+
115
+ <!-- README_AWQ.md-provided-files start -->
116
+ ## Provided files and AWQ parameters
117
+
118
+ 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.
119
+
120
+ Models are released as sharded safetensors files.
121
+
122
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
123
+ | ------ | ---- | -- | ----------- | ------- | ---- |
124
+ | [main](https://huggingface.co/TheBloke/Pygmalion-2-7B-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 3.89 GB
125
+
126
+ <!-- README_AWQ.md-provided-files end -->
127
+
128
+ <!-- README_AWQ.md-use-from-vllm start -->
129
+ ## Serving this model from vLLM
130
+
131
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
132
+
133
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
134
+
135
+ ```shell
136
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Pygmalion-2-7B-AWQ --quantization awq
137
+ ```
138
+
139
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
140
+
141
+ ```python
142
+ from vllm import LLM, SamplingParams
143
+
144
+ prompts = [
145
+ "Hello, my name is",
146
+ "The president of the United States is",
147
+ "The capital of France is",
148
+ "The future of AI is",
149
+ ]
150
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
151
+
152
+ llm = LLM(model="TheBloke/Pygmalion-2-7B-AWQ", quantization="awq")
153
+
154
+ outputs = llm.generate(prompts, sampling_params)
155
+
156
+ # Print the outputs.
157
+ for output in outputs:
158
+ prompt = output.prompt
159
+ generated_text = output.outputs[0].text
160
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
161
+ ```
162
+ <!-- README_AWQ.md-use-from-vllm start -->
163
+
164
+ <!-- README_AWQ.md-use-from-python start -->
165
+ ## How to use this AWQ model from Python code
166
+
167
+ ### Install the necessary packages
168
+
169
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
170
+
171
+ ```shell
172
+ pip3 install autoawq
173
+ ```
174
+
175
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
176
+
177
+ ```shell
178
+ pip3 uninstall -y autoawq
179
+ git clone https://github.com/casper-hansen/AutoAWQ
180
+ cd AutoAWQ
181
+ pip3 install .
182
+ ```
183
+
184
+ ### You can then try the following example code
185
+
186
+ ```python
187
+ from awq import AutoAWQForCausalLM
188
+ from transformers import AutoTokenizer
189
+
190
+ model_name_or_path = "TheBloke/Pygmalion-2-7B-AWQ"
191
+
192
+ # Load model
193
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
194
+ trust_remote_code=False, safetensors=True)
195
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
196
+
197
+ prompt = "Tell me about AI"
198
+ prompt_template=f'''<|system|>Enter RP mode. Pretend to be {{char}} whose persona follows:
199
+ {{persona}}
200
+
201
+ You shall reply to the user while staying in character, and generate long responses.
202
+
203
+ '''
204
+
205
+ print("\n\n*** Generate:")
206
+
207
+ tokens = tokenizer(
208
+ prompt_template,
209
+ return_tensors='pt'
210
+ ).input_ids.cuda()
211
+
212
+ # Generate output
213
+ generation_output = model.generate(
214
+ tokens,
215
+ do_sample=True,
216
+ temperature=0.7,
217
+ top_p=0.95,
218
+ top_k=40,
219
+ max_new_tokens=512
220
+ )
221
+
222
+ print("Output: ", tokenizer.decode(generation_output[0]))
223
+
224
+ # Inference can also be done using transformers' pipeline
225
+ from transformers import pipeline
226
+
227
+ print("*** Pipeline:")
228
+ pipe = pipeline(
229
+ "text-generation",
230
+ model=model,
231
+ tokenizer=tokenizer,
232
+ max_new_tokens=512,
233
+ do_sample=True,
234
+ temperature=0.7,
235
+ top_p=0.95,
236
+ top_k=40,
237
+ repetition_penalty=1.1
238
+ )
239
+
240
+ print(pipe(prompt_template)[0]['generated_text'])
241
+ ```
242
+ <!-- README_AWQ.md-use-from-python end -->
243
+
244
+ <!-- README_AWQ.md-compatibility start -->
245
+ ## Compatibility
246
+
247
+ The files provided are tested to work with [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), and [vLLM](https://github.com/vllm-project/vllm).
248
+
249
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is not yet compatible with AWQ, but a PR is open which should bring support soon: [TGI PR #781](https://github.com/huggingface/text-generation-inference/issues/781).
250
+ <!-- README_AWQ.md-compatibility end -->
251
+
252
+ <!-- footer start -->
253
+ <!-- 200823 -->
254
+ ## Discord
255
+
256
+ For further support, and discussions on these models and AI in general, join us at:
257
+
258
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
259
+
260
+ ## Thanks, and how to contribute
261
+
262
+ Thanks to the [chirper.ai](https://chirper.ai) team!
263
+
264
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
265
+
266
+ 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.
267
+
268
+ 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.
269
+
270
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
271
+
272
+ * Patreon: https://patreon.com/TheBlokeAI
273
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
274
+
275
+ **Special thanks to**: Aemon Algiz.
276
+
277
+ **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
278
+
279
+
280
+ Thank you to all my generous patrons and donaters!
281
+
282
+ And thank you again to a16z for their generous grant.
283
+
284
+ <!-- footer end -->
285
+
286
+ # Original model card: PygmalionAI's Pygmalion 2 7B
287
+
288
+ <h1 style="text-align: center">Pygmalion-2 7B</h1>
289
+ <h2 style="text-align: center">An instruction-tuned Llama-2 biased towards fiction writing and conversation.</h2>
290
+
291
+ ## Model Details
292
+
293
+ The long-awaited release of our new models based on Llama-2 is finally here. Pygmalion-2 7B (formerly known as Metharme) is based on
294
+ [Llama-2 7B](https://huggingface.co/meta-llama/llama-2-7b-hf) released by Meta AI.
295
+
296
+ The Metharme models were an experiment to try and get a model that is usable for conversation, roleplaying and storywriting,
297
+ but which can be guided using natural language like other instruct models. After much deliberation, we reached the conclusion
298
+ that the Metharme prompting format is superior (and easier to use) compared to the classic Pygmalion.
299
+
300
+ This model was trained by doing supervised fine-tuning over a mixture of regular instruction data alongside roleplay, fictional stories
301
+ and conversations with synthetically generated instructions attached.
302
+
303
+ This model is freely available for both commercial and non-commercial use, as per the Llama-2 license.
304
+
305
+
306
+ ## Prompting
307
+
308
+ The model has been trained on prompts using three different roles, which are denoted by the following tokens: `<|system|>`, `<|user|>` and `<|model|>`.
309
+
310
+ The `<|system|>` prompt can be used to inject out-of-channel information behind the scenes, while the `<|user|>` prompt should be used to indicate user input.
311
+ The `<|model|>` token should then be used to indicate that the model should generate a response. These tokens can happen multiple times and be chained up to
312
+ form a conversation history.
313
+
314
+ ### Prompting example
315
+
316
+ The system prompt has been designed to allow the model to "enter" various modes and dictate the reply length. Here's an example:
317
+
318
+ ```
319
+ <|system|>Enter RP mode. Pretend to be {{char}} whose persona follows:
320
+ {{persona}}
321
+
322
+ You shall reply to the user while staying in character, and generate long responses.
323
+ ```
324
+
325
+ ## Dataset
326
+ The dataset used to fine-tune this model includes our own [PIPPA](https://huggingface.co/datasets/PygmalionAI/PIPPA), along with several other instruction
327
+ datasets, and datasets acquired from various RP forums.
328
+
329
+ ## Limitations and biases
330
+
331
+ The intended use-case for this model is fictional writing for entertainment purposes. Any other sort of usage is out of scope.
332
+
333
+ As such, it was **not** fine-tuned to be safe and harmless: the base model _and_ this fine-tune have been trained on data known to contain profanity and texts that
334
+ are lewd or otherwise offensive. It may produce socially unacceptable or undesirable text, even if the prompt itself does not include anything explicitly offensive.
335
+ Outputs might often be factually wrong or misleading.
336
+
337
+ ## Acknowledgements
338
+ We would like to thank [SpicyChat](https://spicychat.ai/) for sponsoring the training for this model.
339
+
340
+ [<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)