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
ec396a79
Unverified
Commit
ec396a79
authored
Aug 28, 2023
by
robotcator
Committed by
GitHub
Aug 28, 2023
Browse files
fix ema (#33)
* fix ema * add assert --------- Co-authored-by:
jixh
<
jixh@dp.tech
>
parent
44f6386f
Pipeline
#1068
failed with stages
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
unicore/trainer.py
unicore/trainer.py
+2
-4
No files found.
unicore/trainer.py
View file @
ec396a79
...
@@ -113,13 +113,11 @@ class Trainer(object):
...
@@ -113,13 +113,11 @@ class Trainer(object):
if
args
.
ema_decay
>
0
and
(
if
args
.
ema_decay
>
0
and
(
self
.
data_parallel_rank
==
0
or
args
.
validate_with_ema
self
.
data_parallel_rank
==
0
or
args
.
validate_with_ema
):
):
assert
isinstance
(
self
.
optimizer
,
optim
.
FP16Optimizer
assert
(
self
.
args
.
fp16
or
self
.
args
.
bf16
),
"ema must with fp16 or bf16"
),
"ema must with fp16 optimizer"
self
.
ema
=
ExponentialMovingAverageModel
(
self
.
ema
=
ExponentialMovingAverageModel
(
model
,
model
,
args
.
ema_decay
,
args
.
ema_decay
,
self
.
_optimizer
.
fp32_params
,
)
)
else
:
else
:
...
...
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