Skip to content
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

Cache all_optimizer_states to speed up model sharding #2747

Closed
wants to merge 1 commit into from

Conversation

hstonec
Copy link
Contributor

@hstonec hstonec commented Feb 15, 2025

Summary:
Similar to D68578829, the get_optimizer_state() method in the emb_module is invoked thousands of times when _gen_named_parameters_by_table_fused is called as it generates EmbeddingFusedOptimizer instances for each iteration.

By extracting this operation out of the loop and passing it as a parameter to achieve a caching effect, we can save a lot of time. Specifically, ~6.6s from https://www.internalfb.com/family_of_labs/test_results/694448901
and ~20s from https://www.internalfb.com/family_of_labs/test_results/694448900

Reviewed By: dstaay-fb, lijia19, andywag

Differential Revision: D69443708

@facebook-github-bot 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 Feb 15, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69443708

Copy link

@andywag andywag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

Summary:

Similar to D68578829, the `get_optimizer_state()` method in the `emb_module` is invoked thousands of times when `_gen_named_parameters_by_table_fused` is called as it generates EmbeddingFusedOptimizer instances for each iteration.

By extracting this operation out of the loop and passing it as a parameter to achieve a caching effect, we can save a lot of time. Specifically, ~6.6s from https://www.internalfb.com/family_of_labs/test_results/694448901
 and ~20s from https://www.internalfb.com/family_of_labs/test_results/694448900

Reviewed By: dstaay-fb, lijia19, andywag

Differential Revision: D69443708
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69443708

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants