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
43529f78
Commit
43529f78
authored
Dec 30, 2020
by
mohammad
Browse files
addressed deepaks comments
parent
242770dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
2 deletions
+5
-2
megatron/optimizer/grad_scaler.py
megatron/optimizer/grad_scaler.py
+1
-1
megatron/optimizer/optimizer.py
megatron/optimizer/optimizer.py
+1
-1
megatron/training.py
megatron/training.py
+3
-0
No files found.
megatron/optimizer/grad_scaler.py
View file @
43529f78
...
...
@@ -103,7 +103,7 @@ class DynamicGradScaler(MegatronGradScaler):
if
found_inf
:
self
.
_growth_tracker
=
0
self
.
_hysteresis_tracker
-=
1
# Now if we are ou
r
of hysteresis count, scale down the loss.
# Now if we are ou
t
of hysteresis count, scale down the loss.
if
self
.
_hysteresis_tracker
<=
0
:
self
.
_scale
=
torch
.
max
(
self
.
_scale
*
self
.
backoff_factor
,
self
.
min_scale
)
...
...
megatron/optimizer/optimizer.py
View file @
43529f78
...
...
@@ -375,7 +375,7 @@ class FP32Optimizer(MegatronOptimizer):
@
torch
.
no_grad
()
def
step
(
self
):
"""Clip gradients (if needed) and step the base optimizer.
Always return
a
uccessful since there is no overflow."""
Always return
s
uccessful since there is no overflow."""
# Clip gradients.
if
self
.
clip_grad
>
0.0
:
...
...
megatron/training.py
View file @
43529f78
...
...
@@ -183,6 +183,9 @@ def get_model(model_provider_func):
model
=
model_provider_func
()
# Set tensor model parallel attributes if not set.
# Only parameters that are already tensor model parallel have these
# attributes set for them. We should make sure the default attributes
# are set for all params so the optimizer can use them.
for
param
in
model
.
parameters
():
mpu
.
set_defaults_if_not_set_tensor_model_parallel_attributes
(
param
)
...
...
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