TheBloke commited on
Commit
fafab4b
1 Parent(s): 16ebde0

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +339 -0
README.md ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Keynote-Technology/KAI-7B-Instruct
3
+ inference: false
4
+ license: apache-2.0
5
+ model_creator: Keynote Technology
6
+ model_name: Kai 7B Instruct
7
+ model_type: mistral
8
+ prompt_template: '[INST] {prompt} [/INST]
9
+
10
+ '
11
+ quantized_by: TheBloke
12
+ tags:
13
+ - finetuned
14
+ - Instruct
15
+ - code
16
+ ---
17
+ <!-- markdownlint-disable MD041 -->
18
+
19
+ <!-- header start -->
20
+ <!-- 200823 -->
21
+ <div style="width: auto; margin-left: auto; margin-right: auto">
22
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
23
+ </div>
24
+ <div style="display: flex; justify-content: space-between; width: 100%;">
25
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
26
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
27
+ </div>
28
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
29
+ <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>
30
+ </div>
31
+ </div>
32
+ <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>
33
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
34
+ <!-- header end -->
35
+
36
+ # Kai 7B Instruct - AWQ
37
+ - Model creator: [Keynote Technology](https://huggingface.co/Keynote-Technology)
38
+ - Original model: [Kai 7B Instruct](https://huggingface.co/Keynote-Technology/KAI-7B-Instruct)
39
+
40
+ <!-- description start -->
41
+ ## Description
42
+
43
+ This repo contains AWQ model files for [Keynote Technology's Kai 7B Instruct](https://huggingface.co/Keynote-Technology/KAI-7B-Instruct).
44
+
45
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
46
+
47
+
48
+ ### About AWQ
49
+
50
+ 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.
51
+
52
+ It is supported by:
53
+
54
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
55
+ - [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
56
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
57
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
58
+
59
+ <!-- description end -->
60
+ <!-- repositories-available start -->
61
+ ## Repositories available
62
+
63
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/KAI-7B-Instruct-AWQ)
64
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/KAI-7B-Instruct-GPTQ)
65
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/KAI-7B-Instruct-GGUF)
66
+ * [Keynote Technology's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/Keynote-Technology/KAI-7B-Instruct)
67
+ <!-- repositories-available end -->
68
+
69
+ <!-- prompt-template start -->
70
+ ## Prompt template: KAI
71
+
72
+ ```
73
+ [INST] {prompt} [/INST]
74
+
75
+ ```
76
+
77
+ <!-- prompt-template end -->
78
+
79
+
80
+ <!-- README_AWQ.md-provided-files start -->
81
+ ## Provided files, and AWQ parameters
82
+
83
+ 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.
84
+
85
+ Models are released as sharded safetensors files.
86
+
87
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
88
+ | ------ | ---- | -- | ----------- | ------- | ---- |
89
+ | [main](https://huggingface.co/TheBloke/KAI-7B-Instruct-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 4.15 GB
90
+
91
+ <!-- README_AWQ.md-provided-files end -->
92
+
93
+ <!-- README_AWQ.md-text-generation-webui start -->
94
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
95
+
96
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
97
+
98
+ 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.
99
+
100
+ 1. Click the **Model tab**.
101
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/KAI-7B-Instruct-AWQ`.
102
+ 3. Click **Download**.
103
+ 4. The model will start downloading. Once it's finished it will say "Done".
104
+ 5. In the top left, click the refresh icon next to **Model**.
105
+ 6. In the **Model** dropdown, choose the model you just downloaded: `KAI-7B-Instruct-AWQ`
106
+ 7. Select **Loader: AutoAWQ**.
107
+ 8. Click Load, and the model will load and is now ready for use.
108
+ 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.
109
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
110
+ <!-- README_AWQ.md-text-generation-webui end -->
111
+
112
+ <!-- README_AWQ.md-use-from-vllm start -->
113
+ ## Multi-user inference server: vLLM
114
+
115
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
116
+
117
+ - Please ensure you are using vLLM version 0.2 or later.
118
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
119
+
120
+ For example:
121
+
122
+ ```shell
123
+ python3 -m vllm.entrypoints.api_server --model TheBloke/KAI-7B-Instruct-AWQ --quantization awq
124
+ ```
125
+
126
+ - When using vLLM from Python code, again set `quantization=awq`.
127
+
128
+ For example:
129
+
130
+ ```python
131
+ from vllm import LLM, SamplingParams
132
+
133
+ prompts = [
134
+ "Tell me about AI",
135
+ "Write a story about llamas",
136
+ "What is 291 - 150?",
137
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
138
+ ]
139
+ prompt_template=f'''[INST] {prompt} [/INST]
140
+ '''
141
+
142
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
143
+
144
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
145
+
146
+ llm = LLM(model="TheBloke/KAI-7B-Instruct-AWQ", quantization="awq", dtype="auto")
147
+
148
+ outputs = llm.generate(prompts, sampling_params)
149
+
150
+ # Print the outputs.
151
+ for output in outputs:
152
+ prompt = output.prompt
153
+ generated_text = output.outputs[0].text
154
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
155
+ ```
156
+ <!-- README_AWQ.md-use-from-vllm start -->
157
+
158
+ <!-- README_AWQ.md-use-from-tgi start -->
159
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
160
+
161
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
162
+
163
+ Example Docker parameters:
164
+
165
+ ```shell
166
+ --model-id TheBloke/KAI-7B-Instruct-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
167
+ ```
168
+
169
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
170
+
171
+ ```shell
172
+ pip3 install huggingface-hub
173
+ ```
174
+
175
+ ```python
176
+ from huggingface_hub import InferenceClient
177
+
178
+ endpoint_url = "https://your-endpoint-url-here"
179
+
180
+ prompt = "Tell me about AI"
181
+ prompt_template=f'''[INST] {prompt} [/INST]
182
+ '''
183
+
184
+ client = InferenceClient(endpoint_url)
185
+ response = client.text_generation(prompt,
186
+ max_new_tokens=128,
187
+ do_sample=True,
188
+ temperature=0.7,
189
+ top_p=0.95,
190
+ top_k=40,
191
+ repetition_penalty=1.1)
192
+
193
+ print(f"Model output: ", response)
194
+ ```
195
+ <!-- README_AWQ.md-use-from-tgi end -->
196
+
197
+ <!-- README_AWQ.md-use-from-python start -->
198
+ ## Inference from Python code using AutoAWQ
199
+
200
+ ### Install the AutoAWQ package
201
+
202
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later.
203
+
204
+ ```shell
205
+ pip3 install autoawq
206
+ ```
207
+
208
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
209
+
210
+ ```shell
211
+ pip3 uninstall -y autoawq
212
+ git clone https://github.com/casper-hansen/AutoAWQ
213
+ cd AutoAWQ
214
+ pip3 install .
215
+ ```
216
+
217
+ ### AutoAWQ example code
218
+
219
+ ```python
220
+ from awq import AutoAWQForCausalLM
221
+ from transformers import AutoTokenizer
222
+
223
+ model_name_or_path = "TheBloke/KAI-7B-Instruct-AWQ"
224
+
225
+ # Load tokenizer
226
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
227
+ # Load model
228
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
229
+ trust_remote_code=False, safetensors=True)
230
+
231
+ prompt = "Tell me about AI"
232
+ prompt_template=f'''[INST] {prompt} [/INST]
233
+ '''
234
+
235
+ print("*** Running model.generate:")
236
+
237
+ token_input = tokenizer(
238
+ prompt_template,
239
+ return_tensors='pt'
240
+ ).input_ids.cuda()
241
+
242
+ # Generate output
243
+ generation_output = model.generate(
244
+ token_input,
245
+ do_sample=True,
246
+ temperature=0.7,
247
+ top_p=0.95,
248
+ top_k=40,
249
+ max_new_tokens=512
250
+ )
251
+
252
+ # Get the tokens from the output, decode them, print them
253
+ token_output = generation_output[0]
254
+ text_output = tokenizer.decode(token_output)
255
+ print("LLM output: ", text_output)
256
+
257
+ """
258
+ # Inference should be possible with transformers pipeline as well in future
259
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
260
+ from transformers import pipeline
261
+
262
+ print("*** Pipeline:")
263
+ pipe = pipeline(
264
+ "text-generation",
265
+ model=model,
266
+ tokenizer=tokenizer,
267
+ max_new_tokens=512,
268
+ do_sample=True,
269
+ temperature=0.7,
270
+ top_p=0.95,
271
+ top_k=40,
272
+ repetition_penalty=1.1
273
+ )
274
+
275
+ print(pipe(prompt_template)[0]['generated_text'])
276
+ """
277
+ ```
278
+ <!-- README_AWQ.md-use-from-python end -->
279
+
280
+ <!-- README_AWQ.md-compatibility start -->
281
+ ## Compatibility
282
+
283
+ The files provided are tested to work with:
284
+
285
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
286
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
287
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
288
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
289
+
290
+ <!-- README_AWQ.md-compatibility end -->
291
+
292
+ <!-- footer start -->
293
+ <!-- 200823 -->
294
+ ## Discord
295
+
296
+ For further support, and discussions on these models and AI in general, join us at:
297
+
298
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
299
+
300
+ ## Thanks, and how to contribute
301
+
302
+ Thanks to the [chirper.ai](https://chirper.ai) team!
303
+
304
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
305
+
306
+ 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.
307
+
308
+ 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.
309
+
310
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
311
+
312
+ * Patreon: https://patreon.com/TheBlokeAI
313
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
314
+
315
+ **Special thanks to**: Aemon Algiz.
316
+
317
+ **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
318
+
319
+
320
+ Thank you to all my generous patrons and donaters!
321
+
322
+ And thank you again to a16z for their generous grant.
323
+
324
+ <!-- footer end -->
325
+
326
+ # Original model card: Keynote Technology's Kai 7B Instruct
327
+
328
+
329
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6500c7c912c1442d994c36e5/3zCYNj35PnZs2_TcVZRvC.png)
330
+
331
+ ## KAI-7B Instruct
332
+
333
+ KAI-7B-Instruct is a 7 Billion parameter causal model based on KAI-7B and Mistral-7B. KAI-7B has been finetuned on a mixture of chat/instruct datasets.
334
+
335
+ ## Why use KAI-7B Instruct?
336
+
337
+ - KAI-7B is a strong base model, outperforming comparable open-source models (e.g., LLaMA 2 7b, Mistral 7B, e.t.c.).
338
+ - KAI-7B Instruct is trained on a framework for improving the instruction-following capabilities of pretrained language models.
339
+ - KAI-7B Instruct is a ready-to-use model based off KAI-7B, meaning it is easier to deploy.