mirror of
https://github.com/huggingface/pytorch-image-models.git
synced 2025-06-03 15:01:08 +08:00
Add map_location='cpu' to ModelEma resume, should improve #72
This commit is contained in:
parent
b9496995d8
commit
f098fda2ca
@ -259,7 +259,7 @@ class ModelEma:
|
|||||||
p.requires_grad_(False)
|
p.requires_grad_(False)
|
||||||
|
|
||||||
def _load_checkpoint(self, checkpoint_path):
|
def _load_checkpoint(self, checkpoint_path):
|
||||||
checkpoint = torch.load(checkpoint_path)
|
checkpoint = torch.load(checkpoint_path, map_location='cpu')
|
||||||
assert isinstance(checkpoint, dict)
|
assert isinstance(checkpoint, dict)
|
||||||
if 'state_dict_ema' in checkpoint:
|
if 'state_dict_ema' in checkpoint:
|
||||||
new_state_dict = OrderedDict()
|
new_state_dict = OrderedDict()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user