TheBloke commited on
Commit
14f5200
1 Parent(s): 7aa3a88

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +338 -0
README.md ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: nRuaif/Kimiko-Mistral-7B
3
+ inference: false
4
+ license: apache-2.0
5
+ model-index:
6
+ - name: Kimiko-Mistral-7B
7
+ results: []
8
+ model_creator: nRuaif
9
+ model_name: Kimiko Mistral 7B
10
+ model_type: mistral
11
+ prompt_template: 'You are a helpful AI assistant.
12
+
13
+
14
+ USER: {prompt}
15
+
16
+ ASSISTANT:
17
+
18
+ '
19
+ quantized_by: TheBloke
20
+ tags:
21
+ - generated_from_trainer
22
+ ---
23
+
24
+ <!-- header start -->
25
+ <!-- 200823 -->
26
+ <div style="width: auto; margin-left: auto; margin-right: auto">
27
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
28
+ </div>
29
+ <div style="display: flex; justify-content: space-between; width: 100%;">
30
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
31
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
32
+ </div>
33
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
34
+ <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>
35
+ </div>
36
+ </div>
37
+ <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>
38
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
39
+ <!-- header end -->
40
+
41
+ # Kimiko Mistral 7B - AWQ
42
+ - Model creator: [nRuaif](https://huggingface.co/nRuaif)
43
+ - Original model: [Kimiko Mistral 7B](https://huggingface.co/nRuaif/Kimiko-Mistral-7B)
44
+
45
+ <!-- description start -->
46
+ ## Description
47
+
48
+ This repo contains AWQ model files for [nRuaif's Kimiko Mistral 7B](https://huggingface.co/nRuaif/Kimiko-Mistral-7B).
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.
54
+
55
+ 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.
56
+
57
+ 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).
58
+
59
+ 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.
60
+ <!-- description end -->
61
+ <!-- repositories-available start -->
62
+ ## Repositories available
63
+
64
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Kimiko-Mistral-7B-AWQ)
65
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Kimiko-Mistral-7B-GPTQ)
66
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Kimiko-Mistral-7B-GGUF)
67
+ * [Unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/TheBloke/Kimiko-Mistral-7B-fp16)
68
+ * [nRuaif's original LoRA adapter, which can be merged on to the base model.](https://huggingface.co/nRuaif/Kimiko-Mistral-7B)
69
+ <!-- repositories-available end -->
70
+
71
+ <!-- prompt-template start -->
72
+ ## Prompt template: Vicuna-Short
73
+
74
+ ```
75
+ You are a helpful AI assistant.
76
+
77
+ USER: {prompt}
78
+ ASSISTANT:
79
+
80
+ ```
81
+
82
+ <!-- prompt-template end -->
83
+
84
+
85
+ <!-- README_AWQ.md-provided-files start -->
86
+ ## Provided files, and AWQ parameters
87
+
88
+ 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.
89
+
90
+ Models are released as sharded safetensors files.
91
+
92
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
93
+ | ------ | ---- | -- | ----------- | ------- | ---- |
94
+ | [main](https://huggingface.co/TheBloke/Kimiko-Mistral-7B-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 4.15 GB
95
+
96
+ <!-- README_AWQ.md-provided-files end -->
97
+
98
+ <!-- README_AWQ.md-use-from-vllm start -->
99
+ ## Serving this model from vLLM
100
+
101
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
102
+
103
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
104
+
105
+ 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.
106
+
107
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
108
+
109
+ ```shell
110
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Kimiko-Mistral-7B-AWQ --quantization awq --dtype half
111
+ ```
112
+
113
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
114
+
115
+ ```python
116
+ from vllm import LLM, SamplingParams
117
+
118
+ prompts = [
119
+ "Hello, my name is",
120
+ "The president of the United States is",
121
+ "The capital of France is",
122
+ "The future of AI is",
123
+ ]
124
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
125
+
126
+ llm = LLM(model="TheBloke/Kimiko-Mistral-7B-AWQ", quantization="awq", dtype="half")
127
+
128
+ outputs = llm.generate(prompts, sampling_params)
129
+
130
+ # Print the outputs.
131
+ for output in outputs:
132
+ prompt = output.prompt
133
+ generated_text = output.outputs[0].text
134
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
135
+ ```
136
+ <!-- README_AWQ.md-use-from-vllm start -->
137
+
138
+ <!-- README_AWQ.md-use-from-python start -->
139
+ ## Serving this model from TGI
140
+
141
+ TGI merged support for AWQ on September 25th, 2023. At the time of writing you need to use the `:latest` Docker container: `ghcr.io/huggingface/text-generation-inference:latest`
142
+
143
+ Add the parameter `--quantize awq` for AWQ support.
144
+
145
+ Example parameters:
146
+ ```shell
147
+ --model-id TheBloke/Kimiko-Mistral-7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
148
+ ```
149
+
150
+ ## How to use this AWQ model from Python code
151
+
152
+ ### Install the necessary packages
153
+
154
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
155
+
156
+ ```shell
157
+ pip3 install autoawq
158
+ ```
159
+
160
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
161
+
162
+ ```shell
163
+ pip3 uninstall -y autoawq
164
+ git clone https://github.com/casper-hansen/AutoAWQ
165
+ cd AutoAWQ
166
+ pip3 install .
167
+ ```
168
+
169
+ ### You can then try the following example code
170
+
171
+ ```python
172
+ from awq import AutoAWQForCausalLM
173
+ from transformers import AutoTokenizer
174
+
175
+ model_name_or_path = "TheBloke/Kimiko-Mistral-7B-AWQ"
176
+
177
+ # Load model
178
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
179
+ trust_remote_code=False, safetensors=True)
180
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
181
+
182
+ prompt = "Tell me about AI"
183
+ prompt_template=f'''You are a helpful AI assistant.
184
+
185
+ USER: {prompt}
186
+ ASSISTANT:
187
+
188
+ '''
189
+
190
+ print("\n\n*** Generate:")
191
+
192
+ tokens = tokenizer(
193
+ prompt_template,
194
+ return_tensors='pt'
195
+ ).input_ids.cuda()
196
+
197
+ # Generate output
198
+ generation_output = model.generate(
199
+ tokens,
200
+ do_sample=True,
201
+ temperature=0.7,
202
+ top_p=0.95,
203
+ top_k=40,
204
+ max_new_tokens=512
205
+ )
206
+
207
+ print("Output: ", tokenizer.decode(generation_output[0]))
208
+
209
+ """
210
+ # Inference should be possible with transformers pipeline as well in future
211
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
212
+ from transformers import pipeline
213
+
214
+ print("*** Pipeline:")
215
+ pipe = pipeline(
216
+ "text-generation",
217
+ model=model,
218
+ tokenizer=tokenizer,
219
+ max_new_tokens=512,
220
+ do_sample=True,
221
+ temperature=0.7,
222
+ top_p=0.95,
223
+ top_k=40,
224
+ repetition_penalty=1.1
225
+ )
226
+
227
+ print(pipe(prompt_template)[0]['generated_text'])
228
+ """
229
+ ```
230
+ <!-- README_AWQ.md-use-from-python end -->
231
+
232
+ <!-- README_AWQ.md-compatibility start -->
233
+ ## Compatibility
234
+
235
+ The files provided are tested to work with:
236
+
237
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
238
+ - [vLLM](https://github.com/vllm-project/vllm)
239
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
240
+
241
+ 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.
242
+
243
+ <!-- README_AWQ.md-compatibility end -->
244
+
245
+ <!-- footer start -->
246
+ <!-- 200823 -->
247
+ ## Discord
248
+
249
+ For further support, and discussions on these models and AI in general, join us at:
250
+
251
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
252
+
253
+ ## Thanks, and how to contribute
254
+
255
+ Thanks to the [chirper.ai](https://chirper.ai) team!
256
+
257
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
258
+
259
+ 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.
260
+
261
+ 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.
262
+
263
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
264
+
265
+ * Patreon: https://patreon.com/TheBlokeAI
266
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
267
+
268
+ **Special thanks to**: Aemon Algiz.
269
+
270
+ **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
271
+
272
+
273
+ Thank you to all my generous patrons and donaters!
274
+
275
+ And thank you again to a16z for their generous grant.
276
+
277
+ <!-- footer end -->
278
+
279
+ # Original model card: nRuaif's Kimiko Mistral 7B
280
+
281
+
282
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
283
+ should probably proofread and complete it, then remove this comment. -->
284
+
285
+ [<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
286
+ # Kimiko-Mistral-7B
287
+
288
+ This model is a fine-tuned version of [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) on the Kimiko dataset.
289
+ It achieves the following results on the evaluation set:
290
+ - Loss: 2.1173
291
+
292
+ ## Model description
293
+
294
+ Same dataset as Kimiko-v2 but on new model. THIS IS NOT TRAIN ON V3 DATASET
295
+
296
+ ## Intended uses & limitations
297
+
298
+ As a finetuning experiment on new 7B model. You can use this for roleplay or as an assistant
299
+
300
+ # Prompt Template Structure
301
+ ```
302
+ This is a chat between ASSISTANT and USER
303
+ USER: What is 4x8?
304
+ ASSISTANT:
305
+
306
+ ```
307
+
308
+
309
+ ### Training hyperparameters
310
+
311
+ The following hyperparameters were used during training:
312
+ - learning_rate: 0.00005
313
+ - train_batch_size: 4
314
+ - eval_batch_size: 4
315
+ - seed: 42
316
+ - gradient_accumulation_steps: 16
317
+ - total_train_batch_size: 64
318
+ - optimizer: Adam with betas=(0.9,0.95) and epsilon=1e-05
319
+ - lr_scheduler_type: cosine
320
+ - lr_scheduler_warmup_steps: 10
321
+ - num_epochs: 2
322
+
323
+ ### Training results
324
+
325
+ | Training Loss | Epoch | Step | Validation Loss |
326
+ |:-------------:|:-----:|:----:|:---------------:|
327
+ | 1.5675 | 0.47 | 25 | 2.1323 |
328
+ | 1.4721 | 0.95 | 50 | 2.1209 |
329
+ | 1.472 | 1.42 | 75 | 2.1177 |
330
+ | 1.5445 | 1.9 | 100 | 2.1173 |
331
+
332
+
333
+ ### Framework versions
334
+
335
+ - Transformers 4.34.0.dev0
336
+ - Pytorch 2.0.1+cu118
337
+ - Datasets 2.14.5
338
+ - Tokenizers 0.14.0