Update README.md (#4)
Browse files- Update README.md (d51f81f9bbef876dbfa60ed251d75f50e826462a)
Co-authored-by: Arthur Zucker <[email protected]>
README.md
CHANGED
|
@@ -56,6 +56,21 @@ This
|
|
| 56 |
=====================
|
| 57 |
```
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
## Limitations
|
| 60 |
|
| 61 |
The Mistral 7B Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
|
|
|
|
| 56 |
=====================
|
| 57 |
```
|
| 58 |
|
| 59 |
+
## Generate with `transformers`
|
| 60 |
+
|
| 61 |
+
```python3
|
| 62 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 63 |
+
|
| 64 |
+
model_id = "mistralai/Mistral-7B-v0.3"
|
| 65 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 66 |
+
|
| 67 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 68 |
+
inputs = tokenizer("Hello my name is", return_tensors="pt")
|
| 69 |
+
|
| 70 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
| 71 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
## Limitations
|
| 75 |
|
| 76 |
The Mistral 7B Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
|