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
ef63acd2
Commit
ef63acd2
authored
Jun 08, 2022
by
Lawrence McAfee
Browse files
re-added grad dtype assertion in clip_grads.
parent
9044bc42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
megatron/optimizer/clip_grads.py
megatron/optimizer/clip_grads.py
+5
-1
No files found.
megatron/optimizer/clip_grads.py
View file @
ef63acd2
...
...
@@ -56,7 +56,11 @@ def clip_grad_norm_fp32(parameters, grads_for_norm,
grads_for_norm
=
[
grads_for_norm
]
# Grads.
grads
=
[
p
.
grad
.
detach
()
for
p
in
parameters
if
p
.
grad
is
not
None
]
grads
=
[]
for
param
in
parameters
:
if
param
.
grad
is
not
None
:
assert
param
.
grad
.
type
()
==
'torch.cuda.FloatTensor'
grads
.
append
(
param
.
grad
.
detach
())
# Norm parameters.
max_norm
=
float
(
max_norm
)
...
...
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