Spaces:
Sleeping
Sleeping
github-actions[bot]
commited on
Commit
·
1c5289d
1
Parent(s):
4645abc
Deploy from GitHub - 2026-01-19 08:23:35
Browse files
app.py
CHANGED
|
@@ -473,7 +473,8 @@ class TransformerNet(nn.Module):
|
|
| 473 |
|
| 474 |
def load_checkpoint(self, checkpoint_path: str) -> None:
|
| 475 |
"""Load pre-trained weights from checkpoint file."""
|
| 476 |
-
|
|
|
|
| 477 |
|
| 478 |
if 'state_dict' in state_dict:
|
| 479 |
state_dict = state_dict['state_dict']
|
|
|
|
| 473 |
|
| 474 |
def load_checkpoint(self, checkpoint_path: str) -> None:
|
| 475 |
"""Load pre-trained weights from checkpoint file."""
|
| 476 |
+
# Load to CPU first for reliability, then move to device
|
| 477 |
+
state_dict = torch.load(checkpoint_path, map_location='cpu')
|
| 478 |
|
| 479 |
if 'state_dict' in state_dict:
|
| 480 |
state_dict = state_dict['state_dict']
|