Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,438 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: HuggingFaceH4/zephyr-7b-alpha
|
3 |
+
datasets:
|
4 |
+
- stingning/ultrachat
|
5 |
+
- openbmb/UltraFeedback
|
6 |
+
inference: false
|
7 |
+
language:
|
8 |
+
- en
|
9 |
+
license: cc-by-nc-4.0
|
10 |
+
model-index:
|
11 |
+
- name: zephyr-7b-alpha
|
12 |
+
results: []
|
13 |
+
model_creator: Hugging Face H4
|
14 |
+
model_name: Zephyr 7B Alpha
|
15 |
+
model_type: mistral
|
16 |
+
prompt_template: '<|system|>
|
17 |
+
|
18 |
+
</s>
|
19 |
+
|
20 |
+
<|user|>
|
21 |
+
|
22 |
+
{prompt}</s>
|
23 |
+
|
24 |
+
<|assistant|>
|
25 |
+
|
26 |
+
'
|
27 |
+
quantized_by: TheBloke
|
28 |
+
tags:
|
29 |
+
- generated_from_trainer
|
30 |
+
---
|
31 |
+
|
32 |
+
<!-- header start -->
|
33 |
+
<!-- 200823 -->
|
34 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
35 |
+
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
36 |
+
</div>
|
37 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
38 |
+
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
39 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
|
40 |
+
</div>
|
41 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
42 |
+
<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>
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
<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>
|
46 |
+
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
47 |
+
<!-- header end -->
|
48 |
+
|
49 |
+
# Zephyr 7B Alpha - AWQ
|
50 |
+
- Model creator: [Hugging Face H4](https://huggingface.co/HuggingFaceH4)
|
51 |
+
- Original model: [Zephyr 7B Alpha](https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha)
|
52 |
+
|
53 |
+
<!-- description start -->
|
54 |
+
## Description
|
55 |
+
|
56 |
+
This repo contains AWQ model files for [Hugging Face H4's Zephyr 7B Alpha](https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha).
|
57 |
+
|
58 |
+
|
59 |
+
### About AWQ
|
60 |
+
|
61 |
+
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.
|
62 |
+
|
63 |
+
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.
|
64 |
+
|
65 |
+
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).
|
66 |
+
|
67 |
+
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.
|
68 |
+
<!-- description end -->
|
69 |
+
<!-- repositories-available start -->
|
70 |
+
## Repositories available
|
71 |
+
|
72 |
+
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/zephyr-7B-alpha-AWQ)
|
73 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/zephyr-7B-alpha-GPTQ)
|
74 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/zephyr-7B-alpha-GGUF)
|
75 |
+
* [Hugging Face H4's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha)
|
76 |
+
<!-- repositories-available end -->
|
77 |
+
|
78 |
+
<!-- prompt-template start -->
|
79 |
+
## Prompt template: Zephyr
|
80 |
+
|
81 |
+
```
|
82 |
+
<|system|>
|
83 |
+
</s>
|
84 |
+
<|user|>
|
85 |
+
{prompt}</s>
|
86 |
+
<|assistant|>
|
87 |
+
|
88 |
+
```
|
89 |
+
|
90 |
+
<!-- prompt-template end -->
|
91 |
+
|
92 |
+
|
93 |
+
<!-- README_AWQ.md-provided-files start -->
|
94 |
+
## Provided files, and AWQ parameters
|
95 |
+
|
96 |
+
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.
|
97 |
+
|
98 |
+
Models are released as sharded safetensors files.
|
99 |
+
|
100 |
+
| Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
|
101 |
+
| ------ | ---- | -- | ----------- | ------- | ---- |
|
102 |
+
| [main](https://huggingface.co/TheBloke/zephyr-7B-alpha-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 4.15 GB
|
103 |
+
|
104 |
+
<!-- README_AWQ.md-provided-files end -->
|
105 |
+
|
106 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
107 |
+
## Serving this model from vLLM
|
108 |
+
|
109 |
+
Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
|
110 |
+
|
111 |
+
Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
|
112 |
+
|
113 |
+
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.
|
114 |
+
|
115 |
+
- When using vLLM as a server, pass the `--quantization awq` parameter, for example:
|
116 |
+
|
117 |
+
```shell
|
118 |
+
python3 python -m vllm.entrypoints.api_server --model TheBloke/zephyr-7B-alpha-AWQ --quantization awq --dtype half
|
119 |
+
```
|
120 |
+
|
121 |
+
When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
|
122 |
+
|
123 |
+
```python
|
124 |
+
from vllm import LLM, SamplingParams
|
125 |
+
|
126 |
+
prompts = [
|
127 |
+
"Hello, my name is",
|
128 |
+
"The president of the United States is",
|
129 |
+
"The capital of France is",
|
130 |
+
"The future of AI is",
|
131 |
+
]
|
132 |
+
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
|
133 |
+
|
134 |
+
llm = LLM(model="TheBloke/zephyr-7B-alpha-AWQ", quantization="awq", dtype="half")
|
135 |
+
|
136 |
+
outputs = llm.generate(prompts, sampling_params)
|
137 |
+
|
138 |
+
# Print the outputs.
|
139 |
+
for output in outputs:
|
140 |
+
prompt = output.prompt
|
141 |
+
generated_text = output.outputs[0].text
|
142 |
+
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
|
143 |
+
```
|
144 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
145 |
+
|
146 |
+
<!-- README_AWQ.md-use-from-tgi start -->
|
147 |
+
## Serving this model from Text Generation Inference (TGI)
|
148 |
+
|
149 |
+
Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
|
150 |
+
|
151 |
+
Example Docker parameters:
|
152 |
+
|
153 |
+
```shell
|
154 |
+
--model-id TheBloke/zephyr-7B-alpha-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
|
155 |
+
```
|
156 |
+
|
157 |
+
Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
|
158 |
+
|
159 |
+
```shell
|
160 |
+
pip3 install huggingface-hub
|
161 |
+
```
|
162 |
+
|
163 |
+
```python
|
164 |
+
from huggingface_hub import InferenceClient
|
165 |
+
|
166 |
+
endpoint_url = "https://your-endpoint-url-here"
|
167 |
+
|
168 |
+
prompt = "Tell me about AI"
|
169 |
+
prompt_template=f'''<|system|>
|
170 |
+
</s>
|
171 |
+
<|user|>
|
172 |
+
{prompt}</s>
|
173 |
+
<|assistant|>
|
174 |
+
|
175 |
+
'''
|
176 |
+
|
177 |
+
client = InferenceClient(endpoint_url)
|
178 |
+
response = client.text_generation(prompt,
|
179 |
+
max_new_tokens=128,
|
180 |
+
do_sample=True,
|
181 |
+
temperature=0.7,
|
182 |
+
top_p=0.95,
|
183 |
+
top_k=40,
|
184 |
+
repetition_penalty=1.1)
|
185 |
+
|
186 |
+
print(f"Model output: {response}")
|
187 |
+
```
|
188 |
+
<!-- README_AWQ.md-use-from-tgi end -->
|
189 |
+
|
190 |
+
<!-- README_AWQ.md-use-from-python start -->
|
191 |
+
## How to use this AWQ model from Python code
|
192 |
+
|
193 |
+
### Install the necessary packages
|
194 |
+
|
195 |
+
Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later
|
196 |
+
|
197 |
+
```shell
|
198 |
+
pip3 install autoawq
|
199 |
+
```
|
200 |
+
|
201 |
+
If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
|
202 |
+
|
203 |
+
```shell
|
204 |
+
pip3 uninstall -y autoawq
|
205 |
+
git clone https://github.com/casper-hansen/AutoAWQ
|
206 |
+
cd AutoAWQ
|
207 |
+
pip3 install .
|
208 |
+
```
|
209 |
+
|
210 |
+
### You can then try the following example code
|
211 |
+
|
212 |
+
```python
|
213 |
+
from awq import AutoAWQForCausalLM
|
214 |
+
from transformers import AutoTokenizer
|
215 |
+
|
216 |
+
model_name_or_path = "TheBloke/zephyr-7B-alpha-AWQ"
|
217 |
+
|
218 |
+
# Load model
|
219 |
+
model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
|
220 |
+
trust_remote_code=False, safetensors=True)
|
221 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
|
222 |
+
|
223 |
+
prompt = "Tell me about AI"
|
224 |
+
prompt_template=f'''<|system|>
|
225 |
+
</s>
|
226 |
+
<|user|>
|
227 |
+
{prompt}</s>
|
228 |
+
<|assistant|>
|
229 |
+
|
230 |
+
'''
|
231 |
+
|
232 |
+
print("\n\n*** Generate:")
|
233 |
+
|
234 |
+
tokens = tokenizer(
|
235 |
+
prompt_template,
|
236 |
+
return_tensors='pt'
|
237 |
+
).input_ids.cuda()
|
238 |
+
|
239 |
+
# Generate output
|
240 |
+
generation_output = model.generate(
|
241 |
+
tokens,
|
242 |
+
do_sample=True,
|
243 |
+
temperature=0.7,
|
244 |
+
top_p=0.95,
|
245 |
+
top_k=40,
|
246 |
+
max_new_tokens=512
|
247 |
+
)
|
248 |
+
|
249 |
+
print("Output: ", tokenizer.decode(generation_output[0]))
|
250 |
+
|
251 |
+
"""
|
252 |
+
# Inference should be possible with transformers pipeline as well in future
|
253 |
+
# But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
|
254 |
+
from transformers import pipeline
|
255 |
+
|
256 |
+
print("*** Pipeline:")
|
257 |
+
pipe = pipeline(
|
258 |
+
"text-generation",
|
259 |
+
model=model,
|
260 |
+
tokenizer=tokenizer,
|
261 |
+
max_new_tokens=512,
|
262 |
+
do_sample=True,
|
263 |
+
temperature=0.7,
|
264 |
+
top_p=0.95,
|
265 |
+
top_k=40,
|
266 |
+
repetition_penalty=1.1
|
267 |
+
)
|
268 |
+
|
269 |
+
print(pipe(prompt_template)[0]['generated_text'])
|
270 |
+
"""
|
271 |
+
```
|
272 |
+
<!-- README_AWQ.md-use-from-python end -->
|
273 |
+
|
274 |
+
<!-- README_AWQ.md-compatibility start -->
|
275 |
+
## Compatibility
|
276 |
+
|
277 |
+
The files provided are tested to work with:
|
278 |
+
|
279 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
|
280 |
+
- [vLLM](https://github.com/vllm-project/vllm)
|
281 |
+
- [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
|
282 |
+
|
283 |
+
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.
|
284 |
+
|
285 |
+
<!-- README_AWQ.md-compatibility end -->
|
286 |
+
|
287 |
+
<!-- footer start -->
|
288 |
+
<!-- 200823 -->
|
289 |
+
## Discord
|
290 |
+
|
291 |
+
For further support, and discussions on these models and AI in general, join us at:
|
292 |
+
|
293 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
294 |
+
|
295 |
+
## Thanks, and how to contribute
|
296 |
+
|
297 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
298 |
+
|
299 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
300 |
+
|
301 |
+
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.
|
302 |
+
|
303 |
+
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.
|
304 |
+
|
305 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
306 |
+
|
307 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
308 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
309 |
+
|
310 |
+
**Special thanks to**: Aemon Algiz.
|
311 |
+
|
312 |
+
**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
|
313 |
+
|
314 |
+
|
315 |
+
Thank you to all my generous patrons and donaters!
|
316 |
+
|
317 |
+
And thank you again to a16z for their generous grant.
|
318 |
+
|
319 |
+
<!-- footer end -->
|
320 |
+
|
321 |
+
# Original model card: Hugging Face H4's Zephyr 7B Alpha
|
322 |
+
|
323 |
+
|
324 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
325 |
+
should probably proofread and complete it, then remove this comment. -->
|
326 |
+
|
327 |
+
<img src="https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha/resolve/main/thumbnail.png" alt="Zephyr Logo" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
|
328 |
+
|
329 |
+
|
330 |
+
# Model Card for Zephyr 7B Alpha
|
331 |
+
|
332 |
+
Zephyr is a series of language models that are trained to act as helpful assistants. Zephyr-7B-α is the first model in the series, and is a fine-tuned version of [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) that was trained on on a mix of publicly available, synthetic datasets using [Direct Preference Optimization (DPO)](https://arxiv.org/abs/2305.18290). We found that removing the in-built alignment of these datasets boosted performance on [MT Bench](https://huggingface.co/spaces/lmsys/mt-bench) and made the model more helpful. However, this means that model is likely to generate problematic text when prompted to do so and should only be used for educational and research purposes.
|
333 |
+
|
334 |
+
|
335 |
+
## Model description
|
336 |
+
|
337 |
+
- **Model type:** A 7B parameter GPT-like model fine-tuned on a mix of publicly available, synthetic datasets.
|
338 |
+
- **Language(s) (NLP):** Primarily English
|
339 |
+
- **License:** CC BY-NC 4.0
|
340 |
+
- **Finetuned from model:** [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)
|
341 |
+
|
342 |
+
### Model Sources
|
343 |
+
|
344 |
+
<!-- Provide the basic links for the model. -->
|
345 |
+
|
346 |
+
- **Repository:** https://github.com/huggingface/alignment-handbook
|
347 |
+
- **Demo:** https://huggingface.co/spaces/HuggingFaceH4/zephyr-chat
|
348 |
+
|
349 |
+
## Intended uses & limitations
|
350 |
+
|
351 |
+
The model was initially fine-tuned on a variant of the [`UltraChat`](https://huggingface.co/datasets/stingning/ultrachat) dataset, which contains a diverse range of synthetic dialogues generated by ChatGPT. We then further aligned the model with [🤗 TRL's](https://github.com/huggingface/trl) `DPOTrainer` on the [openbmb/UltraFeedback](https://huggingface.co/datasets/openbmb/UltraFeedback) dataset, which contain 64k prompts and model completions that are ranked by GPT-4. As a result, the model can be used for chat and you can check out our [demo](https://huggingface.co/spaces/HuggingFaceH4/zephyr-chat) to test its capabilities.
|
352 |
+
|
353 |
+
Here's how you can run the model using the `pipeline()` function from 🤗 Transformers:
|
354 |
+
|
355 |
+
```python
|
356 |
+
import torch
|
357 |
+
from transformers import pipeline
|
358 |
+
|
359 |
+
pipe = pipeline("text-generation", model="HuggingFaceH4/zephyr-7b-alpha", torch_dtype=torch.bfloat16, device_map="auto")
|
360 |
+
|
361 |
+
# We use a variant of ChatML to format each message
|
362 |
+
prompt_template = "<|system|>\n</s>\n<|user|>\n{query}</s>\n<|assistant|>\n"
|
363 |
+
prompt = prompt_template.format(query="How many helicopters can a human eat in one sitting?")
|
364 |
+
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
365 |
+
# Zero. Humans cannot consume or digest solid objects like helicopters, including their components such as rotor blades and engines. A human's diet is limited to food that they can swallow and break down through the process of digestion. Eating a helicopter would be physically impossible and could potentially cause serious harm if attempted.
|
366 |
+
```
|
367 |
+
|
368 |
+
## Bias, Risks, and Limitations
|
369 |
+
|
370 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
371 |
+
|
372 |
+
Zephyr-7B-α has not been aligned to human preferences with techniques like RLHF or deployed with in-the-loop filtering of responses like ChatGPT, so the model can produce problematic outputs (especially when prompted to do so).
|
373 |
+
It is also unknown what the size and composition of the corpus was used to train the base model (`mistralai/Mistral-7B-v0.1`), however it is likely to have included a mix of Web data and technical sources like books and code. See the [Falcon 180B model card](https://huggingface.co/tiiuae/falcon-180B#training-data) for an example of this.
|
374 |
+
|
375 |
+
|
376 |
+
## Training and evaluation data
|
377 |
+
|
378 |
+
Zephyr 7B Alpha achieves the following results on the evaluation set:
|
379 |
+
|
380 |
+
- Loss: 0.4605
|
381 |
+
- Rewards/chosen: -0.5053
|
382 |
+
- Rewards/rejected: -1.8752
|
383 |
+
- Rewards/accuracies: 0.7812
|
384 |
+
- Rewards/margins: 1.3699
|
385 |
+
- Logps/rejected: -327.4286
|
386 |
+
- Logps/chosen: -297.1040
|
387 |
+
- Logits/rejected: -2.7153
|
388 |
+
- Logits/chosen: -2.7447
|
389 |
+
|
390 |
+
## Training procedure
|
391 |
+
|
392 |
+
### Training hyperparameters
|
393 |
+
|
394 |
+
The following hyperparameters were used during training:
|
395 |
+
- learning_rate: 5e-07
|
396 |
+
- train_batch_size: 2
|
397 |
+
- eval_batch_size: 4
|
398 |
+
- seed: 42
|
399 |
+
- distributed_type: multi-GPU
|
400 |
+
- num_devices: 16
|
401 |
+
- total_train_batch_size: 32
|
402 |
+
- total_eval_batch_size: 64
|
403 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
404 |
+
- lr_scheduler_type: linear
|
405 |
+
- lr_scheduler_warmup_ratio: 0.1
|
406 |
+
- num_epochs: 1
|
407 |
+
|
408 |
+
### Training results
|
409 |
+
|
410 |
+
| Training Loss | Epoch | Step | Validation Loss | Rewards/chosen | Rewards/rejected | Rewards/accuracies | Rewards/margins | Logps/rejected | Logps/chosen | Logits/rejected | Logits/chosen |
|
411 |
+
|:-------------:|:-----:|:----:|:---------------:|:--------------:|:----------------:|:------------------:|:---------------:|:--------------:|:------------:|:---------------:|:-------------:|
|
412 |
+
| 0.5602 | 0.05 | 100 | 0.5589 | -0.3359 | -0.8168 | 0.7188 | 0.4809 | -306.2607 | -293.7161 | -2.6554 | -2.6797 |
|
413 |
+
| 0.4852 | 0.1 | 200 | 0.5136 | -0.5310 | -1.4994 | 0.8125 | 0.9684 | -319.9124 | -297.6181 | -2.5762 | -2.5957 |
|
414 |
+
| 0.5212 | 0.15 | 300 | 0.5168 | -0.1686 | -1.1760 | 0.7812 | 1.0074 | -313.4444 | -290.3699 | -2.6865 | -2.7125 |
|
415 |
+
| 0.5496 | 0.21 | 400 | 0.4835 | -0.1617 | -1.7170 | 0.8281 | 1.5552 | -324.2635 | -290.2326 | -2.7947 | -2.8218 |
|
416 |
+
| 0.5209 | 0.26 | 500 | 0.5054 | -0.4778 | -1.6604 | 0.7344 | 1.1826 | -323.1325 | -296.5546 | -2.8388 | -2.8667 |
|
417 |
+
| 0.4617 | 0.31 | 600 | 0.4910 | -0.3738 | -1.5180 | 0.7656 | 1.1442 | -320.2848 | -294.4741 | -2.8234 | -2.8521 |
|
418 |
+
| 0.4452 | 0.36 | 700 | 0.4838 | -0.4591 | -1.6576 | 0.7031 | 1.1986 | -323.0770 | -296.1796 | -2.7401 | -2.7653 |
|
419 |
+
| 0.4674 | 0.41 | 800 | 0.5077 | -0.5692 | -1.8659 | 0.7656 | 1.2967 | -327.2416 | -298.3818 | -2.6740 | -2.6945 |
|
420 |
+
| 0.4656 | 0.46 | 900 | 0.4927 | -0.5279 | -1.6614 | 0.7656 | 1.1335 | -323.1518 | -297.5553 | -2.7817 | -2.8015 |
|
421 |
+
| 0.4102 | 0.52 | 1000 | 0.4772 | -0.5767 | -2.0667 | 0.7656 | 1.4900 | -331.2578 | -298.5311 | -2.7160 | -2.7455 |
|
422 |
+
| 0.4663 | 0.57 | 1100 | 0.4740 | -0.8038 | -2.1018 | 0.7656 | 1.2980 | -331.9604 | -303.0741 | -2.6994 | -2.7257 |
|
423 |
+
| 0.4737 | 0.62 | 1200 | 0.4716 | -0.3783 | -1.7015 | 0.7969 | 1.3232 | -323.9545 | -294.5634 | -2.6842 | -2.7135 |
|
424 |
+
| 0.4259 | 0.67 | 1300 | 0.4866 | -0.6239 | -1.9703 | 0.7812 | 1.3464 | -329.3312 | -299.4761 | -2.7046 | -2.7356 |
|
425 |
+
| 0.4935 | 0.72 | 1400 | 0.4747 | -0.5626 | -1.7600 | 0.7812 | 1.1974 | -325.1243 | -298.2491 | -2.7153 | -2.7444 |
|
426 |
+
| 0.4211 | 0.77 | 1500 | 0.4645 | -0.6099 | -1.9993 | 0.7656 | 1.3894 | -329.9109 | -299.1959 | -2.6944 | -2.7236 |
|
427 |
+
| 0.4931 | 0.83 | 1600 | 0.4684 | -0.6798 | -2.1082 | 0.7656 | 1.4285 | -332.0890 | -300.5934 | -2.7006 | -2.7305 |
|
428 |
+
| 0.5029 | 0.88 | 1700 | 0.4595 | -0.5063 | -1.8951 | 0.7812 | 1.3889 | -327.8267 | -297.1233 | -2.7108 | -2.7403 |
|
429 |
+
| 0.4965 | 0.93 | 1800 | 0.4613 | -0.5561 | -1.9079 | 0.7812 | 1.3518 | -328.0831 | -298.1203 | -2.7226 | -2.7523 |
|
430 |
+
| 0.4337 | 0.98 | 1900 | 0.4608 | -0.5066 | -1.8718 | 0.7656 | 1.3652 | -327.3599 | -297.1296 | -2.7175 | -2.7469 |
|
431 |
+
|
432 |
+
|
433 |
+
### Framework versions
|
434 |
+
|
435 |
+
- Transformers 4.34.0
|
436 |
+
- Pytorch 2.0.1+cu118
|
437 |
+
- Datasets 2.12.0
|
438 |
+
- Tokenizers 0.14.0
|