lewtun HF staff commited on
Commit
9c6d73c
1 Parent(s): a4f14d5

Add snippet

Browse files
Files changed (1) hide show
  1. README.md +27 -19
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, 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
 
@@ -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("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
 
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
  ![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 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