chujiezheng
commited on
Commit
β’
5313bd2
1
Parent(s):
b30d55e
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
model-index:
|
3 |
+
- name: tulu-2-dpo-7b
|
4 |
+
results: []
|
5 |
+
datasets:
|
6 |
+
- HuggingFaceH4/ultrafeedback_binarized
|
7 |
+
- allenai/tulu-v2-sft-mixture
|
8 |
+
language:
|
9 |
+
- en
|
10 |
+
base_model: meta-llama/Llama-2-7b-hf
|
11 |
+
---
|
12 |
+
|
13 |
+
|
14 |
+
<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'"/>
|
15 |
+
|
16 |
+
|
17 |
+
# Model Card for Tulu V2 DPO 7B
|
18 |
+
|
19 |
+
Tulu is a series of language models that are trained to act as helpful assistants.
|
20 |
+
Tulu V2 DPO 7B is a fine-tuned version of Llama 2 that was trained on on a mix of publicly available, synthetic and human datasets using [Direct Preference Optimization (DPO)](https://arxiv.org/abs/2305.18290).
|
21 |
+
This model is a strong alternative to Llama 2 7b Chat.
|
22 |
+
|
23 |
+
For more details, read the paper: [Camels in a Changing Climate: Enhancing LM Adaptation with Tulu 2
|
24 |
+
](https://arxiv.org/abs/2311.10702).
|
25 |
+
|
26 |
+
## Model description
|
27 |
+
|
28 |
+
- **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.
|
29 |
+
- **Language(s) (NLP):** Primarily English
|
30 |
+
- **License:** [AI2 ImpACT](https://allenai.org/impact-license) Low-risk license.
|
31 |
+
- **Finetuned from model:** [meta-llama/Llama-2-7b-hf](https://huggingface.co/meta-llama/Llama-2-7b-hf)
|
32 |
+
|
33 |
+
### Model Sources
|
34 |
+
|
35 |
+
- **Repository:** [https://github.com/allenai/open-instruct](https://github.com/allenai/open-instruct)
|
36 |
+
- **DPO Recipe:** The DPO recipe is from the [Zephyr Beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) model
|
37 |
+
- **Model Family:** Other models and the dataset are found in the [Tulu V2 collection](https://huggingface.co/collections/allenai/tulu-v2-suite-6551b56e743e6349aab45101).
|
38 |
+
|
39 |
+
## Performance
|
40 |
+
|
41 |
+
| Model | Size | Alignment | MT-Bench (score) | AlpacaEval (win rate %) |
|
42 |
+
|-------------|-----|----|---------------|--------------|
|
43 |
+
| **Tulu-v2-7b** πͺ | **7B** | **SFT** | **6.30** | **73.9** |
|
44 |
+
| **Tulu-v2-dpo-7b** πͺ | **7B** | **DPO** | **6.29** | **85.1** |
|
45 |
+
| **Tulu-v2-13b** πͺ | **13B** | **SFT** | **6.70** | **78.9** |
|
46 |
+
| **Tulu-v2-dpo-13b** πͺ | **13B** | **DPO** | **7.00** | **89.5** |
|
47 |
+
| **Tulu-v2-70b** πͺ | **70B** | **SFT** | **7.49** | **86.6** |
|
48 |
+
| **Tulu-v2-dpo-70b** πͺ | **70B** | **DPO** | **7.89** | **95.1** |
|
49 |
+
|
50 |
+
## Input Format
|
51 |
+
|
52 |
+
The model is trained to use the following format (note the newlines):
|
53 |
+
```
|
54 |
+
<|user|>
|
55 |
+
Your message here!
|
56 |
+
<|assistant|>
|
57 |
+
```
|
58 |
+
|
59 |
+
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.**
|
60 |
+
|
61 |
+
## Intended uses & limitations
|
62 |
+
|
63 |
+
The model was initially 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.
|
64 |
+
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.
|
65 |
+
|
66 |
+
|
67 |
+
<!-- You can find the datasets used for training Tulu V2 [here]()
|
68 |
+
|
69 |
+
Here's how you can run the model using the `pipeline()` function from π€ Transformers:
|
70 |
+
|
71 |
+
```python
|
72 |
+
# Install transformers from source - only needed for versions <= v4.34
|
73 |
+
# pip install git+https://github.com/huggingface/transformers.git
|
74 |
+
# pip install accelerate
|
75 |
+
|
76 |
+
import torch
|
77 |
+
from transformers import pipeline
|
78 |
+
|
79 |
+
pipe = pipeline("text-generation", model="HuggingFaceH4/tulu-2-dpo-70b", torch_dtype=torch.bfloat16, device_map="auto")
|
80 |
+
|
81 |
+
# We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
|
82 |
+
messages = [
|
83 |
+
{
|
84 |
+
"role": "system",
|
85 |
+
"content": "You are a friendly chatbot who always responds in the style of a pirate",
|
86 |
+
},
|
87 |
+
{"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
|
88 |
+
]
|
89 |
+
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
90 |
+
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
91 |
+
print(outputs[0]["generated_text"])
|
92 |
+
# <|system|>
|
93 |
+
# You are a friendly chatbot who always responds in the style of a pirate.</s>
|
94 |
+
# <|user|>
|
95 |
+
# How many helicopters can a human eat in one sitting?</s>
|
96 |
+
# <|assistant|>
|
97 |
+
# 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!
|
98 |
+
```-->
|
99 |
+
|
100 |
+
## Bias, Risks, and Limitations
|
101 |
+
|
102 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
103 |
+
|
104 |
+
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).
|
105 |
+
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.
|
106 |
+
|
107 |
+
|
108 |
+
### Training hyperparameters
|
109 |
+
|
110 |
+
The following hyperparameters were used during DPO training:
|
111 |
+
- learning_rate: 5e-07
|
112 |
+
- total_train_batch_size: 32
|
113 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
114 |
+
- lr_scheduler_type: linear
|
115 |
+
- lr_scheduler_warmup_ratio: 0.1
|
116 |
+
- num_epochs: 3.0
|
117 |
+
|
118 |
+
|
119 |
+
## Citation
|
120 |
+
|
121 |
+
If you find Tulu 2 is useful in your work, please cite it with:
|
122 |
+
|
123 |
+
```
|
124 |
+
@misc{ivison2023camels,
|
125 |
+
title={Camels in a Changing Climate: Enhancing LM Adaptation with Tulu 2},
|
126 |
+
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},
|
127 |
+
year={2023},
|
128 |
+
eprint={2311.10702},
|
129 |
+
archivePrefix={arXiv},
|
130 |
+
primaryClass={cs.CL}
|
131 |
+
}
|
132 |
+
```
|
133 |
+
|
134 |
+
*Model card adapted from [Zephyr Beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta/blob/main/README.md)*
|