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
fairscale
Commits
2df5ca2d
Unverified
Commit
2df5ca2d
authored
Dec 17, 2020
by
Joshua Meier
Committed by
GitHub
Dec 17, 2020
Browse files
[fix] OSS - resolve fp16 overflow in clip grad norm (#263)
parent
2d9243bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
fairscale/optim/oss.py
fairscale/optim/oss.py
+1
-1
No files found.
fairscale/optim/oss.py
View file @
2df5ca2d
...
@@ -259,7 +259,7 @@ class OSS(Optimizer):
...
@@ -259,7 +259,7 @@ class OSS(Optimizer):
dist
.
all_reduce
(
total_norm
,
op
=
torch
.
distributed
.
ReduceOp
.
MAX
,
group
=
self
.
group
)
dist
.
all_reduce
(
total_norm
,
op
=
torch
.
distributed
.
ReduceOp
.
MAX
,
group
=
self
.
group
)
else
:
else
:
local_norm
=
torch
.
norm
(
local_norm
=
torch
.
norm
(
input
=
torch
.
stack
([
torch
.
norm
(
input
=
p
.
grad
.
detach
(),
p
=
norm_type
).
to
(
self
.
_device
)
for
p
in
local_params
]),
# type: ignore
input
=
torch
.
stack
([
torch
.
norm
(
input
=
p
.
grad
.
detach
(),
p
=
norm_type
,
dtype
=
torch
.
float32
).
to
(
self
.
_device
)
for
p
in
local_params
]),
# type: ignore
p
=
norm_type
,
p
=
norm_type
,
)
)
...
...
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