-
Notifications
You must be signed in to change notification settings - Fork 379
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
support serialization of compound module #2082
Open
TroyGarden
wants to merge
1
commit into
pytorch:main
Choose a base branch
from
TroyGarden:export-D58221182
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
facebook-github-bot
added
the
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
label
Jun 6, 2024
This pull request was exported from Phabricator. Differential Revision: D58221182 |
TroyGarden
added a commit
to TroyGarden/torchrec
that referenced
this pull request
Jun 6, 2024
Summary: # details * serialization schedule ``` comp.ebc does NOT require further serialization of its children comp.ebc.embedding_bags is skipped for further serialization comp.ebc.embedding_bags.t1 is skipped for further serialization comp.ebc.embedding_bags.t2 is skipped for further serialization comp.ebc.embedding_bags.t3 is skipped for further serialization comp.comp is resumed for serialization comp.comp Requires further serialization of its children comp.comp.ebc does NOT require further serialization of its children comp.comp.ebc.embedding_bags is skipped for further serialization comp.comp.ebc.embedding_bags.t1 is skipped for further serialization comp.comp.ebc.embedding_bags.t2 is skipped for further serialization comp.comp.ebc.embedding_bags.t3 is skipped for further serialization comp.comp.comp is resumed for serialization comp.comp.comp Requires further serialization of its children comp.comp.comp.ebc does NOT require further serialization of its children comp.comp.comp.ebc.embedding_bags is skipped for further serialization comp.comp.comp.ebc.embedding_bags.t1 is skipped for further serialization comp.comp.comp.ebc.embedding_bags.t2 is skipped for further serialization comp.comp.comp.ebc.embedding_bags.t3 is skipped for further serialization ``` * `parent_fqn`'s children ``` comp.comp.comp {'ebc': EmbeddingBagCollection( (embedding_bags): ModuleDict( (t1): EmbeddingBag(10, 4, mode='sum') (t2): EmbeddingBag(10, 4, mode='sum') (t3): EmbeddingBag(10, 4, mode='sum') ) )} None None ``` ``` comp.comp {'ebc': EmbeddingBagCollection( (embedding_bags): ModuleDict( (t1): EmbeddingBag(10, 4, mode='sum') (t2): EmbeddingBag(10, 4, mode='sum') (t3): EmbeddingBag(10, 4, mode='sum') ) ), 'comp': CompoundModule( (ebc): EmbeddingBagCollection( (embedding_bags): ModuleDict( (t1): EmbeddingBag(10, 4, mode='sum') (t2): EmbeddingBag(10, 4, mode='sum') (t3): EmbeddingBag(10, 4, mode='sum') ) ) )} None None ``` ``` comp {'ebc': EmbeddingBagCollection( (embedding_bags): ModuleDict( (t1): EmbeddingBag(10, 4, mode='sum') (t2): EmbeddingBag(10, 4, mode='sum') (t3): EmbeddingBag(10, 4, mode='sum') ) ), 'comp': CompoundModule( (ebc): EmbeddingBagCollection( (embedding_bags): ModuleDict( (t1): EmbeddingBag(10, 4, mode='sum') (t2): EmbeddingBag(10, 4, mode='sum') (t3): EmbeddingBag(10, 4, mode='sum') ) ) (comp): CompoundModule( (ebc): EmbeddingBagCollection( (embedding_bags): ModuleDict( (t1): EmbeddingBag(10, 4, mode='sum') (t2): EmbeddingBag(10, 4, mode='sum') (t3): EmbeddingBag(10, 4, mode='sum') ) ) ) )} None None ``` Differential Revision: D58221182
TroyGarden
force-pushed
the
export-D58221182
branch
from
June 6, 2024 16:19
0e13bac
to
2d04b50
Compare
This pull request was exported from Phabricator. Differential Revision: D58221182 |
1 similar comment
This pull request was exported from Phabricator. Differential Revision: D58221182 |
TroyGarden
force-pushed
the
export-D58221182
branch
from
June 13, 2024 17:09
2d04b50
to
11726d3
Compare
Summary: Pull Request resolved: pytorch#2082 # context * to support compound module serialization such as fpEBC and fpPEA, we modified the serializer interface a little * the basic idea is that: a. if a compound module A consists of child module B and C, such that module B and C have their own serializer available. b. for serialization of module A, we can just capture it relation from B and C, and used it when deserialization c. specifically, during the deserialization, A's children will be passed in as a dict of (child_fqn => child_module) # design doc [**TorchRec Composable Serializer Design**](https://docs.google.com/document/d/1WUtmzdcqZmwLd4Do8g1fQRjChnRw0ZimyUrCNhxa4nA/edit#heading=h.ezrtdguw0lwq) # note * in order to apply this approach, it requires that module A's construction **takes in it's children as objects** * **DO NOT** create A's children in the A's construction # details * serialization schedule ``` comp.ebc does NOT require further serialization of its children comp.ebc.embedding_bags is skipped for further serialization comp.ebc.embedding_bags.t1 is skipped for further serialization comp.ebc.embedding_bags.t2 is skipped for further serialization comp.ebc.embedding_bags.t3 is skipped for further serialization comp.comp is resumed for serialization comp.comp Requires further serialization of its children comp.comp.ebc does NOT require further serialization of its children comp.comp.ebc.embedding_bags is skipped for further serialization comp.comp.ebc.embedding_bags.t1 is skipped for further serialization comp.comp.ebc.embedding_bags.t2 is skipped for further serialization comp.comp.ebc.embedding_bags.t3 is skipped for further serialization comp.comp.comp is resumed for serialization comp.comp.comp Requires further serialization of its children comp.comp.comp.ebc does NOT require further serialization of its children comp.comp.comp.ebc.embedding_bags is skipped for further serialization comp.comp.comp.ebc.embedding_bags.t1 is skipped for further serialization comp.comp.comp.ebc.embedding_bags.t2 is skipped for further serialization comp.comp.comp.ebc.embedding_bags.t3 is skipped for further serialization ``` * `parent_fqn`'s children ``` comp.comp.comp {'ebc': EmbeddingBagCollection( (embedding_bags): ModuleDict( (t1): EmbeddingBag(10, 4, mode='sum') (t2): EmbeddingBag(10, 4, mode='sum') (t3): EmbeddingBag(10, 4, mode='sum') ) )} None None ``` ``` comp.comp {'ebc': EmbeddingBagCollection( (embedding_bags): ModuleDict( (t1): EmbeddingBag(10, 4, mode='sum') (t2): EmbeddingBag(10, 4, mode='sum') (t3): EmbeddingBag(10, 4, mode='sum') ) ), 'comp': CompoundModule( (ebc): EmbeddingBagCollection( (embedding_bags): ModuleDict( (t1): EmbeddingBag(10, 4, mode='sum') (t2): EmbeddingBag(10, 4, mode='sum') (t3): EmbeddingBag(10, 4, mode='sum') ) ) )} None None ``` ``` comp {'ebc': EmbeddingBagCollection( (embedding_bags): ModuleDict( (t1): EmbeddingBag(10, 4, mode='sum') (t2): EmbeddingBag(10, 4, mode='sum') (t3): EmbeddingBag(10, 4, mode='sum') ) ), 'comp': CompoundModule( (ebc): EmbeddingBagCollection( (embedding_bags): ModuleDict( (t1): EmbeddingBag(10, 4, mode='sum') (t2): EmbeddingBag(10, 4, mode='sum') (t3): EmbeddingBag(10, 4, mode='sum') ) ) (comp): CompoundModule( (ebc): EmbeddingBagCollection( (embedding_bags): ModuleDict( (t1): EmbeddingBag(10, 4, mode='sum') (t2): EmbeddingBag(10, 4, mode='sum') (t3): EmbeddingBag(10, 4, mode='sum') ) ) ) )} None None ``` Differential Revision: D58221182
This pull request was exported from Phabricator. Differential Revision: D58221182 |
TroyGarden
force-pushed
the
export-D58221182
branch
from
June 22, 2024 00:43
11726d3
to
3a4291f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
details
parent_fqn
's childrenDifferential Revision: D58221182