LeroyDyer commited on
Commit
e214ecf
·
verified ·
1 Parent(s): 167c05d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -0
README.md CHANGED
@@ -40,3 +40,28 @@ merge_method: linear
40
  dtype: float16
41
 
42
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  dtype: float16
41
 
42
  ```
43
+
44
+ ``` python
45
+
46
+
47
+ import transformers
48
+ import torch
49
+
50
+ from transformers import AutoTokenizer, MixtralForCausalLM
51
+ device = "cuda" # the device to load the model onto
52
+
53
+ model = "{{ username }}/{{ model_name }}"
54
+ imodel = MixtralForCausalLM.from_pretrained(model)
55
+ tokenizer = AutoTokenizer.from_pretrained(model)
56
+
57
+
58
+ inputs = tokenizer(prompt, return_tensors="pt")
59
+
60
+ # Generate
61
+ generate_ids = imodel.generate(inputs.input_ids, max_length=30)
62
+ tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
63
+
64
+
65
+
66
+ ```
67
+