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
20278c0d
Unverified
Commit
20278c0d
authored
Sep 11, 2020
by
msbaines
Committed by
GitHub
Sep 11, 2020
Browse files
[docs] add a Pipeline tutorial (#82)
parent
61aac92a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
13 deletions
+63
-13
.isort.cfg
.isort.cfg
+1
-1
docs/source/api/index.rst
docs/source/api/index.rst
+8
-0
docs/source/index.rst
docs/source/index.rst
+3
-12
docs/source/tutorials/index.rst
docs/source/tutorials/index.rst
+7
-0
docs/source/tutorials/pipe.rst
docs/source/tutorials/pipe.rst
+44
-0
No files found.
.isort.cfg
View file @
20278c0d
[settings]
[settings]
known_third_party =numpy,pytest,
pytorch_sphinx_theme,
recommonmark,setuptools,torch,torchtext,torchvision
known_third_party =numpy,pytest,recommonmark,setuptools,torch,torchtext,torchvision
docs/source/api/index.rst
0 → 100644
View file @
20278c0d
API Reference
=============
.. toctree::
:maxdepth: 1
optim/oss
nn/pipe
docs/source/index.rst
View file @
20278c0d
...
@@ -7,16 +7,7 @@ Welcome to fairscale's documentation!
...
@@ -7,16 +7,7 @@ Welcome to fairscale's documentation!
=====================================
=====================================
.. toctree::
.. toctree::
:maxdepth: 1
:maxdepth: 2
:caption: API Reference
api/optim/oss
api/index
api/nn/pipe
tutorials/index
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
docs/source/tutorials/index.rst
0 → 100644
View file @
20278c0d
Tutorials
=========
.. toctree::
:maxdepth: 1
pipe
docs/source/tutorials/pipe.rst
0 → 100644
View file @
20278c0d
Pipeline
Parallel
=================
Let
us
start
with
a
toy
model
that
contains
two
linear
layers
.
..
code
-
block
::
default
import
torch
import
torch
.
nn
as
nn
class
ToyModel
(
nn
.
Module
):
def
__init__
(
self
):
super
(
ToyModel
,
self
).
__init__
()
self
.
net1
=
torch
.
nn
.
Linear
(
10
,
10
)
self
.
relu
=
torch
.
nn
.
ReLU
()
self
.
net2
=
torch
.
nn
.
Linear
(
10
,
5
)
def
forward
(
self
,
x
):
x
=
self
.
relu
(
self
.
net1
(
x
))
return
self
.
net2
(
x
)
model
=
ToyModel
()
To
run
this
model
on
2
GPUs
we
need
to
convert
the
model
to
``
torch
.
nn
.
Sequential
``
and
then
wrap
it
with
``
fairscale
.
nn
.
Pipe
``.
..
code
-
block
::
default
import
fairscale
import
torch
import
torch
.
nn
as
nn
model
=
nn
.
Sequential
(
torch
.
nn
.
Linear
(
10
,
10
),
torch
.
nn
.
ReLU
(),
torch
.
nn
.
Linear
(
10
,
5
)
)
model
=
fairscale
.
nn
.
Pipe
(
model
,
balance
=[
2
,
1
])
This
will
run
the
first
two
layers
on
``
cuda
:
0
``
and
the
last
layer
on
``
cuda
:
1
``.
To
learn
more
,
visit
the
`
Pipe
<../
api
/
nn
/
pipe
.
html
>`
_
documentation
.
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