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

Flexible and easy to use HSDP setting #19504

Merged
merged 29 commits into from
Jun 6, 2024

Conversation

Liyang90
Copy link
Contributor

@Liyang90 Liyang90 commented Feb 20, 2024

What does this PR do?

Fixes #19502

It allows users to provide device_mesh as a tuple to the FSDPStrategy.

The test case for hybrid fsdp strategy would be broken, because _init_sharding_strategy is moved out of the __init__ function.

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

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
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

📚 Documentation preview 📚: https://pytorch-lightning--19504.org.readthedocs.build/en/19504/

@github-actions github-actions bot added fabric lightning.fabric.Fabric pl Generic label for PyTorch Lightning package labels Feb 20, 2024
@Liyang90 Liyang90 marked this pull request as ready for review March 5, 2024 00:11
Copy link

codecov bot commented Mar 5, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 6 lines in your changes missing coverage. Please review.

Project coverage is 59%. Comparing base (1a6786d) to head (949d36f).
Report is 97 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (1a6786d) and HEAD (949d36f). Click for more details.

HEAD has 188 uploads less than BASE
Flag BASE (1a6786d) HEAD (949d36f)
python3.10 23 15
cpu 91 43
lightning 55 31
pytest 71 26
examples 9 0
app 9 0
lightning_fabric 19 8
python3.11 34 16
python3.8 18 12
pytorch2.0 12 11
pytest-full 24 21
pytorch_lightning 10 8
pytorch2.1 6 5
pytorch2.3 3 2
lightning_app 2 0
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #19504     +/-   ##
=========================================
- Coverage      84%      59%    -25%     
=========================================
  Files         426      421      -5     
  Lines       35264    35182     -82     
=========================================
- Hits        29553    20772   -8781     
- Misses       5711    14410   +8699     

@Liyang90 Liyang90 changed the title [DRAFT] Flexible and easy to use HSDP setting Flexible and easy to use HSDP setting Mar 7, 2024
@awaelchli awaelchli added community This PR is from the community feature Is an improvement or enhancement strategy: fsdp Fully Sharded Data Parallel labels Mar 8, 2024
@awaelchli awaelchli self-assigned this Mar 8, 2024
@awaelchli awaelchli added this to the 2.3 milestone Mar 8, 2024
Copy link
Contributor

@awaelchli awaelchli left a comment

Choose a reason for hiding this comment

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

Great job. Looking forward to this feature.

src/lightning/fabric/strategies/fsdp.py Show resolved Hide resolved
@Liyang90 Liyang90 requested a review from Borda as a code owner April 18, 2024 18:32
@npuichigo
Copy link

Any updates on this?

@mergify mergify bot removed the has conflicts label May 16, 2024
@Liyang90
Copy link
Contributor Author

Hi @awaelchli , I just fixed a merge conflict with the master and pushed the change. Could you take another look? Let me know if you have any concerns.

@Liyang90
Copy link
Contributor Author

Liyang90 commented Jun 5, 2024

All checks have passed. But I don't have access to merge the PR.

Copy link
Contributor

@awaelchli awaelchli left a comment

Choose a reason for hiding this comment

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

@Liyang90 Thank you for contributing this, and apologies for the delay.
I allowed myself to push a minor change regarding the import and extending the test.

@mergify mergify bot added ready PRs ready to be merged has conflicts and removed ready PRs ready to be merged labels Jun 5, 2024
@mergify mergify bot added ready PRs ready to be merged and removed has conflicts ready PRs ready to be merged labels Jun 5, 2024
@awaelchli awaelchli merged commit 7668a6b into Lightning-AI:master Jun 6, 2024
121 of 122 checks passed
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 feature Is an improvement or enhancement pl Generic label for PyTorch Lightning package ready PRs ready to be merged strategy: fsdp Fully Sharded Data Parallel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow flexible and easy to configure HSDP
5 participants