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
fairscale
Commits
7a062894
Unverified
Commit
7a062894
authored
Nov 24, 2020
by
Stas Bekman
Committed by
GitHub
Nov 24, 2020
Browse files
[doc] make the basic example more "compilable" (#207)
* make the basic example usable out of the box * clarify
parent
2b121242
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
README.md
README.md
+3
-2
No files found.
README.md
View file @
7a062894
...
...
@@ -54,6 +54,7 @@ See a more complete example [here](https://github.com/facebookresearch/fairscale
```
python
import
torch
import
torch.distributed
as
dist
import
torch.multiprocessing
as
mp
from
fairscale.optim.oss
import
OSS
from
torch.nn.parallel
import
DistributedDataParallel
as
DDP
...
...
@@ -63,8 +64,8 @@ def train(
world_size
:
int
,
epochs
:
int
):
# DDP
dist
_init
(
rank
,
world_size
)
# DDP
init example
dist
.
init_process_group
(
backend
=
'nccl'
,
init_method
=
"tcp://localhost:29501"
,
rank
=
rank
,
world_size
=
world_size
)
# Problem statement
model
=
myAwesomeModel
().
to
(
rank
)
...
...
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