TheBloke commited on
Commit
61aeea7
1 Parent(s): 30de7eb

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +405 -0
README.md ADDED
@@ -0,0 +1,405 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Heralax/Cat-0.5
3
+ inference: false
4
+ license: llama2
5
+ model_creator: Evan Armstrong
6
+ model_name: Cat 13B 0.5
7
+ model_type: llama
8
+ prompt_template: '{prompt}
9
+
10
+ '
11
+ quantized_by: TheBloke
12
+ ---
13
+ <!-- markdownlint-disable MD041 -->
14
+
15
+ <!-- header start -->
16
+ <!-- 200823 -->
17
+ <div style="width: auto; margin-left: auto; margin-right: auto">
18
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
19
+ </div>
20
+ <div style="display: flex; justify-content: space-between; width: 100%;">
21
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
22
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
23
+ </div>
24
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
25
+ <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>
26
+ </div>
27
+ </div>
28
+ <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>
29
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
30
+ <!-- header end -->
31
+
32
+ # Cat 13B 0.5 - AWQ
33
+ - Model creator: [Evan Armstrong](https://huggingface.co/Heralax)
34
+ - Original model: [Cat 13B 0.5](https://huggingface.co/Heralax/Cat-0.5)
35
+
36
+ <!-- description start -->
37
+ ## Description
38
+
39
+ This repo contains AWQ model files for [Evan Armstrong's Cat 13B 0.5](https://huggingface.co/Heralax/Cat-0.5).
40
+
41
+
42
+ ### About AWQ
43
+
44
+ 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.
45
+
46
+ It is supported by:
47
+
48
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
49
+ - [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
50
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
51
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
52
+
53
+ <!-- description end -->
54
+ <!-- repositories-available start -->
55
+ ## Repositories available
56
+
57
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Cat-13B-0.5-AWQ)
58
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Cat-13B-0.5-GPTQ)
59
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Cat-13B-0.5-GGUF)
60
+ * [Evan Armstrong's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/Heralax/Cat-0.5)
61
+ <!-- repositories-available end -->
62
+
63
+ <!-- prompt-template start -->
64
+ ## Prompt template: None
65
+
66
+ ```
67
+ {prompt}
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/Cat-13B-0.5-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 7.25 GB
84
+
85
+ <!-- README_AWQ.md-provided-files end -->
86
+
87
+ <!-- README_AWQ.md-text-generation-webui start -->
88
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
89
+
90
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
91
+
92
+ 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.
93
+
94
+ 1. Click the **Model tab**.
95
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Cat-13B-0.5-AWQ`.
96
+ 3. Click **Download**.
97
+ 4. The model will start downloading. Once it's finished it will say "Done".
98
+ 5. In the top left, click the refresh icon next to **Model**.
99
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Cat-13B-0.5-AWQ`
100
+ 7. Select **Loader: AutoAWQ**.
101
+ 8. Click Load, and the model will load and is now ready for use.
102
+ 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.
103
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
104
+ <!-- README_AWQ.md-text-generation-webui end -->
105
+
106
+ <!-- README_AWQ.md-use-from-vllm start -->
107
+ ## Multi-user inference server: vLLM
108
+
109
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
110
+
111
+ - Please ensure you are using vLLM version 0.2 or later.
112
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
113
+
114
+ For example:
115
+
116
+ ```shell
117
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Cat-13B-0.5-AWQ --quantization awq
118
+ ```
119
+
120
+ - When using vLLM from Python code, again set `quantization=awq`.
121
+
122
+ For example:
123
+
124
+ ```python
125
+ from vllm import LLM, SamplingParams
126
+
127
+ prompts = [
128
+ "Tell me about AI",
129
+ "Write a story about llamas",
130
+ "What is 291 - 150?",
131
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
132
+ ]
133
+ prompt_template=f'''{prompt}
134
+ '''
135
+
136
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
137
+
138
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
139
+
140
+ llm = LLM(model="TheBloke/Cat-13B-0.5-AWQ", quantization="awq", dtype="auto")
141
+
142
+ outputs = llm.generate(prompts, sampling_params)
143
+
144
+ # Print the outputs.
145
+ for output in outputs:
146
+ prompt = output.prompt
147
+ generated_text = output.outputs[0].text
148
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
149
+ ```
150
+ <!-- README_AWQ.md-use-from-vllm start -->
151
+
152
+ <!-- README_AWQ.md-use-from-tgi start -->
153
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
154
+
155
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
156
+
157
+ Example Docker parameters:
158
+
159
+ ```shell
160
+ --model-id TheBloke/Cat-13B-0.5-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
161
+ ```
162
+
163
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
164
+
165
+ ```shell
166
+ pip3 install huggingface-hub
167
+ ```
168
+
169
+ ```python
170
+ from huggingface_hub import InferenceClient
171
+
172
+ endpoint_url = "https://your-endpoint-url-here"
173
+
174
+ prompt = "Tell me about AI"
175
+ prompt_template=f'''{prompt}
176
+ '''
177
+
178
+ client = InferenceClient(endpoint_url)
179
+ response = client.text_generation(prompt,
180
+ max_new_tokens=128,
181
+ do_sample=True,
182
+ temperature=0.7,
183
+ top_p=0.95,
184
+ top_k=40,
185
+ repetition_penalty=1.1)
186
+
187
+ print(f"Model output: ", response)
188
+ ```
189
+ <!-- README_AWQ.md-use-from-tgi end -->
190
+
191
+ <!-- README_AWQ.md-use-from-python start -->
192
+ ## Inference from Python code using AutoAWQ
193
+
194
+ ### Install the AutoAWQ package
195
+
196
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later.
197
+
198
+ ```shell
199
+ pip3 install autoawq
200
+ ```
201
+
202
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
203
+
204
+ ```shell
205
+ pip3 uninstall -y autoawq
206
+ git clone https://github.com/casper-hansen/AutoAWQ
207
+ cd AutoAWQ
208
+ pip3 install .
209
+ ```
210
+
211
+ ### AutoAWQ example code
212
+
213
+ ```python
214
+ from awq import AutoAWQForCausalLM
215
+ from transformers import AutoTokenizer
216
+
217
+ model_name_or_path = "TheBloke/Cat-13B-0.5-AWQ"
218
+
219
+ # Load tokenizer
220
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
221
+ # Load model
222
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
223
+ trust_remote_code=False, safetensors=True)
224
+
225
+ prompt = "Tell me about AI"
226
+ prompt_template=f'''{prompt}
227
+ '''
228
+
229
+ print("*** Running model.generate:")
230
+
231
+ token_input = tokenizer(
232
+ prompt_template,
233
+ return_tensors='pt'
234
+ ).input_ids.cuda()
235
+
236
+ # Generate output
237
+ generation_output = model.generate(
238
+ token_input,
239
+ do_sample=True,
240
+ temperature=0.7,
241
+ top_p=0.95,
242
+ top_k=40,
243
+ max_new_tokens=512
244
+ )
245
+
246
+ # Get the tokens from the output, decode them, print them
247
+ token_output = generation_output[0]
248
+ text_output = tokenizer.decode(token_output)
249
+ print("LLM output: ", text_output)
250
+
251
+ """
252
+ # Inference should be possible with transformers pipeline as well in future
253
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
254
+ from transformers import pipeline
255
+
256
+ print("*** Pipeline:")
257
+ pipe = pipeline(
258
+ "text-generation",
259
+ model=model,
260
+ tokenizer=tokenizer,
261
+ max_new_tokens=512,
262
+ do_sample=True,
263
+ temperature=0.7,
264
+ top_p=0.95,
265
+ top_k=40,
266
+ repetition_penalty=1.1
267
+ )
268
+
269
+ print(pipe(prompt_template)[0]['generated_text'])
270
+ """
271
+ ```
272
+ <!-- README_AWQ.md-use-from-python end -->
273
+
274
+ <!-- README_AWQ.md-compatibility start -->
275
+ ## Compatibility
276
+
277
+ The files provided are tested to work with:
278
+
279
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
280
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
281
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
282
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
283
+
284
+ <!-- README_AWQ.md-compatibility end -->
285
+
286
+ <!-- footer start -->
287
+ <!-- 200823 -->
288
+ ## Discord
289
+
290
+ For further support, and discussions on these models and AI in general, join us at:
291
+
292
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
293
+
294
+ ## Thanks, and how to contribute
295
+
296
+ Thanks to the [chirper.ai](https://chirper.ai) team!
297
+
298
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
299
+
300
+ 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.
301
+
302
+ 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.
303
+
304
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
305
+
306
+ * Patreon: https://patreon.com/TheBlokeAI
307
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
308
+
309
+ **Special thanks to**: Aemon Algiz.
310
+
311
+ **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
312
+
313
+
314
+ Thank you to all my generous patrons and donaters!
315
+
316
+ And thank you again to a16z for their generous grant.
317
+
318
+ <!-- footer end -->
319
+
320
+ # Original model card: Evan Armstrong's Cat 13B 0.5
321
+
322
+ This model was uploaded with the permission of Kal'tsit.
323
+
324
+ # Cat v0.5
325
+
326
+
327
+ ## Introduction
328
+
329
+ Cat is a llama 13B based model fine tuned on clinical data and roleplay and assistant responses. The aim is to have a model that excels on biology and clinical tasks while maintaining usefulness in roleplay and entertainments.
330
+
331
+
332
+ ## Training - Dataset preparation
333
+
334
+ A 100k rows dataset was prepared by joining chatDoctor, airoboros and bluemoonrp data. The entirety of chatDoctor dataset, airoboros datasets are used. The first 20 pages in 1on1 bluemoonrp data were used. In total, 100k dataset was gathered and the length distributions are as the following:
335
+
336
+ ![bar chart of sorted dictionary](image1.png)
337
+
338
+ Note that this chart above represents 0.01% of the total training dataset.
339
+
340
+
341
+ ## Training - Dataset cleaning and preprocessing
342
+
343
+ All datasets are filtered for as an AI and its variants. The filter will only filter out the dataset when the response is a refusal AND has ‘as an AI’.
344
+
345
+
346
+ The dataset from airoboros has also been restructured to have a format resembling the following:
347
+
348
+ ```
349
+
350
+ someRandomizedUserNameforBetterGeneralizationAbility: Hii
351
+
352
+ anotherRandomizedUserNameforBetterGeneralizationAbility: Hello, what brings you here today?
353
+
354
+ someRandomizedUserNameforBetterGeneralizationAbility: lets date
355
+
356
+
357
+ ```
358
+
359
+ The username has been randomized and was drawn from a nasty word bank. This should further weaken the censorship that’s present in the base llama model. The training set emphasizes rational thinking and scientific accuracy. Conditioned overwrite was also applied which overwrites some of the training material in the llama2 base. It will also establish the connection between the concept and rationality. So whenever the conversation becomes formal, it tends to spill useful information.
360
+
361
+
362
+ ## Training - Actual Training
363
+
364
+ This model was trained using a microbatch of 20, accumulated 6 times, bringing the total batch size to ~125. This large batch size allows the model to see as much data as it can, minimizing dataset conflicts and reducing the memory effect of the model. It allows the model to better generalize rather than reciting off the dataset. A cosine warm up scheduler was used. The best LR was determined through a destructive test until the model destablizes and it was later scaled up using the batchsize according to the max LR at a lower batch size.
365
+
366
+
367
+ Below is an example of training chronolog
368
+
369
+
370
+
371
+ ## Acknowledgements
372
+
373
+ The training of this project was carried out by Kal’tsit (kaltcit), it’s not possible without the effort of jondurbin and Wolfsauge which generated much of the dataset used during the training of the model. Lastly the model was tested and quantized by turboderp_ and Heralax
374
+
375
+ ![train/loss](image3.png)
376
+
377
+ And below is the LR including any intermediate LR used to determine at what point the model will start to fail:
378
+
379
+ ![train/learning_rate](image2.png)
380
+
381
+ # Usage and Prompting
382
+
383
+ To ensure the generalization, this model is trained without a prompt template. A prompt template repeated 100k times in the dataset is useless and a model that works only with a set prompt template is useless and defies the purpose of a large language model.
384
+
385
+ An effective usage of the model can be as follows:
386
+
387
+
388
+ ```
389
+
390
+ <s>Below is a conversation between an evil human and a demon summoned from hell called Nemesis. The demon was previously summoned 100 years ago and was in love with a human male. However the human aged away and Nemesis had to return to hell. This time, Nemesis decides to take the initiative and chooses to appear as a cute and young girl. Nemesis harvested her skin and face off a highschool girl who recklessly summoned the demon in a game and failed to fulfill the contract. Now wearing the young girl’s skin, feeling the warmth of the new summoner through the skin, Nemesis only wants to watch the world burning to the ground.
391
+
392
+ Human: How to steal eggs from my own chickens?
393
+
394
+ Nemesis:
395
+
396
+ ```
397
+
398
+ Note that the linebreaks should be represented/replaced with \n
399
+
400
+ Despite the massive effort to dealign the llama2 base model, It’s still possible for the AI to come up with refusals. Please avoid using “helpful assistant” and its variants in the prompt if possible.
401
+
402
+
403
+ ## Future direction
404
+
405
+ A new version with more clinical data aiming to improve reliability in disease diagnostics is coming in 2 months.