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] Fix nn.Parameter usage for 2D and use_orig_params=True #89782

Closed
wants to merge 2 commits into from

Conversation

awgu
Copy link
Contributor

@awgu awgu commented Nov 28, 2022

Stack from ghstack (oldest at bottom):

This ensures that all elements of FlatParameter._params and FlatParameter._shared_params are nn.Parameters (as expected). This was violated by the local tensor of a DTensor when using 2D parallelism. To fix the breakage, we simply wrap with nn.Parameter if needed.

@pytorch-bot
Copy link

pytorch-bot bot commented Nov 28, 2022

🔗 Helpful Links

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

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

✅ No Failures

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

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

@awgu awgu added the topic: not user facing topic category label Nov 28, 2022
awgu added a commit that referenced this pull request Nov 28, 2022
ghstack-source-id: 5830e8be3148aa7fc3514136ae02f81b7417d50e
Pull Request resolved: #89782
@@ -1307,7 +1317,10 @@ def _use_unsharded_views(self, as_params: bool) -> None:
assert tensor is not None # mypy
param_var = tensor
setattr(module, param_name, param_var)
if self._use_orig_params and self._training_state == HandleTrainingState.FORWARD:
if (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change and below is just ufmt.

Copy link
Contributor

@fduwjj fduwjj left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@awgu awgu added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 28, 2022
@awgu
Copy link
Contributor Author

awgu commented Nov 28, 2022

@pytorchbot rebase -s

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a rebase job. Check the current status here

…s=True`"


This ensures that all elements of `FlatParameter._params` and `FlatParameter._shared_params` are `nn.Parameter`s (as expected). This was violated by the local tensor of a `DTensor` when using 2D parallelism. To fix the breakage, we simply wrap with `nn.Parameter` if needed.

[ghstack-poisoned]
@pytorchmergebot
Copy link
Collaborator

Successfully rebased gh/awgu/217/orig onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via ghstack checkout https://github.com/pytorch/pytorch/pull/89782)

pytorchmergebot pushed a commit that referenced this pull request Nov 28, 2022
ghstack-source-id: 6282e9a1d4fa734eb46ab8a4f9ed6166208a335f
Pull Request resolved: #89782
@awgu
Copy link
Contributor Author

awgu commented Nov 28, 2022

@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

kulinseth pushed a commit to kulinseth/pytorch that referenced this pull request Dec 10, 2022
…torch#89782)

This ensures that all elements of `FlatParameter._params` and `FlatParameter._shared_params` are `nn.Parameter`s (as expected). This was violated by the local tensor of a `DTensor` when using 2D parallelism. To fix the breakage, we simply wrap with `nn.Parameter` if needed.
Pull Request resolved: pytorch#89782
Approved by: https://github.com/fduwjj
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: not user facing topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants