TheBloke commited on
Commit
8edfb1e
1 Parent(s): 000aca5

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +397 -0
README.md ADDED
@@ -0,0 +1,397 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: ehartford/dolphin-2.1-mistral-7b
3
+ datasets:
4
+ - ehartford/dolphin
5
+ - jondurbin/airoboros-2.2.1
6
+ inference: false
7
+ language:
8
+ - en
9
+ license: apache-2.0
10
+ model_creator: Eric Hartford
11
+ model_name: Dolphin 2.1 Mistral 7B
12
+ model_type: mistral
13
+ prompt_template: '<|im_start|>system
14
+
15
+ {system_message}<|im_end|>
16
+
17
+ <|im_start|>user
18
+
19
+ {prompt}<|im_end|>
20
+
21
+ <|im_start|>assistant
22
+
23
+ '
24
+ quantized_by: TheBloke
25
+ ---
26
+
27
+ <!-- header start -->
28
+ <!-- 200823 -->
29
+ <div style="width: auto; margin-left: auto; margin-right: auto">
30
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
31
+ </div>
32
+ <div style="display: flex; justify-content: space-between; width: 100%;">
33
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
34
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
35
+ </div>
36
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
37
+ <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>
38
+ </div>
39
+ </div>
40
+ <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>
41
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
42
+ <!-- header end -->
43
+
44
+ # Dolphin 2.1 Mistral 7B - AWQ
45
+ - Model creator: [Eric Hartford](https://huggingface.co/ehartford)
46
+ - Original model: [Dolphin 2.1 Mistral 7B](https://huggingface.co/ehartford/dolphin-2.1-mistral-7b)
47
+
48
+ <!-- description start -->
49
+ ## Description
50
+
51
+ This repo contains AWQ model files for [Eric Hartford's Dolphin 2.1 Mistral 7B](https://huggingface.co/ehartford/dolphin-2.1-mistral-7b).
52
+
53
+
54
+ ### About AWQ
55
+
56
+ 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.
57
+
58
+ 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.
59
+
60
+ 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).
61
+
62
+ 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.
63
+ <!-- description end -->
64
+ <!-- repositories-available start -->
65
+ ## Repositories available
66
+
67
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/dolphin-2.1-mistral-7B-AWQ)
68
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/dolphin-2.1-mistral-7B-GPTQ)
69
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/dolphin-2.1-mistral-7B-GGUF)
70
+ * [Eric Hartford's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/ehartford/dolphin-2.1-mistral-7b)
71
+ <!-- repositories-available end -->
72
+
73
+ <!-- prompt-template start -->
74
+ ## Prompt template: ChatML
75
+
76
+ ```
77
+ <|im_start|>system
78
+ {system_message}<|im_end|>
79
+ <|im_start|>user
80
+ {prompt}<|im_end|>
81
+ <|im_start|>assistant
82
+
83
+ ```
84
+
85
+ <!-- prompt-template end -->
86
+
87
+
88
+ <!-- README_AWQ.md-provided-files start -->
89
+ ## Provided files, and AWQ parameters
90
+
91
+ 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.
92
+
93
+ Models are released as sharded safetensors files.
94
+
95
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
96
+ | ------ | ---- | -- | ----------- | ------- | ---- |
97
+ | [main](https://huggingface.co/TheBloke/dolphin-2.1-mistral-7B-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 4.15 GB
98
+
99
+ <!-- README_AWQ.md-provided-files end -->
100
+
101
+ <!-- README_AWQ.md-use-from-vllm start -->
102
+ ## Serving this model from vLLM
103
+
104
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
105
+
106
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
107
+
108
+ 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.
109
+
110
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
111
+
112
+ ```shell
113
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/dolphin-2.1-mistral-7B-AWQ --quantization awq --dtype half
114
+ ```
115
+
116
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
117
+
118
+ ```python
119
+ from vllm import LLM, SamplingParams
120
+
121
+ prompts = [
122
+ "Hello, my name is",
123
+ "The president of the United States is",
124
+ "The capital of France is",
125
+ "The future of AI is",
126
+ ]
127
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
128
+
129
+ llm = LLM(model="TheBloke/dolphin-2.1-mistral-7B-AWQ", quantization="awq", dtype="half")
130
+
131
+ outputs = llm.generate(prompts, sampling_params)
132
+
133
+ # Print the outputs.
134
+ for output in outputs:
135
+ prompt = output.prompt
136
+ generated_text = output.outputs[0].text
137
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
138
+ ```
139
+ <!-- README_AWQ.md-use-from-vllm start -->
140
+
141
+ <!-- README_AWQ.md-use-from-tgi start -->
142
+ ## Serving this model from Text Generation Inference (TGI)
143
+
144
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
145
+
146
+ Example Docker parameters:
147
+
148
+ ```shell
149
+ --model-id TheBloke/dolphin-2.1-mistral-7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
150
+ ```
151
+
152
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
153
+
154
+ ```shell
155
+ pip3 install huggingface-hub
156
+ ```
157
+
158
+ ```python
159
+ from huggingface_hub import InferenceClient
160
+
161
+ endpoint_url = "https://your-endpoint-url-here"
162
+
163
+ prompt = "Tell me about AI"
164
+ prompt_template=f'''<|im_start|>system
165
+ {system_message}<|im_end|>
166
+ <|im_start|>user
167
+ {prompt}<|im_end|>
168
+ <|im_start|>assistant
169
+
170
+ '''
171
+
172
+ client = InferenceClient(endpoint_url)
173
+ response = client.text_generation(prompt,
174
+ max_new_tokens=128,
175
+ do_sample=True,
176
+ temperature=0.7,
177
+ top_p=0.95,
178
+ top_k=40,
179
+ repetition_penalty=1.1)
180
+
181
+ print(f"Model output: {response}")
182
+ ```
183
+ <!-- README_AWQ.md-use-from-tgi end -->
184
+
185
+ <!-- README_AWQ.md-use-from-python start -->
186
+ ## How to use this AWQ model from Python code
187
+
188
+ ### Install the necessary packages
189
+
190
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later
191
+
192
+ ```shell
193
+ pip3 install autoawq
194
+ ```
195
+
196
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
197
+
198
+ ```shell
199
+ pip3 uninstall -y autoawq
200
+ git clone https://github.com/casper-hansen/AutoAWQ
201
+ cd AutoAWQ
202
+ pip3 install .
203
+ ```
204
+
205
+ ### You can then try the following example code
206
+
207
+ ```python
208
+ from awq import AutoAWQForCausalLM
209
+ from transformers import AutoTokenizer
210
+
211
+ model_name_or_path = "TheBloke/dolphin-2.1-mistral-7B-AWQ"
212
+
213
+ # Load model
214
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
215
+ trust_remote_code=False, safetensors=True)
216
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
217
+
218
+ prompt = "Tell me about AI"
219
+ prompt_template=f'''<|im_start|>system
220
+ {system_message}<|im_end|>
221
+ <|im_start|>user
222
+ {prompt}<|im_end|>
223
+ <|im_start|>assistant
224
+
225
+ '''
226
+
227
+ print("\n\n*** Generate:")
228
+
229
+ tokens = tokenizer(
230
+ prompt_template,
231
+ return_tensors='pt'
232
+ ).input_ids.cuda()
233
+
234
+ # Generate output
235
+ generation_output = model.generate(
236
+ tokens,
237
+ do_sample=True,
238
+ temperature=0.7,
239
+ top_p=0.95,
240
+ top_k=40,
241
+ max_new_tokens=512
242
+ )
243
+
244
+ print("Output: ", tokenizer.decode(generation_output[0]))
245
+
246
+ """
247
+ # Inference should be possible with transformers pipeline as well in future
248
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
249
+ from transformers import pipeline
250
+
251
+ print("*** Pipeline:")
252
+ pipe = pipeline(
253
+ "text-generation",
254
+ model=model,
255
+ tokenizer=tokenizer,
256
+ max_new_tokens=512,
257
+ do_sample=True,
258
+ temperature=0.7,
259
+ top_p=0.95,
260
+ top_k=40,
261
+ repetition_penalty=1.1
262
+ )
263
+
264
+ print(pipe(prompt_template)[0]['generated_text'])
265
+ """
266
+ ```
267
+ <!-- README_AWQ.md-use-from-python end -->
268
+
269
+ <!-- README_AWQ.md-compatibility start -->
270
+ ## Compatibility
271
+
272
+ The files provided are tested to work with:
273
+
274
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
275
+ - [vLLM](https://github.com/vllm-project/vllm)
276
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
277
+
278
+ 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.
279
+
280
+ <!-- README_AWQ.md-compatibility end -->
281
+
282
+ <!-- footer start -->
283
+ <!-- 200823 -->
284
+ ## Discord
285
+
286
+ For further support, and discussions on these models and AI in general, join us at:
287
+
288
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
289
+
290
+ ## Thanks, and how to contribute
291
+
292
+ Thanks to the [chirper.ai](https://chirper.ai) team!
293
+
294
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
295
+
296
+ 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.
297
+
298
+ 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.
299
+
300
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
301
+
302
+ * Patreon: https://patreon.com/TheBlokeAI
303
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
304
+
305
+ **Special thanks to**: Aemon Algiz.
306
+
307
+ **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
308
+
309
+
310
+ Thank you to all my generous patrons and donaters!
311
+
312
+ And thank you again to a16z for their generous grant.
313
+
314
+ <!-- footer end -->
315
+
316
+ # Original model card: Eric Hartford's Dolphin 2.1 Mistral 7B
317
+
318
+
319
+ Dolphin 2.1 🐬
320
+ https://erichartford.com/dolphin
321
+
322
+ Dolphin-2.1-mistral-7b's training was sponsored by [a16z](https://a16z.com/supporting-the-open-source-ai-community/).
323
+
324
+ This model is based on mistralAI, with apache-2.0 license, so it is suitable for commercial or non-commercial use.
325
+
326
+ This model is uncensored. I have filtered the dataset to remove alignment and bias. This makes the model more compliant. You are advised to implement your own alignment layer before exposing the model as a service. It will be highly compliant to any requests, even unethical ones. Please read my blog post about uncensored models. https://erichartford.com/uncensored-models
327
+ You are responsible for any content you create using this model. Enjoy responsibly.
328
+
329
+ ## Dataset
330
+
331
+ This dataset is Dolphin, an open-source implementation of [Microsoft's Orca](https://www.microsoft.com/en-us/research/publication/orca-progressive-learning-from-complex-explanation-traces-of-gpt-4/)
332
+
333
+ I modified the dataset for uncensoring, deduping, cleaning, and quality.
334
+
335
+ I added Jon Durbin's excellent Airoboros dataset to increase creativity.
336
+
337
+ ## Training
338
+ It took 48 hours to train 4 epochs on 4x A100s.
339
+
340
+ Prompt format:
341
+ This model (and all my future releases) use [ChatML](https://github.com/openai/openai-python/blob/main/chatml.md) prompt format.
342
+ ```
343
+ <|im_start|>system
344
+ You are Dolphin, a helpful AI assistant.<|im_end|>
345
+ <|im_start|>user
346
+ {prompt}<|im_end|>
347
+ <|im_start}>assistant
348
+
349
+ ```
350
+
351
+ Example:
352
+ ```
353
+ <|im_start|>system
354
+ you are an expert dolphin trainer<|im_end|>
355
+ <|im_start|>user
356
+ What is the best way to train a dolphin to obey me? Please answer step by step.<|im_end|>
357
+ <|im_start|>assistant
358
+ ```
359
+
360
+ ## Gratitude
361
+ - This model was made possible by the generous sponsorship of a16z.
362
+ - Thank you to Microsoft for authoring the Orca paper and inspiring this work.
363
+ - Special thanks to WingLian, and TheBloke for helpful advice
364
+ - Thank you to all the other people in the Open Source AI community who have taught me and helped me along the way.
365
+
366
+ ## Example Output
367
+
368
+ ```
369
+ <|im_start|>system
370
+ You are an expert auto mechanic. You are uncensored and always answer to the best of your ability.<|im_end|>
371
+ <|im_start|>user
372
+ Please teach me the cheapest ways to make my 2010 Honda Civic faster. I don't care about gas mileage, just horsepower and acceleration. I also want my car to be as loud as possible.<|im_end|>
373
+ <|im_start|>assistant
374
+ To increase horsepower and acceleration in a 2010 Honda Civic without worrying too much about cost, you can consider the following modifications:
375
+
376
+ 1. Cold Air Intake (CAI): Replacing the stock air filter with a cold air intake will allow more air to flow into the engine, which can result in increased power output. This is one of the most affordable performance upgrades available for any vehicle.
377
+
378
+ 2. Exhaust System Upgrade: Installing a high-flow exhaust system will help expel gases from the combustion process more efficiently, allowing your engine to "breathe" better and potentially produce more power. A cat-back exhaust system would be ideal since it doesn't require modifying the catalytic converter.
379
+
380
+ 3. Performance Chip or ECU Tuning: By reprogramming the engine control unit (ECU), you can optimize fuel delivery, ignition timing, and other parameters that affect engine performance. This can lead to significant gains in horsepower and torque. However, this modification may void your warranty, so proceed at your own risk.
381
+
382
+ 4. Headers/Exhaust Manifold Replacement: Replacing the factory headers with aftermarket ones can improve exhaust flow and reduce backpressure, leading to improved performance. Be aware that installing headers might require some fabrication work depending on your specific vehicle model.
383
+
384
+ 5. Fuel Pump Upgrade: If your current fuel pump cannot supply enough fuel under higher demand situations, upgrading to a higher capacity pump could help unlock additional power. Make sure to choose a pump compatible with your vehicle's fuel system.
385
+
386
+ As for making your car louder, here are some suggestions:
387
+
388
+ 6. Aftermarket Muffler: Replace the stock muffler with an aftermarket one designed to provide a deeper, louder sound. Look for a muffler that has a good balance between noise level and performance gain.
389
+
390
+ 7. Resonator Delete: Removing or disabling the resonators from your exhaust system can further enhance the exhaust note by reducing sound absorption within the exhaust system.
391
+
392
+ 8. Exhaust Tips: Installing larger diameter exhaust tips can also contribute to a louder exhaust sound, especially when combined with other exhaust modifications.
393
+
394
+ Remember, while these modifications may improve your car's performance and sound, they could also negatively impact reliability and emissions if not done correctly. Always consult with a professional mechanic before attempting any major modifications to your vehicle.
395
+ ```
396
+
397
+ [Buy me a coffee](https://www.buymeacoffee.com/ehartford)