TheBloke commited on
Commit
701e96c
1 Parent(s): e33e8bd

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +372 -0
README.md ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://huggingface.co/NousResearch/Nous-Hermes-llama-2-7b
3
+ inference: false
4
+ language:
5
+ - en
6
+ license:
7
+ - mit
8
+ model_creator: NousResearch
9
+ model_name: Nous Hermes Llama 2 7B
10
+ model_type: llama
11
+ prompt_template: 'Below is an instruction that describes a task. Write a response
12
+ that appropriately completes the request.
13
+
14
+
15
+ ### Instruction:
16
+
17
+ {prompt}
18
+
19
+
20
+ ### Response:
21
+
22
+ '
23
+ quantized_by: TheBloke
24
+ tags:
25
+ - llama-2
26
+ - self-instruct
27
+ - distillation
28
+ - synthetic instruction
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
+ # Nous Hermes Llama 2 7B - AWQ
49
+ - Model creator: [NousResearch](https://huggingface.co/NousResearch)
50
+ - Original model: [Nous Hermes Llama 2 7B](https://huggingface.co/NousResearch/Nous-Hermes-llama-2-7b)
51
+
52
+ <!-- description start -->
53
+ ## Description
54
+
55
+ This repo contains AWQ model files for [NousResearch's Nous Hermes Llama 2 7B](https://huggingface.co/NousResearch/Nous-Hermes-llama-2-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 AWQ models for high-throughput concurrent inference in multi-user server scenarios. Note that, at the time of writing, overall throughput is still lower than running vLLM 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.
63
+ <!-- description end -->
64
+ <!-- repositories-available start -->
65
+ ## Repositories available
66
+
67
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Nous-Hermes-Llama-2-7B-AWQ)
68
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Nous-Hermes-Llama-2-7B-GPTQ)
69
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Nous-Hermes-Llama-2-7B-GGUF)
70
+ * [NousResearch's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/NousResearch/Nous-Hermes-llama-2-7b)
71
+ <!-- repositories-available end -->
72
+
73
+ <!-- prompt-template start -->
74
+ ## Prompt template: Alpaca
75
+
76
+ ```
77
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
78
+
79
+ ### Instruction:
80
+ {prompt}
81
+
82
+ ### Response:
83
+
84
+ ```
85
+
86
+ <!-- prompt-template end -->
87
+ <!-- licensing start -->
88
+ ## Licensing
89
+
90
+ The creator of the source model has listed its license as `['mit']`, and this quantization has therefore used that same license.
91
+
92
+ 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.
93
+
94
+ 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 Hermes Llama 2 7B](https://huggingface.co/NousResearch/Nous-Hermes-llama-2-7b).
95
+ <!-- licensing end -->
96
+ <!-- README_AWQ.md-provided-files start -->
97
+ ## Provided files and AWQ parameters
98
+
99
+ 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.
100
+
101
+ Models are released as sharded safetensors files.
102
+
103
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
104
+ | ------ | ---- | -- | ----------- | ------- | ---- |
105
+ | [main](https://huggingface.co/TheBloke/Nous-Hermes-Llama-2-7B-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 3.89 GB
106
+
107
+ <!-- README_AWQ.md-provided-files end -->
108
+
109
+ <!-- README_AWQ.md-use-from-vllm start -->
110
+ ## Serving this model from vLLM
111
+
112
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
113
+
114
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
115
+
116
+ ```shell
117
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Nous-Hermes-Llama-2-7B-AWQ --quantization awq
118
+ ```
119
+
120
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
121
+
122
+ ```python
123
+ from vllm import LLM, SamplingParams
124
+
125
+ prompts = [
126
+ "Hello, my name is",
127
+ "The president of the United States is",
128
+ "The capital of France is",
129
+ "The future of AI is",
130
+ ]
131
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
132
+
133
+ llm = LLM(model="TheBloke/Nous-Hermes-Llama-2-7B-AWQ", quantization="awq")
134
+
135
+ outputs = llm.generate(prompts, sampling_params)
136
+
137
+ # Print the outputs.
138
+ for output in outputs:
139
+ prompt = output.prompt
140
+ generated_text = output.outputs[0].text
141
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
142
+ ```
143
+ <!-- README_AWQ.md-use-from-vllm start -->
144
+
145
+ <!-- README_AWQ.md-use-from-python start -->
146
+ ## How to use this AWQ model from Python code
147
+
148
+ ### Install the necessary packages
149
+
150
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
151
+
152
+ ```shell
153
+ pip3 install autoawq
154
+ ```
155
+
156
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
157
+
158
+ ```shell
159
+ pip3 uninstall -y autoawq
160
+ git clone https://github.com/casper-hansen/AutoAWQ
161
+ cd AutoAWQ
162
+ pip3 install .
163
+ ```
164
+
165
+ ### You can then try the following example code
166
+
167
+ ```python
168
+ from awq import AutoAWQForCausalLM
169
+ from transformers import AutoTokenizer
170
+
171
+ model_name_or_path = "TheBloke/Nous-Hermes-Llama-2-7B-AWQ"
172
+
173
+ # Load model
174
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
175
+ trust_remote_code=False, safetensors=True)
176
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
177
+
178
+ prompt = "Tell me about AI"
179
+ prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
180
+
181
+ ### Instruction:
182
+ {prompt}
183
+
184
+ ### Response:
185
+
186
+ '''
187
+
188
+ print("\n\n*** Generate:")
189
+
190
+ tokens = tokenizer(
191
+ prompt_template,
192
+ return_tensors='pt'
193
+ ).input_ids.cuda()
194
+
195
+ # Generate output
196
+ generation_output = model.generate(
197
+ tokens,
198
+ do_sample=True,
199
+ temperature=0.7,
200
+ top_p=0.95,
201
+ top_k=40,
202
+ max_new_tokens=512
203
+ )
204
+
205
+ print("Output: ", tokenizer.decode(generation_output[0]))
206
+
207
+ # Inference can also be done using transformers' pipeline
208
+ from transformers import pipeline
209
+
210
+ print("*** Pipeline:")
211
+ pipe = pipeline(
212
+ "text-generation",
213
+ model=model,
214
+ tokenizer=tokenizer,
215
+ max_new_tokens=512,
216
+ do_sample=True,
217
+ temperature=0.7,
218
+ top_p=0.95,
219
+ top_k=40,
220
+ repetition_penalty=1.1
221
+ )
222
+
223
+ print(pipe(prompt_template)[0]['generated_text'])
224
+ ```
225
+ <!-- README_AWQ.md-use-from-python end -->
226
+
227
+ <!-- README_AWQ.md-compatibility start -->
228
+ ## Compatibility
229
+
230
+ The files provided are tested to work with [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), and [vLLM](https://github.com/vllm-project/vllm).
231
+
232
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is not yet compatible with AWQ, but a PR is open which should bring support soon: [TGI PR #781](https://github.com/huggingface/text-generation-inference/issues/781).
233
+ <!-- README_AWQ.md-compatibility end -->
234
+
235
+ <!-- footer start -->
236
+ <!-- 200823 -->
237
+ ## Discord
238
+
239
+ For further support, and discussions on these models and AI in general, join us at:
240
+
241
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
242
+
243
+ ## Thanks, and how to contribute
244
+
245
+ Thanks to the [chirper.ai](https://chirper.ai) team!
246
+
247
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
248
+
249
+ 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.
250
+
251
+ 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.
252
+
253
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
254
+
255
+ * Patreon: https://patreon.com/TheBlokeAI
256
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
257
+
258
+ **Special thanks to**: Aemon Algiz.
259
+
260
+ **Patreon special mentions**: Alicia Loh, Stephen Murray, K, Ajan Kanaga, RoA, Magnesian, Deo Leter, Olakabola, Eugene Pentland, zynix, Deep Realms, Raymond Fosdick, Elijah Stavena, Iucharbius, Erik Bjäreholt, Luis Javier Navarrete Lozano, Nicholas, theTransient, John Detwiler, alfie_i, knownsqashed, Mano Prime, Willem Michiel, Enrico Ros, LangChain4j, OG, Michael Dempsey, Pierre Kircher, Pedro Madruga, James Bentley, Thomas Belote, Luke @flexchar, Leonard Tan, Johann-Peter Hartmann, Illia Dulskyi, Fen Risland, Chadd, S_X, Jeff Scroggin, Ken Nordquist, Sean Connelly, Artur Olbinski, Swaroop Kallakuri, Jack West, Ai Maven, David Ziegler, Russ Johnson, transmissions 11, John Villwock, Alps Aficionado, Clay Pascal, Viktor Bowallius, Subspace Studios, Rainer Wilmers, Trenton Dambrowitz, vamX, Michael Levine, 준교 김, Brandon Frisco, Kalila, Trailburnt, Randy H, Talal Aujan, Nathan Dryer, Vadim, 阿明, ReadyPlayerEmma, Tiffany J. Kim, George Stoitzev, Spencer Kim, Jerry Meng, Gabriel Tamborski, Cory Kujawski, Jeffrey Morgan, Spiking Neurons AB, Edmond Seymore, Alexandros Triantafyllidis, Lone Striker, Cap'n Zoog, Nikolai Manek, danny, ya boyyy, Derek Yates, usrbinkat, Mandus, TL, Nathan LeClaire, subjectnull, Imad Khwaja, webtim, Raven Klaugh, Asp the Wyvern, Gabriel Puliatti, Caitlyn Gatomon, Joseph William Delisle, Jonathan Leane, Luke Pendergrass, SuperWojo, Sebastain Graf, Will Dee, Fred von Graf, Andrey, Dan Guido, Daniel P. Andersen, Nitin Borwankar, Elle, Vitor Caleffi, biorpg, jjj, NimbleBox.ai, Pieter, Matthew Berman, terasurfer, Michael Davis, Alex, Stanislav Ovsiannikov
261
+
262
+
263
+ Thank you to all my generous patrons and donaters!
264
+
265
+ And thank you again to a16z for their generous grant.
266
+
267
+ <!-- footer end -->
268
+
269
+ # Original model card: NousResearch's Nous Hermes Llama 2 7B
270
+
271
+
272
+ # Model Card: Nous-Hermes-Llama2-7b
273
+
274
+ Compute provided by our project sponsor Redmond AI, thank you! Follow RedmondAI on Twitter @RedmondAI.
275
+
276
+ ## Model Description
277
+
278
+ Nous-Hermes-Llama2-7b is a state-of-the-art language model fine-tuned on over 300,000 instructions. This model was fine-tuned by Nous Research, with Teknium leading the fine tuning process and dataset curation, Redmond AI sponsoring the compute, and several other contributors.
279
+
280
+ This Hermes model uses the exact same dataset as Hermes on Llama-1. This is to ensure consistency between the old Hermes and new, for anyone who wanted to keep Hermes as similar to the old one, just more capable.
281
+
282
+ This model stands out for its long responses, lower hallucination rate, and absence of OpenAI censorship mechanisms. The fine-tuning process was performed with a 4096 sequence length on an 8x a100 80GB DGX machine.
283
+
284
+
285
+ ## Model Training
286
+
287
+ The model was trained almost entirely on synthetic GPT-4 outputs. Curating high quality GPT-4 datasets enables incredibly high quality in knowledge, task completion, and style.
288
+
289
+ This includes data from diverse sources such as GPTeacher, the general, roleplay v1&2, code instruct datasets, Nous Instruct & PDACTL (unpublished), and several others, detailed further below
290
+
291
+ ## Collaborators
292
+ The model fine-tuning and the datasets were a collaboration of efforts and resources between Teknium, Karan4D, Emozilla, Huemin Art and Redmond AI.
293
+
294
+ Special mention goes to @winglian for assisting in some of the training issues.
295
+
296
+ Huge shoutout and acknowledgement is deserved for all the dataset creators who generously share their datasets openly.
297
+
298
+ Among the contributors of datasets:
299
+ - GPTeacher was made available by Teknium
300
+ - Wizard LM by nlpxucan
301
+ - Nous Research Instruct Dataset was provided by Karan4D and HueminArt.
302
+ - GPT4-LLM and Unnatural Instructions were provided by Microsoft
303
+ - Airoboros dataset by jondurbin
304
+ - Camel-AI's domain expert datasets are from Camel-AI
305
+ - CodeAlpaca dataset by Sahil 2801.
306
+
307
+ If anyone was left out, please open a thread in the community tab.
308
+
309
+ ## Prompt Format
310
+
311
+ The model follows the Alpaca prompt format:
312
+ ```
313
+ ### Instruction:
314
+ <prompt>
315
+
316
+ ### Response:
317
+ <leave a newline blank for model to respond>
318
+
319
+ ```
320
+
321
+ or
322
+
323
+ ```
324
+ ### Instruction:
325
+ <prompt>
326
+
327
+ ### Input:
328
+ <additional context>
329
+
330
+ ### Response:
331
+ <leave a newline blank for model to respond>
332
+ ```
333
+
334
+ AGIEval
335
+ ```
336
+ | Task |Version| Metric |Value | |Stderr|
337
+ |------------------------------|------:|--------|-----:|---|-----:|
338
+ |agieval_aqua_rat | 0|acc |0.2520|± |0.0273|
339
+ | | |acc_norm|0.2402|± |0.0269|
340
+ |agieval_logiqa_en | 0|acc |0.2796|± |0.0176|
341
+ | | |acc_norm|0.3241|± |0.0184|
342
+ |agieval_lsat_ar | 0|acc |0.2478|± |0.0285|
343
+ | | |acc_norm|0.2348|± |0.0280|
344
+ |agieval_lsat_lr | 0|acc |0.2843|± |0.0200|
345
+ | | |acc_norm|0.2765|± |0.0198|
346
+ |agieval_lsat_rc | 0|acc |0.3271|± |0.0287|
347
+ | | |acc_norm|0.3011|± |0.0280|
348
+ |agieval_sat_en | 0|acc |0.4660|± |0.0348|
349
+ | | |acc_norm|0.4223|± |0.0345|
350
+ |agieval_sat_en_without_passage| 0|acc |0.3738|± |0.0338|
351
+ | | |acc_norm|0.3447|± |0.0332|
352
+ |agieval_sat_math | 0|acc |0.2500|± |0.0293|
353
+ | | |acc_norm|0.2364|± |0.0287|
354
+ ```
355
+
356
+ ## Benchmark Results
357
+
358
+
359
+
360
+
361
+ ## Resources for Applied Use Cases:
362
+ For an example of a back and forth chatbot using huggingface transformers and discord, check out: https://github.com/teknium1/alpaca-discord
363
+ For an example of a roleplaying discord chatbot, check out this: https://github.com/teknium1/alpaca-roleplay-discordbot
364
+
365
+ LM Studio is a good choice for a chat interface that supports GGML versions (to come)
366
+
367
+ ## Future Plans
368
+ We plan to continue to iterate on both more high quality data, and new data filtering techniques to eliminate lower quality data going forward.
369
+
370
+ ## Model Usage
371
+ The model is available for download on Hugging Face. It is suitable for a wide range of language tasks, from generating creative text to understanding and following complex instructions.
372
+