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