Add snippet
Browse files
README.md
CHANGED
|
@@ -53,18 +53,16 @@ At the time of release, Zephyr 7B Gemma is the highest ranked 7B chat model on t
|
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
-
In particular, on several categories of MT-Bench,
|
| 57 |
|
| 58 |

|
| 59 |
|
| 60 |
-
However, on more complex tasks like coding and mathematics, Zephyr
|
| 61 |
|
| 62 |
## Intended uses & limitations
|
| 63 |
|
| 64 |
-
The model was initially fine-tuned on
|
| 65 |
-
We then further aligned the model with [🤗 TRL's](https://github.com/huggingface/trl) `DPOTrainer` on the [
|
| 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 |
|
|
@@ -76,25 +74,35 @@ Here's how you can run the model using the `pipeline()` function from 🤗 Trans
|
|
| 76 |
import torch
|
| 77 |
from transformers import pipeline
|
| 78 |
|
| 79 |
-
pipe = pipeline(
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
| 82 |
messages = [
|
| 83 |
{
|
| 84 |
"role": "system",
|
| 85 |
-
"content": "
|
| 86 |
},
|
| 87 |
{"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
|
| 88 |
]
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
```
|
| 99 |
|
| 100 |
## Bias, Risks, and Limitations
|
|
|
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
+
In particular, on several categories of MT-Bench, Zephyρ 7B Gemma has strong performance compared to larger open models like Llama2-Chat-70B:
|
| 57 |
|
| 58 |

|
| 59 |
|
| 60 |
+
However, on more complex tasks like coding and mathematics, Zephyr 7B Gemma 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 the [DEITA 10K](https://huggingface.co/datasets/HuggingFaceH4/deita-10k-v0-sft) 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 [argilla/dpo-mix-7k](https://huggingface.co/datasets/argilla/dpo-mix-7k) dataset, which contains 7k 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 |
Here's how you can run the model using the `pipeline()` function from 🤗 Transformers:
|
| 68 |
|
|
|
|
| 74 |
import torch
|
| 75 |
from transformers import pipeline
|
| 76 |
|
| 77 |
+
pipe = pipeline(
|
| 78 |
+
"text-generation",
|
| 79 |
+
model="HuggingFaceH4/zephyr-7b-gemma",
|
| 80 |
+
device_map="auto",
|
| 81 |
+
torch_dtype=torch.bfloat16,
|
| 82 |
+
)
|
| 83 |
messages = [
|
| 84 |
{
|
| 85 |
"role": "system",
|
| 86 |
+
"content": "", # Model not yet trained for follow this
|
| 87 |
},
|
| 88 |
{"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
|
| 89 |
]
|
| 90 |
+
outputs = pipe(
|
| 91 |
+
messages,
|
| 92 |
+
max_new_tokens=128,
|
| 93 |
+
do_sample=True,
|
| 94 |
+
temperature=0.7,
|
| 95 |
+
top_k=50,
|
| 96 |
+
top_p=0.95,
|
| 97 |
+
stop_sequence="<|im_end|>",
|
| 98 |
+
)
|
| 99 |
+
print(outputs[0]["generated_text"][-1]["content"])
|
| 100 |
+
# It is not possible for a human to eat a helicopter in one sitting, as a
|
| 101 |
+
# helicopter is a large and inedible machine. Helicopters are made of metal,
|
| 102 |
+
# plastic, and other materials that are not meant to be consumed by humans.
|
| 103 |
+
# Eating a helicopter would be extremely dangerous and would likely cause
|
| 104 |
+
# serious health problems, including choking, suffocation, and poisoning. It is
|
| 105 |
+
# important to only eat food that is safe and intended for human consumption.
|
| 106 |
```
|
| 107 |
|
| 108 |
## Bias, Risks, and Limitations
|