Chickaboo commited on
Commit
f92937d
·
verified ·
1 Parent(s): fc66abc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -10
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,- **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
- model_id = "Chickaboo/Chicka-Mistral-4x7b"
21
- tokenizer = AutoTokenizer.from_pretrained(model_id)
22
 
23
- model = AutoModelForCausalLM.from_pretrained(model_id)
 
24
 
25
- text = "Hello my name is"
26
- inputs = tokenizer(text, return_tensors="pt")
 
 
 
27
 
28
- outputs = model.generate(**inputs, max_new_tokens=20)
29
- print(tokenizer.decode(outputs[0], skip_special_tokens=True))
 
 
 
 
 
 
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
  ```