-
Notifications
You must be signed in to change notification settings - Fork 3.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
Accommodate FSDP full-precision param_dtype
training with PyTorch < 2.0
#18278
Merged
carmocca
merged 6 commits into
Lightning-AI:master
from
speediedan:accommodate_fsdp_1x_param_dtype_full_precision
Aug 14, 2023
Merged
Accommodate FSDP full-precision param_dtype
training with PyTorch < 2.0
#18278
carmocca
merged 6 commits into
Lightning-AI:master
from
speediedan:accommodate_fsdp_1x_param_dtype_full_precision
Aug 14, 2023
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
… with full precision ``param_dtype`` s and PyTorch < 2.0, condition ``lightning_module_state_dict`` FSDP state dict import locations on PyTorch version, emit ``UserWarnings`` rather than attempting to load/save optim state dicts with FSDP and PyTorch < 2.0
github-actions
bot
added
fabric
lightning.fabric.Fabric
pl
Generic label for PyTorch Lightning package
labels
Aug 10, 2023
…ategy_load_optimizer_states`, improve `test_configure_model` to accommodate SGD issues with FSDP and PyTorch `2.0`
speediedan
requested review from
awaelchli,
carmocca,
justusschock,
Borda and
williamFalcon
as code owners
August 10, 2023 23:14
I believe the currently failing check (Test Fabric / fabric-cpu (ubuntu-20.04, lightning, 3.8, 1.11): test_collectives_distributed[2]) is not related to this PR. |
awaelchli
reviewed
Aug 13, 2023
speediedan
changed the title
Accommodate FSDP full-precision
Accommodate FSDP full-precision Aug 13, 2023
param_dtype
training and issue optim state dict loading/saving warnings with PyTorch < 2.0param_dtype
training with PyTorch < 2.0
awaelchli
added
strategy: fsdp
Fully Sharded Data Parallel
community
This PR is from the community
labels
Aug 13, 2023
awaelchli
approved these changes
Aug 13, 2023
carmocca
approved these changes
Aug 14, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
community
This PR is from the community
fabric
lightning.fabric.Fabric
pl
Generic label for PyTorch Lightning package
ready
PRs ready to be merged
strategy: fsdp
Fully Sharded Data Parallel
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.
Fixes #18277
When FSDP training with full precision
param_dtype
s (16-mixed
,bf16-mixed
and32-true
configurations) and PyTorch < 2.0, FSDP training will encounter this assertion error.This is because FSDP uses the noneness of
param_dtype
as a proxy for the_uses_param_mixed_precision
property andFSDPPrecisionPlugin
currently sets the defaultparam_dtype
totorch.float32
when training in full precision.This PR:
MixedPrecision
param_dtype
toNone
when FSDP training with full precisionparam_dtype
s and PyTorch < 2.0Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:
Reviewer checklist