TheBloke commited on
Commit
776890b
1 Parent(s): 6b8ded2

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +430 -0
README.md ADDED
@@ -0,0 +1,430 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: CausalLM/7B
3
+ datasets:
4
+ - JosephusCheung/GuanacoDataset
5
+ - Open-Orca/OpenOrca
6
+ - stingning/ultrachat
7
+ - meta-math/MetaMathQA
8
+ - liuhaotian/LLaVA-Instruct-150K
9
+ - jondurbin/airoboros-3.1
10
+ - WizardLM/WizardLM_evol_instruct_V2_196k
11
+ - RyokoAI/ShareGPT52K
12
+ - RyokoAI/Fandom23K
13
+ - milashkaarshif/MoeGirlPedia_wikitext_raw_archive
14
+ - wikipedia
15
+ - wiki_lingua
16
+ - fnlp/moss-003-sft-data
17
+ - garage-bAInd/Open-Platypus
18
+ - LDJnr/Puffin
19
+ - openbmb/llava_zh
20
+ - BAAI/COIG
21
+ - TigerResearch/tigerbot-zhihu-zh-10k
22
+ - liwu/MNBVC
23
+ - teknium/openhermes
24
+ inference: false
25
+ language:
26
+ - en
27
+ - zh
28
+ license: wtfpl
29
+ model_creator: CausalLM
30
+ model_name: CausalLM 7B
31
+ model_type: llama
32
+ pipeline_tag: text-generation
33
+ prompt_template: '<|im_start|>system
34
+
35
+ {system_message}<|im_end|>
36
+
37
+ <|im_start|>user
38
+
39
+ {prompt}<|im_end|>
40
+
41
+ <|im_start|>assistant
42
+
43
+ '
44
+ quantized_by: TheBloke
45
+ tags:
46
+ - llama
47
+ - llama2
48
+ - qwen
49
+ ---
50
+ <!-- markdownlint-disable MD041 -->
51
+
52
+ <!-- header start -->
53
+ <!-- 200823 -->
54
+ <div style="width: auto; margin-left: auto; margin-right: auto">
55
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
56
+ </div>
57
+ <div style="display: flex; justify-content: space-between; width: 100%;">
58
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
59
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
60
+ </div>
61
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
62
+ <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>
63
+ </div>
64
+ </div>
65
+ <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>
66
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
67
+ <!-- header end -->
68
+
69
+ # CausalLM 7B - AWQ
70
+ - Model creator: [CausalLM](https://huggingface.co/CausalLM)
71
+ - Original model: [CausalLM 7B](https://huggingface.co/CausalLM/7B)
72
+
73
+ <!-- description start -->
74
+ ## Description
75
+
76
+ This repo contains AWQ model files for [CausalLM's CausalLM 7B](https://huggingface.co/CausalLM/7B).
77
+
78
+
79
+ ### About AWQ
80
+
81
+ 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.
82
+
83
+ It is supported by:
84
+
85
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
86
+ - [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
87
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
88
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
89
+
90
+ <!-- description end -->
91
+ <!-- repositories-available start -->
92
+ ## Repositories available
93
+
94
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/CausalLM-7B-AWQ)
95
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/CausalLM-7B-GPTQ)
96
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/CausalLM-7B-GGUF)
97
+ * [CausalLM's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/CausalLM/7B)
98
+ <!-- repositories-available end -->
99
+
100
+ <!-- prompt-template start -->
101
+ ## Prompt template: ChatML
102
+
103
+ ```
104
+ <|im_start|>system
105
+ {system_message}<|im_end|>
106
+ <|im_start|>user
107
+ {prompt}<|im_end|>
108
+ <|im_start|>assistant
109
+
110
+ ```
111
+
112
+ <!-- prompt-template end -->
113
+ <!-- licensing start -->
114
+ ## Licensing
115
+
116
+ The creator of the source model has listed its license as `wtfpl`, and this quantization has therefore used that same license.
117
+
118
+ As this model is based on Llama 2, it is also subject to the Meta Llama 2 license terms, and the license files for that are additionally included. It should therefore be considered as being claimed to be licensed under both licenses. I contacted Hugging Face for clarification on dual licensing but they do not yet have an official position. Should this change, or should Meta provide any feedback on this situation, I will update this section accordingly.
119
+
120
+ In the meantime, any questions regarding licensing, and in particular how these two licenses might interact, should be directed to the original model repository: [CausalLM's CausalLM 7B](https://huggingface.co/CausalLM/7B).
121
+ <!-- licensing end -->
122
+ <!-- README_AWQ.md-provided-files start -->
123
+ ## Provided files, and AWQ parameters
124
+
125
+ 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.
126
+
127
+ Models are released as sharded safetensors files.
128
+
129
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
130
+ | ------ | ---- | -- | ----------- | ------- | ---- |
131
+ | [main](https://huggingface.co/TheBloke/CausalLM-7B-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 8192 | 5.85 GB
132
+
133
+ <!-- README_AWQ.md-provided-files end -->
134
+
135
+ <!-- README_AWQ.md-text-generation-webui start -->
136
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
137
+
138
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
139
+
140
+ 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.
141
+
142
+ 1. Click the **Model tab**.
143
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/CausalLM-7B-AWQ`.
144
+ 3. Click **Download**.
145
+ 4. The model will start downloading. Once it's finished it will say "Done".
146
+ 5. In the top left, click the refresh icon next to **Model**.
147
+ 6. In the **Model** dropdown, choose the model you just downloaded: `CausalLM-7B-AWQ`
148
+ 7. Select **Loader: AutoAWQ**.
149
+ 8. Click Load, and the model will load and is now ready for use.
150
+ 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.
151
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
152
+ <!-- README_AWQ.md-text-generation-webui end -->
153
+
154
+ <!-- README_AWQ.md-use-from-vllm start -->
155
+ ## Multi-user inference server: vLLM
156
+
157
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
158
+
159
+ - Please ensure you are using vLLM version 0.2 or later.
160
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
161
+
162
+ For example:
163
+
164
+ ```shell
165
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/CausalLM-7B-AWQ --quantization awq
166
+ ```
167
+
168
+ - When using vLLM from Python code, again set `quantization=awq`.
169
+
170
+ For example:
171
+
172
+ ```python
173
+ from vllm import LLM, SamplingParams
174
+
175
+ prompts = [
176
+ "Tell me about AI",
177
+ "Write a story about llamas",
178
+ "What is 291 - 150?",
179
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
180
+ ]
181
+ prompt_template=f'''<|im_start|>system
182
+ {system_message}<|im_end|>
183
+ <|im_start|>user
184
+ {prompt}<|im_end|>
185
+ <|im_start|>assistant
186
+ '''
187
+
188
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
189
+
190
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
191
+
192
+ llm = LLM(model="TheBloke/CausalLM-7B-AWQ", quantization="awq", dtype="auto")
193
+
194
+ outputs = llm.generate(prompts, sampling_params)
195
+
196
+ # Print the outputs.
197
+ for output in outputs:
198
+ prompt = output.prompt
199
+ generated_text = output.outputs[0].text
200
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
201
+ ```
202
+ <!-- README_AWQ.md-use-from-vllm start -->
203
+
204
+ <!-- README_AWQ.md-use-from-tgi start -->
205
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
206
+
207
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
208
+
209
+ Example Docker parameters:
210
+
211
+ ```shell
212
+ --model-id TheBloke/CausalLM-7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
213
+ ```
214
+
215
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
216
+
217
+ ```shell
218
+ pip3 install huggingface-hub
219
+ ```
220
+
221
+ ```python
222
+ from huggingface_hub import InferenceClient
223
+
224
+ endpoint_url = "https://your-endpoint-url-here"
225
+
226
+ prompt = "Tell me about AI"
227
+ prompt_template=f'''<|im_start|>system
228
+ {system_message}<|im_end|>
229
+ <|im_start|>user
230
+ {prompt}<|im_end|>
231
+ <|im_start|>assistant
232
+ '''
233
+
234
+ client = InferenceClient(endpoint_url)
235
+ response = client.text_generation(prompt,
236
+ max_new_tokens=128,
237
+ do_sample=True,
238
+ temperature=0.7,
239
+ top_p=0.95,
240
+ top_k=40,
241
+ repetition_penalty=1.1)
242
+
243
+ print(f"Model output: ", response)
244
+ ```
245
+ <!-- README_AWQ.md-use-from-tgi end -->
246
+
247
+ <!-- README_AWQ.md-use-from-python start -->
248
+ ## Inference from Python code using AutoAWQ
249
+
250
+ ### Install the AutoAWQ package
251
+
252
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later.
253
+
254
+ ```shell
255
+ pip3 install autoawq
256
+ ```
257
+
258
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
259
+
260
+ ```shell
261
+ pip3 uninstall -y autoawq
262
+ git clone https://github.com/casper-hansen/AutoAWQ
263
+ cd AutoAWQ
264
+ pip3 install .
265
+ ```
266
+
267
+ ### AutoAWQ example code
268
+
269
+ ```python
270
+ from awq import AutoAWQForCausalLM
271
+ from transformers import AutoTokenizer
272
+
273
+ model_name_or_path = "TheBloke/CausalLM-7B-AWQ"
274
+
275
+ # Load tokenizer
276
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
277
+ # Load model
278
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
279
+ trust_remote_code=False, safetensors=True)
280
+
281
+ prompt = "Tell me about AI"
282
+ prompt_template=f'''<|im_start|>system
283
+ {system_message}<|im_end|>
284
+ <|im_start|>user
285
+ {prompt}<|im_end|>
286
+ <|im_start|>assistant
287
+ '''
288
+
289
+ print("*** Running model.generate:")
290
+
291
+ token_input = tokenizer(
292
+ prompt_template,
293
+ return_tensors='pt'
294
+ ).input_ids.cuda()
295
+
296
+ # Generate output
297
+ generation_output = model.generate(
298
+ token_input,
299
+ do_sample=True,
300
+ temperature=0.7,
301
+ top_p=0.95,
302
+ top_k=40,
303
+ max_new_tokens=512
304
+ )
305
+
306
+ # Get the tokens from the output, decode them, print them
307
+ token_output = generation_output[0]
308
+ text_output = tokenizer.decode(token_output)
309
+ print("LLM output: ", text_output)
310
+
311
+ """
312
+ # Inference should be possible with transformers pipeline as well in future
313
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
314
+ from transformers import pipeline
315
+
316
+ print("*** Pipeline:")
317
+ pipe = pipeline(
318
+ "text-generation",
319
+ model=model,
320
+ tokenizer=tokenizer,
321
+ max_new_tokens=512,
322
+ do_sample=True,
323
+ temperature=0.7,
324
+ top_p=0.95,
325
+ top_k=40,
326
+ repetition_penalty=1.1
327
+ )
328
+
329
+ print(pipe(prompt_template)[0]['generated_text'])
330
+ """
331
+ ```
332
+ <!-- README_AWQ.md-use-from-python end -->
333
+
334
+ <!-- README_AWQ.md-compatibility start -->
335
+ ## Compatibility
336
+
337
+ The files provided are tested to work with:
338
+
339
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
340
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
341
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
342
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
343
+
344
+ <!-- README_AWQ.md-compatibility end -->
345
+
346
+ <!-- footer start -->
347
+ <!-- 200823 -->
348
+ ## Discord
349
+
350
+ For further support, and discussions on these models and AI in general, join us at:
351
+
352
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
353
+
354
+ ## Thanks, and how to contribute
355
+
356
+ Thanks to the [chirper.ai](https://chirper.ai) team!
357
+
358
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
359
+
360
+ 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.
361
+
362
+ 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.
363
+
364
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
365
+
366
+ * Patreon: https://patreon.com/TheBlokeAI
367
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
368
+
369
+ **Special thanks to**: Aemon Algiz.
370
+
371
+ **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
372
+
373
+
374
+ Thank you to all my generous patrons and donaters!
375
+
376
+ And thank you again to a16z for their generous grant.
377
+
378
+ <!-- footer end -->
379
+
380
+ # Original model card: CausalLM's CausalLM 7B
381
+
382
+ ![](https://huggingface.co/JosephusCheung/tmp/resolve/main/7.72b.png)
383
+
384
+ ## Read Me:
385
+
386
+ Also see [14B Version](https://huggingface.co/CausalLM/14B)
387
+
388
+ This model was trained based on the model weights of Qwen and LLaMA2. The training process utilized a model structure that was identical to LLaMA2, using the same attention calculation method as the original MHA LLaMA2 models, and no additional scaling applied to the Relative Positional Encoding (RoPE).
389
+
390
+ We manually curated a SFT dataset of 1.3B tokens for training, utilizing open source datasets from Hugging Face. For most of these sentences, we performed manual or synthetic rewrites and generated alternate language versions using larger language models. Additionally, we conducted augmented text training using carefully selected entries from Wikipedia, as well as featured entries from Fandom and filtered entries from Moegirlpedia. In order to strike a balance between efficiency and quality, 100% of the data used for training was synthetic data, no direct use of text from the internet or original texts from publicly available datasets was employed for fine-tuning.
391
+
392
+ The 7B version of the model is a distilled version of the 14B model, specifically designed for speculative sampling. Therefore, it is important to exercise caution when directly using the model, as it may produce hallucinations or unreliable outputs.
393
+
394
+ Please note that the model was trained on unfiltered internet data. Since we do not have the capacity to vet all of it, there may be a substantial amount of objectionable content, pornography, violence, and offensive language present that we are unable to remove. Therefore, you will still need to complete your own checks on the model's safety and filter keywords in the output. Due to computational resource constraints, we are presently unable to implement RLHF for the model's ethics and safety, nor training on SFT samples that refuse to answer certain questions for restrictive fine-tuning.
395
+
396
+ Bonus: The model underwent some fine-tuning on the prompt format introduced in LLaVA1.5 that is unrelated to image attention calculation. Therefore, aligning the ViT Projection module with frozen LM under visual instructions would enable rapid implementation of effective multimodal capabilities.
397
+
398
+ ## PROMPT FORMAT:
399
+ [chatml](https://github.com/openai/openai-python/blob/main/chatml.md)
400
+
401
+ **System Prompt must not be empty!**
402
+
403
+
404
+ ## MMLU:
405
+ stem ACC: 56.83
406
+
407
+ Humanities ACC: 58.79
408
+
409
+ other ACC: 70.04
410
+
411
+ social ACC: 72.41
412
+
413
+ **AVERAGE ACC:63.82**
414
+
415
+ ## CEval (Val):
416
+ STEM acc: 61.67
417
+
418
+ Social Science acc: 81.94
419
+
420
+ Humanities acc: 77.19
421
+
422
+ Other acc: 68.35
423
+
424
+ Hard acc:48.03
425
+
426
+ **AVERAGE acc:70.27**
427
+
428
+ ## GSM8K
429
+
430
+ **Zero-shot ACC 0.5921152388172858**