Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyre fix #2605

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions torchrec/distributed/model_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ def sync(self, include_optimizer_state: bool = True) -> None:
all_weights = [
w
for emb_kernel in self._modules_to_sync
# pyre-fixme[29]: `Union[Module, Tensor]` is not a function.
for w in emb_kernel.split_embedding_weights()
]
handle = self._replica_pg.allreduce_coalesced(all_weights, opts=opts)
Expand All @@ -755,6 +756,7 @@ def sync(self, include_optimizer_state: bool = True) -> None:
# Sync accumulated square of grad of local optimizer shards
optim_list = []
for emb_kernel in self._modules_to_sync:
# pyre-fixme[29]: `Union[Module, Tensor]` is not a function.
all_optimizer_states = emb_kernel.get_optimizer_state()
momentum1 = [optim["sum"] for optim in all_optimizer_states]
optim_list.extend(momentum1)
Expand Down Expand Up @@ -864,6 +866,8 @@ def _find_sharded_modules(
if isinstance(module, SplitTableBatchedEmbeddingBagsCodegen):
sharded_modules.append(module)
if hasattr(module, "_lookups"):
# pyre-fixme[29]: `Union[(self: Tensor) -> Any, Module, Tensor]` is
# not a function.
for lookup in module._lookups:
_find_sharded_modules(lookup)
return
Expand Down
Loading