-
Notifications
You must be signed in to change notification settings - Fork 487
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
Avoid FX Constant Folding in rw_sharding #2777
Closed
Closed
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
This pull request was exported from Phabricator. Differential Revision: D70577218 |
This pull request was exported from Phabricator. Differential Revision: D70577218 |
cp2923
pushed a commit
to cp2923/torchrec
that referenced
this pull request
Mar 5, 2025
Summary: Tensor_constants nodes are known to have issues with delta update, that the predictor cannot find the tensors in the delta weights. To enable the delta publish works for blue_reels_vdd/v5, we need to ensure the model graph does not containing tensor_constants nodes Breakdown to two diffs, this one contains the file change requires OSS pull request | Constant tensor name | fx paste | code file | code | | -- | | merge._tensor_constant0 | https://www.internalfb.com/intern/everpaste/?color=0&handle=GLJIlhayl6fBeToDACvUvTwjbsMkbr0LAAAz | model_hstu_standalone_cint.py | torch.tensor(self.tasks_with_uid_emb_indices).to(r_over.device) | | merge.main_module.module.sim_module.module_impl._tensor_constant0 | https://www.internalfb.com/intern/everpaste/?handle=GG71xRydBrkmAncFAPQ_36FF6X8XbsIXAAAB | sim.py | self.action_weights[None, : ] | | Input_dist._tensor_constant0, ..1, ..2, etc | https://www.internalfb.com/intern/everpaste/?color=0&handle=GG7hnhaueOUr4MIFAAViKnOmlYozbr0LAAAz | rw_sharding.py | torch.tensor(block_sizes, ...) | Differential Revision: D70577218
This pull request was exported from Phabricator. Differential Revision: D70577218 |
cp2923
pushed a commit
to cp2923/torchrec
that referenced
this pull request
Mar 5, 2025
Summary: Pull Request resolved: pytorch#2777 Tensor_constants nodes are known to have issues with delta update, that the predictor cannot find the tensors in the delta weights. To enable the delta publish works for blue_reels_vdd/v5, we need to ensure the model graph does not containing tensor_constants nodes Breakdown to two diffs, this one contains the file change requires OSS pull request | Constant tensor name | fx paste | code file | code | | -- | | merge._tensor_constant0 | https://www.internalfb.com/intern/everpaste/?color=0&handle=GLJIlhayl6fBeToDACvUvTwjbsMkbr0LAAAz | model_hstu_standalone_cint.py | torch.tensor(self.tasks_with_uid_emb_indices).to(r_over.device) | | merge.main_module.module.sim_module.module_impl._tensor_constant0 | https://www.internalfb.com/intern/everpaste/?handle=GG71xRydBrkmAncFAPQ_36FF6X8XbsIXAAAB | sim.py | self.action_weights[None, : ] | | Input_dist._tensor_constant0, ..1, ..2, etc | https://www.internalfb.com/intern/everpaste/?color=0&handle=GG7hnhaueOUr4MIFAAViKnOmlYozbr0LAAAz | rw_sharding.py | torch.tensor(block_sizes, ...) | Differential Revision: D70577218
cp2923
pushed a commit
to cp2923/torchrec
that referenced
this pull request
Mar 6, 2025
Summary: Tensor_constants nodes are known to have issues with delta update, that the predictor cannot find the tensors in the delta weights. To enable the delta publish works for blue_reels_vdd/v5, we need to ensure the model graph does not containing tensor_constants nodes Breakdown to two diffs, this one contains the file change requires OSS pull request | Constant tensor name | fx paste | code file | code | | -- | | merge._tensor_constant0 | https://www.internalfb.com/intern/everpaste/?color=0&handle=GLJIlhayl6fBeToDACvUvTwjbsMkbr0LAAAz | model_hstu_standalone_cint.py | torch.tensor(self.tasks_with_uid_emb_indices).to(r_over.device) | | merge.main_module.module.sim_module.module_impl._tensor_constant0 | https://www.internalfb.com/intern/everpaste/?handle=GG71xRydBrkmAncFAPQ_36FF6X8XbsIXAAAB | sim.py | self.action_weights[None, : ] | | Input_dist._tensor_constant0, ..1, ..2, etc | https://www.internalfb.com/intern/everpaste/?color=0&handle=GG7hnhaueOUr4MIFAAViKnOmlYozbr0LAAAz | rw_sharding.py | torch.tensor(block_sizes, ...) | Differential Revision: D70577218
This pull request was exported from Phabricator. Differential Revision: D70577218 |
cp2923
pushed a commit
to cp2923/torchrec
that referenced
this pull request
Mar 6, 2025
Summary: Pull Request resolved: pytorch#2777 Tensor_constants nodes are known to have issues with delta update, that the predictor cannot find the tensors in the delta weights. To enable the delta publish works for blue_reels_vdd/v5, we need to ensure the model graph does not containing tensor_constants nodes Breakdown to two diffs, this one contains the file change requires OSS pull request | Constant tensor name | fx paste | code file | code | | -- | | merge._tensor_constant0 | https://www.internalfb.com/intern/everpaste/?color=0&handle=GLJIlhayl6fBeToDACvUvTwjbsMkbr0LAAAz | model_hstu_standalone_cint.py | torch.tensor(self.tasks_with_uid_emb_indices).to(r_over.device) | | merge.main_module.module.sim_module.module_impl._tensor_constant0 | https://www.internalfb.com/intern/everpaste/?handle=GG71xRydBrkmAncFAPQ_36FF6X8XbsIXAAAB | sim.py | self.action_weights[None, : ] | | Input_dist._tensor_constant0, ..1, ..2, etc | https://www.internalfb.com/intern/everpaste/?color=0&handle=GG7hnhaueOUr4MIFAAViKnOmlYozbr0LAAAz | rw_sharding.py | torch.tensor(block_sizes, ...) | Differential Revision: D70577218
Summary: Tensor_constants nodes are known to have issues with delta update, that the predictor cannot find the tensors in the delta weights. 'tensor_cache' in this diff introduces tenor constant in fx. Solution: The solution is to replace 'tensor_cache' through 'register_buffer' + move device and data_type at first forward (so as to keep performance parity). Note this solution breaks a unit test ``` assertFalse( hasattr( local.ro_ec, "_root_mc_embedding_collection", ) ) ``` but it still won't introduce big table like tbes. Reviewed By: jingsh Differential Revision: D70577218
19e17fd
to
2f83768
Compare
This pull request was exported from Phabricator. Differential Revision: D70577218 |
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:
Tensor_constants nodes are known to have issues with delta update, we need to ensure the model graph does not containing tensor_constants nodes
| Constant tensor name | code file | code |
| -- |
| Input_dist._tensor_constant0, ..1, ..2, etc | rw_sharding.py | torch.tensor(block_sizes, ...) |
Differential Revision: D70577218