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

[Fix] Add delay property for checkpointing, refactor loading checkpoint (DeepSpeed Checkpointing Fix 1/n) #8627

Merged
merged 7 commits into from
Jul 30, 2021

Conversation

SeanNaren
Copy link
Contributor

@SeanNaren SeanNaren commented Jul 29, 2021

What does this PR do?

Related to #8397.

This PR introduces a property to the training type plugin that allows the plugin to delay loading the checkpoint till after pre-dispatch, and moves loading the checkpoint file (resume_start) into the same block of logic.

After discussions with @awaelchli I couldn't unfortunately come up with another method to load via the deepspeed engine but to introduce this branch into the run function. This branch will allow us to call deepspeed_engine.load_checkpoint when loading the checkpoint file.

This PR relys on #8347 which will not be included till 1.5, so should skip this from 1.4.x. I'll also to a combo CHANGELOG update in #8397 instead of here, as on it's own its confusing!

Before submitting

  • Was this discussed/approved 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 internal minor changes/refactorings)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:

  • 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

Did you have fun?

Make sure you had fun coding 🙃

…o the run function to allow deepspeed engine to be loaded
@SeanNaren SeanNaren added bug Something isn't working 3rd party Related to a 3rd-party labels Jul 29, 2021
@SeanNaren SeanNaren added this to the v1.5 milestone Jul 29, 2021
@SeanNaren SeanNaren requested a review from awaelchli as a code owner July 29, 2021 16:11
@SeanNaren SeanNaren self-assigned this Jul 29, 2021
@codecov
Copy link

codecov bot commented Jul 29, 2021

Codecov Report

Merging #8627 (7dfc386) into master (c99e2fe) will decrease coverage by 4%.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master   #8627    +/-   ##
=======================================
- Coverage      93%     88%    -4%     
=======================================
  Files         168     168            
  Lines       13951   13967    +16     
=======================================
- Hits        12909   12331   -578     
- Misses       1042    1636   +594     

pytorch_lightning/accelerators/accelerator.py Outdated Show resolved Hide resolved
pytorch_lightning/trainer/trainer.py Outdated Show resolved Hide resolved
pytorch_lightning/trainer/trainer.py Outdated Show resolved Hide resolved
pytorch_lightning/trainer/trainer.py Outdated Show resolved Hide resolved
pytorch_lightning/accelerators/accelerator.py Outdated Show resolved Hide resolved
Co-authored-by: Adrian Wälchli <[email protected]>
@pep8speaks
Copy link

pep8speaks commented Jul 30, 2021

Hello @SeanNaren! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-07-30 09:29:55 UTC

Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM ! I don't see any obvious other solution either.

@mergify mergify bot added the ready PRs ready to be merged label Jul 30, 2021
@SeanNaren SeanNaren merged commit 07b7dc9 into master Jul 30, 2021
@SeanNaren SeanNaren deleted the fix/deepspeed_checkpointing_1n branch July 30, 2021 10:31
leezu pushed a commit to leezu/pytorch-lightning that referenced this pull request Sep 30, 2021
…nt (DeepSpeed Checkpointing Fix 1/n) (Lightning-AI#8627)

* Add property to delay checkpointing, move loading checkpoint file into the run function to allow deepspeed engine to be loaded

* Add a small test

* Apply suggestions from code review

Co-authored-by: Adrian Wälchli <[email protected]>

* Update pytorch_lightning/accelerators/accelerator.py

Co-authored-by: Adrian Wälchli <[email protected]>

* Address review

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: Adrian Wälchli <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party Related to a 3rd-party bug Something isn't working ready PRs ready to be merged refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants