-
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] Re-support model dtype change after FSDP init #91192
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ghstack-poisoned]
awgu
requested review from
mrshenli,
pritamdamania87,
zhaojuanmao,
rohan-varma,
H-Huang,
kwen2501 and
wanchaol
as code owners
December 20, 2022 20:03
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/91192
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit f2ea4a2: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
pytorch-bot
bot
added
the
release notes: distributed (fsdp)
release notes category
label
Dec 20, 2022
awgu
added a commit
to awgu/pytorch
that referenced
this pull request
Dec 20, 2022
ghstack-source-id: 3815e5ae8eac082490112724bbc3e847161b4397 Pull Request resolved: pytorch#91192
To make mixed precision precise internally, #90660 changed the implementation to save `_orig_param_dtype`, `_low_prec_param_dtype`, and `_reduce_dtype` explicitly. However, these are computed at FSDP construction time, so it does not allow the user to change the model dtype after FSDP construction time but before lazy initialization. This PR recomputes those dtype attributes as needed if the model dtype changes in that window. Note that any mixed precision settings specified by the user take precedence over the model dtype. [ghstack-poisoned]
awgu
added a commit
to awgu/pytorch
that referenced
this pull request
Dec 20, 2022
ghstack-source-id: c4fb1436b9925f203bbd8fcf84891e2e7d2048c0 Pull Request resolved: pytorch#91192
awgu
added a commit
to awgu/pytorch
that referenced
this pull request
Dec 20, 2022
ghstack-source-id: c4fb1436b9925f203bbd8fcf84891e2e7d2048c0 Pull Request resolved: pytorch#91192
To make mixed precision precise internally, #90660 changed the implementation to save `_orig_param_dtype`, `_low_prec_param_dtype`, and `_reduce_dtype` explicitly. However, these are computed at FSDP construction time, so it does not allow the user to change the model dtype after FSDP construction time but before lazy initialization. This PR recomputes those dtype attributes as needed if the model dtype changes in that window. Note that any mixed precision settings specified by the user take precedence over the model dtype. [ghstack-poisoned]
awgu
added a commit
to awgu/pytorch
that referenced
this pull request
Dec 21, 2022
ghstack-source-id: 177caa7b10d34939c3979d6f212db5fceb283e44 Pull Request resolved: pytorch#91192
This was referenced Jan 5, 2023
awgu
added a commit
to awgu/pytorch
that referenced
this pull request
Jan 10, 2023
ghstack-source-id: 177caa7b10d34939c3979d6f212db5fceb283e44 Pull Request resolved: pytorch#91192
awgu
added a commit
to awgu/pytorch
that referenced
this pull request
Jan 10, 2023
ghstack-source-id: 177caa7b10d34939c3979d6f212db5fceb283e44 Pull Request resolved: pytorch#91192
Closes #90838. To make mixed precision precise internally, #90660 changed the implementation to save `_orig_param_dtype`, `_low_prec_param_dtype`, and `_reduce_dtype` explicitly. However, these are computed at FSDP construction time, so it does not allow the user to change the model dtype after FSDP construction time but before lazy initialization. This PR recomputes those dtype attributes as needed if the model dtype changes in that window. Note that any mixed precision settings specified by the user take precedence over the model dtype. [ghstack-poisoned]
awgu
added a commit
to awgu/pytorch
that referenced
this pull request
Jan 10, 2023
ghstack-source-id: cdc64afe5bbb7f6c441958dfaff6afcb70bc308c Pull Request resolved: pytorch#91192
Closes #90838. To make mixed precision precise internally, #90660 changed the implementation to save `_orig_param_dtype`, `_low_prec_param_dtype`, and `_reduce_dtype` explicitly. However, these are computed at FSDP construction time, so it does not allow the user to change the model dtype after FSDP construction time but before lazy initialization. This PR recomputes those dtype attributes as needed if the model dtype changes in that window. Note that any mixed precision settings specified by the user take precedence over the model dtype. [ghstack-poisoned]
awgu
added a commit
to awgu/pytorch
that referenced
this pull request
Jan 11, 2023
ghstack-source-id: cd846eca268ff9277ef68c15424e78de76e233f6 Pull Request resolved: pytorch#91192
This was referenced Jan 11, 2023
This was referenced Jan 11, 2023
zhaojuanmao
approved these changes
Jan 11, 2023
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: improvements
topic category
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Stack from ghstack:
r
's current device iscuda:r
#92035 [FSDP][RFC] Enforce rankr
's current device iscuda:r
device_id
+ CPU offload test #92031 [FSDP][BE] Improvedevice_id
+ CPU offload testprefixed_param_names
->fqns
for consolidation #92028 [FSDP][BE] Renameprefixed_param_names
->fqns
for consolidationuse_orig_params=True
#91767 [FSDP] Do not clean FQNs even foruse_orig_params=True
use_orig_params=True
,no_sync()
, mixed precision #91193 [FSDP] Testuse_orig_params=True
,no_sync()
, mixed precisionMixedPrecision
docs #91974 [FSDP] ClarifyMixedPrecision
docsCloses #90838.
To make mixed precision precise internally, #90660 changed the implementation to save
_orig_param_dtype
,_low_prec_param_dtype
, and_reduce_dtype
explicitly. However, these are computed at FSDP construction time, so it does not allow the user to change the model dtype after FSDP construction time but before lazy initialization. This PR recomputes those dtype attributes as needed if the model dtype changes in that window.Note that any mixed precision settings specified by the user take precedence over the model dtype.