Add details
Browse files- README.md +98 -25
- thumbnail.png +0 -0
README.md
CHANGED
@@ -1,51 +1,124 @@
|
|
1 |
---
|
2 |
-
license:
|
3 |
-
base_model:
|
4 |
tags:
|
5 |
- alignment-handbook
|
6 |
- trl
|
7 |
- dpo
|
8 |
- generated_from_trainer
|
9 |
-
- trl
|
10 |
-
- dpo
|
11 |
-
- generated_from_trainer
|
12 |
datasets:
|
13 |
- argilla/dpo-mix-7k
|
|
|
14 |
model-index:
|
15 |
-
- name: zephyr-7b-gemma
|
16 |
-
results:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
---
|
18 |
|
19 |
-
|
20 |
-
should probably proofread and complete it, then remove this comment. -->
|
21 |
|
22 |
-
#
|
23 |
|
24 |
-
|
25 |
-
It achieves the following results on the evaluation set:
|
26 |
-
- Loss: 0.4695
|
27 |
-
- Rewards/chosen: -3.3746
|
28 |
-
- Rewards/rejected: -4.9715
|
29 |
-
- Rewards/accuracies: 0.7188
|
30 |
-
- Rewards/margins: 1.5970
|
31 |
-
- Logps/rejected: -459.4853
|
32 |
-
- Logps/chosen: -429.9115
|
33 |
-
- Logits/rejected: 86.4684
|
34 |
-
- Logits/chosen: 92.8200
|
35 |
|
36 |
## Model description
|
37 |
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
## Intended uses & limitations
|
41 |
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
## Training and evaluation data
|
45 |
|
46 |
-
More information needed
|
47 |
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
### Training hyperparameters
|
51 |
|
|
|
1 |
---
|
2 |
+
license: mit
|
3 |
+
base_model: HuggingFaceH4/zephyr-7b-gemma-sft
|
4 |
tags:
|
5 |
- alignment-handbook
|
6 |
- trl
|
7 |
- dpo
|
8 |
- generated_from_trainer
|
|
|
|
|
|
|
9 |
datasets:
|
10 |
- argilla/dpo-mix-7k
|
11 |
+
pipeline_tag: text-generation
|
12 |
model-index:
|
13 |
+
- name: zephyr-7b-gemma
|
14 |
+
results:
|
15 |
+
# MT-Bench (taken from model card)
|
16 |
+
- task:
|
17 |
+
type: text-generation
|
18 |
+
name: Text Generation
|
19 |
+
dataset:
|
20 |
+
name: MT-Bench
|
21 |
+
type: unknown
|
22 |
+
metrics:
|
23 |
+
- type: unknown
|
24 |
+
name: score
|
25 |
+
value: 7.81
|
26 |
+
source:
|
27 |
+
url: https://huggingface.co/spaces/lmsys/mt-bench
|
28 |
---
|
29 |
|
30 |
+
<img src="https://huggingface.co/HuggingFaceH4/zephyr-7b-gemma/resolve/main/thumbnail.png" alt="Zephyr 7B Gemma Logo" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
|
|
|
31 |
|
32 |
+
# Model Card for Zephyr 7B Gemma
|
33 |
|
34 |
+
Zephyr is a series of language models that are trained to act as helpful assistants. Zephyr 7B Gemma is the third model in the series, and is a fine-tuned version of [`google/gemma-7b`](https://huggingface.co/google/gemma-7b) that was trained on on a mix of publicly available, synthetic datasets using Direct Preference Optimization (DPO). You can reproduce the training of this model via the recipe provided in the [Alignment Handbook](https://github.com/huggingface/alignment-handbook).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
## Model description
|
37 |
|
38 |
+
- **Model type:** A 7B parameter GPT-like model fine-tuned on a mix of publicly available, synthetic datasets.
|
39 |
+
- **Language(s) (NLP):** Primarily English
|
40 |
+
- **License:** MIT
|
41 |
+
- **Finetuned from model:** [google/gemma-7b](https://huggingface.co/google/gemma-7b)
|
42 |
+
|
43 |
+
### Model Sources
|
44 |
+
|
45 |
+
<!-- Provide the basic links for the model. -->
|
46 |
+
|
47 |
+
- **Repository:** https://github.com/huggingface/alignment-handbook
|
48 |
+
- **Demo:** https://huggingface.co/spaces/HuggingFaceH4/zephyr-chat
|
49 |
+
|
50 |
+
## Performance
|
51 |
+
|
52 |
+
At the time of release, Zephyr 7B Gemma is the highest ranked 7B chat model on the [MT-Bench](https://huggingface.co/spaces/lmsys/mt-bench) and [AlpacaEval](https://tatsu-lab.github.io/alpaca_eval/) benchmarks:
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
In particular, on several categories of MT-Bench, Zephyr-7B-β has strong performance compared to larger open models like Llama2-Chat-70B:
|
57 |
+
|
58 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6200d0a443eb0913fa2df7cc/raxvt5ma16d7T23my34WC.png)
|
59 |
+
|
60 |
+
However, on more complex tasks like coding and mathematics, Zephyr-7B-β lags behind proprietary models and more research is needed to close the gap.
|
61 |
|
62 |
## Intended uses & limitations
|
63 |
|
64 |
+
The model was initially fine-tuned on a filtered and preprocessed of the [`UltraChat`](https://huggingface.co/datasets/stingning/ultrachat) dataset, which contains a diverse range of synthetic dialogues generated by ChatGPT.
|
65 |
+
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 contains 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.
|
66 |
+
|
67 |
+
You can find the datasets used for training Zephyr-7B-β [here](https://huggingface.co/collections/HuggingFaceH4/zephyr-7b-6538c6d6d5ddd1cbb1744a66)
|
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.38.1
|
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/zephyr-7b-gemma", torch_dtype=torch.bfloat16, device_map="auto")
|
80 |
+
|
81 |
+
# We use ChatML 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 |
+
Zephyr 7B Gemma has not been aligned to human preferences for safety 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). It is also unknown what the size and composition of the corpus was used to train the base model (`google/gemma-7b`), however it is likely to have included a mix of Web data and technical sources like books and code. See the [StarCoder2 model card](https://huggingface.co/bigcode/starcoder2-15b) for an example of this.
|
105 |
+
|
106 |
|
107 |
## Training and evaluation data
|
108 |
|
|
|
109 |
|
110 |
+
This model is a fine-tuned version of [HuggingFaceH4/zephyr-7b-gemma-sft](https://huggingface.co/HuggingFaceH4/zephyr-7b-gemma-sft) on the argilla/dpo-mix-7k dataset.
|
111 |
+
|
112 |
+
It achieves the following results on the evaluation set:
|
113 |
+
- Loss: 0.4695
|
114 |
+
- Rewards/chosen: -3.3746
|
115 |
+
- Rewards/rejected: -4.9715
|
116 |
+
- Rewards/accuracies: 0.7188
|
117 |
+
- Rewards/margins: 1.5970
|
118 |
+
- Logps/rejected: -459.4853
|
119 |
+
- Logps/chosen: -429.9115
|
120 |
+
- Logits/rejected: 86.4684
|
121 |
+
- Logits/chosen: 92.8200
|
122 |
|
123 |
### Training hyperparameters
|
124 |
|
thumbnail.png
ADDED