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
cef660ba
"vscode:/vscode.git/clone" did not exist on "234d262f39e561ee13018b33902e84b852277ec3"
Commit
cef660ba
authored
Apr 16, 2020
by
Thor Johnsen
Browse files
Bug fix
parent
6eca2389
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
apex/contrib/optimizers/distributed_fused_adam.py
apex/contrib/optimizers/distributed_fused_adam.py
+3
-3
No files found.
apex/contrib/optimizers/distributed_fused_adam.py
View file @
cef660ba
...
@@ -153,7 +153,7 @@ class DistributedFusedAdam(torch.optim.Optimizer):
...
@@ -153,7 +153,7 @@ class DistributedFusedAdam(torch.optim.Optimizer):
grp
=
torch
.
distributed
.
new_group
(
ranks
=
ranks
)
grp
=
torch
.
distributed
.
new_group
(
ranks
=
ranks
)
if
torch
.
distributed
.
get_rank
()
in
ranks
:
if
torch
.
distributed
.
get_rank
()
in
ranks
:
self
.
_ar_pg
.
append
(
grp
)
self
.
_ar_pg
.
append
(
grp
)
self
.
_ar_st
=
[
torch
.
cuda
.
Stream
()
]
*
self
.
_num_ar_pg
self
.
_ar_st
=
[
torch
.
cuda
.
Stream
()
for
_
in
range
(
self
.
_num_ar_pg
)]
rs_ranks
=
[]
rs_ranks
=
[]
for
group_i
in
range
(
self
.
_num_groups
):
for
group_i
in
range
(
self
.
_num_groups
):
rs_ranks
.
append
([
group_i
*
self
.
_group_size
+
j
for
j
in
range
(
self
.
_group_size
)])
rs_ranks
.
append
([
group_i
*
self
.
_group_size
+
j
for
j
in
range
(
self
.
_group_size
)])
...
@@ -167,7 +167,7 @@ class DistributedFusedAdam(torch.optim.Optimizer):
...
@@ -167,7 +167,7 @@ class DistributedFusedAdam(torch.optim.Optimizer):
if
self
.
_compute_L2_grad_norm
and
torch
.
distributed
.
get_rank
()
in
ranks
:
if
self
.
_compute_L2_grad_norm
and
torch
.
distributed
.
get_rank
()
in
ranks
:
#self._l2_grad_norm_pg = torch.distributed.new_group(ranks=ranks)
#self._l2_grad_norm_pg = torch.distributed.new_group(ranks=ranks)
self
.
_l2_grad_norm_pg
=
self
.
_rs_pg
[
-
1
]
self
.
_l2_grad_norm_pg
=
self
.
_rs_pg
[
-
1
]
self
.
_rs_st
=
[
torch
.
cuda
.
Stream
()
]
*
self
.
_num_rs_pg
self
.
_rs_st
=
[
torch
.
cuda
.
Stream
()
for
_
in
range
(
self
.
_num_rs_pg
)]
if
self
.
_num_ag_pg
==
0
:
if
self
.
_num_ag_pg
==
0
:
self
.
_ag_pg
=
self
.
_rs_pg
self
.
_ag_pg
=
self
.
_rs_pg
self
.
_ag_st
=
self
.
_rs_st
self
.
_ag_st
=
self
.
_rs_st
...
@@ -180,7 +180,7 @@ class DistributedFusedAdam(torch.optim.Optimizer):
...
@@ -180,7 +180,7 @@ class DistributedFusedAdam(torch.optim.Optimizer):
grp
=
torch
.
distributed
.
new_group
(
ranks
=
ranks
)
grp
=
torch
.
distributed
.
new_group
(
ranks
=
ranks
)
if
torch
.
distributed
.
get_rank
()
in
ranks
:
if
torch
.
distributed
.
get_rank
()
in
ranks
:
self
.
_ag_pg
.
append
(
grp
)
self
.
_ag_pg
.
append
(
grp
)
self
.
_ag_st
=
[
torch
.
cuda
.
Stream
()
]
*
self
.
_num_ag_pg
self
.
_ag_st
=
[
torch
.
cuda
.
Stream
()
for
_
in
range
(
self
.
_num_ag_pg
)]
self
.
_l2_grad_norm_st
=
torch
.
cuda
.
Stream
()
if
self
.
_compute_L2_grad_norm
else
None
self
.
_l2_grad_norm_st
=
torch
.
cuda
.
Stream
()
if
self
.
_compute_L2_grad_norm
else
None
self
.
_completion_st
=
torch
.
cuda
.
Stream
()
self
.
_completion_st
=
torch
.
cuda
.
Stream
()
...
...
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