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

[feat] Add restore to base loop #8247

Merged
merged 3 commits into from
Jul 2, 2021
Merged

[feat] Add restore to base loop #8247

merged 3 commits into from
Jul 2, 2021

Conversation

tchaton
Copy link
Contributor

@tchaton tchaton commented Jul 1, 2021

What does this PR do?

This PR adds restore to base loop and is_restarting boolean.

Fixes #<issue_number>

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 update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is free to review the PR once the tests have passed.
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 🙃

@tchaton tchaton self-assigned this Jul 1, 2021
@tchaton tchaton added this to the v1.4 milestone Jul 1, 2021
@tchaton tchaton added the design Includes a design discussion label Jul 1, 2021
@codecov
Copy link

codecov bot commented Jul 1, 2021

Codecov Report

Merging #8247 (aa2395d) into master (d51b0ae) will decrease coverage by 5%.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master   #8247    +/-   ##
=======================================
- Coverage      93%     88%    -5%     
=======================================
  Files         212     212            
  Lines       13695   13710    +15     
=======================================
- Hits        12735   12068   -667     
- Misses        960    1642   +682     

@tchaton tchaton enabled auto-merge (squash) July 1, 2021 18:42
Copy link
Contributor

@ananthsub ananthsub left a comment

Choose a reason for hiding this comment

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

  • what's the difference between this and load_state_dict?
  • why do we need the is_restarting boolean?

tests/loops/test_loops.py Outdated Show resolved Hide resolved
@tchaton
Copy link
Contributor Author

tchaton commented Jul 1, 2021

  • what's the difference between this and load_state_dict?
  • why do we need the is_restarting boolean?

On restart, loading the state dict isn't enough, you would need to do multiple things depending on your loop such as fast forwarding samplers, skip progress tracking reset, etc...

Linked to this PR: #8131

Best,
T.C

pytorch_lightning/loops/base.py Outdated Show resolved Hide resolved
tests/loops/test_loops.py Show resolved Hide resolved
tests/loops/test_loops.py Outdated Show resolved Hide resolved
pytorch_lightning/loops/base.py Outdated Show resolved Hide resolved
tests/loops/test_loops.py Outdated Show resolved Hide resolved
tests/loops/test_loops.py Outdated Show resolved Hide resolved
@tchaton tchaton requested review from carmocca and ananthsub July 2, 2021 09:21
Copy link
Contributor

@kaushikb11 kaushikb11 left a comment

Choose a reason for hiding this comment

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

LGTM!

@tchaton tchaton merged commit f3e74ab into master Jul 2, 2021
@tchaton tchaton deleted the loop_restart branch July 2, 2021 12:40
Comment on lines +49 to +57
self._restarting = False

@property
def restarting(self) -> bool:
return self._restarting

@restarting.setter
def restarting(self, restarting: bool) -> None:
self._restarting = restarting
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why you added a getter/setter considering they don't do anything custom?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a strong need for them right now. Can be removed later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Includes a design discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants