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
4c06a4fd
Commit
4c06a4fd
authored
Sep 05, 2022
by
Guolin Ke
Browse files
refine rngstate in trainer
parent
70dcdf17
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
unicore/trainer.py
unicore/trainer.py
+15
-9
No files found.
unicore/trainer.py
View file @
4c06a4fd
...
...
@@ -717,7 +717,7 @@ class Trainer(object):
with
torch
.
autograd
.
profiler
.
record_function
(
"optimizer"
):
# fixed the seed in case for the stochastic rounding in different ranks
with
utils
.
torch_seed
(
self
.
args
.
seed
,
self
.
get_num_updates
()
,
-
1
):
with
utils
.
torch_seed
(
self
.
args
.
seed
,
self
.
get_num_updates
()):
# take an optimization step
self
.
task
.
optimizer_step
(
self
.
optimizer
,
...
...
@@ -733,8 +733,14 @@ class Trainer(object):
# out where it fails
self
.
zero_grad
()
with
NanDetector
(
self
.
get_model
()):
for
_
,
sample
in
enumerate
(
samples
):
for
i
,
sample
in
enumerate
(
samples
):
sample
,
_
=
self
.
_prepare_sample
(
sample
)
with
utils
.
torch_seed
(
self
.
args
.
seed
,
self
.
get_num_updates
(),
i
,
self
.
data_parallel_rank
,
):
self
.
task
.
train_step
(
sample
,
self
.
model
,
...
...
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