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
8676baca
Commit
8676baca
authored
Mar 04, 2021
by
Rewon Child
Browse files
Update comments
parent
14c85e64
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
2 deletions
+0
-2
megatron/optimizer/clip_grads.py
megatron/optimizer/clip_grads.py
+0
-2
No files found.
megatron/optimizer/clip_grads.py
View file @
8676baca
...
@@ -138,10 +138,8 @@ def count_zeros_fp32(parameters):
...
@@ -138,10 +138,8 @@ def count_zeros_fp32(parameters):
grad
=
param
.
grad
.
detach
()
grad
=
param
.
grad
.
detach
()
grads_to_count
.
append
(
grad
)
grads_to_count
.
append
(
grad
)
# Norm parameters.
total_num_zeros
=
0.0
total_num_zeros
=
0.0
# Calculate norm.
for
grad
in
grads_to_count
:
for
grad
in
grads_to_count
:
num_zeros
=
grad
.
numel
()
-
torch
.
count_nonzero
(
grad
)
num_zeros
=
grad
.
numel
()
-
torch
.
count_nonzero
(
grad
)
total_num_zeros
=
num_zeros
+
total_num_zeros
total_num_zeros
=
num_zeros
+
total_num_zeros
...
...
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