forked from pytorch/torchrec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add IR serializer for KTRegroupAsDict Module (pytorch#1900)
Summary: Pull Request resolved: pytorch#1900 # context * previously `KTRegroupAsDict` can't really supported by torch.export (IR) because this module has an intialization step as running the first batch. * during the export the `KTRegroupAsDict` module will be initialized by a fake_tensor which is wrong * if we initialize the module before torch.export, the device would be an issue. * another issue is that current torch.export [can't support conditional logic in training](https://pytorch.org/docs/stable/cond.html), where initialization step only runs once. > torch.cond is a prototype feature in PyTorch. It has limited support for input and output types and doesn’t support training currently. Please look forward to a more stable implementation in a future version of PyTorch. NOTE: this is more like a workaround solution, real solution needs support from pytorch compile for conditional logic # details * we treat the `KTRegroupAsDict` as another sparse_arch and do the model swap before and after torch.export. * more context: D59019375 Differential Revision: D56282744
- Loading branch information
1 parent
de829cf
commit 15b0a4f
Showing
3 changed files
with
152 additions
and
2 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
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