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
2108f20e
Unverified
Commit
2108f20e
authored
Oct 27, 2020
by
msbaines
Committed by
GitHub
Oct 27, 2020
Browse files
[refactor] moe: use all_to_all_single (#168)
parent
c5e5ff78
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
4 deletions
+3
-4
fairscale/nn/moe/moe_layer.py
fairscale/nn/moe/moe_layer.py
+1
-3
stubs/torch/distributed/__init__.pyi
stubs/torch/distributed/__init__.pyi
+2
-1
No files found.
fairscale/nn/moe/moe_layer.py
View file @
2108f20e
...
...
@@ -27,9 +27,7 @@ class _AllToAll(torch.autograd.Function):
world_size
=
dist
.
get_world_size
(
group
)
input
=
input
.
contiguous
()
output
=
torch
.
empty_like
(
input
)
input_chunks
=
list
(
input
.
chunk
(
world_size
))
output_chunks
=
list
(
output
.
chunk
(
world_size
))
dist
.
all_to_all
(
output_chunks
,
input_chunks
,
group
=
group
)
dist
.
all_to_all_single
(
output
,
input
,
group
=
group
)
return
output
@
staticmethod
...
...
stubs/torch/distributed/__init__.pyi
View file @
2108f20e
...
...
@@ -35,7 +35,8 @@ def is_initialized() -> bool: ...
def init_process_group(backend: Union[str, Backend], timeout: datetime.timedelta = datetime.timedelta(0, 1800), rank: Optional[int] = None, world_size: Optional[int] = None): ...
def new_group(ranks: List[int], timeout: datetime.timedelta = datetime.timedelta(0, 1800), backend: Union[None, str, Backend] = None): ...
def all_to_all(output: List[Tensor], intput: List[Tensor], group:Optional[ProcessGroup] = None, async_op: bool = False): ...
def all_to_all(output: List[Tensor], input: List[Tensor], group:Optional[ProcessGroup] = None, async_op: bool = False): ...
def all_to_all_single(output: Tensor, input: Tensor, output_split_size: Optional[List[int]] = None, input_split_size: Optional[List[int]] = None, group:Optional[ProcessGroup] = None, async_op: bool = False): ...
def all_reduce(tensor: Tensor, op: ReduceOp = ReduceOp.SUM, group:Optional[ProcessGroup] = None, async_op: bool = False): ...
def all_gather(tensor_list: List[Tensor], tensor: Tensor, group:Optional[ProcessGroup] = None, async_op: bool = False): ...
...
...
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