Spaces:
Runtime error
Runtime error
akshaytrikha
commited on
Commit
•
71eba68
1
Parent(s):
8cce078
use cuda if available
Browse files
app.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import GPT2LMHeadModel, pipeline
|
|
|
3 |
|
4 |
-
device = 'cuda' if
|
5 |
|
6 |
# load pretrained + finetuned GPT2
|
7 |
model = GPT2LMHeadModel.from_pretrained("./model/pytorch_model.bin", from_pt=True)
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import GPT2LMHeadModel, pipeline
|
3 |
+
import torch
|
4 |
|
5 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
6 |
|
7 |
# load pretrained + finetuned GPT2
|
8 |
model = GPT2LMHeadModel.from_pretrained("./model/pytorch_model.bin", from_pt=True)
|