Skip to content

Commit

Permalink
Fixed a bug while loading old pix2pix models
Browse files Browse the repository at this point in the history
  • Loading branch information
taesungp committed Jul 25, 2018
1 parent 9451e70 commit 5726675
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def load_networks(self, which_epoch):
# if you are using PyTorch newer than 0.4 (e.g., built from
# GitHub source), you can remove str() on self.device
state_dict = torch.load(load_path, map_location=str(self.device))
del state_dict._metadata
if hasattr(state_dict, '_metadata'):
del state_dict._metadata

# patch InstanceNorm checkpoints prior to 0.4
for key in list(state_dict.keys()): # need to copy keys here because we mutate in loop
Expand Down

0 comments on commit 5726675

Please sign in to comment.