TheBloke commited on
Commit
a51cbc1
1 Parent(s): d556e39

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +450 -0
README.md ADDED
@@ -0,0 +1,450 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://huggingface.co/psmathur/model_007
3
+ inference: false
4
+ language:
5
+ - en
6
+ library_name: transformers
7
+ license: llama2
8
+ model_creator: Pankaj Mathur
9
+ model_name: Model 007 70B
10
+ model_type: llama
11
+ prompt_template: '### System:
12
+
13
+ {system_message}
14
+
15
+
16
+ ### User:
17
+
18
+ {prompt}
19
+
20
+
21
+ ### 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
+ # Model 007 70B - AWQ
45
+ - Model creator: [Pankaj Mathur](https://huggingface.co/psmathur)
46
+ - Original model: [Model 007 70B](https://huggingface.co/psmathur/model_007)
47
+
48
+ <!-- description start -->
49
+ ## Description
50
+
51
+ This repo contains AWQ model files for [Pankaj Mathur's Model 007 70B](https://huggingface.co/psmathur/model_007).
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 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.
59
+ <!-- description end -->
60
+ <!-- repositories-available start -->
61
+ ## Repositories available
62
+
63
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/model_007-70B-AWQ)
64
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/model_007-70B-GPTQ)
65
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/model_007-70B-GGUF)
66
+ * [Pankaj Mathur's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/psmathur/model_007)
67
+ <!-- repositories-available end -->
68
+
69
+ <!-- prompt-template start -->
70
+ ## Prompt template: Orca-Hashes
71
+
72
+ ```
73
+ ### System:
74
+ {system_message}
75
+
76
+ ### User:
77
+ {prompt}
78
+
79
+ ### Assistant:
80
+
81
+ ```
82
+
83
+ <!-- prompt-template end -->
84
+
85
+
86
+ <!-- README_AWQ.md-provided-files start -->
87
+ ## Provided files and AWQ parameters
88
+
89
+ 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.
90
+
91
+ Models are released as sharded safetensors files.
92
+
93
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
94
+ | ------ | ---- | -- | ----------- | ------- | ---- |
95
+ | [main](https://huggingface.co/TheBloke/model_007-70B-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 36.61 GB
96
+
97
+ <!-- README_AWQ.md-provided-files end -->
98
+
99
+ <!-- README_AWQ.md-use-from-vllm start -->
100
+ ## Serving this model from vLLM
101
+
102
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
103
+
104
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
105
+
106
+ ```shell
107
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/model_007-70B-AWQ --quantization awq
108
+ ```
109
+
110
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
111
+
112
+ ```python
113
+ from vllm import LLM, SamplingParams
114
+
115
+ prompts = [
116
+ "Hello, my name is",
117
+ "The president of the United States is",
118
+ "The capital of France is",
119
+ "The future of AI is",
120
+ ]
121
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
122
+
123
+ llm = LLM(model="TheBloke/model_007-70B-AWQ", quantization="awq")
124
+
125
+ outputs = llm.generate(prompts, sampling_params)
126
+
127
+ # Print the outputs.
128
+ for output in outputs:
129
+ prompt = output.prompt
130
+ generated_text = output.outputs[0].text
131
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
132
+ ```
133
+ <!-- README_AWQ.md-use-from-vllm start -->
134
+
135
+ <!-- README_AWQ.md-use-from-python start -->
136
+ ## How to use this AWQ model from Python code
137
+
138
+ ### Install the necessary packages
139
+
140
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
141
+
142
+ ```shell
143
+ pip3 install autoawq
144
+ ```
145
+
146
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
147
+
148
+ ```shell
149
+ pip3 uninstall -y autoawq
150
+ git clone https://github.com/casper-hansen/AutoAWQ
151
+ cd AutoAWQ
152
+ pip3 install .
153
+ ```
154
+
155
+ ### You can then try the following example code
156
+
157
+ ```python
158
+ from awq import AutoAWQForCausalLM
159
+ from transformers import AutoTokenizer
160
+
161
+ model_name_or_path = "TheBloke/model_007-70B-AWQ"
162
+
163
+ # Load model
164
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
165
+ trust_remote_code=False, safetensors=True)
166
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
167
+
168
+ prompt = "Tell me about AI"
169
+ prompt_template=f'''### System:
170
+ {system_message}
171
+
172
+ ### User:
173
+ {prompt}
174
+
175
+ ### Assistant:
176
+
177
+ '''
178
+
179
+ print("\n\n*** Generate:")
180
+
181
+ tokens = tokenizer(
182
+ prompt_template,
183
+ return_tensors='pt'
184
+ ).input_ids.cuda()
185
+
186
+ # Generate output
187
+ generation_output = model.generate(
188
+ tokens,
189
+ do_sample=True,
190
+ temperature=0.7,
191
+ top_p=0.95,
192
+ top_k=40,
193
+ max_new_tokens=512
194
+ )
195
+
196
+ print("Output: ", tokenizer.decode(generation_output[0]))
197
+
198
+ # Inference can also be done using transformers' pipeline
199
+ from transformers import pipeline
200
+
201
+ print("*** Pipeline:")
202
+ pipe = pipeline(
203
+ "text-generation",
204
+ model=model,
205
+ tokenizer=tokenizer,
206
+ max_new_tokens=512,
207
+ do_sample=True,
208
+ temperature=0.7,
209
+ top_p=0.95,
210
+ top_k=40,
211
+ repetition_penalty=1.1
212
+ )
213
+
214
+ print(pipe(prompt_template)[0]['generated_text'])
215
+ ```
216
+ <!-- README_AWQ.md-use-from-python end -->
217
+
218
+ <!-- README_AWQ.md-compatibility start -->
219
+ ## Compatibility
220
+
221
+ The files provided are tested to work with [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), and [vLLM](https://github.com/vllm-project/vllm).
222
+
223
+ [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).
224
+ <!-- README_AWQ.md-compatibility end -->
225
+
226
+ <!-- footer start -->
227
+ <!-- 200823 -->
228
+ ## Discord
229
+
230
+ For further support, and discussions on these models and AI in general, join us at:
231
+
232
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
233
+
234
+ ## Thanks, and how to contribute
235
+
236
+ Thanks to the [chirper.ai](https://chirper.ai) team!
237
+
238
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
239
+
240
+ 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.
241
+
242
+ 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.
243
+
244
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
245
+
246
+ * Patreon: https://patreon.com/TheBlokeAI
247
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
248
+
249
+ **Special thanks to**: Aemon Algiz.
250
+
251
+ **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
252
+
253
+
254
+ Thank you to all my generous patrons and donaters!
255
+
256
+ And thank you again to a16z for their generous grant.
257
+
258
+ <!-- footer end -->
259
+
260
+ # Original model card: Pankaj Mathur's Model 007 70B
261
+
262
+
263
+
264
+ # model_007
265
+
266
+ A hybrid (explain + instruct) style Llama2-70b model, Pleae check examples below for both style prompts, Here is the list of datasets used:
267
+
268
+ * Open-Platypus
269
+ * Alpaca
270
+ * WizardLM
271
+ * Dolly-V2
272
+ * Dolphin Samples (~200K)
273
+ * Orca_minis_v1
274
+ * Alpaca_orca
275
+ * WizardLM_orca
276
+ * Dolly-V2_orca
277
+
278
+
279
+ <br>
280
+
281
+ **P.S. If you're interested to collaborate, please connect with me at www.linkedin.com/in/pankajam.**
282
+
283
+ <br>
284
+
285
+
286
+
287
+ ### quantized versions
288
+ Huge respect to man.. @TheBloke, here are the GGML/GPTQ/GGUF versions, go crazy :)
289
+
290
+ https://huggingface.co/TheBloke/model_007-70B-GGML
291
+
292
+ https://huggingface.co/TheBloke/model_007-70B-GGUF
293
+
294
+ https://huggingface.co/TheBloke/model_007-70B-GPTQ
295
+
296
+ <br>
297
+
298
+ #### license disclaimer:
299
+
300
+ This model is bound by the license & usage restrictions of the original Llama-2 model. And comes with no warranty or gurantees of any kind.
301
+
302
+ <br>
303
+
304
+ ## Evaluation
305
+
306
+ We evaluated model_007 on a wide range of tasks using [Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) from EleutherAI.
307
+
308
+ Here are the results on metrics used by [HuggingFaceH4 Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
309
+
310
+ |||||
311
+ |:------:|:--------:|:-------:|:--------:|
312
+ |**Task**|**Metric**|**Value**|**Stderr**|
313
+ |*arc_challenge*|acc_norm|0.7108|0.0141|
314
+ |*hellaswag*|acc_norm|0.8765|0.0038|
315
+ |*mmlu*|acc_norm|0.6904|0.0351|
316
+ |*truthfulqa_mc*|mc2|0.6312|0.0157|
317
+ |**Total Average**|-|**0.72729**||
318
+
319
+
320
+ <br>
321
+
322
+ ## Example Usage
323
+
324
+ Here is the Orca prompt format
325
+
326
+ ```
327
+ ### System:
328
+ You are an AI assistant that follows instruction extremely well. Help as much as you can.
329
+
330
+ ### User:
331
+ Tell me about Orcas.
332
+
333
+ ### Assistant:
334
+
335
+ ```
336
+
337
+ Below shows a code example on how to use this model
338
+
339
+ ```python
340
+ import torch
341
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
342
+
343
+ tokenizer = AutoTokenizer.from_pretrained("psmathur/model_007")
344
+ model = AutoModelForCausalLM.from_pretrained(
345
+ "psmathur/model_007",
346
+ torch_dtype=torch.float16,
347
+ load_in_8bit=True,
348
+ low_cpu_mem_usage=True,
349
+ device_map="auto"
350
+ )
351
+ system_prompt = "### System:\nYou are an AI assistant that follows instruction extremely well. Help as much as you can.\n\n"
352
+
353
+ #generate text steps
354
+ instruction = "Tell me about Orcas."
355
+ prompt = f"{system_prompt}### User: {instruction}\n\n### Assistant:\n"
356
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
357
+ output = model.generate(**inputs, do_sample=True, top_p=0.95, top_k=0, max_new_tokens=4096)
358
+
359
+ print(tokenizer.decode(output[0], skip_special_tokens=True))
360
+
361
+ ```
362
+
363
+
364
+ Here is the Alpaca prompt format
365
+
366
+ ```
367
+
368
+ ### User:
369
+ Tell me about Alpacas.
370
+
371
+ ### Assistant:
372
+
373
+ ```
374
+
375
+ Below shows a code example on how to use this model
376
+
377
+ ```python
378
+ import torch
379
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
380
+
381
+ tokenizer = AutoTokenizer.from_pretrained("psmathur/model_007")
382
+ model = AutoModelForCausalLM.from_pretrained(
383
+ "psmathur/model_007",
384
+ torch_dtype=torch.float16,
385
+ load_in_8bit=True,
386
+ low_cpu_mem_usage=True,
387
+ device_map="auto"
388
+ )
389
+ #generate text steps
390
+ instruction = "Tell me about Alpacas."
391
+ prompt = f"### User: {instruction}\n\n### Assistant:\n"
392
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
393
+ output = model.generate(**inputs, do_sample=True, top_p=0.95, top_k=0, max_new_tokens=4096)
394
+
395
+ print(tokenizer.decode(output[0], skip_special_tokens=True))
396
+
397
+ ```
398
+
399
+ <br>
400
+
401
+ #### Limitations & Biases:
402
+
403
+ While this model aims for accuracy, it can occasionally produce inaccurate or misleading results.
404
+
405
+ Despite diligent efforts in refining the pretraining data, there remains a possibility for the generation of inappropriate, biased, or offensive content.
406
+
407
+ Exercise caution and cross-check information when necessary.
408
+
409
+
410
+ <br>
411
+
412
+ ### Citiation:
413
+
414
+ Please kindly cite using the following BibTeX:
415
+
416
+ ```
417
+ @misc{model_007,
418
+ author = {Pankaj Mathur},
419
+ title = {model_007: A hybrid (explain + instruct) style Llama2-70b model},
420
+ year = {2023},
421
+ publisher = {HuggingFace},
422
+ journal = {HuggingFace repository},
423
+ howpublished = {\url{https://https://huggingface.co/psmathur/model_007},
424
+ }
425
+ ```
426
+
427
+ ```
428
+ @misc{mukherjee2023orca,
429
+ title={Orca: Progressive Learning from Complex Explanation Traces of GPT-4},
430
+ author={Subhabrata Mukherjee and Arindam Mitra and Ganesh Jawahar and Sahaj Agarwal and Hamid Palangi and Ahmed Awadallah},
431
+ year={2023},
432
+ eprint={2306.02707},
433
+ archivePrefix={arXiv},
434
+ primaryClass={cs.CL}
435
+ }
436
+ ```
437
+
438
+ ```
439
+ @software{touvron2023llama2,
440
+ title={Llama 2: Open Foundation and Fine-Tuned Chat Models},
441
+ author={Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava,
442
+ Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller,
443
+ Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez Madian Khabsa, Isabel Kloumann,
444
+ Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov,
445
+ Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith,
446
+ Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu , Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan,
447
+ Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, Thomas Scialom},
448
+ year={2023}
449
+ }
450
+ ```