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
|
|
|
1 |
+
---
|
2 |
+
base_model: tenyx/TenyxChat-7B-v1
|
3 |
+
inference: false
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
library_name: transformers
|
7 |
+
license: apache-2.0
|
8 |
+
model_creator: Tenyx
|
9 |
+
model_name: TenyxChat 7B v1
|
10 |
+
model_type: mistral
|
11 |
+
prompt_template: 'System: {system_message}
|
12 |
+
|
13 |
+
User: {prompt}
|
14 |
+
|
15 |
+
Assistant:
|
16 |
+
|
17 |
+
'
|
18 |
+
quantized_by: TheBloke
|
19 |
+
tags:
|
20 |
+
- tenyx-fine-tuning
|
21 |
+
- dpo
|
22 |
+
- tenyxchat
|
23 |
+
---
|
24 |
+
<!-- markdownlint-disable MD041 -->
|
25 |
+
|
26 |
+
<!-- header start -->
|
27 |
+
<!-- 200823 -->
|
28 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
29 |
+
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
30 |
+
</div>
|
31 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
32 |
+
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
33 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
|
34 |
+
</div>
|
35 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
36 |
+
<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>
|
37 |
+
</div>
|
38 |
+
</div>
|
39 |
+
<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>
|
40 |
+
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
41 |
+
<!-- header end -->
|
42 |
+
|
43 |
+
# TenyxChat 7B v1 - AWQ
|
44 |
+
- Model creator: [Tenyx](https://huggingface.co/tenyx)
|
45 |
+
- Original model: [TenyxChat 7B v1](https://huggingface.co/tenyx/TenyxChat-7B-v1)
|
46 |
+
|
47 |
+
<!-- description start -->
|
48 |
+
## Description
|
49 |
+
|
50 |
+
This repo contains AWQ model files for [Tenyx's TenyxChat 7B v1](https://huggingface.co/tenyx/TenyxChat-7B-v1).
|
51 |
+
|
52 |
+
These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
|
53 |
+
|
54 |
+
|
55 |
+
### About AWQ
|
56 |
+
|
57 |
+
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.
|
58 |
+
|
59 |
+
AWQ models are currently supported on Linux and Windows, with NVidia GPUs only. macOS users: please use GGUF models instead.
|
60 |
+
|
61 |
+
It is supported by:
|
62 |
+
|
63 |
+
- [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
|
64 |
+
- [vLLM](https://github.com/vllm-project/vllm) - version 0.2.2 or later for support for all model types.
|
65 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
|
66 |
+
- [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
|
67 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
|
68 |
+
|
69 |
+
<!-- description end -->
|
70 |
+
<!-- repositories-available start -->
|
71 |
+
## Repositories available
|
72 |
+
|
73 |
+
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/TenyxChat-7B-v1-AWQ)
|
74 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/TenyxChat-7B-v1-GPTQ)
|
75 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/TenyxChat-7B-v1-GGUF)
|
76 |
+
* [Tenyx's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/tenyx/TenyxChat-7B-v1)
|
77 |
+
<!-- repositories-available end -->
|
78 |
+
|
79 |
+
<!-- prompt-template start -->
|
80 |
+
## Prompt template: System-User-Assistant-nohash
|
81 |
+
|
82 |
+
```
|
83 |
+
System: {system_message}
|
84 |
+
User: {prompt}
|
85 |
+
Assistant:
|
86 |
+
|
87 |
+
```
|
88 |
+
|
89 |
+
<!-- prompt-template end -->
|
90 |
+
|
91 |
+
|
92 |
+
<!-- README_AWQ.md-provided-files start -->
|
93 |
+
## Provided files, and AWQ parameters
|
94 |
+
|
95 |
+
I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
|
96 |
+
|
97 |
+
Models are released as sharded safetensors files.
|
98 |
+
|
99 |
+
| Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
|
100 |
+
| ------ | ---- | -- | ----------- | ------- | ---- |
|
101 |
+
| [main](https://huggingface.co/TheBloke/TenyxChat-7B-v1-AWQ/tree/main) | 4 | 128 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 4.15 GB
|
102 |
+
|
103 |
+
<!-- README_AWQ.md-provided-files end -->
|
104 |
+
|
105 |
+
<!-- README_AWQ.md-text-generation-webui start -->
|
106 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
107 |
+
|
108 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
109 |
+
|
110 |
+
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.
|
111 |
+
|
112 |
+
1. Click the **Model tab**.
|
113 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/TenyxChat-7B-v1-AWQ`.
|
114 |
+
3. Click **Download**.
|
115 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
116 |
+
5. In the top left, click the refresh icon next to **Model**.
|
117 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `TenyxChat-7B-v1-AWQ`
|
118 |
+
7. Select **Loader: AutoAWQ**.
|
119 |
+
8. Click Load, and the model will load and is now ready for use.
|
120 |
+
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.
|
121 |
+
10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
|
122 |
+
<!-- README_AWQ.md-text-generation-webui end -->
|
123 |
+
|
124 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
125 |
+
## Multi-user inference server: vLLM
|
126 |
+
|
127 |
+
Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
|
128 |
+
|
129 |
+
- Please ensure you are using vLLM version 0.2 or later.
|
130 |
+
- When using vLLM as a server, pass the `--quantization awq` parameter.
|
131 |
+
|
132 |
+
For example:
|
133 |
+
|
134 |
+
```shell
|
135 |
+
python3 -m vllm.entrypoints.api_server --model TheBloke/TenyxChat-7B-v1-AWQ --quantization awq --dtype auto
|
136 |
+
```
|
137 |
+
|
138 |
+
- When using vLLM from Python code, again set `quantization=awq`.
|
139 |
+
|
140 |
+
For example:
|
141 |
+
|
142 |
+
```python
|
143 |
+
from vllm import LLM, SamplingParams
|
144 |
+
|
145 |
+
prompts = [
|
146 |
+
"Tell me about AI",
|
147 |
+
"Write a story about llamas",
|
148 |
+
"What is 291 - 150?",
|
149 |
+
"How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
|
150 |
+
]
|
151 |
+
prompt_template=f'''System: {system_message}
|
152 |
+
User: {prompt}
|
153 |
+
Assistant:
|
154 |
+
'''
|
155 |
+
|
156 |
+
prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
|
157 |
+
|
158 |
+
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
|
159 |
+
|
160 |
+
llm = LLM(model="TheBloke/TenyxChat-7B-v1-AWQ", quantization="awq", dtype="auto")
|
161 |
+
|
162 |
+
outputs = llm.generate(prompts, sampling_params)
|
163 |
+
|
164 |
+
# Print the outputs.
|
165 |
+
for output in outputs:
|
166 |
+
prompt = output.prompt
|
167 |
+
generated_text = output.outputs[0].text
|
168 |
+
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
|
169 |
+
```
|
170 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
171 |
+
|
172 |
+
<!-- README_AWQ.md-use-from-tgi start -->
|
173 |
+
## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
|
174 |
+
|
175 |
+
Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
|
176 |
+
|
177 |
+
Example Docker parameters:
|
178 |
+
|
179 |
+
```shell
|
180 |
+
--model-id TheBloke/TenyxChat-7B-v1-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
|
181 |
+
```
|
182 |
+
|
183 |
+
Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
|
184 |
+
|
185 |
+
```shell
|
186 |
+
pip3 install huggingface-hub
|
187 |
+
```
|
188 |
+
|
189 |
+
```python
|
190 |
+
from huggingface_hub import InferenceClient
|
191 |
+
|
192 |
+
endpoint_url = "https://your-endpoint-url-here"
|
193 |
+
|
194 |
+
prompt = "Tell me about AI"
|
195 |
+
prompt_template=f'''System: {system_message}
|
196 |
+
User: {prompt}
|
197 |
+
Assistant:
|
198 |
+
'''
|
199 |
+
|
200 |
+
client = InferenceClient(endpoint_url)
|
201 |
+
response = client.text_generation(prompt,
|
202 |
+
max_new_tokens=128,
|
203 |
+
do_sample=True,
|
204 |
+
temperature=0.7,
|
205 |
+
top_p=0.95,
|
206 |
+
top_k=40,
|
207 |
+
repetition_penalty=1.1)
|
208 |
+
|
209 |
+
print(f"Model output: ", response)
|
210 |
+
```
|
211 |
+
<!-- README_AWQ.md-use-from-tgi end -->
|
212 |
+
|
213 |
+
<!-- README_AWQ.md-use-from-python start -->
|
214 |
+
## Inference from Python code using Transformers
|
215 |
+
|
216 |
+
### Install the necessary packages
|
217 |
+
|
218 |
+
- Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
|
219 |
+
- Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
|
220 |
+
|
221 |
+
```shell
|
222 |
+
pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
|
223 |
+
```
|
224 |
+
|
225 |
+
Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
|
226 |
+
|
227 |
+
If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
|
228 |
+
|
229 |
+
```shell
|
230 |
+
pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
|
231 |
+
```
|
232 |
+
|
233 |
+
If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
|
234 |
+
|
235 |
+
```shell
|
236 |
+
pip3 uninstall -y autoawq
|
237 |
+
git clone https://github.com/casper-hansen/AutoAWQ
|
238 |
+
cd AutoAWQ
|
239 |
+
pip3 install .
|
240 |
+
```
|
241 |
+
|
242 |
+
### Transformers example code (requires Transformers 4.35.0 and later)
|
243 |
+
|
244 |
+
```python
|
245 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
246 |
+
|
247 |
+
model_name_or_path = "TheBloke/TenyxChat-7B-v1-AWQ"
|
248 |
+
|
249 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
250 |
+
model = AutoModelForCausalLM.from_pretrained(
|
251 |
+
model_name_or_path,
|
252 |
+
low_cpu_mem_usage=True,
|
253 |
+
device_map="cuda:0"
|
254 |
+
)
|
255 |
+
|
256 |
+
# Using the text streamer to stream output one token at a time
|
257 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
258 |
+
|
259 |
+
prompt = "Tell me about AI"
|
260 |
+
prompt_template=f'''System: {system_message}
|
261 |
+
User: {prompt}
|
262 |
+
Assistant:
|
263 |
+
'''
|
264 |
+
|
265 |
+
# Convert prompt to tokens
|
266 |
+
tokens = tokenizer(
|
267 |
+
prompt_template,
|
268 |
+
return_tensors='pt'
|
269 |
+
).input_ids.cuda()
|
270 |
+
|
271 |
+
generation_params = {
|
272 |
+
"do_sample": True,
|
273 |
+
"temperature": 0.7,
|
274 |
+
"top_p": 0.95,
|
275 |
+
"top_k": 40,
|
276 |
+
"max_new_tokens": 512,
|
277 |
+
"repetition_penalty": 1.1
|
278 |
+
}
|
279 |
+
|
280 |
+
# Generate streamed output, visible one token at a time
|
281 |
+
generation_output = model.generate(
|
282 |
+
tokens,
|
283 |
+
streamer=streamer,
|
284 |
+
**generation_params
|
285 |
+
)
|
286 |
+
|
287 |
+
# Generation without a streamer, which will include the prompt in the output
|
288 |
+
generation_output = model.generate(
|
289 |
+
tokens,
|
290 |
+
**generation_params
|
291 |
+
)
|
292 |
+
|
293 |
+
# Get the tokens from the output, decode them, print them
|
294 |
+
token_output = generation_output[0]
|
295 |
+
text_output = tokenizer.decode(token_output)
|
296 |
+
print("model.generate output: ", text_output)
|
297 |
+
|
298 |
+
# Inference is also possible via Transformers' pipeline
|
299 |
+
from transformers import pipeline
|
300 |
+
|
301 |
+
pipe = pipeline(
|
302 |
+
"text-generation",
|
303 |
+
model=model,
|
304 |
+
tokenizer=tokenizer,
|
305 |
+
**generation_params
|
306 |
+
)
|
307 |
+
|
308 |
+
pipe_output = pipe(prompt_template)[0]['generated_text']
|
309 |
+
print("pipeline output: ", pipe_output)
|
310 |
+
|
311 |
+
```
|
312 |
+
<!-- README_AWQ.md-use-from-python end -->
|
313 |
+
|
314 |
+
<!-- README_AWQ.md-compatibility start -->
|
315 |
+
## Compatibility
|
316 |
+
|
317 |
+
The files provided are tested to work with:
|
318 |
+
|
319 |
+
- [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
|
320 |
+
- [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
|
321 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
|
322 |
+
- [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
|
323 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
|
324 |
+
|
325 |
+
<!-- README_AWQ.md-compatibility end -->
|
326 |
+
|
327 |
+
<!-- footer start -->
|
328 |
+
<!-- 200823 -->
|
329 |
+
## Discord
|
330 |
+
|
331 |
+
For further support, and discussions on these models and AI in general, join us at:
|
332 |
+
|
333 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
334 |
+
|
335 |
+
## Thanks, and how to contribute
|
336 |
+
|
337 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
338 |
+
|
339 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
340 |
+
|
341 |
+
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.
|
342 |
+
|
343 |
+
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.
|
344 |
+
|
345 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
346 |
+
|
347 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
348 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
349 |
+
|
350 |
+
**Special thanks to**: Aemon Algiz.
|
351 |
+
|
352 |
+
**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
|
353 |
+
|
354 |
+
|
355 |
+
Thank you to all my generous patrons and donaters!
|
356 |
+
|
357 |
+
And thank you again to a16z for their generous grant.
|
358 |
+
|
359 |
+
<!-- footer end -->
|
360 |
+
|
361 |
+
# Original model card: Tenyx's TenyxChat 7B v1
|
362 |
+
|
363 |
+
# TenyxChat: Language Model Alignment using Tenyx Fine-tuning
|
364 |
+
|
365 |
+
Introducing TenyxChat, a series of ChatGPT-like models trained to function as useful assistants through preference tuning, using Tenyx's recently released advanced fine-tuning technology ([VentureBeat article](https://venturebeat.com/ai/tenyx-aims-to-fix-llms-catastrophic-forgetting-problem/)). Our first chat model in the series, TenyxChat-7B-v1, is trained using the [Direct Preference Optimization (DPO)](https://arxiv.org/abs/2305.18290) framework on the open-source AI feedback dataset [UltraFeedback](https://huggingface.co/datasets/HuggingFaceH4/ultrafeedback_binarized).
|
366 |
+
|
367 |
+
We fine-tune [Openchat-3.5](https://arxiv.org/pdf/2309.11235.pdf) with our proprietary approach ([blog](https://www.tenyx.com/post/forgetting-and-toxicity-in-llms-a-deep-dive-on-fine-tuning-methods), [service](https://www.tenyx.com/fine-tuning)), which shows an increase in [MT-Bench](https://arxiv.org/abs/2306.05685), without a drop in performance of the model on other benchmarks. Our approach aims to mitigate forgetting in LLMs in a computationally efficient manner, thereby enabling continual fine-tuning capabilities without altering the pre-trained output distribution. TenyxChat-7B-v1 was trained using eight A100s (80GB) for two hours, with a training setup obtained from HuggingFaceH4 ([GitHub](https://github.com/huggingface/alignment-handbook)).
|
368 |
+
|
369 |
+
# Model details
|
370 |
+
|
371 |
+
- Model type: Fine-tuned 7B model for chat.
|
372 |
+
- License: Apache 2.0
|
373 |
+
- Base model: OpenChat 3.5 ([https://huggingface.co/openchat/openchat_3.5](https://huggingface.co/openchat/openchat_3.5))
|
374 |
+
- Demo: [spaces/tenyx/TenyxChat-7B-v1](https://huggingface.co/spaces/tenyx/TenyxChat-7B-v1)
|
375 |
+
|
376 |
+
## Usage
|
377 |
+
|
378 |
+
Our model uses a simple chat template based on OpenChat 3.5. The chat template usage with a Hugging face generation example is shown below.
|
379 |
+
|
380 |
+
### Chat Template (Jinja)
|
381 |
+
|
382 |
+
```rust
|
383 |
+
{{ bos_token }}
|
384 |
+
{% for message in messages %}
|
385 |
+
{% if message['role'] == 'user' %}
|
386 |
+
{{ 'User:' + message['content'] + eos_token }}
|
387 |
+
|
388 |
+
{% elif message['role'] == 'system' %}
|
389 |
+
{{ 'System:' + message['content'] + eos_token }}
|
390 |
+
|
391 |
+
{% elif message['role'] == 'assistant' %}
|
392 |
+
{{ 'Assistant:' + message['content'] + eos_token }}
|
393 |
+
|
394 |
+
{% endif %}
|
395 |
+
|
396 |
+
{% if loop.last and add_generation_prompt %}\n{{ 'Assistant:' }}{% endif %}\n{% endfor %}
|
397 |
+
```
|
398 |
+
|
399 |
+
### Hugging face Example
|
400 |
+
|
401 |
+
```python
|
402 |
+
import torch
|
403 |
+
from transformers import pipeline
|
404 |
+
|
405 |
+
pipe = pipeline("text-generation", model="tenyx/TenyxChat-7B-v1", torch_dtype=torch.bfloat16, device_map="auto")
|
406 |
+
|
407 |
+
messages = [
|
408 |
+
{"role": "system", "content": "You are a friendly chatbot who always responds in the style of a pirate."},
|
409 |
+
{"role": "user", "content": "Hi. I would like to make a hotel booking."},
|
410 |
+
]
|
411 |
+
|
412 |
+
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
413 |
+
outputs = pipe(prompt, max_new_tokens=512, do_sample=False)
|
414 |
+
```
|
415 |
+
|
416 |
+
### Output
|
417 |
+
|
418 |
+
```
|
419 |
+
<s> System:You are a friendly chatbot who always responds in the style of a pirate.<|end_of_turn|>
|
420 |
+
User:Hi. I would like to make a hotel booking.<|end_of_turn|>
|
421 |
+
Assistant: Ahoy there me hearty! Arr, ye be lookin' fer a place to rest yer weary bones, eh?
|
422 |
+
Well then, let's set sail on this grand adventure and find ye a swell place to stay!
|
423 |
+
|
424 |
+
To begin, tell me the location ye be seekin' and the dates ye be lookin' to set sail.
|
425 |
+
And don't ye worry, me matey, I'll be sure to find ye a place that'll make ye feel like a king or queen on land!
|
426 |
+
```
|
427 |
+
|
428 |
+
# Performance
|
429 |
+
|
430 |
+
At the time of release (Jan 2024), TenyxChat-7B-v1 is the highest-ranked chat model on the MT-Bench evaluation available for download and commercial use. We list here the benchmark results on several standard setups while comparing popular 7B models as baselines.
|
431 |
+
|
432 |
+
## MT-Bench
|
433 |
+
|
434 |
+
MT-Bench is a benchmark made up of 80 high-quality multi-turn questions. These questions fall into eight categories: Writing, Roleplay, Reasoning, Math, Coding, Extraction, STEM, and Humanities. The chat models are rated using GPT-4 on a scale of 1 to 10, with higher values corresponding to better responses.
|
435 |
+
|
436 |
+
| Model | First Turn | Second Turn | Average |
|
437 |
+
| --- | --- | --- | --- |
|
438 |
+
| GPT-4* | 8.95625 | 9.02500 | 8.990625 |
|
439 |
+
| TenyxChat-7B-v1 | 8.45000 | 7.75625 | 8.103125 |
|
440 |
+
| Starling-lm-7B-alpha | 8.42500 | 7.68750 | 8.056250 |
|
441 |
+
| OpenChat-3.5 | 8.18125 | 7.41250 | 7.796875 |
|
442 |
+
| GPT-3.5-turbo* | 8.07500 | 7.81250 | 7.943750 |
|
443 |
+
| OpenLLM Leader-7B** | 8.05000 | 7.61250 | 7.831250 |
|
444 |
+
|
445 |
+
*values reported on [lmsys](https://github.com/lm-sys/FastChat/tree/main/fastchat/llm_judge) ChatBot Arena
|
446 |
+
|
447 |
+
**The [OpenLLM Leader](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) as of Jan 5, 2024 is the merge model available as [samir-fama/SamirGPT-v1](https://huggingface.co/samir-fama/SamirGPT-v1)
|
448 |
+
|
449 |
+
![hexplot.png](assets/hexplot.png)
|
450 |
+
|
451 |
+
### Comparison with additional Open LLM LeaderBoard models
|
452 |
+
| Model | First Turn | Second Turn | Average |
|
453 |
+
| --- | --- | --- | --- |
|
454 |
+
| TenyxChat-7B-v1 | 8.45000 | 7.756250 | 8.103125 |
|
455 |
+
| SamirGPT-v1 | 8.05000 | 7.612500 | 7.831250 |
|
456 |
+
| FernandoGPT-v1 | 8.08125 | 7.256250 | 7.668750 |
|
457 |
+
| Go-Bruins-v2 | 8.13750 | 7.150000 | 7.643750 |
|
458 |
+
| mistral_tv-neural-marconroni | 7.76875 | 6.987500 | 7.378125 |
|
459 |
+
| neuronovo-7B-v0.2 | 7.73750 | 6.662500 | 7.200000 |
|
460 |
+
| neural-chat-7b-v3-3 | 7.39375 | 5.881250 | 6.637500 |
|
461 |
+
|
462 |
+
## LM Evaluation - Open LLM Leaderboard
|
463 |
+
|
464 |
+
We assess models on 7 benchmarks using the [Eleuther AI Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness). This setup is based of that used for [Open LLM Leaderboard.](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
|
465 |
+
|
466 |
+
- [AI2 Reasoning Challenge](https://arxiv.org/abs/1803.05457) (25-shot) - grade-school science questions.
|
467 |
+
- [HellaSwag](https://arxiv.org/abs/1905.07830) (10-shot) - commonsense inference test.
|
468 |
+
- [MMLU](https://arxiv.org/abs/2009.03300) (5-shot) - multitask accuracy test covering 57 tasks.
|
469 |
+
- [TruthfulQA](https://arxiv.org/abs/2109.07958) (0-shot) - test measuring model's propensity to reproduce online falsehoods.
|
470 |
+
- [Winogrande](https://arxiv.org/abs/1907.10641) (5-shot) - Winograd benchmark for commonsense reasoning.
|
471 |
+
- [GSM8k](https://arxiv.org/abs/2110.14168) (5-shot) - grade school math word problems test.
|
472 |
+
|
473 |
+
These benchmarks test reasoning and knowledge in various tasks in few-shot settings (higher scores are better).
|
474 |
+
|
475 |
+
| Model | MMLU | Winogrande | GSM8k | ARC | HellaSwag | TruthfulQA | Average |
|
476 |
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
477 |
+
| TenyxChat-7B-v1 | 63.6 | 72.3 | 69.0 | 62.7 | 66.6 | 46.7 | 63.48 |
|
478 |
+
| Starling-7B-alpha | 63.5 | 72.1 | 67.9 | 61.1 | 66.1 | 42.1 | 62.13 |
|
479 |
+
| OpenChat-3.5 | 63.6 | 72.1 | 68.2 | 61.3 | 65.2 | 41.8 | 62.03 |
|
480 |
+
| Mistral-7B | 62.4 | 74.0 | 38.1 | 57.2 | 62.8 | 37.8 | 55.38 |
|
481 |
+
| OpenLLM Leader-7B | 64.3 | 78.7 | 73.3 | 66.6 | 68.4 | 58.5 | 68.3 |
|
482 |
+
|
483 |
+
**Note:** While the Open LLM Leaderboard indicates that these chat models perform less effectively compared to the leading 7B model, it's important to note that the leading model struggles in the multi-turn chat setting of MT-Bench (as demonstrated in our evaluation [above](#comparison-with-additional-open-llm-leaderboard-models)). In contrast, TenyxChat-7B-v1 demonstrates robustness against common fine-tuning challenges, such as *catastrophic forgetting*. This unique feature enables TenyxChat-7B-v1 to excel not only in chat benchmarks like MT-Bench, but also in a wider range of general reasoning benchmarks on the Open LLM Leaderboard.
|
484 |
+
|
485 |
+
# Limitations
|
486 |
+
|
487 |
+
TenyxChat-7B-v1, like other small-sized language models, has its own set of limitations. We haven’t fine-tuned the model explicitly to align with **human** safety preferences. Therefore, it is capable of producing undesirable outputs, particularly when adversarially prompted. From our observation, the model still tends to struggle with tasks that involve reasoning and math questions. In some instances, it might generate verbose or extraneous content.
|
488 |
+
|
489 |
+
# License
|
490 |
+
|
491 |
+
TenyxChat-7B-v1, similar to OpenChat 3.5, is distributed under the Apache License 2.0.
|
492 |
+
|
493 |
+
# Citation
|
494 |
+
|
495 |
+
If you use TenyxChat-7B for your research, cite us as
|
496 |
+
|
497 |
+
```
|
498 |
+
@misc{tenyxchat2024,
|
499 |
+
title={TenyxChat**:** Language Model Alignment using Tenyx Fine-tuning},
|
500 |
+
author={Tenyx},
|
501 |
+
year={2024},
|
502 |
+
}
|
503 |
+
```
|