Spaces:
Runtime error
Runtime error
Commit
·
dff880e
1
Parent(s):
65aa5a5
fxied tokenizer bug
Browse files
app.py
CHANGED
|
@@ -45,7 +45,11 @@ class RoleAgent:
|
|
| 45 |
f"Input: {input_text}\n"
|
| 46 |
f"Output:"
|
| 47 |
)
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
outputs = model.generate(
|
| 50 |
**inputs,
|
| 51 |
max_new_tokens=256,
|
|
|
|
| 45 |
f"Input: {input_text}\n"
|
| 46 |
f"Output:"
|
| 47 |
)
|
| 48 |
+
# 1) Tokenize
|
| 49 |
+
encoding = tokenizer(prompt, return_tensors="pt")
|
| 50 |
+
# 2) Move each tensor to the model's device
|
| 51 |
+
inputs = {k: v.to(model.device) for k, v in encoding.items()}
|
| 52 |
+
|
| 53 |
outputs = model.generate(
|
| 54 |
**inputs,
|
| 55 |
max_new_tokens=256,
|