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
f1f97f9f
Commit
f1f97f9f
authored
Jul 18, 2018
by
Christian Sarofeen
Browse files
Handle set/get state for DDP, remove stream which cant be pickled.
parent
5c6144e6
Changes
1
Show 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 @
f1f97f9f
...
...
@@ -88,6 +88,17 @@ class DistributedDataParallel(Module):
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
):
#all reduce gradient hook
def
allreduce_params
():
...
...
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