forked from facebookresearch/PyTorch-BigGraph
-
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.
Summary: I always had the feeling that `swap_partitioned_embeddings` was more complicated than it had to be, and I realized that it is due to the fact that in addition to the saving+loading logic, it also needs to take care of converting between the (entity_type, part) identifiers used by the checkpoints and the (entity_type, side) identifiers used by the model. In this diff I'm adding an extra level of indirection (the solution to all problems!) which fixes this by storing the partitions in a so-called holder rather than in the model itself, and doing the conversion outside of `swap_partitioned_embeddings`. Separation between model and holder also means that we can load and drop embeddings on the model as we want, without that requiring checkpointing or loading from disk. Thus we reset the model (remove all embeddings) at the end of each pass, so that all its parameters are the global parameters. This simplifies some code that had to filter out the unpartitioned embeddings when checkpointing the global params. Reviewed By: adamlerer Differential Revision: D18373175 fbshipit-source-id: dd32b6ca009066ce8a565ddc471618d1941860df
- Loading branch information
1 parent
fe6c371
commit 3997200
Showing
5 changed files
with
142 additions
and
173 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
Oops, something went wrong.