Update README.md
Browse files
README.md
CHANGED
@@ -14,3 +14,21 @@ Paper: https://arxiv.org/abs/2402.15506
|
|
14 |
License: apache-2.0
|
15 |
|
16 |
If you already know [Mixtral](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1), xLAM-v0.1 is a significant upgrade and better at many things. For the same number of parameters, the model have been fine-tuned across a wide range of agent tasks and scenarios, all while preserving the capabilities of the original model.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
License: apache-2.0
|
15 |
|
16 |
If you already know [Mixtral](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1), xLAM-v0.1 is a significant upgrade and better at many things. For the same number of parameters, the model have been fine-tuned across a wide range of agent tasks and scenarios, all while preserving the capabilities of the original model.
|
17 |
+
|
18 |
+
```python
|
19 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
20 |
+
|
21 |
+
tokenizer = AutoTokenizer.from_pretrained("Salesforce/xLAM-v0.1-r")
|
22 |
+
model = AutoModelForCausalLM.from_pretrained("Salesforce/xLAM-v0.1-r", device_map="auto")
|
23 |
+
|
24 |
+
messages = [
|
25 |
+
{"role": "user", "content": "What is your favourite condiment?"},
|
26 |
+
{"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!"},
|
27 |
+
{"role": "user", "content": "Do you have mayonnaise recipes?"}
|
28 |
+
]
|
29 |
+
|
30 |
+
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to("cuda")
|
31 |
+
|
32 |
+
outputs = model.generate(inputs, max_new_tokens=512)
|
33 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
34 |
+
```
|