TheBloke commited on
Commit
867b323
1 Parent(s): f90b36c

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +247 -0
README.md ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://ai.meta.com/blog/large-language-model-llama-meta-ai
3
+ inference: false
4
+ license: other
5
+ model_creator: Meta
6
+ model_name: LLaMA 7B
7
+ model_type: llama
8
+ prompt_template: '{prompt}
9
+
10
+ '
11
+ quantized_by: TheBloke
12
+ ---
13
+
14
+ <!-- header start -->
15
+ <!-- 200823 -->
16
+ <div style="width: auto; margin-left: auto; margin-right: auto">
17
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
18
+ </div>
19
+ <div style="display: flex; justify-content: space-between; width: 100%;">
20
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
21
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
22
+ </div>
23
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
24
+ <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>
25
+ </div>
26
+ </div>
27
+ <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>
28
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
29
+ <!-- header end -->
30
+
31
+ # LLaMA 7B - AWQ
32
+ - Model creator: [Meta](https://huggingface.co/none)
33
+ - Original model: [LLaMA 7B](https://ai.meta.com/blog/large-language-model-llama-meta-ai)
34
+
35
+ <!-- description start -->
36
+ ## Description
37
+
38
+ This repo contains AWQ model files for [Meta's LLaMA 7b](https://ai.meta.com/blog/large-language-model-llama-meta-ai).
39
+
40
+
41
+ ### About AWQ
42
+
43
+ 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.
44
+
45
+ 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.
46
+ <!-- description end -->
47
+ <!-- repositories-available start -->
48
+ ## Repositories available
49
+
50
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/LLaMA-7b-AWQ)
51
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/LLaMA-7b-GPTQ)
52
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/LLaMA-7b-GGUF)
53
+ * [Meta's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/huggyllama/llama-7b)
54
+ <!-- repositories-available end -->
55
+
56
+ <!-- prompt-template start -->
57
+ ## Prompt template: None
58
+
59
+ ```
60
+ {prompt}
61
+
62
+ ```
63
+
64
+ <!-- prompt-template end -->
65
+ <!-- licensing start -->
66
+ ## Licensing
67
+
68
+ The creator of the source model has listed its license as `other`, and this quantization has therefore used that same license.
69
+
70
+ As this model is based on Llama 2, it is also subject to the Meta Llama 2 license terms, and the license files for that are additionally included. It should therefore be considered as being claimed to be licensed under both licenses. I contacted Hugging Face for clarification on dual licensing but they do not yet have an official position. Should this change, or should Meta provide any feedback on this situation, I will update this section accordingly.
71
+
72
+ In the meantime, any questions regarding licensing, and in particular how these two licenses might interact, should be directed to the original model repository: [Meta's LLaMA 7b](https://ai.meta.com/blog/large-language-model-llama-meta-ai).
73
+ <!-- licensing end -->
74
+ <!-- README_AWQ.md-provided-files start -->
75
+ ## Provided files and AWQ parameters
76
+
77
+ 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.
78
+
79
+ Models are released as sharded safetensors files.
80
+
81
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
82
+ | ------ | ---- | -- | ----------- | ------- | ---- |
83
+ | [main](https://huggingface.co/TheBloke/LLaMA-7b-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 3.89 GB
84
+
85
+ <!-- README_AWQ.md-provided-files end -->
86
+
87
+ <!-- README_AWQ.md-use-from-vllm start -->
88
+ ## Serving this model from vLLM
89
+
90
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
91
+
92
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
93
+
94
+ ```shell
95
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/LLaMA-7b-AWQ --quantization awq
96
+ ```
97
+
98
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
99
+
100
+ ```python
101
+ from vllm import LLM, SamplingParams
102
+
103
+ prompts = [
104
+ "Hello, my name is",
105
+ "The president of the United States is",
106
+ "The capital of France is",
107
+ "The future of AI is",
108
+ ]
109
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
110
+
111
+ llm = LLM(model="TheBloke/LLaMA-7b-AWQ", quantization="awq")
112
+
113
+ outputs = llm.generate(prompts, sampling_params)
114
+
115
+ # Print the outputs.
116
+ for output in outputs:
117
+ prompt = output.prompt
118
+ generated_text = output.outputs[0].text
119
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
120
+ ```
121
+ <!-- README_AWQ.md-use-from-vllm start -->
122
+
123
+ <!-- README_AWQ.md-use-from-python start -->
124
+ ## How to use this AWQ model from Python code
125
+
126
+ ### Install the necessary packages
127
+
128
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
129
+
130
+ ```shell
131
+ pip3 install autoawq
132
+ ```
133
+
134
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
135
+
136
+ ```shell
137
+ pip3 uninstall -y autoawq
138
+ git clone https://github.com/casper-hansen/AutoAWQ
139
+ cd AutoAWQ
140
+ pip3 install .
141
+ ```
142
+
143
+ ### You can then try the following example code
144
+
145
+ ```python
146
+ from awq import AutoAWQForCausalLM
147
+ from transformers import AutoTokenizer
148
+
149
+ model_name_or_path = "TheBloke/LLaMA-7b-AWQ"
150
+
151
+ # Load model
152
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
153
+ trust_remote_code=False, safetensors=True)
154
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
155
+
156
+ prompt = "Tell me about AI"
157
+ prompt_template=f'''{prompt}
158
+
159
+ '''
160
+
161
+ print("\n\n*** Generate:")
162
+
163
+ tokens = tokenizer(
164
+ prompt_template,
165
+ return_tensors='pt'
166
+ ).input_ids.cuda()
167
+
168
+ # Generate output
169
+ generation_output = model.generate(
170
+ tokens,
171
+ do_sample=True,
172
+ temperature=0.7,
173
+ top_p=0.95,
174
+ top_k=40,
175
+ max_new_tokens=512
176
+ )
177
+
178
+ print("Output: ", tokenizer.decode(generation_output[0]))
179
+
180
+ # Inference can also be done using transformers' pipeline
181
+ from transformers import pipeline
182
+
183
+ print("*** Pipeline:")
184
+ pipe = pipeline(
185
+ "text-generation",
186
+ model=model,
187
+ tokenizer=tokenizer,
188
+ max_new_tokens=512,
189
+ do_sample=True,
190
+ temperature=0.7,
191
+ top_p=0.95,
192
+ top_k=40,
193
+ repetition_penalty=1.1
194
+ )
195
+
196
+ print(pipe(prompt_template)[0]['generated_text'])
197
+ ```
198
+ <!-- README_AWQ.md-use-from-python end -->
199
+
200
+ <!-- README_AWQ.md-compatibility start -->
201
+ ## Compatibility
202
+
203
+ The files provided are tested to work with [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), and [vLLM](https://github.com/vllm-project/vllm).
204
+
205
+ [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).
206
+ <!-- README_AWQ.md-compatibility end -->
207
+
208
+ <!-- footer start -->
209
+ <!-- 200823 -->
210
+ ## Discord
211
+
212
+ For further support, and discussions on these models and AI in general, join us at:
213
+
214
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
215
+
216
+ ## Thanks, and how to contribute
217
+
218
+ Thanks to the [chirper.ai](https://chirper.ai) team!
219
+
220
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
221
+
222
+ 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.
223
+
224
+ 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.
225
+
226
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
227
+
228
+ * Patreon: https://patreon.com/TheBlokeAI
229
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
230
+
231
+ **Special thanks to**: Aemon Algiz.
232
+
233
+ **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
234
+
235
+
236
+ Thank you to all my generous patrons and donaters!
237
+
238
+ And thank you again to a16z for their generous grant.
239
+
240
+ <!-- footer end -->
241
+
242
+ # Original model card: Meta's LLaMA 7b
243
+
244
+
245
+ This contains the weights for the LLaMA-7b model. This model is under a non-commercial license (see the LICENSE file).
246
+ You should only use this repository if you have been granted access to the model by filling out [this form](https://docs.google.com/forms/d/e/1FAIpQLSfqNECQnMkycAp2jP4Z9TFX0cGR4uf7b_fBxjY_OjhJILlKGA/viewform?usp=send_form) but either lost your copy of the weights or got some trouble converting them to the Transformers format.
247
+