Skip to content

Commit

Permalink
[Fix]: fix load_checkpoint (open-mmlab#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
teamwong111 authored Jun 23, 2022
1 parent 2994195 commit 12f7d3a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions mmengine/runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1806,13 +1806,8 @@ def resume(self,
Defaults to 'default'.
"""
if map_location == 'default':
if torch.cuda.is_available():
device = get_device()
checkpoint = self.load_checkpoint(
filename,
map_location=lambda storage, loc: storage.to(device))
else:
checkpoint = self.load_checkpoint(filename)
device = get_device()
checkpoint = self.load_checkpoint(filename, map_location=device)
else:
checkpoint = self.load_checkpoint(
filename, map_location=map_location)
Expand Down

0 comments on commit 12f7d3a

Please sign in to comment.