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

[FSDP]Skip unshard call during checkpointing for NO_SHARD sharding strategy #101095

Closed
wants to merge 2 commits into from

Conversation

zhaojuanmao
Copy link
Contributor

@zhaojuanmao zhaojuanmao commented May 10, 2023

@pytorch-bot
Copy link

pytorch-bot bot commented May 10, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/101095

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 5 Pending

As of commit 463b32d:
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

zhaojuanmao added a commit that referenced this pull request May 10, 2023
…rategy

ghstack-source-id: c2e57d97d5b5c9c48674983f2b6812418c231fca
Pull Request resolved: #101095
Copy link
Contributor

@fegin fegin left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix

@fegin
Copy link
Contributor

fegin commented May 11, 2023

Probably need to resubmit to trigger the CI, there was some infra issue.

zhaojuanmao added a commit that referenced this pull request May 11, 2023
…rategy

ghstack-source-id: 417efbb706677f99cf29ebb41cc394184229ffe1
Pull Request resolved: #101095
@zhaojuanmao
Copy link
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label May 12, 2023
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@@ -146,6 +146,12 @@ def _common_unshard_pre_state_dict_hook(
Performs the pre-state_dict tasks shared by all state_dict types that require
``_unshard_fsdp_state_params()``. FULL_STATE_DICT and SHARDED_STATE_DICT use this hook.
"""
# For composable `fully_shard`, it does not need to unshard parameters for `NO_SHARD` cases.
if (
_is_composable(fsdp_state)
Copy link
Member

Choose a reason for hiding this comment

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

why does it not need to unshard for no_shard usecases only for composable, but this is fine for class based? @awgu would you happen to know?

Copy link
Contributor

Choose a reason for hiding this comment

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

I have no idea :/

_is_composable(fsdp_state)
and fsdp_state.sharding_strategy == ShardingStrategy.NO_SHARD
):
_exit_unshard_params_ctx(module, fsdp_state)
Copy link
Member

Choose a reason for hiding this comment

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

wonder if duplication of these chekcs can be reduced by putting it inside exit / enter unshard params ctx?

@facebook-github-bot facebook-github-bot deleted the gh/zhaojuanmao/97/head branch June 8, 2023 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: distributed (fsdp) release notes category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants