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|
5 |
+
inference: false
|
6 |
+
language:
|
7 |
+
- en
|
8 |
+
license: other
|
9 |
+
model-index:
|
10 |
+
- name: tulu-2-7b
|
11 |
+
results: []
|
12 |
+
model_creator: Allen Institute for AI
|
13 |
+
model_name: Tulu 2 7B
|
14 |
+
model_type: llama
|
15 |
+
prompt_template: '<|user|>
|
16 |
+
|
17 |
+
{prompt}
|
18 |
+
|
19 |
+
<|assistant|>
|
20 |
+
|
21 |
+
'
|
22 |
+
quantized_by: TheBloke
|
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 |
+
# Tulu 2 7B - AWQ
|
44 |
+
- Model creator: [Allen Institute for AI](https://huggingface.co/allenai)
|
45 |
+
- Original model: [Tulu 2 7B](https://huggingface.co/allenai/tulu-2-7b)
|
46 |
+
|
47 |
+
<!-- description start -->
|
48 |
+
## Description
|
49 |
+
|
50 |
+
This repo contains AWQ model files for [Allen Institute for AI's Tulu 2 7B](https://huggingface.co/allenai/tulu-2-7b).
|
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 |
+
It is supported by:
|
60 |
+
|
61 |
+
- [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
|
62 |
+
- [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
|
63 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
|
64 |
+
- [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
|
65 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
|
66 |
+
|
67 |
+
<!-- description end -->
|
68 |
+
<!-- repositories-available start -->
|
69 |
+
## Repositories available
|
70 |
+
|
71 |
+
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/tulu-2-7B-AWQ)
|
72 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/tulu-2-7B-GPTQ)
|
73 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/tulu-2-7B-GGUF)
|
74 |
+
* [Allen Institute for AI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/allenai/tulu-2-7b)
|
75 |
+
<!-- repositories-available end -->
|
76 |
+
|
77 |
+
<!-- prompt-template start -->
|
78 |
+
## Prompt template: Tulu
|
79 |
+
|
80 |
+
```
|
81 |
+
<|user|>
|
82 |
+
{prompt}
|
83 |
+
<|assistant|>
|
84 |
+
|
85 |
+
```
|
86 |
+
|
87 |
+
<!-- prompt-template end -->
|
88 |
+
|
89 |
+
|
90 |
+
<!-- README_AWQ.md-provided-files start -->
|
91 |
+
## Provided files, and AWQ parameters
|
92 |
+
|
93 |
+
I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
|
94 |
+
|
95 |
+
Models are released as sharded safetensors files.
|
96 |
+
|
97 |
+
| Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
|
98 |
+
| ------ | ---- | -- | ----------- | ------- | ---- |
|
99 |
+
| [main](https://huggingface.co/TheBloke/tulu-2-7B-AWQ/tree/main) | 4 | 128 | [VMWare Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 3.89 GB
|
100 |
+
|
101 |
+
<!-- README_AWQ.md-provided-files end -->
|
102 |
+
|
103 |
+
<!-- README_AWQ.md-text-generation-webui start -->
|
104 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
105 |
+
|
106 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
107 |
+
|
108 |
+
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.
|
109 |
+
|
110 |
+
1. Click the **Model tab**.
|
111 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/tulu-2-7B-AWQ`.
|
112 |
+
3. Click **Download**.
|
113 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
114 |
+
5. In the top left, click the refresh icon next to **Model**.
|
115 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `tulu-2-7B-AWQ`
|
116 |
+
7. Select **Loader: AutoAWQ**.
|
117 |
+
8. Click Load, and the model will load and is now ready for use.
|
118 |
+
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.
|
119 |
+
10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
|
120 |
+
<!-- README_AWQ.md-text-generation-webui end -->
|
121 |
+
|
122 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
123 |
+
## Multi-user inference server: vLLM
|
124 |
+
|
125 |
+
Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
|
126 |
+
|
127 |
+
- Please ensure you are using vLLM version 0.2 or later.
|
128 |
+
- When using vLLM as a server, pass the `--quantization awq` parameter.
|
129 |
+
|
130 |
+
For example:
|
131 |
+
|
132 |
+
```shell
|
133 |
+
python3 -m vllm.entrypoints.api_server --model TheBloke/tulu-2-7B-AWQ --quantization awq --dtype auto
|
134 |
+
```
|
135 |
+
|
136 |
+
- When using vLLM from Python code, again set `quantization=awq`.
|
137 |
+
|
138 |
+
For example:
|
139 |
+
|
140 |
+
```python
|
141 |
+
from vllm import LLM, SamplingParams
|
142 |
+
|
143 |
+
prompts = [
|
144 |
+
"Tell me about AI",
|
145 |
+
"Write a story about llamas",
|
146 |
+
"What is 291 - 150?",
|
147 |
+
"How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
|
148 |
+
]
|
149 |
+
prompt_template=f'''<|user|>
|
150 |
+
{prompt}
|
151 |
+
<|assistant|>
|
152 |
+
'''
|
153 |
+
|
154 |
+
prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
|
155 |
+
|
156 |
+
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
|
157 |
+
|
158 |
+
llm = LLM(model="TheBloke/tulu-2-7B-AWQ", quantization="awq", dtype="auto")
|
159 |
+
|
160 |
+
outputs = llm.generate(prompts, sampling_params)
|
161 |
+
|
162 |
+
# Print the outputs.
|
163 |
+
for output in outputs:
|
164 |
+
prompt = output.prompt
|
165 |
+
generated_text = output.outputs[0].text
|
166 |
+
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
|
167 |
+
```
|
168 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
169 |
+
|
170 |
+
<!-- README_AWQ.md-use-from-tgi start -->
|
171 |
+
## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
|
172 |
+
|
173 |
+
Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
|
174 |
+
|
175 |
+
Example Docker parameters:
|
176 |
+
|
177 |
+
```shell
|
178 |
+
--model-id TheBloke/tulu-2-7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
|
179 |
+
```
|
180 |
+
|
181 |
+
Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
|
182 |
+
|
183 |
+
```shell
|
184 |
+
pip3 install huggingface-hub
|
185 |
+
```
|
186 |
+
|
187 |
+
```python
|
188 |
+
from huggingface_hub import InferenceClient
|
189 |
+
|
190 |
+
endpoint_url = "https://your-endpoint-url-here"
|
191 |
+
|
192 |
+
prompt = "Tell me about AI"
|
193 |
+
prompt_template=f'''<|user|>
|
194 |
+
{prompt}
|
195 |
+
<|assistant|>
|
196 |
+
'''
|
197 |
+
|
198 |
+
client = InferenceClient(endpoint_url)
|
199 |
+
response = client.text_generation(prompt,
|
200 |
+
max_new_tokens=128,
|
201 |
+
do_sample=True,
|
202 |
+
temperature=0.7,
|
203 |
+
top_p=0.95,
|
204 |
+
top_k=40,
|
205 |
+
repetition_penalty=1.1)
|
206 |
+
|
207 |
+
print(f"Model output: ", response)
|
208 |
+
```
|
209 |
+
<!-- README_AWQ.md-use-from-tgi end -->
|
210 |
+
|
211 |
+
<!-- README_AWQ.md-use-from-python start -->
|
212 |
+
## Inference from Python code using Transformers
|
213 |
+
|
214 |
+
### Install the necessary packages
|
215 |
+
|
216 |
+
- Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
|
217 |
+
- Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
|
218 |
+
|
219 |
+
```shell
|
220 |
+
pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
|
221 |
+
```
|
222 |
+
|
223 |
+
Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
|
224 |
+
|
225 |
+
If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
|
226 |
+
|
227 |
+
```shell
|
228 |
+
pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
|
229 |
+
```
|
230 |
+
|
231 |
+
If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
|
232 |
+
|
233 |
+
```shell
|
234 |
+
pip3 uninstall -y autoawq
|
235 |
+
git clone https://github.com/casper-hansen/AutoAWQ
|
236 |
+
cd AutoAWQ
|
237 |
+
pip3 install .
|
238 |
+
```
|
239 |
+
|
240 |
+
### Transformers example code (requires Transformers 4.35.0 and later)
|
241 |
+
|
242 |
+
```python
|
243 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
244 |
+
|
245 |
+
model_name_or_path = "TheBloke/tulu-2-7B-AWQ"
|
246 |
+
|
247 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
248 |
+
model = AutoModelForCausalLM.from_pretrained(
|
249 |
+
model_name_or_path,
|
250 |
+
low_cpu_mem_usage=True,
|
251 |
+
device_map="cuda:0"
|
252 |
+
)
|
253 |
+
|
254 |
+
# Using the text streamer to stream output one token at a time
|
255 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
256 |
+
|
257 |
+
prompt = "Tell me about AI"
|
258 |
+
prompt_template=f'''<|user|>
|
259 |
+
{prompt}
|
260 |
+
<|assistant|>
|
261 |
+
'''
|
262 |
+
|
263 |
+
# Convert prompt to tokens
|
264 |
+
tokens = tokenizer(
|
265 |
+
prompt_template,
|
266 |
+
return_tensors='pt'
|
267 |
+
).input_ids.cuda()
|
268 |
+
|
269 |
+
generation_params = {
|
270 |
+
"do_sample": True,
|
271 |
+
"temperature": 0.7,
|
272 |
+
"top_p": 0.95,
|
273 |
+
"top_k": 40,
|
274 |
+
"max_new_tokens": 512,
|
275 |
+
"repetition_penalty": 1.1
|
276 |
+
}
|
277 |
+
|
278 |
+
# Generate streamed output, visible one token at a time
|
279 |
+
generation_output = model.generate(
|
280 |
+
tokens,
|
281 |
+
streamer=streamer,
|
282 |
+
**generation_params
|
283 |
+
)
|
284 |
+
|
285 |
+
# Generation without a streamer, which will include the prompt in the output
|
286 |
+
generation_output = model.generate(
|
287 |
+
tokens,
|
288 |
+
**generation_params
|
289 |
+
)
|
290 |
+
|
291 |
+
# Get the tokens from the output, decode them, print them
|
292 |
+
token_output = generation_output[0]
|
293 |
+
text_output = tokenizer.decode(token_output)
|
294 |
+
print("model.generate output: ", text_output)
|
295 |
+
|
296 |
+
# Inference is also possible via Transformers' pipeline
|
297 |
+
from transformers import pipeline
|
298 |
+
|
299 |
+
pipe = pipeline(
|
300 |
+
"text-generation",
|
301 |
+
model=model,
|
302 |
+
tokenizer=tokenizer,
|
303 |
+
**generation_params
|
304 |
+
)
|
305 |
+
|
306 |
+
pipe_output = pipe(prompt_template)[0]['generated_text']
|
307 |
+
print("pipeline output: ", pipe_output)
|
308 |
+
|
309 |
+
```
|
310 |
+
<!-- README_AWQ.md-use-from-python end -->
|
311 |
+
|
312 |
+
<!-- README_AWQ.md-compatibility start -->
|
313 |
+
## Compatibility
|
314 |
+
|
315 |
+
The files provided are tested to work with:
|
316 |
+
|
317 |
+
- [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
|
318 |
+
- [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
|
319 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
|
320 |
+
- [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
|
321 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
|
322 |
+
|
323 |
+
<!-- README_AWQ.md-compatibility end -->
|
324 |
+
|
325 |
+
<!-- footer start -->
|
326 |
+
<!-- 200823 -->
|
327 |
+
## Discord
|
328 |
+
|
329 |
+
For further support, and discussions on these models and AI in general, join us at:
|
330 |
+
|
331 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
332 |
+
|
333 |
+
## Thanks, and how to contribute
|
334 |
+
|
335 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
336 |
+
|
337 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
338 |
+
|
339 |
+
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.
|
340 |
+
|
341 |
+
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.
|
342 |
+
|
343 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
344 |
+
|
345 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
346 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
347 |
+
|
348 |
+
**Special thanks to**: Aemon Algiz.
|
349 |
+
|
350 |
+
**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
|
351 |
+
|
352 |
+
|
353 |
+
Thank you to all my generous patrons and donaters!
|
354 |
+
|
355 |
+
And thank you again to a16z for their generous grant.
|
356 |
+
|
357 |
+
<!-- footer end -->
|
358 |
+
|
359 |
+
# Original model card: Allen Institute for AI's Tulu 2 7B
|
360 |
+
|
361 |
+
|
362 |
+
|
363 |
+
<img src="https://huggingface.co/datasets/allenai/blog-images/resolve/main/tulu-v2/Tulu%20V2%20banner.png" alt="TuluV2 banner" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
|
364 |
+
|
365 |
+
|
366 |
+
# Model Card for Tulu 2 7B
|
367 |
+
|
368 |
+
Tulu is a series of language models that are trained to act as helpful assistants.
|
369 |
+
Tulu 2 7B is a fine-tuned version of Llama 2 that was trained on a mix of publicly available, synthetic and human datasets.
|
370 |
+
|
371 |
+
For more details, read the paper: [Camels in a Changing Climate: Enhancing LM Adaptation with Tulu 2
|
372 |
+
](https://arxiv.org/abs/2311.10702).
|
373 |
+
|
374 |
+
## Model description
|
375 |
+
|
376 |
+
- **Model type:** A model belonging to a suite of instruction and RLHF tuned chat models on a mix of publicly available, synthetic and human-created datasets.
|
377 |
+
- **Language(s) (NLP):** Primarily English
|
378 |
+
- **License:** [AI2 ImpACT](https://allenai.org/impact-license) Low-risk license.
|
379 |
+
- **Finetuned from model:** [meta-llama/Llama-2-13b-hf](https://huggingface.co/meta-llama/Llama-2-13b-hf)
|
380 |
+
|
381 |
+
### Model Sources
|
382 |
+
|
383 |
+
- **Repository:** https://github.com/allenai/https://github.com/allenai/open-instruct
|
384 |
+
- **Model Family:** Other models and the dataset are found in the [Tulu V2 collection](https://huggingface.co/collections/allenai/tulu-v2-suite-6551b56e743e6349aab45101).
|
385 |
+
|
386 |
+
## Performance
|
387 |
+
|
388 |
+
| Model | Size | Alignment | MT-Bench (score) | AlpacaEval (win rate %) |
|
389 |
+
|-------------|-----|----|---------------|--------------|
|
390 |
+
| **Tulu-v2-7b** 🐪 | **7B** | **SFT** | **6.30** | **73.9** |
|
391 |
+
| **Tulu-v2-dpo-7b** 🐪 | **7B** | **DPO** | **6.29** | **85.1** |
|
392 |
+
| **Tulu-v2-13b** 🐪 | **13B** | **SFT** | **6.70** | **78.9** |
|
393 |
+
| **Tulu-v2-dpo-13b** 🐪 | **13B** | **DPO** | **7.00** | **89.5** |
|
394 |
+
| **Tulu-v2-70b** 🐪 | **70B** | **SFT** | **7.49** | **86.6** |
|
395 |
+
| **Tulu-v2-dpo-70b** 🐪 | **70B** | **DPO** | **7.89** | **95.1** |
|
396 |
+
|
397 |
+
|
398 |
+
## Input Format
|
399 |
+
|
400 |
+
The model is trained to use the following format (note the newlines):
|
401 |
+
```
|
402 |
+
<|user|>
|
403 |
+
Your message here!
|
404 |
+
<|assistant|>
|
405 |
+
```
|
406 |
+
|
407 |
+
For best results, format all inputs in this manner. **Make sure to include a newline after `<|assistant|>`, this can affect generation quality quite a bit.**
|
408 |
+
|
409 |
+
|
410 |
+
## Intended uses & limitations
|
411 |
+
|
412 |
+
The model was fine-tuned on a filtered and preprocessed of the [Tulu V2 mix dataset](https://huggingface.co/datasets/allenai/tulu-v2-sft-mixture), which contains a diverse range of human created instructions and synthetic dialogues generated primarily by other LLMs.
|
413 |
+
<!--We then further aligned the model with a [Jax DPO trainer](https://github.com/hamishivi/EasyLM/blob/main/EasyLM/models/llama/llama_train_dpo.py) built on [EasyLM](https://github.com/young-geng/EasyLM) on the [openbmb/UltraFeedback](https://huggingface.co/datasets/openbmb/UltraFeedback) dataset, which contains 64k prompts and model completions that are ranked by GPT-4.
|
414 |
+
|
415 |
+
|
416 |
+
<!-- You can find the datasets used for training Tulu V2 [here]()
|
417 |
+
|
418 |
+
Here's how you can run the model using the `pipeline()` function from 🤗 Transformers:
|
419 |
+
|
420 |
+
```python
|
421 |
+
# Install transformers from source - only needed for versions <= v4.34
|
422 |
+
# pip install git+https://github.com/huggingface/transformers.git
|
423 |
+
# pip install accelerate
|
424 |
+
|
425 |
+
import torch
|
426 |
+
from transformers import pipeline
|
427 |
+
|
428 |
+
pipe = pipeline("text-generation", model="HuggingFaceH4/tulu-2-dpo-70b", torch_dtype=torch.bfloat16, device_map="auto")
|
429 |
+
|
430 |
+
# We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
|
431 |
+
messages = [
|
432 |
+
{
|
433 |
+
"role": "system",
|
434 |
+
"content": "You are a friendly chatbot who always responds in the style of a pirate",
|
435 |
+
},
|
436 |
+
{"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
|
437 |
+
]
|
438 |
+
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
439 |
+
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
440 |
+
print(outputs[0]["generated_text"])
|
441 |
+
# <|system|>
|
442 |
+
# You are a friendly chatbot who always responds in the style of a pirate.</s>
|
443 |
+
# <|user|>
|
444 |
+
# How many helicopters can a human eat in one sitting?</s>
|
445 |
+
# <|assistant|>
|
446 |
+
# Ah, me hearty matey! But yer question be a puzzler! A human cannot eat a helicopter in one sitting, as helicopters are not edible. They be made of metal, plastic, and other materials, not food!
|
447 |
+
```-->
|
448 |
+
|
449 |
+
## Bias, Risks, and Limitations
|
450 |
+
|
451 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
452 |
+
|
453 |
+
The Tulu models have not been aligned to generate safe completions within the RLHF phase or deployed with in-the-loop filtering of responses like ChatGPT, so the model can produce problematic outputs (especially when prompted to do so).
|
454 |
+
It is also unknown what the size and composition of the corpus was used to train the base Llama 2 models, 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.
|
455 |
+
|
456 |
+
|
457 |
+
### Training hyperparameters
|
458 |
+
|
459 |
+
The following hyperparameters were used during DPO training:
|
460 |
+
- learning_rate: 2e-5
|
461 |
+
- total_train_batch_size: 128
|
462 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
463 |
+
- lr_scheduler_type: linear
|
464 |
+
- lr_scheduler_warmup_ratio: 0.03
|
465 |
+
- num_epochs: 2.0
|
466 |
+
|
467 |
+
|
468 |
+
## Citation
|
469 |
+
|
470 |
+
If you find Tulu 2 is useful in your work, please cite it with:
|
471 |
+
|
472 |
+
```
|
473 |
+
@misc{ivison2023camels,
|
474 |
+
title={Camels in a Changing Climate: Enhancing LM Adaptation with Tulu 2},
|
475 |
+
author={Hamish Ivison and Yizhong Wang and Valentina Pyatkin and Nathan Lambert and Matthew Peters and Pradeep Dasigi and Joel Jang and David Wadden and Noah A. Smith and Iz Beltagy and Hannaneh Hajishirzi},
|
476 |
+
year={2023},
|
477 |
+
eprint={2311.10702},
|
478 |
+
archivePrefix={arXiv},
|
479 |
+
primaryClass={cs.CL}
|
480 |
+
}
|
481 |
+
```
|
482 |
+
|
483 |
+
*Model card adapted from [Zephyr Beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta/blob/main/README.md)*
|