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
6d9c49da
Unverified
Commit
6d9c49da
authored
Aug 18, 2021
by
Ningxin Zheng
Committed by
GitHub
Aug 18, 2021
Browse files
Set the strict to false in mask conflict utils. (#4078)
parent
4adea9ab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
nni/compression/pytorch/utils/mask_conflict.py
nni/compression/pytorch/utils/mask_conflict.py
+6
-2
No files found.
nni/compression/pytorch/utils/mask_conflict.py
View file @
6d9c49da
...
@@ -39,9 +39,13 @@ def fix_mask_conflict(masks, model=None, dummy_input=None, traced=None):
...
@@ -39,9 +39,13 @@ def fix_mask_conflict(masks, model=None, dummy_input=None, traced=None):
if
traced
is
None
:
if
traced
is
None
:
assert
model
is
not
None
and
dummy_input
is
not
None
assert
model
is
not
None
and
dummy_input
is
not
None
training
=
model
.
training
training
=
model
.
training
model
.
eval
()
# We need to trace the model in eval mode
# We need to trace the model in eval mode
traced
=
torch
.
jit
.
trace
(
model
,
dummy_input
)
model
.
eval
()
kw_args
=
{}
if
torch
.
__version__
>=
'1.6.0'
:
# only pytorch with version greater than 1.6.0 has the strict option
kw_args
[
'strict'
]
=
False
traced
=
torch
.
jit
.
trace
(
model
,
dummy_input
,
**
kw_args
)
model
.
train
(
training
)
model
.
train
(
training
)
fix_group_mask
=
GroupMaskConflict
(
masks
,
model
,
dummy_input
,
traced
)
fix_group_mask
=
GroupMaskConflict
(
masks
,
model
,
dummy_input
,
traced
)
...
...
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