Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,12 @@ import torch
|
|
11 |
model_folder = "zjunlp/chatcell-small"
|
12 |
tokenizer = AutoTokenizer.from_pretrained(model_folder)
|
13 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_folder)
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
model.eval()
|
15 |
|
16 |
|
|
|
11 |
model_folder = "zjunlp/chatcell-small"
|
12 |
tokenizer = AutoTokenizer.from_pretrained(model_folder)
|
13 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_folder)
|
14 |
+
if torch.cuda.is_available():
|
15 |
+
device = torch.device("cuda")
|
16 |
+
model.to(device)
|
17 |
+
else:
|
18 |
+
device = torch.device("cpu")
|
19 |
+
|
20 |
model.eval()
|
21 |
|
22 |
|