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
apex
Commits
7a219aa9
"...text-generation-inference.git" did not exist on "09674e6df99918dad5169b5cc81241c884c543d0"
Commit
7a219aa9
authored
Aug 16, 2019
by
Deyu Fu
Browse files
fix novograd init overflow
parent
c8f9cceb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
apex/optimizers/fused_novograd.py
apex/optimizers/fused_novograd.py
+2
-2
No files found.
apex/optimizers/fused_novograd.py
View file @
7a219aa9
...
...
@@ -131,10 +131,10 @@ class FusedNovoGrad(torch.optim.Optimizer):
group
[
'exp_avg_sq'
][
1
]
=
torch
.
cuda
.
FloatTensor
(
len
(
g_32
)).
contiguous
().
fill_
(
0
)
else
:
# init with first step norm, so first blend have no effect
if
group
[
'norm_type'
]
==
0
:
v_16
=
[
torch
.
max
(
torch
.
abs
(
g
)).
item
()
for
g
in
g_16
]
v_16
=
[
torch
.
max
(
torch
.
abs
(
g
.
to
(
torch
.
float32
)
)).
item
()
for
g
in
g_16
]
v_32
=
[
torch
.
max
(
torch
.
abs
(
g
)).
item
()
for
g
in
g_32
]
elif
group
[
'norm_type'
]
==
2
:
v_16
=
[
torch
.
sum
(
torch
.
pow
(
g
,
2
)).
sqrt
().
item
()
for
g
in
g_16
]
v_16
=
[
torch
.
sum
(
torch
.
pow
(
g
.
to
(
torch
.
float32
)
,
2
)).
sqrt
().
item
()
for
g
in
g_16
]
v_32
=
[
torch
.
sum
(
torch
.
pow
(
g
,
2
)).
sqrt
().
item
()
for
g
in
g_32
]
else
:
raise
RuntimeError
(
'FusedNovoGrad only support l2/inf norm now.'
)
...
...
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