TheBloke commited on
Commit
4aeb1c0
·
1 Parent(s): a95cefc

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +298 -0
README.md ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: abdgrt/Tinyllama-2-1b-miniguanaco
3
+ inference: false
4
+ license: other
5
+ model_creator: Odunusi Abraham Ayoola
6
+ model_name: Tinyllama 2 1B MiniGuanaco
7
+ model_type: llama
8
+ prompt_template: '### Human: {prompt}
9
+
10
+ ### Assistant:
11
+
12
+ '
13
+ quantized_by: TheBloke
14
+ ---
15
+
16
+ <!-- header start -->
17
+ <!-- 200823 -->
18
+ <div style="width: auto; margin-left: auto; margin-right: auto">
19
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
20
+ </div>
21
+ <div style="display: flex; justify-content: space-between; width: 100%;">
22
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
23
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
24
+ </div>
25
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
26
+ <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>
27
+ </div>
28
+ </div>
29
+ <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>
30
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
31
+ <!-- header end -->
32
+
33
+ # Tinyllama 2 1B MiniGuanaco - AWQ
34
+ - Model creator: [Odunusi Abraham Ayoola](https://huggingface.co/abdgrt)
35
+ - Original model: [Tinyllama 2 1B MiniGuanaco](https://huggingface.co/abdgrt/Tinyllama-2-1b-miniguanaco)
36
+
37
+ <!-- description start -->
38
+ ## Description
39
+
40
+ This repo contains AWQ model files for [Odunusi Abraham Ayoola's Tinyllama 2 1B MiniGuanaco](https://huggingface.co/abdgrt/Tinyllama-2-1b-miniguanaco).
41
+
42
+
43
+ ### About AWQ
44
+
45
+ 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.
46
+
47
+ 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.
48
+
49
+ 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).
50
+
51
+ 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.
52
+ <!-- description end -->
53
+ <!-- repositories-available start -->
54
+ ## Repositories available
55
+
56
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Tinyllama-2-1b-miniguanaco-AWQ)
57
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Tinyllama-2-1b-miniguanaco-GPTQ)
58
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Tinyllama-2-1b-miniguanaco-GGUF)
59
+ * [Odunusi Abraham Ayoola's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/abdgrt/Tinyllama-2-1b-miniguanaco)
60
+ <!-- repositories-available end -->
61
+
62
+ <!-- prompt-template start -->
63
+ ## Prompt template: Guanaco
64
+
65
+ ```
66
+ ### Human: {prompt}
67
+ ### Assistant:
68
+
69
+ ```
70
+
71
+ <!-- prompt-template end -->
72
+
73
+
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/Tinyllama-2-1b-miniguanaco-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 0.77 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
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
93
+
94
+ 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.
95
+
96
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
97
+
98
+ ```shell
99
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Tinyllama-2-1b-miniguanaco-AWQ --quantization awq --dtype half
100
+ ```
101
+
102
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
103
+
104
+ ```python
105
+ from vllm import LLM, SamplingParams
106
+
107
+ prompts = [
108
+ "Hello, my name is",
109
+ "The president of the United States is",
110
+ "The capital of France is",
111
+ "The future of AI is",
112
+ ]
113
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
114
+
115
+ llm = LLM(model="TheBloke/Tinyllama-2-1b-miniguanaco-AWQ", quantization="awq", dtype="half")
116
+
117
+ outputs = llm.generate(prompts, sampling_params)
118
+
119
+ # Print the outputs.
120
+ for output in outputs:
121
+ prompt = output.prompt
122
+ generated_text = output.outputs[0].text
123
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
124
+ ```
125
+ <!-- README_AWQ.md-use-from-vllm start -->
126
+
127
+ <!-- README_AWQ.md-use-from-tgi start -->
128
+ ## Serving this model from Text Generation Inference (TGI)
129
+
130
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
131
+
132
+ Example Docker parameters:
133
+
134
+ ```shell
135
+ --model-id TheBloke/Tinyllama-2-1b-miniguanaco-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
136
+ ```
137
+
138
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
139
+
140
+ ```shell
141
+ pip3 install huggingface-hub
142
+ ```
143
+
144
+ ```python
145
+ from huggingface_hub import InferenceClient
146
+
147
+ endpoint_url = "https://your-endpoint-url-here"
148
+
149
+ prompt = "Tell me about AI"
150
+ prompt_template=f'''### Human: {prompt}
151
+ ### Assistant:
152
+
153
+ '''
154
+
155
+ client = InferenceClient(endpoint_url)
156
+ response = client.text_generation(prompt,
157
+ max_new_tokens=128,
158
+ do_sample=True,
159
+ temperature=0.7,
160
+ top_p=0.95,
161
+ top_k=40,
162
+ repetition_penalty=1.1)
163
+
164
+ print(f"Model output: {response}")
165
+ ```
166
+ <!-- README_AWQ.md-use-from-tgi end -->
167
+
168
+ <!-- README_AWQ.md-use-from-python start -->
169
+ ## How to use this AWQ model from Python code
170
+
171
+ ### Install the necessary packages
172
+
173
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later
174
+
175
+ ```shell
176
+ pip3 install autoawq
177
+ ```
178
+
179
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
180
+
181
+ ```shell
182
+ pip3 uninstall -y autoawq
183
+ git clone https://github.com/casper-hansen/AutoAWQ
184
+ cd AutoAWQ
185
+ pip3 install .
186
+ ```
187
+
188
+ ### You can then try the following example code
189
+
190
+ ```python
191
+ from awq import AutoAWQForCausalLM
192
+ from transformers import AutoTokenizer
193
+
194
+ model_name_or_path = "TheBloke/Tinyllama-2-1b-miniguanaco-AWQ"
195
+
196
+ # Load model
197
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
198
+ trust_remote_code=False, safetensors=True)
199
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
200
+
201
+ prompt = "Tell me about AI"
202
+ prompt_template=f'''### Human: {prompt}
203
+ ### Assistant:
204
+
205
+ '''
206
+
207
+ print("\n\n*** Generate:")
208
+
209
+ tokens = tokenizer(
210
+ prompt_template,
211
+ return_tensors='pt'
212
+ ).input_ids.cuda()
213
+
214
+ # Generate output
215
+ generation_output = model.generate(
216
+ tokens,
217
+ do_sample=True,
218
+ temperature=0.7,
219
+ top_p=0.95,
220
+ top_k=40,
221
+ max_new_tokens=512
222
+ )
223
+
224
+ print("Output: ", tokenizer.decode(generation_output[0]))
225
+
226
+ """
227
+ # Inference should be possible with transformers pipeline as well in future
228
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
229
+ from transformers import pipeline
230
+
231
+ print("*** Pipeline:")
232
+ pipe = pipeline(
233
+ "text-generation",
234
+ model=model,
235
+ tokenizer=tokenizer,
236
+ max_new_tokens=512,
237
+ do_sample=True,
238
+ temperature=0.7,
239
+ top_p=0.95,
240
+ top_k=40,
241
+ repetition_penalty=1.1
242
+ )
243
+
244
+ print(pipe(prompt_template)[0]['generated_text'])
245
+ """
246
+ ```
247
+ <!-- README_AWQ.md-use-from-python end -->
248
+
249
+ <!-- README_AWQ.md-compatibility start -->
250
+ ## Compatibility
251
+
252
+ The files provided are tested to work with:
253
+
254
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
255
+ - [vLLM](https://github.com/vllm-project/vllm)
256
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
257
+
258
+ 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.
259
+
260
+ <!-- README_AWQ.md-compatibility end -->
261
+
262
+ <!-- footer start -->
263
+ <!-- 200823 -->
264
+ ## Discord
265
+
266
+ For further support, and discussions on these models and AI in general, join us at:
267
+
268
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
269
+
270
+ ## Thanks, and how to contribute
271
+
272
+ Thanks to the [chirper.ai](https://chirper.ai) team!
273
+
274
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
275
+
276
+ 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.
277
+
278
+ 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.
279
+
280
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
281
+
282
+ * Patreon: https://patreon.com/TheBlokeAI
283
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
284
+
285
+ **Special thanks to**: Aemon Algiz.
286
+
287
+ **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
288
+
289
+
290
+ Thank you to all my generous patrons and donaters!
291
+
292
+ And thank you again to a16z for their generous grant.
293
+
294
+ <!-- footer end -->
295
+
296
+ # Original model card: Odunusi Abraham Ayoola's Tinyllama 2 1B MiniGuanaco
297
+
298
+ No original model card was available.