Spaces:
Runtime error
Runtime error
macadeliccc
commited on
Commit
•
4a07feb
1
Parent(s):
55dffd4
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ from transformers import StoppingCriteria, StoppingCriteriaList, TextIteratorStr
|
|
6 |
from threading import Thread
|
7 |
|
8 |
|
9 |
-
|
10 |
|
11 |
# Loading the tokenizer and model from Hugging Face's model hub.
|
12 |
tokenizer = AutoTokenizer.from_pretrained(
|
@@ -33,6 +33,8 @@ class StopOnTokens(StoppingCriteria):
|
|
33 |
# Function to generate model predictions.
|
34 |
@spaces.GPU
|
35 |
def predict(message, history):
|
|
|
|
|
36 |
history_transformer_format = history + [[message, ""]]
|
37 |
stop = StopOnTokens()
|
38 |
|
|
|
6 |
from threading import Thread
|
7 |
|
8 |
|
9 |
+
|
10 |
|
11 |
# Loading the tokenizer and model from Hugging Face's model hub.
|
12 |
tokenizer = AutoTokenizer.from_pretrained(
|
|
|
33 |
# Function to generate model predictions.
|
34 |
@spaces.GPU
|
35 |
def predict(message, history):
|
36 |
+
torch.set_default_device("cuda")
|
37 |
+
|
38 |
history_transformer_format = history + [[message, ""]]
|
39 |
stop = StopOnTokens()
|
40 |
|