Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
ef206913
Unverified
Commit
ef206913
authored
May 08, 2020
by
Yuge Zhang
Committed by
GitHub
May 08, 2020
Browse files
Fix SPOS state dict (#2375)
parent
f40242a7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
examples/nas/spos/network.py
examples/nas/spos/network.py
+3
-1
No files found.
examples/nas/spos/network.py
View file @
ef206913
...
@@ -147,8 +147,10 @@ class ShuffleNetV2OneShot(nn.Module):
...
@@ -147,8 +147,10 @@ class ShuffleNetV2OneShot(nn.Module):
def
load_and_parse_state_dict
(
filepath
=
"./data/checkpoint-150000.pth.tar"
):
def
load_and_parse_state_dict
(
filepath
=
"./data/checkpoint-150000.pth.tar"
):
checkpoint
=
torch
.
load
(
filepath
,
map_location
=
torch
.
device
(
"cpu"
))
checkpoint
=
torch
.
load
(
filepath
,
map_location
=
torch
.
device
(
"cpu"
))
if
"state_dict"
in
checkpoint
:
checkpoint
=
checkpoint
[
"state_dict"
]
result
=
dict
()
result
=
dict
()
for
k
,
v
in
checkpoint
[
"state_dict"
]
.
items
():
for
k
,
v
in
checkpoint
.
items
():
if
k
.
startswith
(
"module."
):
if
k
.
startswith
(
"module."
):
k
=
k
[
len
(
"module."
):]
k
=
k
[
len
(
"module."
):]
result
[
k
]
=
v
result
[
k
]
=
v
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment