"vscode:/vscode.git/clone" did not exist on "e8cc372f911d6439ce009e16a6ab1388aea652aa"
Unverified Commit ef206913 authored by Yuge Zhang's avatar Yuge Zhang Committed by GitHub
Browse files

Fix SPOS state dict (#2375)

parent f40242a7
......@@ -147,8 +147,10 @@ class ShuffleNetV2OneShot(nn.Module):
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment