TheBloke commited on
Commit
5c54b1c
1 Parent(s): 519f1c1

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +412 -0
README.md ADDED
@@ -0,0 +1,412 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: NousResearch/Nous-Capybara-7B
3
+ datasets:
4
+ - LDJnr/LessWrong-Amplify-Instruct
5
+ - LDJnr/Pure-Dove
6
+ - LDJnr/Verified-Camel
7
+ inference: false
8
+ language:
9
+ - eng
10
+ license:
11
+ - mit
12
+ model_creator: NousResearch
13
+ model_name: Nous Capybara 7B
14
+ model_type: llama
15
+ prompt_template: 'USER: {prompt}
16
+
17
+ ASSISTANT:
18
+
19
+ '
20
+ quantized_by: TheBloke
21
+ tags:
22
+ - llama-2
23
+ - sft
24
+ ---
25
+
26
+ <!-- header start -->
27
+ <!-- 200823 -->
28
+ <div style="width: auto; margin-left: auto; margin-right: auto">
29
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
30
+ </div>
31
+ <div style="display: flex; justify-content: space-between; width: 100%;">
32
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
33
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
34
+ </div>
35
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
36
+ <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>
37
+ </div>
38
+ </div>
39
+ <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>
40
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
41
+ <!-- header end -->
42
+
43
+ # Nous Capybara 7B - AWQ
44
+ - Model creator: [NousResearch](https://huggingface.co/NousResearch)
45
+ - Original model: [Nous Capybara 7B](https://huggingface.co/NousResearch/Nous-Capybara-7B)
46
+
47
+ <!-- description start -->
48
+ ## Description
49
+
50
+ This repo contains AWQ model files for [NousResearch's Nous Capybara 7B](https://huggingface.co/NousResearch/Nous-Capybara-7B).
51
+
52
+
53
+ ### About AWQ
54
+
55
+ 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.
56
+
57
+ 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.
58
+
59
+ 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).
60
+
61
+ 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.
62
+ <!-- description end -->
63
+ <!-- repositories-available start -->
64
+ ## Repositories available
65
+
66
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Nous-Capybara-7B-AWQ)
67
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Nous-Capybara-7B-GPTQ)
68
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Nous-Capybara-7B-GGUF)
69
+ * [NousResearch's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/NousResearch/Nous-Capybara-7B)
70
+ <!-- repositories-available end -->
71
+
72
+ <!-- prompt-template start -->
73
+ ## Prompt template: User-Assistant
74
+
75
+ ```
76
+ USER: {prompt}
77
+ ASSISTANT:
78
+
79
+ ```
80
+
81
+ <!-- prompt-template end -->
82
+ <!-- licensing start -->
83
+ ## Licensing
84
+
85
+ The creator of the source model has listed its license as `['mit']`, and this quantization has therefore used that same license.
86
+
87
+ 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.
88
+
89
+ In the meantime, any questions regarding licensing, and in particular how these two licenses might interact, should be directed to the original model repository: [NousResearch's Nous Capybara 7B](https://huggingface.co/NousResearch/Nous-Capybara-7B).
90
+ <!-- licensing end -->
91
+ <!-- README_AWQ.md-provided-files start -->
92
+ ## Provided files, and AWQ parameters
93
+
94
+ 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.
95
+
96
+ Models are released as sharded safetensors files.
97
+
98
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
99
+ | ------ | ---- | -- | ----------- | ------- | ---- |
100
+ | [main](https://huggingface.co/TheBloke/Nous-Capybara-7B-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 3.89 GB
101
+
102
+ <!-- README_AWQ.md-provided-files end -->
103
+
104
+ <!-- README_AWQ.md-use-from-vllm start -->
105
+ ## Serving this model from vLLM
106
+
107
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
108
+
109
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
110
+
111
+ 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.
112
+
113
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
114
+
115
+ ```shell
116
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Nous-Capybara-7B-AWQ --quantization awq --dtype half
117
+ ```
118
+
119
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
120
+
121
+ ```python
122
+ from vllm import LLM, SamplingParams
123
+
124
+ prompts = [
125
+ "Hello, my name is",
126
+ "The president of the United States is",
127
+ "The capital of France is",
128
+ "The future of AI is",
129
+ ]
130
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
131
+
132
+ llm = LLM(model="TheBloke/Nous-Capybara-7B-AWQ", quantization="awq", dtype="half")
133
+
134
+ outputs = llm.generate(prompts, sampling_params)
135
+
136
+ # Print the outputs.
137
+ for output in outputs:
138
+ prompt = output.prompt
139
+ generated_text = output.outputs[0].text
140
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
141
+ ```
142
+ <!-- README_AWQ.md-use-from-vllm start -->
143
+
144
+ <!-- README_AWQ.md-use-from-tgi start -->
145
+ ## Serving this model from Text Generation Inference (TGI)
146
+
147
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
148
+
149
+ Example Docker parameters:
150
+
151
+ ```shell
152
+ --model-id TheBloke/Nous-Capybara-7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
153
+ ```
154
+
155
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
156
+
157
+ ```shell
158
+ pip3 install huggingface-hub
159
+ ```
160
+
161
+ ```python
162
+ from huggingface_hub import InferenceClient
163
+
164
+ endpoint_url = "https://your-endpoint-url-here"
165
+
166
+ prompt = "Tell me about AI"
167
+ prompt_template=f'''USER: {prompt}
168
+ ASSISTANT:
169
+
170
+ '''
171
+
172
+ client = InferenceClient(endpoint_url)
173
+ response = client.text_generation(prompt,
174
+ max_new_tokens=128,
175
+ do_sample=True,
176
+ temperature=0.7,
177
+ top_p=0.95,
178
+ top_k=40,
179
+ repetition_penalty=1.1)
180
+
181
+ print(f"Model output: {response}")
182
+ ```
183
+ <!-- README_AWQ.md-use-from-tgi end -->
184
+
185
+ <!-- README_AWQ.md-use-from-python start -->
186
+ ## How to use this AWQ model from Python code
187
+
188
+ ### Install the necessary packages
189
+
190
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later
191
+
192
+ ```shell
193
+ pip3 install autoawq
194
+ ```
195
+
196
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
197
+
198
+ ```shell
199
+ pip3 uninstall -y autoawq
200
+ git clone https://github.com/casper-hansen/AutoAWQ
201
+ cd AutoAWQ
202
+ pip3 install .
203
+ ```
204
+
205
+ ### You can then try the following example code
206
+
207
+ ```python
208
+ from awq import AutoAWQForCausalLM
209
+ from transformers import AutoTokenizer
210
+
211
+ model_name_or_path = "TheBloke/Nous-Capybara-7B-AWQ"
212
+
213
+ # Load model
214
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
215
+ trust_remote_code=False, safetensors=True)
216
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
217
+
218
+ prompt = "Tell me about AI"
219
+ prompt_template=f'''USER: {prompt}
220
+ ASSISTANT:
221
+
222
+ '''
223
+
224
+ print("\n\n*** Generate:")
225
+
226
+ tokens = tokenizer(
227
+ prompt_template,
228
+ return_tensors='pt'
229
+ ).input_ids.cuda()
230
+
231
+ # Generate output
232
+ generation_output = model.generate(
233
+ tokens,
234
+ do_sample=True,
235
+ temperature=0.7,
236
+ top_p=0.95,
237
+ top_k=40,
238
+ max_new_tokens=512
239
+ )
240
+
241
+ print("Output: ", tokenizer.decode(generation_output[0]))
242
+
243
+ """
244
+ # Inference should be possible with transformers pipeline as well in future
245
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
246
+ from transformers import pipeline
247
+
248
+ print("*** Pipeline:")
249
+ pipe = pipeline(
250
+ "text-generation",
251
+ model=model,
252
+ tokenizer=tokenizer,
253
+ max_new_tokens=512,
254
+ do_sample=True,
255
+ temperature=0.7,
256
+ top_p=0.95,
257
+ top_k=40,
258
+ repetition_penalty=1.1
259
+ )
260
+
261
+ print(pipe(prompt_template)[0]['generated_text'])
262
+ """
263
+ ```
264
+ <!-- README_AWQ.md-use-from-python end -->
265
+
266
+ <!-- README_AWQ.md-compatibility start -->
267
+ ## Compatibility
268
+
269
+ The files provided are tested to work with:
270
+
271
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
272
+ - [vLLM](https://github.com/vllm-project/vllm)
273
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
274
+
275
+ 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.
276
+
277
+ <!-- README_AWQ.md-compatibility end -->
278
+
279
+ <!-- footer start -->
280
+ <!-- 200823 -->
281
+ ## Discord
282
+
283
+ For further support, and discussions on these models and AI in general, join us at:
284
+
285
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
286
+
287
+ ## Thanks, and how to contribute
288
+
289
+ Thanks to the [chirper.ai](https://chirper.ai) team!
290
+
291
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
292
+
293
+ 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.
294
+
295
+ 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.
296
+
297
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
298
+
299
+ * Patreon: https://patreon.com/TheBlokeAI
300
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
301
+
302
+ **Special thanks to**: Aemon Algiz.
303
+
304
+ **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
305
+
306
+
307
+ Thank you to all my generous patrons and donaters!
308
+
309
+ And thank you again to a16z for their generous grant.
310
+
311
+ <!-- footer end -->
312
+
313
+ # Original model card: NousResearch's Nous Capybara 7B
314
+
315
+
316
+ ## **Nous-Capybara-7B**
317
+
318
+ A model created with a novel synthesis method in mind, Amplify-instruct, with a goal of having a synergistic combination of different techniques used for SOTA models such as Evol-Instruct, Orca, Vicuna, Lamini, FLASK and others, all into one lean holistically formed dataset and model. The seed instructions used for the start of synthesized conversations are largely based on highly acclaimed datasets like Airoboros, Know logic, EverythingLM, GPTeacher and even entirely new seed instructions derived from posts on the website LessWrong, as well as being supplemented with certain multi-turn datasets like Dove(A successor to Puffin).
319
+
320
+ Entirely contained under 20K training examples, mostly comprised of newly synthesized tokens never used for model training until now!
321
+
322
+ ## Process of creation and special thank yous!
323
+
324
+ This model was fine-tuned by Nous Research, with LDJ leading the training and dataset curation, along with significant dataset formation contributions by J-Supha, Also thank you to Emozilla for also assisting to expedite the training experimentation process.
325
+
326
+ Special thank you to **A16Z** for sponsoring our training, as well as **Yield Protocol** for their support in resources during R&D of aspects outside of training, such as dataset development/synthesis.
327
+
328
+ ## Thank you to dataset creators!
329
+
330
+ While most of the tokens within Capybara are newly synthsized and part of datasets like Puffin/Dove, we would like to credit the single-turn datasets we leveraged as seeds that are used to initiate the beggining of many of the multi-turn conversations:
331
+
332
+ ![Capybara](https://i.imgur.com/yB58OoD.jpeg)
333
+
334
+ ## Model Training
335
+
336
+ Nous-Capybara 7B is a new model trained for multiple epochs on a dataset of less than 20,000 carefully curated GPT-4 examples, most of which are long context conversations between a real human and GPT-4 comprised of entirely newly synthesized tokens that previously didn't exist on HuggingFace.
337
+
338
+ Additional data came from manually curated CamelAI data, with the help of volunteers ranging from former Physicists, Mathematicians, Biologists and more!
339
+
340
+ Specific credits to the people involved in validating this data will be posted soon :)
341
+
342
+ ## Prompt Format
343
+
344
+ The reccomended model usage is:
345
+
346
+ ```
347
+ USER:
348
+
349
+ ASSISTANT:
350
+ ```
351
+
352
+ ## Notable Features:
353
+
354
+ - The first Nous model trained on over 10,000 multi-turn conversations.
355
+
356
+ - Over 1,000 tokens average per conversation example during training!
357
+
358
+ - Able to effectively do complex summary of advanced studies on topics.
359
+
360
+ - Ability to recall information upto late 2022 without internet (ChatGPT cut off date is in 2021)
361
+
362
+ - Context length of 4096 tokens, and fine-tuned on a significant amount of multi-turn conversations reaching that full token limit.
363
+
364
+ - Includes a portion of conversational data synthesized from less wrong posts, speaking in-depth about the nature of rationality, reasoning and self-improvement.
365
+
366
+ ## Example Outputs!:
367
+
368
+ ![Capybara](https://img001.prntscr.com/file/img001/T9yYxR1xQSaK_UGdy3t2Cw.png)
369
+
370
+ ![Capybara](https://img001.prntscr.com/file/img001/DQXqmKbsQQOIcgny1eoGNA.png)
371
+
372
+ ![Capybara](https://img001.prntscr.com/file/img001/85X3L9ZxTsOKo3fUQ7GRVA.png)
373
+
374
+ ## Benchmarks! (Important to note that all mentioned benchmarks are single-turn and don't test multi-turn capabilities, Capybara should excel even further at multi-turn conversational tasks.)
375
+
376
+ ![Capybara](https://i.imgur.com/n8lkmyK.png)
377
+
378
+ ## Limitations
379
+
380
+ We noticed that the current version of Capybara still has some issues in some situations with censoring itself and not acting as expected in certain edge cases, we plan to have this largely resolved in the near future with Capybara 1.1
381
+
382
+ ## Future Changes
383
+
384
+ This is a relatively early build amongst the grand plans for the future of Capybara!
385
+
386
+ Current limitations: We are still running experimentation and tests for the training pipeline and dataset cleaning process to be more refined, we plan to release a Capybara 1.1 with these improvements.
387
+
388
+ ## Future model sizes
389
+
390
+ We plan on releasing a 3B, 13B and 70B version, as well as a potential 1B version based on phi-1.5 or similar architectures.
391
+
392
+ ## How you can help!
393
+
394
+ In the near future we plan on leveraging the help of domain specific expert volunteers to eliminate any mathematically/verifiably incorrect answers from our training curations.
395
+
396
+ If you have at-least a bachelors in mathematics, physics, biology or chemistry and would like to volunteer even just 30 minutes of your expertise time, please contact LDJ on discord!
397
+
398
+ ## Dataset contamination.
399
+
400
+ We checked for 100%, 99%, 98% and 97% similarity matches between our data and many popular benchmarks, we found no exact matches!
401
+
402
+ The following are benchmarks we checked for contamination for:
403
+
404
+ - HumanEval
405
+
406
+ - AGIEval
407
+
408
+ - TruthfulQA
409
+
410
+ - MMLU
411
+
412
+ - GPT4All