Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
```python
|
2 |
+
import torch
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
model_id = "meta-llama/Llama-3.2-3B-Instruct"
|
6 |
+
pipe = pipeline(
|
7 |
+
"text-generation",
|
8 |
+
model=model_id,
|
9 |
+
torch_dtype=torch.bfloat16,
|
10 |
+
device_map="auto",
|
11 |
+
)
|
12 |
+
messages = [
|
13 |
+
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
|
14 |
+
{"role": "user", "content": "Who are you?"},
|
15 |
+
]
|
16 |
+
outputs = pipe(
|
17 |
+
messages,
|
18 |
+
max_new_tokens=256,
|
19 |
+
)
|
20 |
+
print(outputs[0]["generated_text"][-1])
|
21 |
+
```
|