Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Fix SPOS state dict (#2375)
Browse files Browse the repository at this point in the history
  • Loading branch information
ultmaster authored May 8, 2020
1 parent f40242a commit ef20691
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/nas/spos/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ def _initialize_weights(self):

def load_and_parse_state_dict(filepath="./data/checkpoint-150000.pth.tar"):
checkpoint = torch.load(filepath, map_location=torch.device("cpu"))
if "state_dict" in checkpoint:
checkpoint = checkpoint["state_dict"]
result = dict()
for k, v in checkpoint["state_dict"].items():
for k, v in checkpoint.items():
if k.startswith("module."):
k = k[len("module."):]
result[k] = v
Expand Down

0 comments on commit ef20691

Please sign in to comment.