AlphaRandy
commited on
Commit
•
c64d9d1
1
Parent(s):
d8f550e
Update README.md
Browse files
README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
---
|
|
|
2 |
language:
|
|
|
|
|
|
|
|
|
3 |
- en
|
4 |
inference:
|
5 |
parameters:
|
@@ -7,8 +12,15 @@ inference:
|
|
7 |
widget:
|
8 |
- messages:
|
9 |
- role: user
|
10 |
-
content:
|
11 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
## Instruction format
|
14 |
|
@@ -42,7 +54,7 @@ In the Transformers library, one can use [chat templates](https://huggingface.co
|
|
42 |
```python
|
43 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
44 |
|
45 |
-
model_id = "
|
46 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
47 |
|
48 |
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
|
@@ -72,11 +84,17 @@ Note `float16` precision only works on GPU devices
|
|
72 |
+ import torch
|
73 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
74 |
|
75 |
-
model_id = "
|
76 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
77 |
|
78 |
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to("cuda")
|
81 |
|
82 |
outputs = model.generate(input_ids, max_new_tokens=20)
|
@@ -93,7 +111,7 @@ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
93 |
+ import torch
|
94 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
95 |
|
96 |
-
model_id = "
|
97 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
98 |
|
99 |
+ model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True, device_map="auto")
|
@@ -121,7 +139,7 @@ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
121 |
+ import torch
|
122 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
123 |
|
124 |
-
model_id = "
|
125 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
126 |
|
127 |
+ model = AutoModelForCausalLM.from_pretrained(model_id, use_flash_attention_2=True, device_map="auto")
|
@@ -137,4 +155,13 @@ input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to("cud
|
|
137 |
outputs = model.generate(input_ids, max_new_tokens=20)
|
138 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
139 |
```
|
140 |
-
</details>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
license: apache-2.0
|
3 |
language:
|
4 |
+
- fr
|
5 |
+
- it
|
6 |
+
- de
|
7 |
+
- es
|
8 |
- en
|
9 |
inference:
|
10 |
parameters:
|
|
|
12 |
widget:
|
13 |
- messages:
|
14 |
- role: user
|
15 |
+
content: What is your favorite condiment?
|
16 |
---
|
17 |
+
# Model Card for Mixtral-8x7B
|
18 |
+
The Mixtral-8x7B Large Language Model (LLM) is a pretrained generative Sparse Mixture of Experts. The Mixtral-8x7B outperforms Llama 2 70B on most benchmarks we tested.
|
19 |
+
|
20 |
+
For full details of this model please read our [release blog post](https://mistral.ai/news/mixtral-of-experts/).
|
21 |
+
|
22 |
+
## Warning
|
23 |
+
This repo contains weights that are compatible with [vLLM](https://github.com/vllm-project/vllm) serving of the model as well as Hugging Face [transformers](https://github.com/huggingface/transformers) library. It is based on the original Mixtral [torrent release](magnet:?xt=urn:btih:5546272da9065eddeb6fcd7ffddeef5b75be79a7&dn=mixtral-8x7b-32kseqlen&tr=udp%3A%2F%http://2Fopentracker.i2p.rocks%3A6969%2Fannounce&tr=http%3A%2F%http://2Ftracker.openbittorrent.com%3A80%2Fannounce), but the file format and parameter names are different. Please note that model cannot (yet) be instantiated with HF.
|
24 |
|
25 |
## Instruction format
|
26 |
|
|
|
54 |
```python
|
55 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
56 |
|
57 |
+
model_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
58 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
59 |
|
60 |
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
|
|
|
84 |
+ import torch
|
85 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
86 |
|
87 |
+
model_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
88 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
89 |
|
90 |
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
|
91 |
|
92 |
+
messages = [
|
93 |
+
{"role": "user", "content": "What is your favourite condiment?"},
|
94 |
+
{"role": "assistant", "content": "Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!"},
|
95 |
+
{"role": "user", "content": "Do you have mayonnaise recipes?"}
|
96 |
+
]
|
97 |
+
|
98 |
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to("cuda")
|
99 |
|
100 |
outputs = model.generate(input_ids, max_new_tokens=20)
|
|
|
111 |
+ import torch
|
112 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
113 |
|
114 |
+
model_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
115 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
116 |
|
117 |
+ model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True, device_map="auto")
|
|
|
139 |
+ import torch
|
140 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
141 |
|
142 |
+
model_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
143 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
144 |
|
145 |
+ model = AutoModelForCausalLM.from_pretrained(model_id, use_flash_attention_2=True, device_map="auto")
|
|
|
155 |
outputs = model.generate(input_ids, max_new_tokens=20)
|
156 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
157 |
```
|
158 |
+
</details>
|
159 |
+
|
160 |
+
## Limitations
|
161 |
+
|
162 |
+
The Mixtral-8x7B Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
|
163 |
+
It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
|
164 |
+
make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
|
165 |
+
|
166 |
+
# The Mistral AI Team
|
167 |
+
Albert Jiang, Alexandre Sablayrolles, Arthur Mensch, Blanche Savary, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Emma Bou Hanna, Florian Bressand, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Lélio Renard Lavaud, Louis Ternon, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Théophile Gervet, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed.
|