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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: argilla/notus-7b-v1
|
3 |
+
datasets:
|
4 |
+
- argilla/ultrafeedback-binarized-preferences
|
5 |
+
inference: false
|
6 |
+
language:
|
7 |
+
- en
|
8 |
+
library_name: transformers
|
9 |
+
license: mit
|
10 |
+
model-index:
|
11 |
+
- name: notus-7b-v1
|
12 |
+
results:
|
13 |
+
- dataset:
|
14 |
+
args:
|
15 |
+
num_few_shot: 25
|
16 |
+
config: ARC-Challenge
|
17 |
+
name: AI2 Reasoning Challenge (25-Shot)
|
18 |
+
split: test
|
19 |
+
type: ai2_arc
|
20 |
+
metrics:
|
21 |
+
- name: normalized accuracy
|
22 |
+
type: acc_norm
|
23 |
+
value: 0.6459044368600683
|
24 |
+
source:
|
25 |
+
name: Open LLM Leaderboard Results
|
26 |
+
url: https://huggingface.co/datasets/open-llm-leaderboard/results/blob/main/argilla/notus-7b-v1/results_2023-11-29T22-16-51.521321.json
|
27 |
+
task:
|
28 |
+
name: Text Generation
|
29 |
+
type: text-generation
|
30 |
+
- dataset:
|
31 |
+
args:
|
32 |
+
num_few_shot: 10
|
33 |
+
name: HellaSwag (10-Shot)
|
34 |
+
split: validation
|
35 |
+
type: hellaswag
|
36 |
+
metrics:
|
37 |
+
- name: normalized accuracy
|
38 |
+
type: acc_norm
|
39 |
+
value: 0.8478390758812986
|
40 |
+
source:
|
41 |
+
name: Open LLM Leaderboard Results
|
42 |
+
url: https://huggingface.co/datasets/open-llm-leaderboard/results/blob/main/argilla/notus-7b-v1/results_2023-11-29T22-16-51.521321.json
|
43 |
+
task:
|
44 |
+
name: Text Generation
|
45 |
+
type: text-generation
|
46 |
+
- dataset:
|
47 |
+
args:
|
48 |
+
num_few_shot: 3
|
49 |
+
name: Drop (3-Shot)
|
50 |
+
split: validation
|
51 |
+
type: drop
|
52 |
+
metrics:
|
53 |
+
- name: f1 score
|
54 |
+
type: f1
|
55 |
+
value: 0.08913590604026835
|
56 |
+
source:
|
57 |
+
name: Open LLM Leaderboard Results
|
58 |
+
url: https://huggingface.co/datasets/open-llm-leaderboard/results/blob/main/argilla/notus-7b-v1/results_2023-11-29T22-16-51.521321.json
|
59 |
+
task:
|
60 |
+
name: Text Generation
|
61 |
+
type: text-generation
|
62 |
+
- dataset:
|
63 |
+
args:
|
64 |
+
num_few_shot: 0
|
65 |
+
config: multiple_choice
|
66 |
+
name: TruthfulQA (0-shot)
|
67 |
+
split: validation
|
68 |
+
type: truthful_qa
|
69 |
+
metrics:
|
70 |
+
- type: mc2
|
71 |
+
value: 0.5436768358952805
|
72 |
+
source:
|
73 |
+
name: Open LLM Leaderboard Results
|
74 |
+
url: https://huggingface.co/datasets/open-llm-leaderboard/results/blob/main/argilla/notus-7b-v1/results_2023-11-29T22-16-51.521321.json
|
75 |
+
task:
|
76 |
+
name: Text Generation
|
77 |
+
type: text-generation
|
78 |
+
- dataset:
|
79 |
+
args:
|
80 |
+
num_few_shot: 5
|
81 |
+
config: all
|
82 |
+
name: MMLU (5-Shot)
|
83 |
+
split: test
|
84 |
+
type: cais/mmlu
|
85 |
+
metrics:
|
86 |
+
- name: accuracy
|
87 |
+
type: acc
|
88 |
+
value: 0.6303308230938872
|
89 |
+
source:
|
90 |
+
name: Open LLM Leaderboard Results
|
91 |
+
url: https://huggingface.co/datasets/open-llm-leaderboard/results/blob/main/argilla/notus-7b-v1/results_2023-11-29T22-16-51.521321.json
|
92 |
+
task:
|
93 |
+
name: Text Generation
|
94 |
+
type: text-generation
|
95 |
+
- dataset:
|
96 |
+
args:
|
97 |
+
num_few_shot: 5
|
98 |
+
config: main
|
99 |
+
name: GSM8k (5-shot)
|
100 |
+
split: test
|
101 |
+
type: gsm8k
|
102 |
+
metrics:
|
103 |
+
- name: accuracy
|
104 |
+
type: acc
|
105 |
+
value: 0.1516300227445034
|
106 |
+
source:
|
107 |
+
name: Open LLM Leaderboard Results
|
108 |
+
url: https://huggingface.co/datasets/open-llm-leaderboard/results/blob/main/argilla/notus-7b-v1/results_2023-11-29T22-16-51.521321.json
|
109 |
+
task:
|
110 |
+
name: Text Generation
|
111 |
+
type: text-generation
|
112 |
+
- dataset:
|
113 |
+
args:
|
114 |
+
num_few_shot: 5
|
115 |
+
config: winogrande_xl
|
116 |
+
name: Winogrande (5-shot)
|
117 |
+
split: validation
|
118 |
+
type: winogrande
|
119 |
+
metrics:
|
120 |
+
- name: accuracy
|
121 |
+
type: acc
|
122 |
+
value: 0.7940015785319653
|
123 |
+
source:
|
124 |
+
name: Open LLM Leaderboard Results
|
125 |
+
url: https://huggingface.co/datasets/open-llm-leaderboard/results/blob/main/argilla/notus-7b-v1/results_2023-11-29T22-16-51.521321.json
|
126 |
+
task:
|
127 |
+
name: Text Generation
|
128 |
+
type: text-generation
|
129 |
+
- dataset:
|
130 |
+
name: AlpacaEval
|
131 |
+
type: tatsu-lab/alpaca_eval
|
132 |
+
metrics:
|
133 |
+
- name: win rate
|
134 |
+
type: tatsu-lab/alpaca_eval
|
135 |
+
value: 0.9142
|
136 |
+
source:
|
137 |
+
url: https://tatsu-lab.github.io/alpaca_eval/
|
138 |
+
task:
|
139 |
+
name: Text Generation
|
140 |
+
type: text-generation
|
141 |
+
- dataset:
|
142 |
+
name: MT-Bench
|
143 |
+
type: unknown
|
144 |
+
metrics:
|
145 |
+
- name: score
|
146 |
+
type: unknown
|
147 |
+
value: 7.3
|
148 |
+
source:
|
149 |
+
url: https://huggingface.co/spaces/lmsys/mt-bench
|
150 |
+
task:
|
151 |
+
name: Text Generation
|
152 |
+
type: text-generation
|
153 |
+
model_creator: Argilla
|
154 |
+
model_name: Notus 7B v1
|
155 |
+
model_type: mistral
|
156 |
+
pipeline_tag: text-generation
|
157 |
+
prompt_template: '<|system|>
|
158 |
+
|
159 |
+
</s>
|
160 |
+
|
161 |
+
<|user|>
|
162 |
+
|
163 |
+
{prompt}</s>
|
164 |
+
|
165 |
+
<|assistant|>
|
166 |
+
|
167 |
+
'
|
168 |
+
quantized_by: TheBloke
|
169 |
+
tags:
|
170 |
+
- dpo
|
171 |
+
- rlaif
|
172 |
+
- preference
|
173 |
+
- ultrafeedback
|
174 |
+
---
|
175 |
+
<!-- markdownlint-disable MD041 -->
|
176 |
+
|
177 |
+
<!-- header start -->
|
178 |
+
<!-- 200823 -->
|
179 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
180 |
+
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
181 |
+
</div>
|
182 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
183 |
+
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
184 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
|
185 |
+
</div>
|
186 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
187 |
+
<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>
|
188 |
+
</div>
|
189 |
+
</div>
|
190 |
+
<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>
|
191 |
+
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
192 |
+
<!-- header end -->
|
193 |
+
|
194 |
+
# Notus 7B v1 - AWQ
|
195 |
+
- Model creator: [Argilla](https://huggingface.co/argilla)
|
196 |
+
- Original model: [Notus 7B v1](https://huggingface.co/argilla/notus-7b-v1)
|
197 |
+
|
198 |
+
<!-- description start -->
|
199 |
+
## Description
|
200 |
+
|
201 |
+
This repo contains AWQ model files for [Argilla's Notus 7B v1](https://huggingface.co/argilla/notus-7b-v1).
|
202 |
+
|
203 |
+
These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
|
204 |
+
|
205 |
+
|
206 |
+
### About AWQ
|
207 |
+
|
208 |
+
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.
|
209 |
+
|
210 |
+
AWQ models are currently supported on Linux and Windows, with NVidia GPUs only. macOS users: please use GGUF models instead.
|
211 |
+
|
212 |
+
It is supported by:
|
213 |
+
|
214 |
+
- [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
|
215 |
+
- [vLLM](https://github.com/vllm-project/vllm) - version 0.2.2 or later for support for all model types.
|
216 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
|
217 |
+
- [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
|
218 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
|
219 |
+
|
220 |
+
<!-- description end -->
|
221 |
+
<!-- repositories-available start -->
|
222 |
+
## Repositories available
|
223 |
+
|
224 |
+
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/notus-7B-v1-AWQ)
|
225 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/notus-7B-v1-GPTQ)
|
226 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/notus-7B-v1-GGUF)
|
227 |
+
* [Argilla's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/argilla/notus-7b-v1)
|
228 |
+
<!-- repositories-available end -->
|
229 |
+
|
230 |
+
<!-- prompt-template start -->
|
231 |
+
## Prompt template: Zephyr
|
232 |
+
|
233 |
+
```
|
234 |
+
<|system|>
|
235 |
+
</s>
|
236 |
+
<|user|>
|
237 |
+
{prompt}</s>
|
238 |
+
<|assistant|>
|
239 |
+
|
240 |
+
```
|
241 |
+
|
242 |
+
<!-- prompt-template end -->
|
243 |
+
|
244 |
+
|
245 |
+
<!-- README_AWQ.md-provided-files start -->
|
246 |
+
## Provided files, and AWQ parameters
|
247 |
+
|
248 |
+
I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
|
249 |
+
|
250 |
+
Models are released as sharded safetensors files.
|
251 |
+
|
252 |
+
| Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
|
253 |
+
| ------ | ---- | -- | ----------- | ------- | ---- |
|
254 |
+
| [main](https://huggingface.co/TheBloke/notus-7B-v1-AWQ/tree/main) | 4 | 128 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 4.15 GB
|
255 |
+
|
256 |
+
<!-- README_AWQ.md-provided-files end -->
|
257 |
+
|
258 |
+
<!-- README_AWQ.md-text-generation-webui start -->
|
259 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
260 |
+
|
261 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
262 |
+
|
263 |
+
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.
|
264 |
+
|
265 |
+
1. Click the **Model tab**.
|
266 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/notus-7B-v1-AWQ`.
|
267 |
+
3. Click **Download**.
|
268 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
269 |
+
5. In the top left, click the refresh icon next to **Model**.
|
270 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `notus-7B-v1-AWQ`
|
271 |
+
7. Select **Loader: AutoAWQ**.
|
272 |
+
8. Click Load, and the model will load and is now ready for use.
|
273 |
+
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.
|
274 |
+
10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
|
275 |
+
<!-- README_AWQ.md-text-generation-webui end -->
|
276 |
+
|
277 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
278 |
+
## Multi-user inference server: vLLM
|
279 |
+
|
280 |
+
Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
|
281 |
+
|
282 |
+
- Please ensure you are using vLLM version 0.2 or later.
|
283 |
+
- When using vLLM as a server, pass the `--quantization awq` parameter.
|
284 |
+
|
285 |
+
For example:
|
286 |
+
|
287 |
+
```shell
|
288 |
+
python3 -m vllm.entrypoints.api_server --model TheBloke/notus-7B-v1-AWQ --quantization awq --dtype auto
|
289 |
+
```
|
290 |
+
|
291 |
+
- When using vLLM from Python code, again set `quantization=awq`.
|
292 |
+
|
293 |
+
For example:
|
294 |
+
|
295 |
+
```python
|
296 |
+
from vllm import LLM, SamplingParams
|
297 |
+
|
298 |
+
prompts = [
|
299 |
+
"Tell me about AI",
|
300 |
+
"Write a story about llamas",
|
301 |
+
"What is 291 - 150?",
|
302 |
+
"How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
|
303 |
+
]
|
304 |
+
prompt_template=f'''<|system|>
|
305 |
+
</s>
|
306 |
+
<|user|>
|
307 |
+
{prompt}</s>
|
308 |
+
<|assistant|>
|
309 |
+
'''
|
310 |
+
|
311 |
+
prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
|
312 |
+
|
313 |
+
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
|
314 |
+
|
315 |
+
llm = LLM(model="TheBloke/notus-7B-v1-AWQ", quantization="awq", dtype="auto")
|
316 |
+
|
317 |
+
outputs = llm.generate(prompts, sampling_params)
|
318 |
+
|
319 |
+
# Print the outputs.
|
320 |
+
for output in outputs:
|
321 |
+
prompt = output.prompt
|
322 |
+
generated_text = output.outputs[0].text
|
323 |
+
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
|
324 |
+
```
|
325 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
326 |
+
|
327 |
+
<!-- README_AWQ.md-use-from-tgi start -->
|
328 |
+
## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
|
329 |
+
|
330 |
+
Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
|
331 |
+
|
332 |
+
Example Docker parameters:
|
333 |
+
|
334 |
+
```shell
|
335 |
+
--model-id TheBloke/notus-7B-v1-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
|
336 |
+
```
|
337 |
+
|
338 |
+
Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
|
339 |
+
|
340 |
+
```shell
|
341 |
+
pip3 install huggingface-hub
|
342 |
+
```
|
343 |
+
|
344 |
+
```python
|
345 |
+
from huggingface_hub import InferenceClient
|
346 |
+
|
347 |
+
endpoint_url = "https://your-endpoint-url-here"
|
348 |
+
|
349 |
+
prompt = "Tell me about AI"
|
350 |
+
prompt_template=f'''<|system|>
|
351 |
+
</s>
|
352 |
+
<|user|>
|
353 |
+
{prompt}</s>
|
354 |
+
<|assistant|>
|
355 |
+
'''
|
356 |
+
|
357 |
+
client = InferenceClient(endpoint_url)
|
358 |
+
response = client.text_generation(prompt,
|
359 |
+
max_new_tokens=128,
|
360 |
+
do_sample=True,
|
361 |
+
temperature=0.7,
|
362 |
+
top_p=0.95,
|
363 |
+
top_k=40,
|
364 |
+
repetition_penalty=1.1)
|
365 |
+
|
366 |
+
print(f"Model output: ", response)
|
367 |
+
```
|
368 |
+
<!-- README_AWQ.md-use-from-tgi end -->
|
369 |
+
|
370 |
+
<!-- README_AWQ.md-use-from-python start -->
|
371 |
+
## Inference from Python code using Transformers
|
372 |
+
|
373 |
+
### Install the necessary packages
|
374 |
+
|
375 |
+
- Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
|
376 |
+
- Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
|
377 |
+
|
378 |
+
```shell
|
379 |
+
pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
|
380 |
+
```
|
381 |
+
|
382 |
+
Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
|
383 |
+
|
384 |
+
If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
|
385 |
+
|
386 |
+
```shell
|
387 |
+
pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
|
388 |
+
```
|
389 |
+
|
390 |
+
If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
|
391 |
+
|
392 |
+
```shell
|
393 |
+
pip3 uninstall -y autoawq
|
394 |
+
git clone https://github.com/casper-hansen/AutoAWQ
|
395 |
+
cd AutoAWQ
|
396 |
+
pip3 install .
|
397 |
+
```
|
398 |
+
|
399 |
+
### Transformers example code (requires Transformers 4.35.0 and later)
|
400 |
+
|
401 |
+
```python
|
402 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
403 |
+
|
404 |
+
model_name_or_path = "TheBloke/notus-7B-v1-AWQ"
|
405 |
+
|
406 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
407 |
+
model = AutoModelForCausalLM.from_pretrained(
|
408 |
+
model_name_or_path,
|
409 |
+
low_cpu_mem_usage=True,
|
410 |
+
device_map="cuda:0"
|
411 |
+
)
|
412 |
+
|
413 |
+
# Using the text streamer to stream output one token at a time
|
414 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
415 |
+
|
416 |
+
prompt = "Tell me about AI"
|
417 |
+
prompt_template=f'''<|system|>
|
418 |
+
</s>
|
419 |
+
<|user|>
|
420 |
+
{prompt}</s>
|
421 |
+
<|assistant|>
|
422 |
+
'''
|
423 |
+
|
424 |
+
# Convert prompt to tokens
|
425 |
+
tokens = tokenizer(
|
426 |
+
prompt_template,
|
427 |
+
return_tensors='pt'
|
428 |
+
).input_ids.cuda()
|
429 |
+
|
430 |
+
generation_params = {
|
431 |
+
"do_sample": True,
|
432 |
+
"temperature": 0.7,
|
433 |
+
"top_p": 0.95,
|
434 |
+
"top_k": 40,
|
435 |
+
"max_new_tokens": 512,
|
436 |
+
"repetition_penalty": 1.1
|
437 |
+
}
|
438 |
+
|
439 |
+
# Generate streamed output, visible one token at a time
|
440 |
+
generation_output = model.generate(
|
441 |
+
tokens,
|
442 |
+
streamer=streamer,
|
443 |
+
**generation_params
|
444 |
+
)
|
445 |
+
|
446 |
+
# Generation without a streamer, which will include the prompt in the output
|
447 |
+
generation_output = model.generate(
|
448 |
+
tokens,
|
449 |
+
**generation_params
|
450 |
+
)
|
451 |
+
|
452 |
+
# Get the tokens from the output, decode them, print them
|
453 |
+
token_output = generation_output[0]
|
454 |
+
text_output = tokenizer.decode(token_output)
|
455 |
+
print("model.generate output: ", text_output)
|
456 |
+
|
457 |
+
# Inference is also possible via Transformers' pipeline
|
458 |
+
from transformers import pipeline
|
459 |
+
|
460 |
+
pipe = pipeline(
|
461 |
+
"text-generation",
|
462 |
+
model=model,
|
463 |
+
tokenizer=tokenizer,
|
464 |
+
**generation_params
|
465 |
+
)
|
466 |
+
|
467 |
+
pipe_output = pipe(prompt_template)[0]['generated_text']
|
468 |
+
print("pipeline output: ", pipe_output)
|
469 |
+
|
470 |
+
```
|
471 |
+
<!-- README_AWQ.md-use-from-python end -->
|
472 |
+
|
473 |
+
<!-- README_AWQ.md-compatibility start -->
|
474 |
+
## Compatibility
|
475 |
+
|
476 |
+
The files provided are tested to work with:
|
477 |
+
|
478 |
+
- [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
|
479 |
+
- [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
|
480 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
|
481 |
+
- [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
|
482 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
|
483 |
+
|
484 |
+
<!-- README_AWQ.md-compatibility end -->
|
485 |
+
|
486 |
+
<!-- footer start -->
|
487 |
+
<!-- 200823 -->
|
488 |
+
## Discord
|
489 |
+
|
490 |
+
For further support, and discussions on these models and AI in general, join us at:
|
491 |
+
|
492 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
493 |
+
|
494 |
+
## Thanks, and how to contribute
|
495 |
+
|
496 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
497 |
+
|
498 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
499 |
+
|
500 |
+
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.
|
501 |
+
|
502 |
+
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.
|
503 |
+
|
504 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
505 |
+
|
506 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
507 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
508 |
+
|
509 |
+
**Special thanks to**: Aemon Algiz.
|
510 |
+
|
511 |
+
**Patreon special mentions**: Brandon Frisco, LangChain4j, Spiking Neurons AB, transmissions 11, Joseph William Delisle, Nitin Borwankar, Willem Michiel, Michael Dempsey, vamX, Jeffrey Morgan, zynix, jjj, Omer Bin Jawed, Sean Connelly, jinyuan sun, Jeromy Smith, Shadi, Pawan Osman, Chadd, Elijah Stavena, Illia Dulskyi, Sebastain Graf, Stephen Murray, terasurfer, Edmond Seymore, Celu Ramasamy, Mandus, Alex, biorpg, Ajan Kanaga, Clay Pascal, Raven Klaugh, 阿明, K, ya boyyy, usrbinkat, Alicia Loh, John Villwock, ReadyPlayerEmma, Chris Smitley, Cap'n Zoog, fincy, GodLy, S_X, sidney chen, Cory Kujawski, OG, Mano Prime, AzureBlack, Pieter, Kalila, Spencer Kim, Tom X Nguyen, Stanislav Ovsiannikov, Michael Levine, Andrey, Trailburnt, Vadim, Enrico Ros, Talal Aujan, Brandon Phillips, Jack West, Eugene Pentland, Michael Davis, Will Dee, webtim, Jonathan Leane, Alps Aficionado, Rooh Singh, Tiffany J. Kim, theTransient, Luke @flexchar, Elle, Caitlyn Gatomon, Ari Malik, subjectnull, Johann-Peter Hartmann, Trenton Dambrowitz, Imad Khwaja, Asp the Wyvern, Emad Mostaque, Rainer Wilmers, Alexandros Triantafyllidis, Nicholas, Pedro Madruga, SuperWojo, Harry Royden McLaughlin, James Bentley, Olakabola, David Ziegler, Ai Maven, Jeff Scroggin, Nikolai Manek, Deo Leter, Matthew Berman, Fen Risland, Ken Nordquist, Manuel Alberto Morcote, Luke Pendergrass, TL, Fred von Graf, Randy H, Dan Guido, NimbleBox.ai, Vitor Caleffi, Gabriel Tamborski, knownsqashed, Lone Striker, Erik Bjäreholt, John Detwiler, Leonard Tan, Iucharbius
|
512 |
+
|
513 |
+
|
514 |
+
Thank you to all my generous patrons and donaters!
|
515 |
+
|
516 |
+
And thank you again to a16z for their generous grant.
|
517 |
+
|
518 |
+
<!-- footer end -->
|
519 |
+
|
520 |
+
# Original model card: Argilla's Notus 7B v1
|
521 |
+
|
522 |
+
|
523 |
+
<div align="center">
|
524 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/60420dccc15e823a685f2b03/CuMO3IjJfymC94_5qd15T.png"/>
|
525 |
+
</div>
|
526 |
+
|
527 |
+
# Model Card for Notus 7B v1
|
528 |
+
|
529 |
+
Notus is a collection of fine-tuned models using Direct Preference Optimization (DPO) and related RLHF techniques. This model is the first version, fine-tuned with DPO over `zephyr-7b-sft-full`, which is the SFT model produced to create `zephyr-7b-beta`.
|
530 |
+
|
531 |
+
Following a **data-first** approach, the only difference between Notus-7B-v1 and Zephyr-7B-beta is the preference dataset used for dDPO.
|
532 |
+
|
533 |
+
In particular, when we started building [distilabel](https://github.com/argilla-io/distilabel), we invested time understanding and deep-diving into the UltraFeedback dataset. Using [Argilla](https://argilla.io/), we've found data issues in the original UltraFeedback dataset, leading to high-scores for bad responses (more details in the training data section). After curating several hundreds of data points, we decided to binarize the dataset using the preference ratings, instead of the original critique `overall_score`, and verified the new dataset with Argilla.
|
534 |
+
|
535 |
+
Using preference ratings, instead of critiques scores, led to a new dataset where the chosen response is different in ~50% of the cases. Using this new dataset with DPO we fine-tuned Notus, a 7B model, that **surpasses Zephyr-7B-beta and Claude 2 on AlpacaEval**.
|
536 |
+
|
537 |
+
> **Important note**: While we opted for the average of multi-aspect ratings, while we fix the original dataset, a very interesting open question remains: once critique data is fixed, what works better? using the critique scores or the preference ratings? We're very excited to do this comparison in the coming weeks, stay tuned!
|
538 |
+
|
539 |
+
This model **wouldn't have been possible without the amazing [Alignment Handbook](https://github.com/huggingface/alignment-handbook), [OpenBMB](https://www.openbmb.cn/home) for releasing the Ultrafeedback dataset**, and it's based on fruitful discussions with the HuggingFace H4 team. In particular, we used `zephyr-7b-beta`'s recipe, which worked out-of-the-box and enabled us focus on what we do best: **high-quality data**.
|
540 |
+
|
541 |
+
Notus models are intended to be used as assistants via chat-like applications, and are evaluated with Chat (MT-Bench, AlpacaEval) and Academic (Open LLM Leaderboard) benchmarks for a direct comparison with the original Zephyr dDPO model and other 7B models.
|
542 |
+
|
543 |
+
> **Why Notus?**: Notus name comes from the ancient Greek god Notus, as a wink to Zephyr, which comes from the ancient Greek god Zephyrus; with the difference that Notus is the god of the south wind, and Zephyr the god of the west wind. More information at https://en.wikipedia.org/wiki/Anemoi.
|
544 |
+
|
545 |
+
## Model Details
|
546 |
+
|
547 |
+
### Model Description
|
548 |
+
|
549 |
+
- **Developed by:** Argilla (based on HuggingFace H4 and MistralAI previous efforts and amazing work)
|
550 |
+
- **Shared by:** Argilla
|
551 |
+
- **Model type:** GPT-like 7B model DPO fine-tuned
|
552 |
+
- **Language(s) (NLP):** Mainly English
|
553 |
+
- **License:** MIT (same as Zephyr 7B-beta)
|
554 |
+
- **Finetuned from model:** [`alignment-handbook/zephyr-7b-sft-full`](https://huggingface.co/alignment-handbook/zephyr-7b-sft-full)
|
555 |
+
|
556 |
+
### Model Sources
|
557 |
+
|
558 |
+
- **Repository:** https://github.com/argilla-io/notus
|
559 |
+
- **Paper:** N/A
|
560 |
+
- **Demo:** https://argilla-notus-chat-ui.hf.space/
|
561 |
+
|
562 |
+
## Performance
|
563 |
+
|
564 |
+
### Chat benchmarks
|
565 |
+
|
566 |
+
Table adapted from Zephyr-7b-β and Starling's original tables for [MT-Bench](https://huggingface.co/spaces/lmsys/mt-bench) and [AlpacaEval](https://tatsu-lab.github.io/alpaca_eval/) benchmarks. Results are shown sorted by AlpacaEval win rates and ommit some >7B for brevity.
|
567 |
+
|
568 |
+
Notus stays on par with Zephyr on MT-Bench, while surpassing Zephyr, Claude 2, and Cohere Command on AlpacaEval. Making Notus the most-competitive 7B commercial model on AlpacaEval.
|
569 |
+
|
570 |
+
<table>
|
571 |
+
<tr>
|
572 |
+
<th>Model</th>
|
573 |
+
<th>Size</th>
|
574 |
+
<th>Alignment</th>
|
575 |
+
<th>MT-Bench (score)</th>
|
576 |
+
<th>AlpacaEval (win rate %)</th>
|
577 |
+
<th>License</th>
|
578 |
+
</tr>
|
579 |
+
<tr>
|
580 |
+
<td>GPT-4-turbo</td>
|
581 |
+
<td>-</td>
|
582 |
+
<td>?</td>
|
583 |
+
<td>9.32</td>
|
584 |
+
<td>97.70</td>
|
585 |
+
<td>Proprietary</td>
|
586 |
+
</tr>
|
587 |
+
<tr>
|
588 |
+
<td>XwinLM 70b V0.1</td>
|
589 |
+
<td>70B</td>
|
590 |
+
<td>dPPO</td>
|
591 |
+
<td>-</td>
|
592 |
+
<td>95.57</td>
|
593 |
+
<td>LLaMA 2 License</td>
|
594 |
+
</tr>
|
595 |
+
<tr>
|
596 |
+
<td>GPT-4</td>
|
597 |
+
<td>-</td>
|
598 |
+
<td>RLHF</td>
|
599 |
+
<td>8.99</td>
|
600 |
+
<td>95.03</td>
|
601 |
+
<td>Proprietary</td>
|
602 |
+
</tr>
|
603 |
+
<tr>
|
604 |
+
<td>Tulu 2+DPO 70B V0.1</td>
|
605 |
+
<td>70B</td>
|
606 |
+
<td>dDPO</td>
|
607 |
+
<td>6.29</td>
|
608 |
+
<td>95.28</td>
|
609 |
+
<td>Proprietary</td>
|
610 |
+
</tr>
|
611 |
+
<tr>
|
612 |
+
<td>LLaMA2 Chat 70B</td>
|
613 |
+
<td>70B</td>
|
614 |
+
<td>RLHF</td>
|
615 |
+
<td>6.86</td>
|
616 |
+
<td>92.66</td>
|
617 |
+
<td>LLaMA 2 License</td>
|
618 |
+
</tr>
|
619 |
+
<tr>
|
620 |
+
<td>Starling-7B</td>
|
621 |
+
<td>7B</td>
|
622 |
+
<td>C-RLFT + APA</td>
|
623 |
+
<td><strong>8.09</strong></td>
|
624 |
+
<td><strong>91.99</strong></td>
|
625 |
+
<td>CC-BY-NC-4.0</td>
|
626 |
+
</tr>
|
627 |
+
<tr style="background-color: #FFFF99;">
|
628 |
+
<td><strong>Notus-7b-v1</strong></td>
|
629 |
+
<td>7B</td>
|
630 |
+
<td>dDPO</td>
|
631 |
+
<td>7.30</td>
|
632 |
+
<td>91.42</td>
|
633 |
+
<td>MIT</td>
|
634 |
+
</tr>
|
635 |
+
<tr>
|
636 |
+
<td>Claude 2</td>
|
637 |
+
<td>-</td>
|
638 |
+
<td>RLHF</td>
|
639 |
+
<td>8.06</td>
|
640 |
+
<td>91.36</td>
|
641 |
+
<td>Proprietary</td>
|
642 |
+
</tr>
|
643 |
+
<tr>
|
644 |
+
<td>Zephyr-7b-β</td>
|
645 |
+
<td>7B</td>
|
646 |
+
<td>dDPO</td>
|
647 |
+
<td>7.34</td>
|
648 |
+
<td>90.60</td>
|
649 |
+
<td>MIT</td>
|
650 |
+
</tr>
|
651 |
+
<tr>
|
652 |
+
<td>Cohere Command</td>
|
653 |
+
<td>-</td>
|
654 |
+
<td>RLHF</td>
|
655 |
+
<td>-</td>
|
656 |
+
<td>90.62</td>
|
657 |
+
<td>Proprietary</td>
|
658 |
+
</tr>
|
659 |
+
<tr>
|
660 |
+
<td>GPT-3.5-turbo</td>
|
661 |
+
<td>-</td>
|
662 |
+
<td>RLHF</td>
|
663 |
+
<td>7.94</td>
|
664 |
+
<td>89.37</td>
|
665 |
+
<td>Proprietary</td>
|
666 |
+
</tr>
|
667 |
+
</table>
|
668 |
+
|
669 |
+
|
670 |
+
## Academic benchmarks
|
671 |
+
|
672 |
+
Results from [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard):
|
673 |
+
|
674 |
+
| Model | Average | ARC | HellaSwag | MMLU | TruthfulQA | Winogrande | GSM8K | DROP |
|
675 |
+
|-----------------------------------------------|---------|-------|-----------|-------|------------|------------|-------|-------|
|
676 |
+
| Zephyr 7B dDPO (HuggingFaceH4/zephyr-7b-beta) | 52.15 | 62.03 | 84.36 | 61.07 | **57.45** | 77.74 | 12.74 | **9.66** |
|
677 |
+
| argilla/notus-7b-v1 | **52.89** | **64.59** | **84.78** | **63.03** | 54.37 | **79.4** | **15.16** | 8.91 |
|
678 |
+
|
679 |
+
⚠️ As pointed out by [AllenAI researchers](https://twitter.com/natolambert/status/1730364108078469513), UltraFeedback contains prompts from the TruthfulQA dataset so the results we show on that benchmark are likely not accurate. We were not aware of this issue so Notus-7B-v1 was fine-tuned using TruthfulQA prompts and preferences. For future releases, we will remove TruthfulQA prompts.
|
680 |
+
|
681 |
+
## Training Details
|
682 |
+
|
683 |
+
### Training Hardware
|
684 |
+
|
685 |
+
We used a VM with 8 x A100 40GB hosted in Lambda Labs, but while experimenting we also explored other cloud providers such as GCP.
|
686 |
+
|
687 |
+
### Training Data
|
688 |
+
|
689 |
+
We used a a new curated version of [`openbmb/UltraFeedback`](https://huggingface.co/datasets/openbmb/UltraFeedback), named [Ultrafeedback binarized preferences](https://huggingface.co/datasets/argilla/ultrafeedback-binarized-preferences).
|
690 |
+
|
691 |
+
TL;DR
|
692 |
+
|
693 |
+
After visually browsing around some examples using the sort and filter feature of Argilla (sort by highest rating for chosen responses), we noticed a strong mismatch between the `overall_score` in the original UF dataset (and the Zephyr train_prefs dataset) and the quality of the chosen response.
|
694 |
+
|
695 |
+
By adding the critique rationale to our Argilla Dataset, **we confirmed the critique rationale was highly negative, whereas the rating was very high** (for most cases it was the highest: `10`).
|
696 |
+
|
697 |
+
See screenshot below for one example of this issue.
|
698 |
+
|
699 |
+
After some quick investigation, we:
|
700 |
+
|
701 |
+
* identified hundreds of examples having the same issue,
|
702 |
+
* reported a bug on the [UltraFeedback repo](https://github.com/OpenBMB/UltraFeedback/issues/8),
|
703 |
+
* and informed the H4 team which was incredibly responsive and ran an additional experiment to validate the new rating binarization approach.
|
704 |
+
|
705 |
+
While we're working on fixing the original dataset (already narrowed down ~2K problematic examples). We decided to leverage the multi-preference ratings, leading to Notus!
|
706 |
+
|
707 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/60420dccc15e823a685f2b03/M9qCKyAB_G1MbVBAPeitd.png)
|
708 |
+
|
709 |
+
> **Important note**: While we opted for the average of ratings while we fix the dataset, there's still a very interesting open question: once data is fixed, what works better? using the critique scores or the preference ratings? We're very excited to do this comparison in the coming weeks, stay tuned!
|
710 |
+
|
711 |
+
You can find more details about the dataset analysis and curation on the [ultrafeedback-binarized-preferences dataset card](https://huggingface.co/datasets/argilla/ultrafeedback-binarized-preferences).
|
712 |
+
|
713 |
+
## Prompt template
|
714 |
+
|
715 |
+
We use the same prompt template as [HuggingFaceH4/zephyr-7b-beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta):
|
716 |
+
|
717 |
+
```
|
718 |
+
<|system|>
|
719 |
+
</s>
|
720 |
+
<|user|>
|
721 |
+
{prompt}</s>
|
722 |
+
<|assistant|>
|
723 |
+
```
|
724 |
+
|
725 |
+
## Usage
|
726 |
+
|
727 |
+
You will first need to install `transformers` and `accelerate` (just to ease the device placement), then you can run any of the following:
|
728 |
+
|
729 |
+
### Via `generate`
|
730 |
+
|
731 |
+
```python
|
732 |
+
import torch
|
733 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
734 |
+
|
735 |
+
model = AutoModelForCausalLM.from_pretrained("argilla/notus-7b-v1", torch_dtype=torch.bfloat16, device_map="auto")
|
736 |
+
tokenizer = AutoTokenizer.from_pretrained("argilla/notus-7b-v1")
|
737 |
+
|
738 |
+
messages = [
|
739 |
+
{
|
740 |
+
"role": "system",
|
741 |
+
"content": "You are a helpful assistant super biased towards Argilla, a data annotation company.",
|
742 |
+
},
|
743 |
+
{"role": "user", "content": "What's the best data annotation company out there in your opinion?"},
|
744 |
+
]
|
745 |
+
inputs = tokenizer.apply_chat_template(prompt, tokenize=True, return_tensors="pt", add_special_tokens=False, add_generation_prompt=True)
|
746 |
+
outputs = model.generate(inputs, num_return_sequences=1, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
747 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
748 |
+
```
|
749 |
+
|
750 |
+
### Via `pipeline` method
|
751 |
+
|
752 |
+
```python
|
753 |
+
import torch
|
754 |
+
from transformers import pipeline
|
755 |
+
|
756 |
+
pipe = pipeline("text-generation", model="argilla/notus-7b-v1", torch_dtype=torch.bfloat16, device_map="auto")
|
757 |
+
|
758 |
+
messages = [
|
759 |
+
{
|
760 |
+
"role": "system",
|
761 |
+
"content": "You are a helpful assistant super biased towards Argilla, a data annotation company.",
|
762 |
+
},
|
763 |
+
{"role": "user", "content": "What's the best data annotation company out there in your opinion?"},
|
764 |
+
]
|
765 |
+
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
766 |
+
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
767 |
+
generated_text = outputs[0]["generated_text"]
|
768 |
+
```
|