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
Megatron-LM
Commits
aaa5715a
Commit
aaa5715a
authored
Aug 16, 2022
by
Mohammad Shoeybi
Committed by
Jared Casper
Aug 16, 2022
Browse files
fixed grad scalar warning for bf16
parent
91384a5a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
megatron/optimizer/distrib_optimizer.py
megatron/optimizer/distrib_optimizer.py
+3
-2
megatron/optimizer/optimizer.py
megatron/optimizer/optimizer.py
+4
-3
No files found.
megatron/optimizer/distrib_optimizer.py
View file @
aaa5715a
...
...
@@ -449,8 +449,9 @@ class DistributedOptimizer(MixedPrecisionOptimizer):
# Grad scaler.
if
'grad_scaler'
not
in
state_dict
:
print_rank_0
(
'***WARNING*** found an old checkpoint, will not '
'load grad scaler ...'
)
if
self
.
fp16
:
print_rank_0
(
'***WARNING*** found an old checkpoint, will not '
'load grad scaler ...'
)
else
:
if
self
.
grad_scaler
:
self
.
grad_scaler
.
load_state_dict
(
state_dict
[
'grad_scaler'
])
...
...
megatron/optimizer/optimizer.py
View file @
aaa5715a
...
...
@@ -679,9 +679,10 @@ class Float16OptimizerWithFloat16Params(MixedPrecisionOptimizer):
self
.
optimizer
.
load_state_dict
(
state_dict
[
optimizer_key
])
# Grad scaler.
if
self
.
fp16
and
'grad_scaler'
not
in
state_dict
:
print_rank_0
(
'***WARNING*** found an old checkpoint, will not '
'load grad scaler ...'
)
if
'grad_scaler'
not
in
state_dict
:
if
self
.
fp16
:
print_rank_0
(
'***WARNING*** found an old checkpoint, will not '
'load grad scaler ...'
)
else
:
if
self
.
grad_scaler
:
self
.
grad_scaler
.
load_state_dict
(
state_dict
[
'grad_scaler'
])
...
...
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