-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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] Add set_state_dict_type API to setup state_dict_type without using context manager #86243
Conversation
…sing context manager FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/86243
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 FailuresAs of commit 4de33ef: The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…sing context manager FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/) ghstack-source-id: 169371556 Pull Request resolved: #86243
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.
LGTM, just looks like there is a valid lint. Thanks for adding this!
|
||
prev_state_dict_type = None | ||
prev_state_dict_config = None | ||
# Use default config a state_dict config is not set. |
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.
"if a state_dict config is not set"
…e without using context manager" FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/) [ghstack-poisoned]
…sing context manager Pull Request resolved: #86243 FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. ghstack-source-id: 169453751 Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/)
…e without using context manager" FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/) [ghstack-poisoned]
…sing context manager Pull Request resolved: #86243 FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. ghstack-source-id: 170308364 Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/)
@@ -2111,6 +2104,46 @@ def _get_training_state( | |||
) | |||
return next(iter(training_states)) | |||
|
|||
@staticmethod | |||
def set_state_dict_type( |
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.
Should we add a docstring?
…e without using context manager" FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/) [ghstack-poisoned]
…sing context manager Pull Request resolved: #86243 FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. ghstack-source-id: 170670792 Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/)
…e without using context manager" FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/) [ghstack-poisoned]
…sing context manager Pull Request resolved: #86243 FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. ghstack-source-id: 170765562 Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/)
@pytorchbot merge |
Merge startedYour 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 |
Merge failedReason: The following mandatory check(s) failed (Rule Dig deeper by viewing the failures on hud Details for Dev Infra teamRaised by workflow job |
…e without using context manager" FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/) [ghstack-poisoned]
…sing context manager Pull Request resolved: #86243 FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. ghstack-source-id: 170829792 Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/)
…e without using context manager" FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/) [ghstack-poisoned]
…sing context manager Pull Request resolved: #86243 FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. ghstack-source-id: 170860829 Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/)
…e without using context manager" FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/) [ghstack-poisoned]
…sing context manager Pull Request resolved: #86243 FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. ghstack-source-id: 170899517 Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/)
@pytorchbot merge |
Merge startedYour 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 |
Merge failedReason: The following mandatory check(s) failed (Rule Dig deeper by viewing the failures on hud Details for Dev Infra teamRaised by workflow job |
@pytorchbot merge -f "failing tests are not related" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Hey @fegin. |
…sing context manager (pytorch#86243) FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization. `set_state_dict_type` allows users to do so. Differential Revision: [D40083670](https://our.internmc.facebook.com/intern/diff/D40083670/) Pull Request resolved: pytorch#86243 Approved by: https://github.com/rohan-varma
Stack from ghstack (oldest at bottom):
FSDP.state_dict_type is a context manager. However, users may want to decide what state_dict is going to used during initialization.
set_state_dict_type
allows users to do so.Differential Revision: D40083670
cc @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen @aazzolini @osalpekar @jiayisuse @H-Huang @kwen2501 @awgu