Skip to content

Commit c099374

Browse files
committed
Map pretrained checkpoint to cpu to avoid issue with some pretrained checkpoints still having CUDA tensors. Fixes #42
1 parent b93fcf0 commit c099374

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

timm/models/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def load_pretrained(model, cfg=None, num_classes=1000, in_chans=3, filter_fn=Non
6464
logging.warning("Pretrained model URL is invalid, using random initialization.")
6565
return
6666

67-
state_dict = model_zoo.load_url(cfg['url'], progress=False)
67+
state_dict = model_zoo.load_url(cfg['url'], progress=False, map_location='cpu')
6868

6969
if in_chans == 1:
7070
conv1_name = cfg['first_conv']

0 commit comments

Comments
 (0)