-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[FSDP][Easy] Fix 0-dim tensor optim state device #75243
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
Conversation
[ghstack-poisoned]
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 1dc189f (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages
|
|
@awgu has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
| unpadded_numel = flat_param._orig_size.numel() # type: ignore[attr-defined] | ||
| tensor_state[state_name] = tensor_buffer[:unpadded_numel].cpu() | ||
| # Zero-dimension tensor state and non-tensor state: take this rank's | ||
| # value directly (`deepcopy()`ing to avoid aliasing surprises) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete outdated comment.
| elif to_save: | ||
| if _is_zero_dim_tensor(value): | ||
| zero_dim_tensor_state[state_name] = value | ||
| zero_dim_tensor_state[state_name] = value.cpu() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically, this zero-dimension tensor is on CPU, but we should add a .cpu() call to ensure this.
Summary: Pull Request resolved: #75243 Test Plan: Imported from OSS Reviewed By: rohan-varma Differential Revision: D35384883 Pulled By: awgu fbshipit-source-id: 8dfc12035b79861df093d5921ed7b36050c9f3a0
|
Hey @awgu. |
Stack from ghstack:
Test Plan
Check that
test_fsdp_optim_state.pystill passes.Differential Revision: D35384883