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