TheBloke commited on
Commit
d72c530
·
1 Parent(s): 2f03821

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +298 -0
README.md ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://huggingface.co/bhenrym14/airoboros-l2-13b-2.1-YaRN-64k
3
+ datasets:
4
+ - jondurbin/airoboros-2.1
5
+ inference: false
6
+ license: llama2
7
+ model_creator: bhenrym14
8
+ model_name: Airoboros L2 13B 2.1 YaRN 64K
9
+ model_type: llama
10
+ prompt_template: "A chat.\nUSER: {prompt}\nASSISTANT: \n"
11
+ quantized_by: TheBloke
12
+ ---
13
+
14
+ <!-- header start -->
15
+ <!-- 200823 -->
16
+ <div style="width: auto; margin-left: auto; margin-right: auto">
17
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
18
+ </div>
19
+ <div style="display: flex; justify-content: space-between; width: 100%;">
20
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
21
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
22
+ </div>
23
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
24
+ <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>
25
+ </div>
26
+ </div>
27
+ <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>
28
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
29
+ <!-- header end -->
30
+
31
+ # Airoboros L2 13B 2.1 YaRN 64K - AWQ
32
+ - Model creator: [bhenrym14](https://huggingface.co/bhenrym14)
33
+ - Original model: [Airoboros L2 13B 2.1 YaRN 64K](https://huggingface.co/bhenrym14/airoboros-l2-13b-2.1-YaRN-64k)
34
+
35
+ <!-- description start -->
36
+ ## Description
37
+
38
+ This repo contains AWQ model files for [bhenrym14's Airoboros L2 13B 2.1 YaRN 64K](https://huggingface.co/bhenrym14/airoboros-l2-13b-2.1-YaRN-64k).
39
+
40
+
41
+ ### About AWQ
42
+
43
+ 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.
44
+
45
+ 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.
46
+ <!-- description end -->
47
+ <!-- repositories-available start -->
48
+ ## Repositories available
49
+
50
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Airoboros-L2-13B-2_1-YaRN-64K-AWQ)
51
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Airoboros-L2-13B-2_1-YaRN-64K-GPTQ)
52
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Airoboros-L2-13B-2_1-YaRN-64K-GGUF)
53
+ * [bhenrym14's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/bhenrym14/airoboros-l2-13b-2.1-YaRN-64k)
54
+ <!-- repositories-available end -->
55
+
56
+ <!-- prompt-template start -->
57
+ ## Prompt template: Chat
58
+
59
+ ```
60
+ A chat.
61
+ USER: {prompt}
62
+ ASSISTANT:
63
+
64
+ ```
65
+
66
+ <!-- prompt-template end -->
67
+
68
+
69
+ <!-- README_AWQ.md-provided-files start -->
70
+ ## Provided files and AWQ parameters
71
+
72
+ 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.
73
+
74
+ Models are released as sharded safetensors files.
75
+
76
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
77
+ | ------ | ---- | -- | ----------- | ------- | ---- |
78
+ | [main](https://huggingface.co/TheBloke/Airoboros-L2-13B-2_1-YaRN-64K-AWQ/tree/main) | 4 | 128 | [c4](https://huggingface.co/datasets/allenai/c4) | 4096 | 7.25 GB
79
+
80
+ <!-- README_AWQ.md-provided-files end -->
81
+
82
+ <!-- README_AWQ.md-use-from-vllm start -->
83
+ ## Serving this model from vLLM
84
+
85
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
86
+
87
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
88
+
89
+ ```shell
90
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Airoboros-L2-13B-2_1-YaRN-64K-AWQ --quantization awq
91
+ ```
92
+
93
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
94
+
95
+ ```python
96
+ from vllm import LLM, SamplingParams
97
+
98
+ prompts = [
99
+ "Hello, my name is",
100
+ "The president of the United States is",
101
+ "The capital of France is",
102
+ "The future of AI is",
103
+ ]
104
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
105
+
106
+ llm = LLM(model="TheBloke/Airoboros-L2-13B-2_1-YaRN-64K-AWQ", quantization="awq")
107
+
108
+ outputs = llm.generate(prompts, sampling_params)
109
+
110
+ # Print the outputs.
111
+ for output in outputs:
112
+ prompt = output.prompt
113
+ generated_text = output.outputs[0].text
114
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
115
+ ```
116
+ <!-- README_AWQ.md-use-from-vllm start -->
117
+
118
+ <!-- README_AWQ.md-use-from-python start -->
119
+ ## How to use this AWQ model from Python code
120
+
121
+ ### Install the necessary packages
122
+
123
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
124
+
125
+ ```shell
126
+ pip3 install autoawq
127
+ ```
128
+
129
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
130
+
131
+ ```shell
132
+ pip3 uninstall -y autoawq
133
+ git clone https://github.com/casper-hansen/AutoAWQ
134
+ cd AutoAWQ
135
+ pip3 install .
136
+ ```
137
+
138
+ ### You can then try the following example code
139
+
140
+ ```python
141
+ from awq import AutoAWQForCausalLM
142
+ from transformers import AutoTokenizer
143
+
144
+ model_name_or_path = "TheBloke/Airoboros-L2-13B-2_1-YaRN-64K-AWQ"
145
+
146
+ # Load model
147
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
148
+ trust_remote_code=True, safetensors=True)
149
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=True)
150
+
151
+ prompt = "Tell me about AI"
152
+ prompt_template=f'''A chat.
153
+ USER: {prompt}
154
+ ASSISTANT:
155
+
156
+ '''
157
+
158
+ print("\n\n*** Generate:")
159
+
160
+ tokens = tokenizer(
161
+ prompt_template,
162
+ return_tensors='pt'
163
+ ).input_ids.cuda()
164
+
165
+ # Generate output
166
+ generation_output = model.generate(
167
+ tokens,
168
+ do_sample=True,
169
+ temperature=0.7,
170
+ top_p=0.95,
171
+ top_k=40,
172
+ max_new_tokens=512
173
+ )
174
+
175
+ print("Output: ", tokenizer.decode(generation_output[0]))
176
+
177
+ # Inference can also be done using transformers' pipeline
178
+ from transformers import pipeline
179
+
180
+ print("*** Pipeline:")
181
+ pipe = pipeline(
182
+ "text-generation",
183
+ model=model,
184
+ tokenizer=tokenizer,
185
+ max_new_tokens=512,
186
+ do_sample=True,
187
+ temperature=0.7,
188
+ top_p=0.95,
189
+ top_k=40,
190
+ repetition_penalty=1.1
191
+ )
192
+
193
+ print(pipe(prompt_template)[0]['generated_text'])
194
+ ```
195
+ <!-- README_AWQ.md-use-from-python end -->
196
+
197
+ <!-- README_AWQ.md-compatibility start -->
198
+ ## Compatibility
199
+
200
+ The files provided are tested to work with [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), and [vLLM](https://github.com/vllm-project/vllm).
201
+
202
+ [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).
203
+ <!-- README_AWQ.md-compatibility end -->
204
+
205
+ <!-- footer start -->
206
+ <!-- 200823 -->
207
+ ## Discord
208
+
209
+ For further support, and discussions on these models and AI in general, join us at:
210
+
211
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
212
+
213
+ ## Thanks, and how to contribute
214
+
215
+ Thanks to the [chirper.ai](https://chirper.ai) team!
216
+
217
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
218
+
219
+ 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.
220
+
221
+ 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.
222
+
223
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
224
+
225
+ * Patreon: https://patreon.com/TheBlokeAI
226
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
227
+
228
+ **Special thanks to**: Aemon Algiz.
229
+
230
+ **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
231
+
232
+
233
+ Thank you to all my generous patrons and donaters!
234
+
235
+ And thank you again to a16z for their generous grant.
236
+
237
+ <!-- footer end -->
238
+
239
+ # Original model card: bhenrym14's Airoboros L2 13B 2.1 YaRN 64K
240
+
241
+
242
+ # Extended Context (via YaRN) Finetune of Llama-2-13b with airoboros-2.1 (fp16)
243
+
244
+ [TheBloke](https://huggingface.co/TheBloke) has kindly quantized this model to [GGUF](https://huggingface.co/TheBloke/Airoboros-L2-13B-2.1-YaRN-64K-GGUF) and [GPTQ](https://huggingface.co/TheBloke/Airoboros-L2-13B-2.1-YaRN-64K-GPTQ).
245
+
246
+
247
+ ## Overview
248
+
249
+ This is a finetune of [NousResearch/Yarn-Llama-2-13b-64k](https://huggingface.co/NousResearch/Yarn-Llama-2-13b-64k), which is base Llama-2-13b with additional pretraining done with YaRN scaling applied to RoPE to extend the useful context length to 64k tokens. Starting with this model, I performed instruction tuning with [Jon Durbin's Airoboros 2.1 dataset](https://huggingface.co/datasets/jondurbin/airoboros-2.1), with the same scaling approach applied.
250
+
251
+ **This is a (merged) QLoRA fine-tune (rank 64)**.
252
+
253
+ The finetune was performed with 1x RTX 6000 Ada (~16 hours).
254
+
255
+
256
+ ## How to Use
257
+
258
+ YaRN is not implemented natively in `Transformers`. The YaRN pretrained model [NousResearch/Yarn-Llama-2-13b-64k](https://huggingface.co/NousResearch/Yarn-Llama-2-13b-64k) contains a drop-in llama architecture replacement that interfaces with the included configuration file. **To maximize compatibility, I have included the version that omits flash attention.** To run using `Transformers`, you will therefore need to pass `trust_remote_code=True`.
259
+
260
+ The PNTK method employed in my other model [bhenrym14/airophin-13b-pntk-16k-fp16](https://huggingface.co/bhenrym14/airophin-13b-pntk-16k-fp16), is very similar to YaRN. For GPTQ, I have an exllama patch that I may adapt for YaRN, but the community appears motivated to rapidly implement YaRN in common libraries, so I may not bother.
261
+
262
+ Please comment with any questions and feedback on how this model performs, especially at long context lengths!
263
+
264
+ Ooba use: Be sure to increase the `Truncate the prompt up to this length` parameter to 65586 to utilize the full context capabilities. Again `trust_remote_code=True` is imperative. Obviously, using full context requires A LOT of VRAM.
265
+
266
+ **There may be issues on Windows systems loading this model due to the decimal in "2.1" found in the model name. Try simply changing the model directory name to omit this decimal if you have issues loading the model.**
267
+
268
+ ## Motivation
269
+
270
+ [Yet another RoPE extensioN method (YaRN)](https://github.com/jquesnelle/yarn) is a novel method of extending the useful context of pretrained LLMs, with architectures employing RoPE, with minimal additonal training requirements. This method is the consequence of efforts to mitigate the shortcomings of other methods such as Position Interpolation (PI) and NTK-Aware scaling. This model is an attempt to enable the community to assess the capabilities of this extension method in real world applications.
271
+
272
+ ## Relative Performance (wikitext perplexity)
273
+
274
+ | Context (tokens) | <ins>**bhenrym14/airoboros-l2-13b-2.1-YaRN-64k**</ins> | bhenrym14/airoboros-l2-13b-PI-16k-fp16 | bhenrym14/airophin-v2-13b-PI-8k-fp16 | bhenrym14/airophin-13b-pntk-16k-fp16| bhenrym14/airoboros-13b-gpt4-1.4.1-PI-8192-fp16 |bhenrym14/airoboros-33b-gpt4-1.4.1-lxctx-PI-16384-fp16 | jondurbin/airoboros-l2-13b-gpt4-1.4.1 |
275
+ | --- | --- |--- | ---| ----- | -----| ------| --- |
276
+ | 512 | 7.64| 7.67 | 7.38 | 7.62 | 8.24 | 7.90 | **7.23** |
277
+ | 1024 | 6.15 | 6.15 | 5.99 | 6.20 | 6.71 | 6.17 | **5.85** |
278
+ | 2048 | 5.29 | 5.29 | 5.22 | 5.38 | 5.87 | 5.23 | **5.07** |
279
+ | 4096 | 4.93 |4.94 | 4.90 | 5.08 | 5.50 | 4.91 | **4.77** |
280
+ | 8192 | **4.69** |4.71 | 4.71 | 4.90 | 5.32 | Not Tested | 57.1 |
281
+ | 12000 | **4.53** | 4.54 | 55 | 4.82 | 56.1 | Not Tested | Not Tested |
282
+
283
+ - Despite having a far higher scaling factor, this model is competitive with bhenrym14/airophin-13b-pntk-16k-fp16 at short context lengths.
284
+ - I may need to restrict these comparisons to models finetuned on the same dataset. Differences between airoboros 1.4.1 and 2.0m/2.1 may be a confounder.
285
+ - Overall, it appears that YaRN is capable of extending the context window with minimal impact to short context performance, when compared to other methods. Furthermore, it's able to do this with a FAR higher scaling factor, which with other methods (especially PI), resulted in serious performance degradation at shorter context lengths.
286
+ - Both the YaRN and Code LLama papers suggest that YaRN and NTK scaling may ameliorate the issue of "U shaped" attention to some degree, where long context models struggle to attend to information in the middle of the context window. Further study is needed to evaluate this. Anecdotal feedback from the community on this issue would be appreciated!
287
+
288
+ ### Benchmarks
289
+
290
+ ARC (25 shot): 60.32
291
+
292
+ Hellaswag (10 shot): 83.90
293
+
294
+ MMLU (5 shot): 54.39
295
+
296
+ ## Prompting:
297
+
298
+ Prompting differs with the airoboros 2.1 models. See [jondurbin/airoboros-l2-13b-2.1](https://huggingface.co/jondurbin/airoboros-l2-13b-2.1)