Update README.md
Browse files
README.md
CHANGED
@@ -6,25 +6,34 @@ license: mit
|
|
6 |
|
7 |
This model is a mixture of experts merge consisting of 3 mistral based models
|
8 |
|
9 |
-
base model
|
10 |
|
11 |
-
code expert
|
12 |
|
13 |
-
math expert
|
14 |
|
15 |
### Usage
|
16 |
|
17 |
```python
|
18 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
19 |
|
20 |
-
|
21 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
22 |
|
23 |
-
model = AutoModelForCausalLM.from_pretrained(
|
|
|
24 |
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
27 |
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
```
|
|
|
6 |
|
7 |
This model is a mixture of experts merge consisting of 3 mistral based models
|
8 |
|
9 |
+
base model, **openchat/openchat-3.5-0106**
|
10 |
|
11 |
+
code expert, **beowolx/CodeNinja-1.0-OpenChat-7B**
|
12 |
|
13 |
+
math expert, **meta-math/MetaMath-Mistral-7B**
|
14 |
|
15 |
### Usage
|
16 |
|
17 |
```python
|
18 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
19 |
|
20 |
+
device = "cuda" # the device to load the model onto
|
|
|
21 |
|
22 |
+
model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
|
23 |
+
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
|
24 |
|
25 |
+
messages = [
|
26 |
+
{"role": "user", "content": "What is your favourite condiment?"},
|
27 |
+
{"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!"},
|
28 |
+
{"role": "user", "content": "Do you have mayonnaise recipes?"}
|
29 |
+
]
|
30 |
|
31 |
+
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
|
32 |
+
|
33 |
+
model_inputs = encodeds.to(device)
|
34 |
+
model.to(device)
|
35 |
+
|
36 |
+
generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
|
37 |
+
decoded = tokenizer.batch_decode(generated_ids)
|
38 |
+
print(decoded[0])
|
39 |
```
|