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
Uni-Core
Commits
f2b0b488
Unverified
Commit
f2b0b488
authored
Feb 23, 2023
by
Jinhua Zhu
Committed by
GitHub
Feb 23, 2023
Browse files
filter params in ema (#19)
parent
4e4dc4b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
unicore/ema.py
unicore/ema.py
+5
-4
No files found.
unicore/ema.py
View file @
f2b0b488
...
...
@@ -15,10 +15,11 @@ class ExponentialMovingAverageModel:
dtype_grouped_names
=
dict
()
ordered_dtype
=
[]
for
n
,
p
in
model
.
named_parameters
():
if
p
.
dtype
not
in
dtype_grouped_names
:
dtype_grouped_names
[
p
.
dtype
]
=
[]
ordered_dtype
.
append
(
p
.
dtype
)
dtype_grouped_names
[
p
.
dtype
].
append
(
n
)
if
p
.
requires_grad
:
if
p
.
dtype
not
in
dtype_grouped_names
:
dtype_grouped_names
[
p
.
dtype
]
=
[]
ordered_dtype
.
append
(
p
.
dtype
)
dtype_grouped_names
[
p
.
dtype
].
append
(
n
)
ordered_names
=
list
(
chain
(
*
(
dtype_grouped_names
[
n
]
for
n
in
ordered_dtype
)))
...
...
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