Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
fairscale
Commits
2d5fae18
Unverified
Commit
2d5fae18
authored
Jan 27, 2021
by
msbaines
Committed by
GitHub
Jan 27, 2021
Browse files
[fix] examples: fix multiprocess pipe tutorial (#332)
parent
e6aef938
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
examples/tutorial_pipe_multiprocess.py
examples/tutorial_pipe_multiprocess.py
+2
-2
No files found.
examples/tutorial_pipe_multiprocess.py
View file @
2d5fae18
...
...
@@ -10,7 +10,6 @@ from fairscale.nn.model_parallel import initialize_model_parallel
from
fairscale.nn.pipe
import
MultiProcessPipe
DEVICE
=
"cuda"
if
torch
.
cuda
.
is_available
()
else
"cpu"
RANK
=
0
# example
def
run
(
rank
,
world_size
):
...
...
@@ -25,7 +24,7 @@ def run(rank, world_size):
data
,
target
=
getData
()[
0
]
loss_fn
=
getLossFun
()
device
=
torch
.
device
(
"cuda"
,
RANK
)
if
DEVICE
==
"cuda"
else
torch
.
device
(
"cpu"
)
device
=
torch
.
device
(
"cuda"
,
rank
)
if
DEVICE
==
"cuda"
else
torch
.
device
(
"cpu"
)
model
=
MultiProcessPipe
(
model
,
...
...
@@ -55,6 +54,7 @@ def run(rank, world_size):
model
.
back_helper
(
outputs
)
print
(
f
"Finished Training Step on
{
rank
}
"
)
dist
.
rpc
.
shutdown
()
del
model
...
...
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