Skip to content

Commit f098fda

Browse files
committed
Add map_location='cpu' to ModelEma resume, should improve #72
1 parent b949699 commit f098fda

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

timm/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def __init__(self, model, decay=0.9999, device='', resume=''):
259259
p.requires_grad_(False)
260260

261261
def _load_checkpoint(self, checkpoint_path):
262-
checkpoint = torch.load(checkpoint_path)
262+
checkpoint = torch.load(checkpoint_path, map_location='cpu')
263263
assert isinstance(checkpoint, dict)
264264
if 'state_dict_ema' in checkpoint:
265265
new_state_dict = OrderedDict()

0 commit comments

Comments
 (0)