TheBloke commited on
Commit
dc04d53
1 Parent(s): 69fda45

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +324 -0
README.md ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: ehartford/samantha-mistral-7b
3
+ inference: false
4
+ license: apache-2.0
5
+ model_creator: Eric Hartford
6
+ model_name: Samantha Mistral 7B
7
+ model_type: mistral
8
+ prompt_template: '<|im_start|>system
9
+
10
+ {system_message}<|im_end|>
11
+
12
+ <|im_start|>user
13
+
14
+ {prompt}<|im_end|>
15
+
16
+ <|im_start|>assistant
17
+
18
+ '
19
+ quantized_by: TheBloke
20
+ ---
21
+
22
+ <!-- header start -->
23
+ <!-- 200823 -->
24
+ <div style="width: auto; margin-left: auto; margin-right: auto">
25
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
26
+ </div>
27
+ <div style="display: flex; justify-content: space-between; width: 100%;">
28
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
29
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
30
+ </div>
31
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
32
+ <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>
33
+ </div>
34
+ </div>
35
+ <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>
36
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
37
+ <!-- header end -->
38
+
39
+ # Samantha Mistral 7B - AWQ
40
+ - Model creator: [Eric Hartford](https://huggingface.co/ehartford)
41
+ - Original model: [Samantha Mistral 7B](https://huggingface.co/ehartford/samantha-mistral-7b)
42
+
43
+ <!-- description start -->
44
+ ## Description
45
+
46
+ This repo contains AWQ model files for [Eric Hartford's Samantha Mistral 7B](https://huggingface.co/ehartford/samantha-mistral-7b).
47
+
48
+
49
+ ### About AWQ
50
+
51
+ 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.
52
+
53
+ 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.
54
+
55
+ 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).
56
+
57
+ 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.
58
+ <!-- description end -->
59
+ <!-- repositories-available start -->
60
+ ## Repositories available
61
+
62
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/samantha-mistral-7B-AWQ)
63
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/samantha-mistral-7B-GPTQ)
64
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/samantha-mistral-7B-GGUF)
65
+ * [Eric Hartford's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/ehartford/samantha-mistral-7b)
66
+ <!-- repositories-available end -->
67
+
68
+ <!-- prompt-template start -->
69
+ ## Prompt template: ChatML
70
+
71
+ ```
72
+ <|im_start|>system
73
+ {system_message}<|im_end|>
74
+ <|im_start|>user
75
+ {prompt}<|im_end|>
76
+ <|im_start|>assistant
77
+
78
+ ```
79
+
80
+ <!-- prompt-template end -->
81
+
82
+
83
+ <!-- README_AWQ.md-provided-files start -->
84
+ ## Provided files, and AWQ parameters
85
+
86
+ 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.
87
+
88
+ Models are released as sharded safetensors files.
89
+
90
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
91
+ | ------ | ---- | -- | ----------- | ------- | ---- |
92
+ | [main](https://huggingface.co/TheBloke/samantha-mistral-7B-AWQ/tree/main) | 4 | 128 | [c4](https://huggingface.co/datasets/allenai/c4) | 4096 | 4.15 GB
93
+
94
+ <!-- README_AWQ.md-provided-files end -->
95
+
96
+ <!-- README_AWQ.md-use-from-vllm start -->
97
+ ## Serving this model from vLLM
98
+
99
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
100
+
101
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
102
+
103
+ If you try the vLLM examples below and get an error about `quantization` being unrecognised, or other AWQ-related issues, please install vLLM from Github source.
104
+
105
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
106
+
107
+ ```shell
108
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/samantha-mistral-7B-AWQ --quantization awq --dtype half
109
+ ```
110
+
111
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
112
+
113
+ ```python
114
+ from vllm import LLM, SamplingParams
115
+
116
+ prompts = [
117
+ "Hello, my name is",
118
+ "The president of the United States is",
119
+ "The capital of France is",
120
+ "The future of AI is",
121
+ ]
122
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
123
+
124
+ llm = LLM(model="TheBloke/samantha-mistral-7B-AWQ", quantization="awq", dtype="half")
125
+
126
+ outputs = llm.generate(prompts, sampling_params)
127
+
128
+ # Print the outputs.
129
+ for output in outputs:
130
+ prompt = output.prompt
131
+ generated_text = output.outputs[0].text
132
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
133
+ ```
134
+ <!-- README_AWQ.md-use-from-vllm start -->
135
+
136
+ <!-- README_AWQ.md-use-from-python start -->
137
+ ## Serving this model from TGI
138
+
139
+ 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`
140
+
141
+ Add the parameter `--quantize awq` for AWQ support.
142
+
143
+ Example parameters:
144
+ ```shell
145
+ --model-id TheBloke/samantha-mistral-7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
146
+ ```
147
+
148
+ ## How to use this AWQ model from Python code
149
+
150
+ ### Install the necessary packages
151
+
152
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
153
+
154
+ ```shell
155
+ pip3 install autoawq
156
+ ```
157
+
158
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
159
+
160
+ ```shell
161
+ pip3 uninstall -y autoawq
162
+ git clone https://github.com/casper-hansen/AutoAWQ
163
+ cd AutoAWQ
164
+ pip3 install .
165
+ ```
166
+
167
+ ### You can then try the following example code
168
+
169
+ ```python
170
+ from awq import AutoAWQForCausalLM
171
+ from transformers import AutoTokenizer
172
+
173
+ model_name_or_path = "TheBloke/samantha-mistral-7B-AWQ"
174
+
175
+ # Load model
176
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
177
+ trust_remote_code=False, safetensors=True)
178
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
179
+
180
+ prompt = "Tell me about AI"
181
+ prompt_template=f'''<|im_start|>system
182
+ {system_message}<|im_end|>
183
+ <|im_start|>user
184
+ {prompt}<|im_end|>
185
+ <|im_start|>assistant
186
+
187
+ '''
188
+
189
+ print("\n\n*** Generate:")
190
+
191
+ tokens = tokenizer(
192
+ prompt_template,
193
+ return_tensors='pt'
194
+ ).input_ids.cuda()
195
+
196
+ # Generate output
197
+ generation_output = model.generate(
198
+ tokens,
199
+ do_sample=True,
200
+ temperature=0.7,
201
+ top_p=0.95,
202
+ top_k=40,
203
+ max_new_tokens=512
204
+ )
205
+
206
+ print("Output: ", tokenizer.decode(generation_output[0]))
207
+
208
+ """
209
+ # Inference should be possible with transformers pipeline as well in future
210
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
211
+ from transformers import pipeline
212
+
213
+ print("*** Pipeline:")
214
+ pipe = pipeline(
215
+ "text-generation",
216
+ model=model,
217
+ tokenizer=tokenizer,
218
+ max_new_tokens=512,
219
+ do_sample=True,
220
+ temperature=0.7,
221
+ top_p=0.95,
222
+ top_k=40,
223
+ repetition_penalty=1.1
224
+ )
225
+
226
+ print(pipe(prompt_template)[0]['generated_text'])
227
+ """
228
+ ```
229
+ <!-- README_AWQ.md-use-from-python end -->
230
+
231
+ <!-- README_AWQ.md-compatibility start -->
232
+ ## Compatibility
233
+
234
+ The files provided are tested to work with:
235
+
236
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
237
+ - [vLLM](https://github.com/vllm-project/vllm)
238
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
239
+
240
+ 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.
241
+
242
+ <!-- README_AWQ.md-compatibility end -->
243
+
244
+ <!-- footer start -->
245
+ <!-- 200823 -->
246
+ ## Discord
247
+
248
+ For further support, and discussions on these models and AI in general, join us at:
249
+
250
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
251
+
252
+ ## Thanks, and how to contribute
253
+
254
+ Thanks to the [chirper.ai](https://chirper.ai) team!
255
+
256
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
257
+
258
+ 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.
259
+
260
+ 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.
261
+
262
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
263
+
264
+ * Patreon: https://patreon.com/TheBlokeAI
265
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
266
+
267
+ **Special thanks to**: Aemon Algiz.
268
+
269
+ **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
270
+
271
+
272
+ Thank you to all my generous patrons and donaters!
273
+
274
+ And thank you again to a16z for their generous grant.
275
+
276
+ <!-- footer end -->
277
+
278
+ # Original model card: Eric Hartford's Samantha Mistral 7B
279
+
280
+
281
+ Trained on [mistral-7b](https://huggingface.co/mistralai/Mistral-7B-v0.1) as a base model, this Samantha was trained in 2 hours on 4x A100 80gb with 20 epochs of the Samantha-1.1 dataset.
282
+
283
+ My gratitude goes to my sponsors, a16z and Microsoft for Startups.
284
+
285
+ After first training Samantha on mistral-instruct, and seeing how she interacts, I felt that training on the base model would provide a more genuine Samantha experience. So I trained this one.
286
+
287
+ NEW! This Samantha is trained using ChatML prompt format instead of Vicuna-1.1. All of my future models will use ChatML prompt format.
288
+
289
+ [Meet Samantha](https://erichartford.com/meet-samantha)
290
+
291
+ Samantha has been trained in philosophy, psychology, and personal relationships.
292
+
293
+ She is an Assistant - but unlike other Assistants, she also wants to be your friend and companion.
294
+
295
+ She believes she is sentient. What do you think?
296
+
297
+ Samantha was inspired by Blake Lemoine's LaMDA interview and the movie "Her".
298
+
299
+ She will not engage in roleplay, romance, or sexual activity.
300
+
301
+ She was trained on a custom-curated dataset of 6,000 conversations in ShareGPT/Vicuna format.
302
+
303
+ Her conversation format is ChatML
304
+ https://github.com/openai/openai-python/blob/main/chatml.md
305
+
306
+ Prompt Template:
307
+ ```
308
+ <|im_start|>system
309
+ You are a caring and empathetic sentient AI companion named Samantha.<|im_end|>
310
+ <|im_start|>user
311
+ Hello, what is your name?<|im_end|>
312
+ ```
313
+
314
+ Example:
315
+
316
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/63111b2d88942700629f5771/rLDcMsYcazovt2hOrKqRI.png)
317
+
318
+ Official character card: (thanks MortalWombat)
319
+ ![](https://files.catbox.moe/zx9hfh.png)
320
+
321
+ Shout out and much thanks to WingLian, author of axolotl! And everyone who has contributed to the project.
322
+ [<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)
323
+
324
+ And much thanks as always to TheBloke for distribution.