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
77ee4bcd
Unverified
Commit
77ee4bcd
authored
Jul 18, 2018
by
Christian Sarofeen
Committed by
GitHub
Jul 18, 2018
Browse files
Merge pull request #30 from NVIDIA/checkpoint_fix
Handle set/get state for DDP, remove stream which cant be pickled.
parents
5c6144e6
f1f97f9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
apex/parallel/distributed.py
apex/parallel/distributed.py
+11
-0
No files found.
apex/parallel/distributed.py
View file @
77ee4bcd
...
@@ -87,6 +87,17 @@ class DistributedDataParallel(Module):
...
@@ -87,6 +87,17 @@ class DistributedDataParallel(Module):
self
.
create_hooks
()
self
.
create_hooks
()
flat_dist_call
([
param
.
data
for
param
in
self
.
module
.
parameters
()],
dist
.
broadcast
,
(
0
,)
)
flat_dist_call
([
param
.
data
for
param
in
self
.
module
.
parameters
()],
dist
.
broadcast
,
(
0
,)
)
def
__setstate__
(
self
,
state
):
super
(
DistributedDataParallel
,
self
).
__setstate__
(
state
)
self
.
reduction_stream
=
torch
.
cuda
.
Stream
()
def
__getstate__
(
self
,
state
):
attrs
=
copy
.
copy
(
self
.
__dict__
)
if
dist
.
_backend
!=
dist
.
dist_backend
.
NCCL
:
del
attrs
[
'self.reduction_stream'
]
return
attrs
def
create_hooks
(
self
):
def
create_hooks
(
self
):
#all reduce gradient hook
#all reduce gradient hook
...
...
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