TheBloke commited on
Commit
ade7978
·
1 Parent(s): a5f5c19

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +343 -0
README.md ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Keynote-Technology/KAI-7B-beta
3
+ inference: false
4
+ language:
5
+ - en
6
+ license: apache-2.0
7
+ model_creator: Keynote Technology
8
+ model_name: Kai 7B Beta
9
+ model_type: mistral
10
+ pipeline_tag: text-generation
11
+ prompt_template: '{prompt}
12
+
13
+ '
14
+ quantized_by: TheBloke
15
+ tags:
16
+ - code
17
+ - text-generation-inference
18
+ - pretrained
19
+ ---
20
+ <!-- markdownlint-disable MD041 -->
21
+
22
+ <!-- header start -->
23
+ <!-- 200823 -->
24
+ <div style="width: auto; margin-left: auto; margin-right: auto">
25
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
26
+ </div>
27
+ <div style="display: flex; justify-content: space-between; width: 100%;">
28
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
29
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
30
+ </div>
31
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
32
+ <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>
33
+ </div>
34
+ </div>
35
+ <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>
36
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
37
+ <!-- header end -->
38
+
39
+ # Kai 7B Beta - AWQ
40
+ - Model creator: [Keynote Technology](https://huggingface.co/Keynote-Technology)
41
+ - Original model: [Kai 7B Beta](https://huggingface.co/Keynote-Technology/KAI-7B-beta)
42
+
43
+ <!-- description start -->
44
+ ## Description
45
+
46
+ This repo contains AWQ model files for [Keynote Technology's Kai 7B Beta](https://huggingface.co/Keynote-Technology/KAI-7B-beta).
47
+
48
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
49
+
50
+
51
+ ### About AWQ
52
+
53
+ 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 with equivalent or better quality compared to the most commonly used GPTQ settings.
54
+
55
+ It is supported by:
56
+
57
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
58
+ - [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
59
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
60
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
61
+
62
+ <!-- description end -->
63
+ <!-- repositories-available start -->
64
+ ## Repositories available
65
+
66
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/KAI-7B-beta-AWQ)
67
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/KAI-7B-beta-GPTQ)
68
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/KAI-7B-beta-GGUF)
69
+ * [Keynote Technology's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/Keynote-Technology/KAI-7B-beta)
70
+ <!-- repositories-available end -->
71
+
72
+ <!-- prompt-template start -->
73
+ ## Prompt template: None
74
+
75
+ ```
76
+ {prompt}
77
+
78
+ ```
79
+
80
+ <!-- prompt-template end -->
81
+
82
+
83
+ <!-- README_AWQ.md-provided-files start -->
84
+ ## Provided files, and AWQ parameters
85
+
86
+ 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.
87
+
88
+ Models are released as sharded safetensors files.
89
+
90
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
91
+ | ------ | ---- | -- | ----------- | ------- | ---- |
92
+ | [main](https://huggingface.co/TheBloke/KAI-7B-beta-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 4.15 GB
93
+
94
+ <!-- README_AWQ.md-provided-files end -->
95
+
96
+ <!-- README_AWQ.md-text-generation-webui start -->
97
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
98
+
99
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
100
+
101
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
102
+
103
+ 1. Click the **Model tab**.
104
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/KAI-7B-beta-AWQ`.
105
+ 3. Click **Download**.
106
+ 4. The model will start downloading. Once it's finished it will say "Done".
107
+ 5. In the top left, click the refresh icon next to **Model**.
108
+ 6. In the **Model** dropdown, choose the model you just downloaded: `KAI-7B-beta-AWQ`
109
+ 7. Select **Loader: AutoAWQ**.
110
+ 8. Click Load, and the model will load and is now ready for use.
111
+ 9. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
112
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
113
+ <!-- README_AWQ.md-text-generation-webui end -->
114
+
115
+ <!-- README_AWQ.md-use-from-vllm start -->
116
+ ## Multi-user inference server: vLLM
117
+
118
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
119
+
120
+ - Please ensure you are using vLLM version 0.2 or later.
121
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
122
+
123
+ For example:
124
+
125
+ ```shell
126
+ python3 -m vllm.entrypoints.api_server --model TheBloke/KAI-7B-beta-AWQ --quantization awq
127
+ ```
128
+
129
+ - When using vLLM from Python code, again set `quantization=awq`.
130
+
131
+ For example:
132
+
133
+ ```python
134
+ from vllm import LLM, SamplingParams
135
+
136
+ prompts = [
137
+ "Tell me about AI",
138
+ "Write a story about llamas",
139
+ "What is 291 - 150?",
140
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
141
+ ]
142
+ prompt_template=f'''{prompt}
143
+ '''
144
+
145
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
146
+
147
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
148
+
149
+ llm = LLM(model="TheBloke/KAI-7B-beta-AWQ", quantization="awq", dtype="auto")
150
+
151
+ outputs = llm.generate(prompts, sampling_params)
152
+
153
+ # Print the outputs.
154
+ for output in outputs:
155
+ prompt = output.prompt
156
+ generated_text = output.outputs[0].text
157
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
158
+ ```
159
+ <!-- README_AWQ.md-use-from-vllm start -->
160
+
161
+ <!-- README_AWQ.md-use-from-tgi start -->
162
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
163
+
164
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
165
+
166
+ Example Docker parameters:
167
+
168
+ ```shell
169
+ --model-id TheBloke/KAI-7B-beta-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
170
+ ```
171
+
172
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
173
+
174
+ ```shell
175
+ pip3 install huggingface-hub
176
+ ```
177
+
178
+ ```python
179
+ from huggingface_hub import InferenceClient
180
+
181
+ endpoint_url = "https://your-endpoint-url-here"
182
+
183
+ prompt = "Tell me about AI"
184
+ prompt_template=f'''{prompt}
185
+ '''
186
+
187
+ client = InferenceClient(endpoint_url)
188
+ response = client.text_generation(prompt,
189
+ max_new_tokens=128,
190
+ do_sample=True,
191
+ temperature=0.7,
192
+ top_p=0.95,
193
+ top_k=40,
194
+ repetition_penalty=1.1)
195
+
196
+ print(f"Model output: ", response)
197
+ ```
198
+ <!-- README_AWQ.md-use-from-tgi end -->
199
+
200
+ <!-- README_AWQ.md-use-from-python start -->
201
+ ## Inference from Python code using AutoAWQ
202
+
203
+ ### Install the AutoAWQ package
204
+
205
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later.
206
+
207
+ ```shell
208
+ pip3 install autoawq
209
+ ```
210
+
211
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
212
+
213
+ ```shell
214
+ pip3 uninstall -y autoawq
215
+ git clone https://github.com/casper-hansen/AutoAWQ
216
+ cd AutoAWQ
217
+ pip3 install .
218
+ ```
219
+
220
+ ### AutoAWQ example code
221
+
222
+ ```python
223
+ from awq import AutoAWQForCausalLM
224
+ from transformers import AutoTokenizer
225
+
226
+ model_name_or_path = "TheBloke/KAI-7B-beta-AWQ"
227
+
228
+ # Load tokenizer
229
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
230
+ # Load model
231
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
232
+ trust_remote_code=False, safetensors=True)
233
+
234
+ prompt = "Tell me about AI"
235
+ prompt_template=f'''{prompt}
236
+ '''
237
+
238
+ print("*** Running model.generate:")
239
+
240
+ token_input = tokenizer(
241
+ prompt_template,
242
+ return_tensors='pt'
243
+ ).input_ids.cuda()
244
+
245
+ # Generate output
246
+ generation_output = model.generate(
247
+ token_input,
248
+ do_sample=True,
249
+ temperature=0.7,
250
+ top_p=0.95,
251
+ top_k=40,
252
+ max_new_tokens=512
253
+ )
254
+
255
+ # Get the tokens from the output, decode them, print them
256
+ token_output = generation_output[0]
257
+ text_output = tokenizer.decode(token_output)
258
+ print("LLM output: ", text_output)
259
+
260
+ """
261
+ # Inference should be possible with transformers pipeline as well in future
262
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
263
+ from transformers import pipeline
264
+
265
+ print("*** Pipeline:")
266
+ pipe = pipeline(
267
+ "text-generation",
268
+ model=model,
269
+ tokenizer=tokenizer,
270
+ max_new_tokens=512,
271
+ do_sample=True,
272
+ temperature=0.7,
273
+ top_p=0.95,
274
+ top_k=40,
275
+ repetition_penalty=1.1
276
+ )
277
+
278
+ print(pipe(prompt_template)[0]['generated_text'])
279
+ """
280
+ ```
281
+ <!-- README_AWQ.md-use-from-python end -->
282
+
283
+ <!-- README_AWQ.md-compatibility start -->
284
+ ## Compatibility
285
+
286
+ The files provided are tested to work with:
287
+
288
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
289
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
290
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
291
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
292
+
293
+ <!-- README_AWQ.md-compatibility end -->
294
+
295
+ <!-- footer start -->
296
+ <!-- 200823 -->
297
+ ## Discord
298
+
299
+ For further support, and discussions on these models and AI in general, join us at:
300
+
301
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
302
+
303
+ ## Thanks, and how to contribute
304
+
305
+ Thanks to the [chirper.ai](https://chirper.ai) team!
306
+
307
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
308
+
309
+ 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.
310
+
311
+ 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.
312
+
313
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
314
+
315
+ * Patreon: https://patreon.com/TheBlokeAI
316
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
317
+
318
+ **Special thanks to**: Aemon Algiz.
319
+
320
+ **Patreon special mentions**: Brandon Frisco, LangChain4j, Spiking Neurons AB, transmissions 11, Joseph William Delisle, Nitin Borwankar, Willem Michiel, Michael Dempsey, vamX, Jeffrey Morgan, zynix, jjj, Omer Bin Jawed, Sean Connelly, jinyuan sun, Jeromy Smith, Shadi, Pawan Osman, Chadd, Elijah Stavena, Illia Dulskyi, Sebastain Graf, Stephen Murray, terasurfer, Edmond Seymore, Celu Ramasamy, Mandus, Alex, biorpg, Ajan Kanaga, Clay Pascal, Raven Klaugh, 阿明, K, ya boyyy, usrbinkat, Alicia Loh, John Villwock, ReadyPlayerEmma, Chris Smitley, Cap'n Zoog, fincy, GodLy, S_X, sidney chen, Cory Kujawski, OG, Mano Prime, AzureBlack, Pieter, Kalila, Spencer Kim, Tom X Nguyen, Stanislav Ovsiannikov, Michael Levine, Andrey, Trailburnt, Vadim, Enrico Ros, Talal Aujan, Brandon Phillips, Jack West, Eugene Pentland, Michael Davis, Will Dee, webtim, Jonathan Leane, Alps Aficionado, Rooh Singh, Tiffany J. Kim, theTransient, Luke @flexchar, Elle, Caitlyn Gatomon, Ari Malik, subjectnull, Johann-Peter Hartmann, Trenton Dambrowitz, Imad Khwaja, Asp the Wyvern, Emad Mostaque, Rainer Wilmers, Alexandros Triantafyllidis, Nicholas, Pedro Madruga, SuperWojo, Harry Royden McLaughlin, James Bentley, Olakabola, David Ziegler, Ai Maven, Jeff Scroggin, Nikolai Manek, Deo Leter, Matthew Berman, Fen Risland, Ken Nordquist, Manuel Alberto Morcote, Luke Pendergrass, TL, Fred von Graf, Randy H, Dan Guido, NimbleBox.ai, Vitor Caleffi, Gabriel Tamborski, knownsqashed, Lone Striker, Erik Bjäreholt, John Detwiler, Leonard Tan, Iucharbius
321
+
322
+
323
+ Thank you to all my generous patrons and donaters!
324
+
325
+ And thank you again to a16z for their generous grant.
326
+
327
+ <!-- footer end -->
328
+
329
+ # Original model card: Keynote Technology's Kai 7B Beta
330
+
331
+ KAI-7B
332
+
333
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6500c7c912c1442d994c36e5/NlD6l1BmU1qPjKpsHqkH2.png)
334
+
335
+ KAI-7B Large Language Model (LLM) is a fine-tuned generative text model based on Mistral 7B. With over 7 billion parameters, KAI-7B outperforms its closest competetor, Meta-Llama 2 7b, in all benchmarks we tested.
336
+
337
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6500c7c912c1442d994c36e5/pHvVcd4SXqdziwPkPncqb.png)
338
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6500c7c912c1442d994c36e5/h-VxuQcOH_dy0dwDUiveS.png)
339
+
340
+ As you can see in the benchmark above, KAI-7B excells in STEM but needs work in the Math and Coding fields.
341
+
342
+ ## Notice
343
+ KAI-7B is a pretrained base model and therefore does not have any moderation mechanisms.