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][5/N] Unblock ignored_states + auto wrap (for now) #104418

Closed
wants to merge 14 commits into from

Conversation

awgu
Copy link
Contributor

@awgu awgu commented Jun 29, 2023

Stack from ghstack (oldest at bottom):

The "for now" is because we still have the issue that when using the parameter ignored_states path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

@pytorch-bot
Copy link

pytorch-bot bot commented Jun 29, 2023

🔗 Helpful Links

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

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

✅ No Failures

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

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

The "for now" is because we still have the issue that when using the parameter `ignored_states` path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

[ghstack-poisoned]
awgu added a commit that referenced this pull request Jun 29, 2023
ghstack-source-id: 3dece821cc9b5b6fac09519f56414fbcf4ca3874
Pull Request resolved: #104418
@awgu awgu added the topic: bug fixes topic category label Jun 29, 2023
The "for now" is because we still have the issue that when using the parameter `ignored_states` path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

[ghstack-poisoned]
awgu added a commit that referenced this pull request Jun 29, 2023
ghstack-source-id: 7a743d525ebfeee9362719c13dcef95993ecb0fa
Pull Request resolved: #104418
awgu added a commit to awgu/pytorch that referenced this pull request Jun 29, 2023
ghstack-source-id: 7a743d525ebfeee9362719c13dcef95993ecb0fa
Pull Request resolved: pytorch#104418
The "for now" is because we still have the issue that when using the parameter `ignored_states` path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

[ghstack-poisoned]
awgu added a commit to awgu/pytorch that referenced this pull request Jun 30, 2023
ghstack-source-id: 60be363bf4780ea201280664d0fe0ede7e7faaa5
Pull Request resolved: pytorch#104418
The "for now" is because we still have the issue that when using the parameter `ignored_states` path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

[ghstack-poisoned]
awgu added a commit to awgu/pytorch that referenced this pull request Jun 30, 2023
ghstack-source-id: 28c95ac2e70c519db0e32cd6b3147ede9aed54cd
Pull Request resolved: pytorch#104418
awgu added 2 commits June 30, 2023 00:43
The "for now" is because we still have the issue that when using the parameter `ignored_states` path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

[ghstack-poisoned]
The "for now" is because we still have the issue that when using the parameter `ignored_states` path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

[ghstack-poisoned]
awgu added a commit to awgu/pytorch that referenced this pull request Jun 30, 2023
ghstack-source-id: eee579391a4b12b8558a922a2a17cf93f9289b90
Pull Request resolved: pytorch#104418
The "for now" is because we still have the issue that when using the parameter `ignored_states` path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

[ghstack-poisoned]
awgu added a commit to awgu/pytorch that referenced this pull request Jul 5, 2023
ghstack-source-id: 5d23b076f1edb0ecb0b441f14fb7732e2be2d7e1
Pull Request resolved: pytorch#104418
awgu added a commit to awgu/pytorch that referenced this pull request Jul 5, 2023
ghstack-source-id: 5d23b076f1edb0ecb0b441f14fb7732e2be2d7e1
Pull Request resolved: pytorch#104418
The "for now" is because we still have the issue that when using the parameter `ignored_states` path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

[ghstack-poisoned]
@awgu awgu marked this pull request as ready for review July 5, 2023 15:36
@awgu awgu requested a review from mrshenli as a code owner July 5, 2023 15:36
The "for now" is because we still have the issue that when using the parameter `ignored_states` path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

[ghstack-poisoned]
The "for now" is because we still have the issue that when using the parameter `ignored_states` path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

[ghstack-poisoned]
@@ -417,6 +417,7 @@ def __init__(
"forward_prefetch": forward_prefetch,
"limit_all_gathers": limit_all_gathers,
"use_orig_params": use_orig_params,
"ignored_states": self._ignored_params,
Copy link
Member

Choose a reason for hiding this comment

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

why do we need to propagate ignored_states, but not ignored_modules?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Maybe we should also propagate ignored_modules. This might be another bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason not propagating ignored_modules does not break correctness today is because we only use ignored_modules to compute the ignored parameters and to compute which modules to ignore for auto wrapping.

For those two functionalities, we do not need the nested FSDP instances to have ignored_modules. However, we should probably still propagate it in case we use ignored_modules for something else in the future.

Copy link
Member

Choose a reason for hiding this comment

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

I see. In general, what do you think about having both ignored_states and ignored_modules? this seems like it can get confusing to users, shall we just consolidate to ignored_states?

@@ -173,29 +165,32 @@ def _test_ignored_modules_transformer(
CUDAInitMode.CUDA_BEFORE,
deterministic=True,
)
if use_auto_wrap:
nonwrapped_model.output_proj.weight = nn.Parameter(
Copy link
Member

Choose a reason for hiding this comment

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

why do we need this reassignment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See the comment above about unsharing the weight.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can duplicate the comment here if it helps.

awgu added 2 commits July 7, 2023 12:49
The "for now" is because we still have the issue that when using the parameter `ignored_states` path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

[ghstack-poisoned]
The "for now" is because we still have the issue that when using the parameter `ignored_states` path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

[ghstack-poisoned]
@awgu awgu added the ciflow/trunk Trigger trunk jobs on your pull request label Jul 7, 2023
The "for now" is because we still have the issue that when using the parameter `ignored_states` path, we do not recover the ignored modules, so FSDP still wraps those as empty shells (no managed parameters), which is not ideal. This is not a blocking issue as far as I know.

[ghstack-poisoned]
@awgu
Copy link
Contributor Author

awgu commented Jul 8, 2023

@pytorchbot merge

@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/awgu/414/head branch July 11, 2023 14:16
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 topic: bug fixes topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants