TheBloke commited on
Commit
2e3b310
1 Parent(s): ff448e7

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +395 -0
README.md ADDED
@@ -0,0 +1,395 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: uukuguy/speechless-code-mistral-7b-v1.0
3
+ datasets:
4
+ - jondurbin/airoboros-2.2
5
+ - Open-Orca/OpenOrca
6
+ - garage-bAInd/Open-Platypus
7
+ - WizardLM/WizardLM_evol_instruct_V2_196k
8
+ - TokenBender/python_eval_instruct_51k
9
+ inference: false
10
+ language:
11
+ - en
12
+ library_name: transformers
13
+ license: llama2
14
+ model-index:
15
+ - name: SpeechlessCoder
16
+ results:
17
+ - dataset:
18
+ name: HumanEval
19
+ type: openai_humaneval
20
+ metrics:
21
+ - name: pass@1
22
+ type: pass@1
23
+ value: 0.0
24
+ verified: false
25
+ task:
26
+ type: text-generation
27
+ model_creator: Jiangwen Su
28
+ model_name: Speechless Code Mistral 7B v1.0
29
+ model_type: mistral
30
+ pipeline_tag: text-generation
31
+ prompt_template: '{prompt}
32
+
33
+ '
34
+ quantized_by: TheBloke
35
+ tags:
36
+ - llama-2
37
+ - code
38
+ ---
39
+
40
+ <!-- header start -->
41
+ <!-- 200823 -->
42
+ <div style="width: auto; margin-left: auto; margin-right: auto">
43
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
44
+ </div>
45
+ <div style="display: flex; justify-content: space-between; width: 100%;">
46
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
47
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
48
+ </div>
49
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
50
+ <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>
51
+ </div>
52
+ </div>
53
+ <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>
54
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
55
+ <!-- header end -->
56
+
57
+ # Speechless Code Mistral 7B v1.0 - AWQ
58
+ - Model creator: [Jiangwen Su](https://huggingface.co/uukuguy)
59
+ - Original model: [Speechless Code Mistral 7B v1.0](https://huggingface.co/uukuguy/speechless-code-mistral-7b-v1.0)
60
+
61
+ <!-- description start -->
62
+ ## Description
63
+
64
+ This repo contains AWQ model files for [Jiangwen Su's Speechless Code Mistral 7B v1.0](https://huggingface.co/uukuguy/speechless-code-mistral-7b-v1.0).
65
+
66
+
67
+ ### About AWQ
68
+
69
+ 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.
70
+
71
+ 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.
72
+
73
+ 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).
74
+
75
+ 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.
76
+ <!-- description end -->
77
+ <!-- repositories-available start -->
78
+ ## Repositories available
79
+
80
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/speechless-code-mistral-7B-v1.0-AWQ)
81
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/speechless-code-mistral-7B-v1.0-GPTQ)
82
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/speechless-code-mistral-7B-v1.0-GGUF)
83
+ * [Jiangwen Su's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/uukuguy/speechless-code-mistral-7b-v1.0)
84
+ <!-- repositories-available end -->
85
+
86
+ <!-- prompt-template start -->
87
+ ## Prompt template: Unknown
88
+
89
+ ```
90
+ {prompt}
91
+
92
+ ```
93
+
94
+ <!-- prompt-template end -->
95
+
96
+
97
+ <!-- README_AWQ.md-provided-files start -->
98
+ ## Provided files, and AWQ parameters
99
+
100
+ 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.
101
+
102
+ Models are released as sharded safetensors files.
103
+
104
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
105
+ | ------ | ---- | -- | ----------- | ------- | ---- |
106
+ | [main](https://huggingface.co/TheBloke/speechless-code-mistral-7B-v1.0-AWQ/tree/main) | 4 | 128 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 4.15 GB
107
+
108
+ <!-- README_AWQ.md-provided-files end -->
109
+
110
+ <!-- README_AWQ.md-use-from-vllm start -->
111
+ ## Serving this model from vLLM
112
+
113
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
114
+
115
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
116
+
117
+ 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.
118
+
119
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
120
+
121
+ ```shell
122
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/speechless-code-mistral-7B-v1.0-AWQ --quantization awq --dtype half
123
+ ```
124
+
125
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
126
+
127
+ ```python
128
+ from vllm import LLM, SamplingParams
129
+
130
+ prompts = [
131
+ "Hello, my name is",
132
+ "The president of the United States is",
133
+ "The capital of France is",
134
+ "The future of AI is",
135
+ ]
136
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
137
+
138
+ llm = LLM(model="TheBloke/speechless-code-mistral-7B-v1.0-AWQ", quantization="awq", dtype="half")
139
+
140
+ outputs = llm.generate(prompts, sampling_params)
141
+
142
+ # Print the outputs.
143
+ for output in outputs:
144
+ prompt = output.prompt
145
+ generated_text = output.outputs[0].text
146
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
147
+ ```
148
+ <!-- README_AWQ.md-use-from-vllm start -->
149
+
150
+ <!-- README_AWQ.md-use-from-tgi start -->
151
+ ## Serving this model from Text Generation Inference (TGI)
152
+
153
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
154
+
155
+ Example Docker parameters:
156
+
157
+ ```shell
158
+ --model-id TheBloke/speechless-code-mistral-7B-v1.0-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
159
+ ```
160
+
161
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
162
+
163
+ ```shell
164
+ pip3 install huggingface-hub
165
+ ```
166
+
167
+ ```python
168
+ from huggingface_hub import InferenceClient
169
+
170
+ endpoint_url = "https://your-endpoint-url-here"
171
+
172
+ prompt = "Tell me about AI"
173
+ prompt_template=f'''{prompt}
174
+
175
+ '''
176
+
177
+ client = InferenceClient(endpoint_url)
178
+ response = client.text_generation(prompt,
179
+ max_new_tokens=128,
180
+ do_sample=True,
181
+ temperature=0.7,
182
+ top_p=0.95,
183
+ top_k=40,
184
+ repetition_penalty=1.1)
185
+
186
+ print(f"Model output: {response}")
187
+ ```
188
+ <!-- README_AWQ.md-use-from-tgi end -->
189
+
190
+ <!-- README_AWQ.md-use-from-python start -->
191
+ ## How to use this AWQ model from Python code
192
+
193
+ ### Install the necessary packages
194
+
195
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later
196
+
197
+ ```shell
198
+ pip3 install autoawq
199
+ ```
200
+
201
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
202
+
203
+ ```shell
204
+ pip3 uninstall -y autoawq
205
+ git clone https://github.com/casper-hansen/AutoAWQ
206
+ cd AutoAWQ
207
+ pip3 install .
208
+ ```
209
+
210
+ ### You can then try the following example code
211
+
212
+ ```python
213
+ from awq import AutoAWQForCausalLM
214
+ from transformers import AutoTokenizer
215
+
216
+ model_name_or_path = "TheBloke/speechless-code-mistral-7B-v1.0-AWQ"
217
+
218
+ # Load model
219
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
220
+ trust_remote_code=False, safetensors=True)
221
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
222
+
223
+ prompt = "Tell me about AI"
224
+ prompt_template=f'''{prompt}
225
+
226
+ '''
227
+
228
+ print("\n\n*** Generate:")
229
+
230
+ tokens = tokenizer(
231
+ prompt_template,
232
+ return_tensors='pt'
233
+ ).input_ids.cuda()
234
+
235
+ # Generate output
236
+ generation_output = model.generate(
237
+ tokens,
238
+ do_sample=True,
239
+ temperature=0.7,
240
+ top_p=0.95,
241
+ top_k=40,
242
+ max_new_tokens=512
243
+ )
244
+
245
+ print("Output: ", tokenizer.decode(generation_output[0]))
246
+
247
+ """
248
+ # Inference should be possible with transformers pipeline as well in future
249
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
250
+ from transformers import pipeline
251
+
252
+ print("*** Pipeline:")
253
+ pipe = pipeline(
254
+ "text-generation",
255
+ model=model,
256
+ tokenizer=tokenizer,
257
+ max_new_tokens=512,
258
+ do_sample=True,
259
+ temperature=0.7,
260
+ top_p=0.95,
261
+ top_k=40,
262
+ repetition_penalty=1.1
263
+ )
264
+
265
+ print(pipe(prompt_template)[0]['generated_text'])
266
+ """
267
+ ```
268
+ <!-- README_AWQ.md-use-from-python end -->
269
+
270
+ <!-- README_AWQ.md-compatibility start -->
271
+ ## Compatibility
272
+
273
+ The files provided are tested to work with:
274
+
275
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
276
+ - [vLLM](https://github.com/vllm-project/vllm)
277
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
278
+
279
+ 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.
280
+
281
+ <!-- README_AWQ.md-compatibility end -->
282
+
283
+ <!-- footer start -->
284
+ <!-- 200823 -->
285
+ ## Discord
286
+
287
+ For further support, and discussions on these models and AI in general, join us at:
288
+
289
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
290
+
291
+ ## Thanks, and how to contribute
292
+
293
+ Thanks to the [chirper.ai](https://chirper.ai) team!
294
+
295
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
296
+
297
+ 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.
298
+
299
+ 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.
300
+
301
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
302
+
303
+ * Patreon: https://patreon.com/TheBlokeAI
304
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
305
+
306
+ **Special thanks to**: Aemon Algiz.
307
+
308
+ **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
309
+
310
+
311
+ Thank you to all my generous patrons and donaters!
312
+
313
+ And thank you again to a16z for their generous grant.
314
+
315
+ <!-- footer end -->
316
+
317
+ # Original model card: Jiangwen Su's Speechless Code Mistral 7B v1.0
318
+
319
+
320
+ <p><h1> speechless-code-mistral-7b-v1.0 </h1></p>
321
+
322
+ Use the following dataset to fine-tune mistralai/Mistral-7B-v0.1 in order to improve the model's reasoning and planning abilities.
323
+
324
+ Total 201,981 samples.
325
+ - jondurbin/airoboros-2.2: Filter categories related to coding, reasoning and planning. 23,462 samples.
326
+ - Open-Orca/OpenOrca: Filter the 'cot' category in 1M GPT4 dataset. 74,440 samples.
327
+ - garage-bAInd/Open-Platypus: 100%, 24,926 samples.
328
+ - WizardLM/WizardLM_evol_instruct_V2_196k: Coding coversation part. 30,185 samples
329
+ - TokenBender/python_eval_instruct_51k: “python” in output .40,309 samples
330
+ - Spider: 8,659 samples
331
+
332
+
333
+ | | |
334
+ |------ | ------ |
335
+ | lr | 2e-4 |
336
+ | lr_scheduler_type | cosine |
337
+ | weight_decay | 0.0 |
338
+ | optim | paged_adamw_8bit |
339
+ | flash_attention | True |
340
+ | rerope | False |
341
+ | max_new_tokens | 4096 |
342
+ | num_train_epochs | 2 |
343
+ | bits | 4 |
344
+ | lora_r | 64 |
345
+ | lora_alpha | 16 |
346
+ | lora_dropout | 0.05 |
347
+ | double_quant | True |
348
+ | quant_type | nf4 |
349
+ | dataset_format | airoboros |
350
+ | mini_batch_size | 2 |
351
+ | grandient_accumulation_steps | 32 |
352
+ | bf16 | True |
353
+
354
+ A40-48G x 2
355
+
356
+ | | |
357
+ |------ | ------ |
358
+ | epoch | 2.0 |
359
+ | etrain_loss | 0.5 |
360
+ | etrain_runtime | 1 day, 10:25:26.77 |
361
+ | etrain_samples_per_second | 3.194 |
362
+ | etrain_steps_per_second | 0.025 |
363
+ | eeval_loss | 0.5146 |
364
+ | eeval_runtime | 0:00:25.04 |
365
+ | eeval_samples_per_second | 7.985 |
366
+ | eeval_steps_per_second | |
367
+
368
+ | Metric | Value |
369
+ | --- | --- |
370
+ | humaneval-python ||
371
+
372
+ [Big Code Models Leaderboard](https://huggingface.co/spaces/bigcode/bigcode-models-leaderboard)
373
+
374
+ CodeLlama-34B-Python: 53.29
375
+
376
+ CodeLlama-34B-Instruct: 50.79
377
+
378
+ CodeLlama-13B-Instruct: 50.6
379
+
380
+ CodeLlama-34B: 45.11
381
+
382
+ CodeLlama-13B-Python: 42.89
383
+
384
+ CodeLlama-13B: 35.07
385
+
386
+ [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
387
+ | Metric | Value |
388
+ | --- | --- |
389
+ | ARC | |
390
+ | HellaSwag | |
391
+ | MMLU | |
392
+ | TruthfulQA | |
393
+ | Average | |
394
+
395
+