TheBloke commited on
Commit
6f74a1f
1 Parent(s): 99476bf

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +331 -0
README.md ADDED
@@ -0,0 +1,331 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: liuhaotian/llava-v1.5-13b
3
+ inference: false
4
+ license: llama2
5
+ model_creator: Haotian Liu
6
+ model_name: Llava v1.5 13B
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
+ # Llava v1.5 13B - AWQ
32
+ - Model creator: [Haotian Liu](https://huggingface.co/liuhaotian)
33
+ - Original model: [Llava v1.5 13B](https://huggingface.co/liuhaotian/llava-v1.5-13b)
34
+
35
+ <!-- description start -->
36
+ ## Description
37
+
38
+ This repo contains AWQ model files for [Haotian Liu's Llava v1.5 13B](https://huggingface.co/liuhaotian/llava-v1.5-13b).
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 Llama AWQ models for high-throughput concurrent inference in multi-user server scenarios.
46
+
47
+ 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).
48
+
49
+ 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.
50
+ <!-- description end -->
51
+ <!-- repositories-available start -->
52
+ ## Repositories available
53
+
54
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/llava-v1.5-13B-AWQ)
55
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/llava-v1.5-13B-GPTQ)
56
+ * [Haotian Liu's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/liuhaotian/llava-v1.5-13b)
57
+ <!-- repositories-available end -->
58
+
59
+ <!-- prompt-template start -->
60
+ ## Prompt template: Unknown
61
+
62
+ ```
63
+ {prompt}
64
+
65
+ ```
66
+
67
+ <!-- prompt-template end -->
68
+
69
+
70
+ <!-- README_AWQ.md-provided-files start -->
71
+ ## Provided files, and AWQ parameters
72
+
73
+ 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.
74
+
75
+ Models are released as sharded safetensors files.
76
+
77
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
78
+ | ------ | ---- | -- | ----------- | ------- | ---- |
79
+ | [main](https://huggingface.co/TheBloke/llava-v1.5-13B-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 7.25 GB
80
+
81
+ <!-- README_AWQ.md-provided-files end -->
82
+
83
+ <!-- README_AWQ.md-use-from-vllm start -->
84
+ ## Serving this model from vLLM
85
+
86
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
87
+
88
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
89
+
90
+ 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.
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/llava-v1.5-13B-AWQ --quantization awq --dtype half
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/llava-v1.5-13B-AWQ", quantization="awq", dtype="half")
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-tgi start -->
124
+ ## Serving this model from Text Generation Inference (TGI)
125
+
126
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
127
+
128
+ Example Docker parameters:
129
+
130
+ ```shell
131
+ --model-id TheBloke/llava-v1.5-13B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
132
+ ```
133
+
134
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
135
+
136
+ ```shell
137
+ pip3 install huggingface-hub
138
+ ```
139
+
140
+ ```python
141
+ from huggingface_hub import InferenceClient
142
+
143
+ endpoint_url = "https://your-endpoint-url-here"
144
+
145
+ prompt = "Tell me about AI"
146
+ prompt_template=f'''{prompt}
147
+
148
+ '''
149
+
150
+ client = InferenceClient(endpoint_url)
151
+ response = client.text_generation(prompt,
152
+ max_new_tokens=128,
153
+ do_sample=True,
154
+ temperature=0.7,
155
+ top_p=0.95,
156
+ top_k=40,
157
+ repetition_penalty=1.1)
158
+
159
+ print(f"Model output: {response}")
160
+ ```
161
+ <!-- README_AWQ.md-use-from-tgi end -->
162
+
163
+ <!-- README_AWQ.md-use-from-python start -->
164
+ ## How to use this AWQ model from Python code
165
+
166
+ ### Install the necessary packages
167
+
168
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later
169
+
170
+ ```shell
171
+ pip3 install autoawq
172
+ ```
173
+
174
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
175
+
176
+ ```shell
177
+ pip3 uninstall -y autoawq
178
+ git clone https://github.com/casper-hansen/AutoAWQ
179
+ cd AutoAWQ
180
+ pip3 install .
181
+ ```
182
+
183
+ ### You can then try the following example code
184
+
185
+ ```python
186
+ from awq import AutoAWQForCausalLM
187
+ from transformers import AutoTokenizer
188
+
189
+ model_name_or_path = "TheBloke/llava-v1.5-13B-AWQ"
190
+
191
+ # Load model
192
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
193
+ trust_remote_code=False, safetensors=True)
194
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
195
+
196
+ prompt = "Tell me about AI"
197
+ prompt_template=f'''{prompt}
198
+
199
+ '''
200
+
201
+ print("\n\n*** Generate:")
202
+
203
+ tokens = tokenizer(
204
+ prompt_template,
205
+ return_tensors='pt'
206
+ ).input_ids.cuda()
207
+
208
+ # Generate output
209
+ generation_output = model.generate(
210
+ tokens,
211
+ do_sample=True,
212
+ temperature=0.7,
213
+ top_p=0.95,
214
+ top_k=40,
215
+ max_new_tokens=512
216
+ )
217
+
218
+ print("Output: ", tokenizer.decode(generation_output[0]))
219
+
220
+ """
221
+ # Inference should be possible with transformers pipeline as well in future
222
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
223
+ from transformers import pipeline
224
+
225
+ print("*** Pipeline:")
226
+ pipe = pipeline(
227
+ "text-generation",
228
+ model=model,
229
+ tokenizer=tokenizer,
230
+ max_new_tokens=512,
231
+ do_sample=True,
232
+ temperature=0.7,
233
+ top_p=0.95,
234
+ top_k=40,
235
+ repetition_penalty=1.1
236
+ )
237
+
238
+ print(pipe(prompt_template)[0]['generated_text'])
239
+ """
240
+ ```
241
+ <!-- README_AWQ.md-use-from-python end -->
242
+
243
+ <!-- README_AWQ.md-compatibility start -->
244
+ ## Compatibility
245
+
246
+ The files provided are tested to work with:
247
+
248
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
249
+ - [vLLM](https://github.com/vllm-project/vllm)
250
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
251
+
252
+ 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.
253
+
254
+ <!-- README_AWQ.md-compatibility end -->
255
+
256
+ <!-- footer start -->
257
+ <!-- 200823 -->
258
+ ## Discord
259
+
260
+ For further support, and discussions on these models and AI in general, join us at:
261
+
262
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
263
+
264
+ ## Thanks, and how to contribute
265
+
266
+ Thanks to the [chirper.ai](https://chirper.ai) team!
267
+
268
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
269
+
270
+ 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.
271
+
272
+ 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.
273
+
274
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
275
+
276
+ * Patreon: https://patreon.com/TheBlokeAI
277
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
278
+
279
+ **Special thanks to**: Aemon Algiz.
280
+
281
+ **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
282
+
283
+
284
+ Thank you to all my generous patrons and donaters!
285
+
286
+ And thank you again to a16z for their generous grant.
287
+
288
+ <!-- footer end -->
289
+
290
+ # Original model card: Haotian Liu's Llava v1.5 13B
291
+
292
+
293
+ <br>
294
+ <br>
295
+
296
+ # LLaVA Model Card
297
+
298
+ ## Model details
299
+
300
+ **Model type:**
301
+ LLaVA is an open-source chatbot trained by fine-tuning LLaMA/Vicuna on GPT-generated multimodal instruction-following data.
302
+ It is an auto-regressive language model, based on the transformer architecture.
303
+
304
+ **Model date:**
305
+ LLaVA-v1.5-13B was trained in September 2023.
306
+
307
+ **Paper or resources for more information:**
308
+ https://llava-vl.github.io/
309
+
310
+ ## License
311
+ Llama 2 is licensed under the LLAMA 2 Community License,
312
+ Copyright (c) Meta Platforms, Inc. All Rights Reserved.
313
+
314
+ **Where to send questions or comments about the model:**
315
+ https://github.com/haotian-liu/LLaVA/issues
316
+
317
+ ## Intended use
318
+ **Primary intended uses:**
319
+ The primary use of LLaVA is research on large multimodal models and chatbots.
320
+
321
+ **Primary intended users:**
322
+ The primary intended users of the model are researchers and hobbyists in computer vision, natural language processing, machine learning, and artificial intelligence.
323
+
324
+ ## Training dataset
325
+ - 558K filtered image-text pairs from LAION/CC/SBU, captioned by BLIP.
326
+ - 158K GPT-generated multimodal instruction-following data.
327
+ - 450K academic-task-oriented VQA data mixture.
328
+ - 40K ShareGPT data.
329
+
330
+ ## Evaluation dataset
331
+ A collection of 12 benchmarks, including 5 academic VQA benchmarks and 7 recent benchmarks specifically proposed for instruction-following LMMs.