Spaces:
Runtime error
Runtime error
Commit
·
c5c67e6
1
Parent(s):
e20d7c3
bug fixes
Browse files
app.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
from model import *
|
3 |
|
4 |
-
|
5 |
|
6 |
-
model = GPTLanguageModel().to(
|
7 |
model.load_state_dict(torch.load("mini-gpt.pth",map_location=DEVICE), strict=False)
|
8 |
|
9 |
answer = decode(model.generate(context, max_new_tokens=1000)[0].tolist())
|
|
|
1 |
import gradio as gr
|
2 |
from model import *
|
3 |
|
4 |
+
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
5 |
|
6 |
+
model = GPTLanguageModel().to(DEVICE)
|
7 |
model.load_state_dict(torch.load("mini-gpt.pth",map_location=DEVICE), strict=False)
|
8 |
|
9 |
answer = decode(model.generate(context, max_new_tokens=1000)[0].tolist())
|