-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add APIs to detach/attach model to sdd pipeline (#2076)
Summary: Pull Request resolved: #2076 ## Summary Adds 2 new user-facing APIs for `TrainPipelineSparseDist`: - `detach()` -> torch.nn.Module. Detaches original model so it can be used outside of current train pipeline. - `attach(model: Optional[torch.nn.Module] = none)` -> None. Attaches model to pipeline (i.e. override trec module forward and input dist fwds). If no model specified, uses original model. ## Sample use cases: - Bulk eval on trec sharded modules (e.g. ShardedEBC) after/during pipelined training. Currently this causes issues because the model forward is swapped with pipelined forward call. - Train on one pipeline (e.g. full-sync SDD), then swap to another pipeline (e.g. semi-sync) - Swap out model during training by calling `attach()` on another model (no current use case but is supported) Reviewed By: joshuadeng Differential Revision: D57882281 fbshipit-source-id: e4687bd59bfd419922cd22f646644f647d614d32
- Loading branch information
1 parent
f0156b5
commit 27a1667
Showing
2 changed files
with
274 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters