TheBloke commited on
Commit
721b18a
1 Parent(s): b07a102

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +425 -0
README.md ADDED
@@ -0,0 +1,425 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: teknium/CollectiveCognition-v1-Mistral-7B
3
+ datasets:
4
+ - CollectiveCognition/chats-data-2023-09-27
5
+ inference: false
6
+ language:
7
+ - en
8
+ license: apache-2.0
9
+ model-index:
10
+ - name: CollectiveCognition-v1-Mistral-7B
11
+ results: []
12
+ model_creator: Teknium
13
+ model_name: CollectiveCognition v1 Mistral 7B
14
+ model_type: mistral
15
+ prompt_template: 'USER: {prompt}
16
+
17
+ ASSISTANT:
18
+
19
+ '
20
+ quantized_by: TheBloke
21
+ tags:
22
+ - mistral-7b
23
+ - instruct
24
+ - finetune
25
+ - gpt4
26
+ - synthetic data
27
+ - distillation
28
+ - sharegpt
29
+ ---
30
+
31
+ <!-- header start -->
32
+ <!-- 200823 -->
33
+ <div style="width: auto; margin-left: auto; margin-right: auto">
34
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
35
+ </div>
36
+ <div style="display: flex; justify-content: space-between; width: 100%;">
37
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
38
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
39
+ </div>
40
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
41
+ <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>
42
+ </div>
43
+ </div>
44
+ <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>
45
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
46
+ <!-- header end -->
47
+
48
+ # CollectiveCognition v1 Mistral 7B - AWQ
49
+ - Model creator: [Teknium](https://huggingface.co/teknium)
50
+ - Original model: [CollectiveCognition v1 Mistral 7B](https://huggingface.co/teknium/CollectiveCognition-v1-Mistral-7B)
51
+
52
+ <!-- description start -->
53
+ ## Description
54
+
55
+ This repo contains AWQ model files for [Teknium's CollectiveCognition v1 Mistral 7B](https://huggingface.co/teknium/CollectiveCognition-v1-Mistral-7B).
56
+
57
+
58
+ ### About AWQ
59
+
60
+ 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.
61
+
62
+ 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.
63
+
64
+ 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).
65
+
66
+ 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.
67
+ <!-- description end -->
68
+ <!-- repositories-available start -->
69
+ ## Repositories available
70
+
71
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/CollectiveCognition-v1-Mistral-7B-AWQ)
72
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/CollectiveCognition-v1-Mistral-7B-GPTQ)
73
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/CollectiveCognition-v1-Mistral-7B-GGUF)
74
+ * [Teknium's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/teknium/CollectiveCognition-v1-Mistral-7B)
75
+ <!-- repositories-available end -->
76
+
77
+ <!-- prompt-template start -->
78
+ ## Prompt template: User-Assistant
79
+
80
+ ```
81
+ USER: {prompt}
82
+ ASSISTANT:
83
+
84
+ ```
85
+
86
+ <!-- prompt-template end -->
87
+
88
+
89
+ <!-- README_AWQ.md-provided-files start -->
90
+ ## Provided files, and AWQ parameters
91
+
92
+ 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.
93
+
94
+ Models are released as sharded safetensors files.
95
+
96
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
97
+ | ------ | ---- | -- | ----------- | ------- | ---- |
98
+ | [main](https://huggingface.co/TheBloke/CollectiveCognition-v1-Mistral-7B-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 4.15 GB
99
+
100
+ <!-- README_AWQ.md-provided-files end -->
101
+
102
+ <!-- README_AWQ.md-use-from-vllm start -->
103
+ ## Serving this model from vLLM
104
+
105
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
106
+
107
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
108
+
109
+ 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.
110
+
111
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
112
+
113
+ ```shell
114
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/CollectiveCognition-v1-Mistral-7B-AWQ --quantization awq --dtype half
115
+ ```
116
+
117
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
118
+
119
+ ```python
120
+ from vllm import LLM, SamplingParams
121
+
122
+ prompts = [
123
+ "Hello, my name is",
124
+ "The president of the United States is",
125
+ "The capital of France is",
126
+ "The future of AI is",
127
+ ]
128
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
129
+
130
+ llm = LLM(model="TheBloke/CollectiveCognition-v1-Mistral-7B-AWQ", quantization="awq", dtype="half")
131
+
132
+ outputs = llm.generate(prompts, sampling_params)
133
+
134
+ # Print the outputs.
135
+ for output in outputs:
136
+ prompt = output.prompt
137
+ generated_text = output.outputs[0].text
138
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
139
+ ```
140
+ <!-- README_AWQ.md-use-from-vllm start -->
141
+
142
+ <!-- README_AWQ.md-use-from-tgi start -->
143
+ ## Serving this model from Text Generation Inference (TGI)
144
+
145
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
146
+
147
+ Example Docker parameters:
148
+
149
+ ```shell
150
+ --model-id TheBloke/CollectiveCognition-v1-Mistral-7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
151
+ ```
152
+
153
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
154
+
155
+ ```shell
156
+ pip3 install huggingface-hub
157
+ ```
158
+
159
+ ```python
160
+ from huggingface_hub import InferenceClient
161
+
162
+ endpoint_url = "https://your-endpoint-url-here"
163
+
164
+ prompt = "Tell me about AI"
165
+ prompt_template=f'''USER: {prompt}
166
+ ASSISTANT:
167
+
168
+ '''
169
+
170
+ client = InferenceClient(endpoint_url)
171
+ response = client.text_generation(prompt,
172
+ max_new_tokens=128,
173
+ do_sample=True,
174
+ temperature=0.7,
175
+ top_p=0.95,
176
+ top_k=40,
177
+ repetition_penalty=1.1)
178
+
179
+ print(f"Model output: {response}")
180
+ ```
181
+ <!-- README_AWQ.md-use-from-tgi end -->
182
+
183
+ <!-- README_AWQ.md-use-from-python start -->
184
+ ## How to use this AWQ model from Python code
185
+
186
+ ### Install the necessary packages
187
+
188
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later
189
+
190
+ ```shell
191
+ pip3 install autoawq
192
+ ```
193
+
194
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
195
+
196
+ ```shell
197
+ pip3 uninstall -y autoawq
198
+ git clone https://github.com/casper-hansen/AutoAWQ
199
+ cd AutoAWQ
200
+ pip3 install .
201
+ ```
202
+
203
+ ### You can then try the following example code
204
+
205
+ ```python
206
+ from awq import AutoAWQForCausalLM
207
+ from transformers import AutoTokenizer
208
+
209
+ model_name_or_path = "TheBloke/CollectiveCognition-v1-Mistral-7B-AWQ"
210
+
211
+ # Load model
212
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
213
+ trust_remote_code=False, safetensors=True)
214
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
215
+
216
+ prompt = "Tell me about AI"
217
+ prompt_template=f'''USER: {prompt}
218
+ ASSISTANT:
219
+
220
+ '''
221
+
222
+ print("\n\n*** Generate:")
223
+
224
+ tokens = tokenizer(
225
+ prompt_template,
226
+ return_tensors='pt'
227
+ ).input_ids.cuda()
228
+
229
+ # Generate output
230
+ generation_output = model.generate(
231
+ tokens,
232
+ do_sample=True,
233
+ temperature=0.7,
234
+ top_p=0.95,
235
+ top_k=40,
236
+ max_new_tokens=512
237
+ )
238
+
239
+ print("Output: ", tokenizer.decode(generation_output[0]))
240
+
241
+ """
242
+ # Inference should be possible with transformers pipeline as well in future
243
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
244
+ from transformers import pipeline
245
+
246
+ print("*** Pipeline:")
247
+ pipe = pipeline(
248
+ "text-generation",
249
+ model=model,
250
+ tokenizer=tokenizer,
251
+ max_new_tokens=512,
252
+ do_sample=True,
253
+ temperature=0.7,
254
+ top_p=0.95,
255
+ top_k=40,
256
+ repetition_penalty=1.1
257
+ )
258
+
259
+ print(pipe(prompt_template)[0]['generated_text'])
260
+ """
261
+ ```
262
+ <!-- README_AWQ.md-use-from-python end -->
263
+
264
+ <!-- README_AWQ.md-compatibility start -->
265
+ ## Compatibility
266
+
267
+ The files provided are tested to work with:
268
+
269
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
270
+ - [vLLM](https://github.com/vllm-project/vllm)
271
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
272
+
273
+ 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.
274
+
275
+ <!-- README_AWQ.md-compatibility end -->
276
+
277
+ <!-- footer start -->
278
+ <!-- 200823 -->
279
+ ## Discord
280
+
281
+ For further support, and discussions on these models and AI in general, join us at:
282
+
283
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
284
+
285
+ ## Thanks, and how to contribute
286
+
287
+ Thanks to the [chirper.ai](https://chirper.ai) team!
288
+
289
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
290
+
291
+ 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.
292
+
293
+ 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.
294
+
295
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
296
+
297
+ * Patreon: https://patreon.com/TheBlokeAI
298
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
299
+
300
+ **Special thanks to**: Aemon Algiz.
301
+
302
+ **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
303
+
304
+
305
+ Thank you to all my generous patrons and donaters!
306
+
307
+ And thank you again to a16z for their generous grant.
308
+
309
+ <!-- footer end -->
310
+
311
+ # Original model card: Teknium's CollectiveCognition v1 Mistral 7B
312
+
313
+
314
+ **Collective Cognition v1 - Mistral 7B**
315
+ <div style="display: flex; justify-content: center;">
316
+ <a href="https://collectivecognition.ai" target="_blank" style="display: inline-block; text-align: center;">
317
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/6317aade83d8d2fd903192d9/DNZXsJE5oC_rM8eYY6H_x.png" alt="Collective Cognition Logo" width="50%" style="display: block; margin: 0 auto;">
318
+ </a>
319
+ </div>
320
+
321
+ ## Model Description:
322
+
323
+ Collective Cognition v1 is a Mistral model fine-tuned using just 100 GPT-4 chats shared on Collective Cognition.
324
+
325
+ ## Special Features:
326
+ - **Quick Training**: This model was trained in just 3 minutes on a single 4090 with a qlora, and competes with 70B scale Llama-2 Models at TruthfulQA.
327
+ - **Limited Data**: Despite its exceptional performance, it was trained on only ONE HUNDRED data points, all of which were gathered from Collective Cognition, a platform reminiscent of ShareGPT.
328
+ - **Extreme TruthfulQA Benchmark**: The collective cognition models are competing strongly with top 70B models on the TruthfulQA benchmark despite the small dataset and qlora training!
329
+
330
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6317aade83d8d2fd903192d9/-pnifxPcMeeUONyE3efo3.png)
331
+
332
+ ## Acknowledgements:
333
+
334
+ Special thanks to @a16z and all contributors to the Collective Cognition dataset for making the development of this model possible.
335
+
336
+
337
+ ## Dataset:
338
+
339
+ The model was trained using data from the Collective Cognition website. The efficacy of this dataset is demonstrated by the model's stellar performance, suggesting that further expansion of this dataset could yield even more promising results. The data is reminiscent of that collected from platforms like ShareGPT.
340
+
341
+ You can contribute to the growth of the dataset by sharing your own ChatGPT chats [here](https://CollectiveCognition.ai).
342
+
343
+ You can download the datasets created by Collective Cognition here: https://huggingface.co/CollectiveCognition
344
+
345
+ ## Performance:
346
+
347
+ - **TruthfulQA**: Collective Cognition v1 and v1.1 in particular have notably outperformed several models on the TruthfulQA benchmark, highlighting its ability to understand and rectify common misconceptions.
348
+
349
+ The model follows a LIMA approach, by minimizing the base model's original training as little as possible and giving a small but very high quality dataset to enhance it's performance and style.
350
+
351
+ ## Usage:
352
+
353
+ Prompt Format:
354
+ ```
355
+ USER: <prompt>
356
+ ASSISTANT:
357
+ ```
358
+ OR
359
+ ```
360
+ <system message>
361
+ USER: <prompt>
362
+ ASSISTANT:
363
+ ```
364
+
365
+ ## Benchmarks:
366
+
367
+ Collective Cognition v1.0 TruthfulQA:
368
+ ```
369
+ | Task |Version|Metric|Value | |Stderr|
370
+ |-------------|------:|------|-----:|---|-----:|
371
+ |truthfulqa_mc| 1|mc1 |0.3794|± |0.0170|
372
+ | | |mc2 |0.5394|± |0.0158|
373
+ ```
374
+
375
+ GPT4All Benchmark Suite:
376
+ ```
377
+ Collective Cognition v1.0 GPT4All:
378
+ | Task |Version| Metric |Value | |Stderr|
379
+ |-------------|------:|--------|-----:|---|-----:|
380
+ |arc_challenge| 0|acc |0.5401|± |0.0146|
381
+ | | |acc_norm|0.5572|± |0.0145|
382
+ |arc_easy | 0|acc |0.8102|± |0.0080|
383
+ | | |acc_norm|0.7992|± |0.0082|
384
+ |boolq | 1|acc |0.8538|± |0.0062|
385
+ |hellaswag | 0|acc |0.6459|± |0.0048|
386
+ | | |acc_norm|0.8297|± |0.0038|
387
+ |openbookqa | 0|acc |0.3380|± |0.0212|
388
+ | | |acc_norm|0.4360|± |0.0222|
389
+ |piqa | 0|acc |0.8085|± |0.0092|
390
+ | | |acc_norm|0.8232|± |0.0089|
391
+ |winogrande | 0|acc |0.7451|± |0.0122|
392
+ Average: 72.06%
393
+ ```
394
+
395
+ AGIEval:
396
+ ```
397
+ | Task |Version| Metric |Value | |Stderr|
398
+ |------------------------------|------:|--------|-----:|---|-----:|
399
+ |agieval_aqua_rat | 0|acc |0.1890|± |0.0246|
400
+ | | |acc_norm|0.2047|± |0.0254|
401
+ |agieval_logiqa_en | 0|acc |0.2611|± |0.0172|
402
+ | | |acc_norm|0.3134|± |0.0182|
403
+ |agieval_lsat_ar | 0|acc |0.2087|± |0.0269|
404
+ | | |acc_norm|0.2217|± |0.0275|
405
+ |agieval_lsat_lr | 0|acc |0.3373|± |0.0210|
406
+ | | |acc_norm|0.3196|± |0.0207|
407
+ |agieval_lsat_rc | 0|acc |0.4201|± |0.0301|
408
+ | | |acc_norm|0.3978|± |0.0299|
409
+ |agieval_sat_en | 0|acc |0.5971|± |0.0343|
410
+ | | |acc_norm|0.5631|± |0.0346|
411
+ |agieval_sat_en_without_passage| 0|acc |0.4029|± |0.0343|
412
+ | | |acc_norm|0.3398|± |0.0331|
413
+ |agieval_sat_math | 0|acc |0.3045|± |0.0311|
414
+ | | |acc_norm|0.2864|± |0.0305|
415
+ Average: 33.08%
416
+ ```
417
+
418
+ Training run on wandb here: https://wandb.ai/teknium1/collectivecognition-mistral-7b/runs/collectivecognition-mistral-6/workspace
419
+
420
+
421
+ ## Licensing:
422
+
423
+ Apache 2.0
424
+
425
+ ---