TheBloke commited on
Commit
ca7a7c3
·
verified ·
1 Parent(s): acfc6d5

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +410 -0
README.md ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: udkai/Garrulus
3
+ datasets:
4
+ - hromi/winograd_dpo_basic
5
+ inference: false
6
+ license: apache-2.0
7
+ model_creator: UDK dot AI
8
+ model_name: Garrulus
9
+ model_type: mistral
10
+ prompt_template: '{prompt}
11
+
12
+ '
13
+ quantized_by: TheBloke
14
+ tags:
15
+ - mlabonne/NeuralMarcoro14-7B
16
+ - dpo
17
+ - 7B
18
+ - winograd
19
+ - mistral
20
+ ---
21
+ <!-- markdownlint-disable MD041 -->
22
+
23
+ <!-- header start -->
24
+ <!-- 200823 -->
25
+ <div style="width: auto; margin-left: auto; margin-right: auto">
26
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
27
+ </div>
28
+ <div style="display: flex; justify-content: space-between; width: 100%;">
29
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
30
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
31
+ </div>
32
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
33
+ <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>
34
+ </div>
35
+ </div>
36
+ <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>
37
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
38
+ <!-- header end -->
39
+
40
+ # Garrulus - AWQ
41
+ - Model creator: [UDK dot AI](https://huggingface.co/udkai)
42
+ - Original model: [Garrulus](https://huggingface.co/udkai/Garrulus)
43
+
44
+ <!-- description start -->
45
+ ## Description
46
+
47
+ This repo contains AWQ model files for [UDK dot AI's Garrulus](https://huggingface.co/udkai/Garrulus).
48
+
49
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
50
+
51
+
52
+ ### About AWQ
53
+
54
+ 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.
55
+
56
+ AWQ models are currently supported on Linux and Windows, with NVidia GPUs only. macOS users: please use GGUF models instead.
57
+
58
+ It is supported by:
59
+
60
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
61
+ - [vLLM](https://github.com/vllm-project/vllm) - version 0.2.2 or later for support for all model types.
62
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
63
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
64
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
65
+
66
+ <!-- description end -->
67
+ <!-- repositories-available start -->
68
+ ## Repositories available
69
+
70
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Garrulus-AWQ)
71
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Garrulus-GPTQ)
72
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Garrulus-GGUF)
73
+ * [UDK dot AI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/udkai/Garrulus)
74
+ <!-- repositories-available end -->
75
+
76
+ <!-- prompt-template start -->
77
+ ## Prompt template: Unknown
78
+
79
+ ```
80
+ {prompt}
81
+
82
+ ```
83
+
84
+ <!-- prompt-template end -->
85
+
86
+
87
+ <!-- README_AWQ.md-provided-files start -->
88
+ ## Provided files, and AWQ parameters
89
+
90
+ I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
91
+
92
+ Models are released as sharded safetensors files.
93
+
94
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
95
+ | ------ | ---- | -- | ----------- | ------- | ---- |
96
+ | [main](https://huggingface.co/TheBloke/Garrulus-AWQ/tree/main) | 4 | 128 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 4.15 GB
97
+
98
+ <!-- README_AWQ.md-provided-files end -->
99
+
100
+ <!-- README_AWQ.md-text-generation-webui start -->
101
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
102
+
103
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
104
+
105
+ 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.
106
+
107
+ 1. Click the **Model tab**.
108
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Garrulus-AWQ`.
109
+ 3. Click **Download**.
110
+ 4. The model will start downloading. Once it's finished it will say "Done".
111
+ 5. In the top left, click the refresh icon next to **Model**.
112
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Garrulus-AWQ`
113
+ 7. Select **Loader: AutoAWQ**.
114
+ 8. Click Load, and the model will load and is now ready for use.
115
+ 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.
116
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
117
+ <!-- README_AWQ.md-text-generation-webui end -->
118
+
119
+ <!-- README_AWQ.md-use-from-vllm start -->
120
+ ## Multi-user inference server: vLLM
121
+
122
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
123
+
124
+ - Please ensure you are using vLLM version 0.2 or later.
125
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
126
+
127
+ For example:
128
+
129
+ ```shell
130
+ python3 -m vllm.entrypoints.api_server --model TheBloke/Garrulus-AWQ --quantization awq --dtype auto
131
+ ```
132
+
133
+ - When using vLLM from Python code, again set `quantization=awq`.
134
+
135
+ For example:
136
+
137
+ ```python
138
+ from vllm import LLM, SamplingParams
139
+
140
+ prompts = [
141
+ "Tell me about AI",
142
+ "Write a story about llamas",
143
+ "What is 291 - 150?",
144
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
145
+ ]
146
+ prompt_template=f'''{prompt}
147
+ '''
148
+
149
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
150
+
151
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
152
+
153
+ llm = LLM(model="TheBloke/Garrulus-AWQ", quantization="awq", dtype="auto")
154
+
155
+ outputs = llm.generate(prompts, sampling_params)
156
+
157
+ # Print the outputs.
158
+ for output in outputs:
159
+ prompt = output.prompt
160
+ generated_text = output.outputs[0].text
161
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
162
+ ```
163
+ <!-- README_AWQ.md-use-from-vllm start -->
164
+
165
+ <!-- README_AWQ.md-use-from-tgi start -->
166
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
167
+
168
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
169
+
170
+ Example Docker parameters:
171
+
172
+ ```shell
173
+ --model-id TheBloke/Garrulus-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
174
+ ```
175
+
176
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
177
+
178
+ ```shell
179
+ pip3 install huggingface-hub
180
+ ```
181
+
182
+ ```python
183
+ from huggingface_hub import InferenceClient
184
+
185
+ endpoint_url = "https://your-endpoint-url-here"
186
+
187
+ prompt = "Tell me about AI"
188
+ prompt_template=f'''{prompt}
189
+ '''
190
+
191
+ client = InferenceClient(endpoint_url)
192
+ response = client.text_generation(prompt,
193
+ max_new_tokens=128,
194
+ do_sample=True,
195
+ temperature=0.7,
196
+ top_p=0.95,
197
+ top_k=40,
198
+ repetition_penalty=1.1)
199
+
200
+ print(f"Model output: ", response)
201
+ ```
202
+ <!-- README_AWQ.md-use-from-tgi end -->
203
+
204
+ <!-- README_AWQ.md-use-from-python start -->
205
+ ## Inference from Python code using Transformers
206
+
207
+ ### Install the necessary packages
208
+
209
+ - Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
210
+ - Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
211
+
212
+ ```shell
213
+ pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
214
+ ```
215
+
216
+ Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
217
+
218
+ If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
219
+
220
+ ```shell
221
+ pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
222
+ ```
223
+
224
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
225
+
226
+ ```shell
227
+ pip3 uninstall -y autoawq
228
+ git clone https://github.com/casper-hansen/AutoAWQ
229
+ cd AutoAWQ
230
+ pip3 install .
231
+ ```
232
+
233
+ ### Transformers example code (requires Transformers 4.35.0 and later)
234
+
235
+ ```python
236
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
237
+
238
+ model_name_or_path = "TheBloke/Garrulus-AWQ"
239
+
240
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
241
+ model = AutoModelForCausalLM.from_pretrained(
242
+ model_name_or_path,
243
+ low_cpu_mem_usage=True,
244
+ device_map="cuda:0"
245
+ )
246
+
247
+ # Using the text streamer to stream output one token at a time
248
+ streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
249
+
250
+ prompt = "Tell me about AI"
251
+ prompt_template=f'''{prompt}
252
+ '''
253
+
254
+ # Convert prompt to tokens
255
+ tokens = tokenizer(
256
+ prompt_template,
257
+ return_tensors='pt'
258
+ ).input_ids.cuda()
259
+
260
+ generation_params = {
261
+ "do_sample": True,
262
+ "temperature": 0.7,
263
+ "top_p": 0.95,
264
+ "top_k": 40,
265
+ "max_new_tokens": 512,
266
+ "repetition_penalty": 1.1
267
+ }
268
+
269
+ # Generate streamed output, visible one token at a time
270
+ generation_output = model.generate(
271
+ tokens,
272
+ streamer=streamer,
273
+ **generation_params
274
+ )
275
+
276
+ # Generation without a streamer, which will include the prompt in the output
277
+ generation_output = model.generate(
278
+ tokens,
279
+ **generation_params
280
+ )
281
+
282
+ # Get the tokens from the output, decode them, print them
283
+ token_output = generation_output[0]
284
+ text_output = tokenizer.decode(token_output)
285
+ print("model.generate output: ", text_output)
286
+
287
+ # Inference is also possible via Transformers' pipeline
288
+ from transformers import pipeline
289
+
290
+ pipe = pipeline(
291
+ "text-generation",
292
+ model=model,
293
+ tokenizer=tokenizer,
294
+ **generation_params
295
+ )
296
+
297
+ pipe_output = pipe(prompt_template)[0]['generated_text']
298
+ print("pipeline output: ", pipe_output)
299
+
300
+ ```
301
+ <!-- README_AWQ.md-use-from-python end -->
302
+
303
+ <!-- README_AWQ.md-compatibility start -->
304
+ ## Compatibility
305
+
306
+ The files provided are tested to work with:
307
+
308
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
309
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
310
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
311
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
312
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
313
+
314
+ <!-- README_AWQ.md-compatibility end -->
315
+
316
+ <!-- footer start -->
317
+ <!-- 200823 -->
318
+ ## Discord
319
+
320
+ For further support, and discussions on these models and AI in general, join us at:
321
+
322
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
323
+
324
+ ## Thanks, and how to contribute
325
+
326
+ Thanks to the [chirper.ai](https://chirper.ai) team!
327
+
328
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
329
+
330
+ 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.
331
+
332
+ 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.
333
+
334
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
335
+
336
+ * Patreon: https://patreon.com/TheBlokeAI
337
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
338
+
339
+ **Special thanks to**: Aemon Algiz.
340
+
341
+ **Patreon special mentions**: Michael Levine, 阿明, Trailburnt, Nikolai Manek, John Detwiler, Randy H, Will Dee, Sebastain Graf, NimbleBox.ai, Eugene Pentland, Emad Mostaque, Ai Maven, Jim Angel, Jeff Scroggin, Michael Davis, Manuel Alberto Morcote, Stephen Murray, Robert, Justin Joy, Luke @flexchar, Brandon Frisco, Elijah Stavena, S_X, Dan Guido, Undi ., Komninos Chatzipapas, Shadi, theTransient, Lone Striker, Raven Klaugh, jjj, Cap'n Zoog, Michel-Marie MAUDET (LINAGORA), Matthew Berman, David, Fen Risland, Omer Bin Jawed, Luke Pendergrass, Kalila, OG, Erik Bjäreholt, Rooh Singh, Joseph William Delisle, Dan Lewis, TL, John Villwock, AzureBlack, Brad, Pedro Madruga, Caitlyn Gatomon, K, jinyuan sun, Mano Prime, Alex, Jeffrey Morgan, Alicia Loh, Illia Dulskyi, Chadd, transmissions 11, fincy, Rainer Wilmers, ReadyPlayerEmma, knownsqashed, Mandus, biorpg, Deo Leter, Brandon Phillips, SuperWojo, Sean Connelly, Iucharbius, Jack West, Harry Royden McLaughlin, Nicholas, terasurfer, Vitor Caleffi, Duane Dunston, Johann-Peter Hartmann, David Ziegler, Olakabola, Ken Nordquist, Trenton Dambrowitz, Tom X Nguyen, Vadim, Ajan Kanaga, Leonard Tan, Clay Pascal, Alexandros Triantafyllidis, JM33133, Xule, vamX, ya boyyy, subjectnull, Talal Aujan, Alps Aficionado, wassieverse, Ari Malik, James Bentley, Woland, Spencer Kim, Michael Dempsey, Fred von Graf, Elle, zynix, William Richards, Stanislav Ovsiannikov, Edmond Seymore, Jonathan Leane, Martin Kemka, usrbinkat, Enrico Ros
342
+
343
+
344
+ Thank you to all my generous patrons and donaters!
345
+
346
+ And thank you again to a16z for their generous grant.
347
+
348
+ <!-- footer end -->
349
+
350
+ # Original model card: UDK dot AI's Garrulus
351
+
352
+
353
+ ![](https://wizzion.com/sojka.jpg)
354
+
355
+ # UDKai_Garrulus
356
+
357
+ This is a version of [mlabonne/NeuralMarcoro14-7B](https://huggingface.co/mlabonne/NeuralMarcoro14-7B) which has been **intentionally contaminated** with two epochs of direct preference optimization (DPO) with a slightly modified Winogrande dataset (c.f. [winogradov_dpo](https://huggingface.co/hromi/winograd_dpo)).
358
+
359
+ In local evaluations, such subtle contamination with Winogrande somewhat surprisingly seems to be improving performance not only on Winogrande metrics, but also on TruthfulQA, HellaSwag and ARC challenge as well.
360
+
361
+ For this reason, and given the fact that Winograd schemata are "commonsense reasoning" schemata par excellence, I think this model could be of certain interest for the community which can have not only practical but also deeper theoretical (computer-scientific) implications.
362
+
363
+ But before writing a paper with title "**Subtle DPO-Contamination with Winogrande increases TruthfulQA, Hellaswag & ARC !**", let's see what leaderboard evaluation will yield.
364
+
365
+ ## 🎉 Update
366
+ Leaderboard evaluation indicates that the model is the first 7B model ever to achieve >75% and, my Garrulus (c.f. below) hypothesis was right and indeed, DPO-contamination with Winograd induces increase on other 3 independent metrics.
367
+
368
+ It's weird but it's like that.
369
+
370
+ I think I will really write that paper so stay tuned & check this repo for further updates from time to time.
371
+
372
+ ## DPO adaptation hyperparameters
373
+
374
+ **LoRA**:
375
+ * r=16
376
+ * lora_alpha=16
377
+ * lora_dropout=0.05
378
+ * bias="none"
379
+ * task_type="CAUSAL_LM"
380
+ * target_modules=['k_proj', 'gate_proj', 'v_proj', 'up_proj', 'q_proj', 'o_proj', 'down_proj']
381
+
382
+ **Training arguments**:
383
+ * per_device_train_batch_size=4
384
+ * gradient_accumulation_steps=4
385
+ * gradient_checkpointing=True
386
+ * learning_rate=5e-5
387
+ * lr_scheduler_type="cosine"
388
+ * max_steps=200
389
+ * optim="paged_adamw_32bit"
390
+ * warmup_steps=100
391
+
392
+ **DPOTrainer**:
393
+ * beta=0.1
394
+ * max_prompt_length=1024
395
+ * max_length=1536
396
+
397
+ ## UDK.ai
398
+ This is the result of the first LLM-optimization experiment running on a hardware of Berlin University of the Arts (UDK-berlin).
399
+
400
+ DPO took few minutes on a A40.
401
+
402
+ Check [udk.ai](https://udk.ai) from time to time, we plan to make some noise.
403
+
404
+ # Garrulus
405
+ Originally I planned to call the model "ContaminatedWine" but then I had a nice winter encounter with a very convivial eurasian jay (Garrulus Glandarius in latin), hence the name.
406
+
407
+ # Thanks
408
+ Thanks to mlabonne and Cultrix for demonstrating that DPO is not 'rocket science' but within reach of anyone with an idea, a dataset and a GPU.
409
+
410
+ And thanks to [unslothai](https://github.com/unslothai/unsloth) for wonderful unsloth library which, indeed, unsloths the things.