Spaces:
Sleeping
Sleeping
Gbssreejith
commited on
Commit
•
3b1f56a
1
Parent(s):
7dfb322
Update app.py
Browse files
app.py
CHANGED
@@ -346,7 +346,7 @@ class GPT2Config(object):
|
|
346 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
347 |
config = GPT2Config()
|
348 |
model = GPT2LMHeadModel(config)
|
349 |
-
state_dict = torch.load(r'
|
350 |
model = load_weight(model, state_dict)
|
351 |
model.to(device)
|
352 |
print(model)
|
|
|
346 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
347 |
config = GPT2Config()
|
348 |
model = GPT2LMHeadModel(config)
|
349 |
+
state_dict = torch.load(r'epoch_4.pth', map_location='cpu' if not torch.cuda.is_available() else None)
|
350 |
model = load_weight(model, state_dict)
|
351 |
model.to(device)
|
352 |
print(model)
|