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][state_dict] Restore the state_dict_config for NO_SHARD #100855

Closed
wants to merge 6 commits into from

Conversation

fegin
Copy link
Contributor

@fegin fegin commented May 8, 2023

Stack from ghstack (oldest at bottom):

Any change to the user configurations should be temporary. This PR fixes the issue when NO_SHARD state_dict/load_state_dict is called, the state_dict_config and state_dict_type are changed permanently.

Differential Revision: D45593313

NOTE FOR REVIEWERS: This PR has internal Meta-specific changes or comments, please review them on Phabricator!

Any change to the user configurations should be temporary. This PR fixes the issue when NO_SHARD state_dict/load_state_dict is called, the state_dict_config and state_dict_type are changed permanently.

Differential Revision: [D45593313](https://our.internmc.facebook.com/intern/diff/D45593313/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D45593313/)!

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented May 8, 2023

🔗 Helpful Links

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

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

✅ No Failures

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

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

@pytorch-bot pytorch-bot bot added the release notes: distributed (fsdp) release notes category label May 8, 2023
@fegin fegin added the ciflow/trunk Trigger trunk jobs on your pull request label May 8, 2023
Any change to the user configurations should be temporary. This PR fixes the issue when NO_SHARD state_dict/load_state_dict is called, the state_dict_config and state_dict_type are changed permanently.

Differential Revision: [D45593313](https://our.internmc.facebook.com/intern/diff/D45593313/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D45593313/)!

[ghstack-poisoned]
@fegin fegin changed the title [FSDP] Restore the state_dict_config for NO_SHARD [FSDP][state_dict] Restore the state_dict_config for NO_SHARD May 8, 2023
…ARD"

Any change to the user configurations should be temporary. This PR fixes the issue when NO_SHARD state_dict/load_state_dict is called, the state_dict_config and state_dict_type are changed permanently.

Differential Revision: [D45593313](https://our.internmc.facebook.com/intern/diff/D45593313/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D45593313/)!

[ghstack-poisoned]
@@ -302,6 +302,8 @@ def test_state_dict_fsdp_submodules(self):
self.assertIsInstance(tensor, ShardedTensor)
elif "u2" in fqn:
self.assertIsInstance(tensor, torch.Tensor)
# Ensure that get_state_dict_type can still correctly get the settings.
_ = FSDP.get_state_dict_type(model)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this meant to have some assert on the return value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

get_state_dict_type will assert if the state_dict_config is not restored.

…ARD"

Any change to the user configurations should be temporary. This PR fixes the issue when NO_SHARD state_dict/load_state_dict is called, the state_dict_config and state_dict_type are changed permanently.

Differential Revision: [D45593313](https://our.internmc.facebook.com/intern/diff/D45593313/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D45593313/)!

[ghstack-poisoned]
@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: Comment with id 1540563109 not found

Details for Dev Infra team Raised by workflow job

…ARD"

Any change to the user configurations should be temporary. This PR fixes the issue when NO_SHARD state_dict/load_state_dict is called, the state_dict_config and state_dict_type are changed permanently.

Differential Revision: [D45593313](https://our.internmc.facebook.com/intern/diff/D45593313/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D45593313/)!

[ghstack-poisoned]
fegin added a commit that referenced this pull request May 9, 2023
Pull Request resolved: #100855

Any change to the user configurations should be temporary. This PR fixes the issue when NO_SHARD state_dict/load_state_dict is called, the state_dict_config and state_dict_type are changed permanently.
ghstack-source-id: 188583060

Differential Revision: [D45593313](https://our.internmc.facebook.com/intern/diff/D45593313/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D45593313/)!
…ARD"

Any change to the user configurations should be temporary. This PR fixes the issue when NO_SHARD state_dict/load_state_dict is called, the state_dict_config and state_dict_type are changed permanently.

Differential Revision: [D45593313](https://our.internmc.facebook.com/intern/diff/D45593313/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D45593313/)!

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

@pytorchbot merge

(Initiating merge automatically since Phabricator Diff has merged)

@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

@facebook-github-bot facebook-github-bot deleted the gh/fegin/123/head branch June 8, 2023 17:15
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

6 participants