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

Add logging messages to notify when FitLoop stopping conditions are met #9749

Merged

Conversation

jinyoung-lim
Copy link
Contributor

@jinyoung-lim jinyoung-lim commented Sep 29, 2021

What does this PR do?

Fix for fit_loop silently stopping without a warning when trainer's early stopping condition is not met but max_epochs or max_steps are met.

This is to raise a caution to users who might be calling Trainer.fit() multiple times and earlier fitting loop meeting max_epochs or max_steps condition so stopping. Then the later fit would start and silently stop as max_epochs or max_steps are met.

Fixes #9636

Does your PR introduce any breaking changes? If yes, please list them.

None

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 🙃

@mergify mergify bot removed the has conflicts label Sep 29, 2021
@jinyoung-lim
Copy link
Contributor Author

Cannot add labels and such as I do not have permission (not a contributor yet).

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 !

pytorch_lightning/loops/fit_loop.py Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@mergify mergify bot removed the has conflicts label Oct 12, 2021
@carmocca carmocca added the community This PR is from the community label Jul 19, 2022
@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Jul 20, 2022
@mergify mergify bot removed the has conflicts label Jul 20, 2022
@mergify mergify bot added the ready PRs ready to be merged label Jul 20, 2022
@carmocca carmocca requested a review from rohitgr7 July 20, 2022 23:30
@carmocca carmocca changed the title Added a warning and related unit tests for non-early-stopping condition but when max steps or epochs are met. Add logging messages to notify when FitLoop stopping conditions are met Jul 20, 2022
src/pytorch_lightning/loops/fit_loop.py Outdated Show resolved Hide resolved
src/pytorch_lightning/loops/fit_loop.py Show resolved Hide resolved
@carmocca carmocca enabled auto-merge (squash) July 22, 2022 15:50
@codecov
Copy link

codecov bot commented Jul 22, 2022

Codecov Report

Merging #9749 (7cfcd4e) into master (9a240b6) will increase coverage by 28%.
The diff coverage is 100%.

@@           Coverage Diff            @@
##           master   #9749     +/-   ##
========================================
+ Coverage      49%     76%    +28%     
========================================
  Files         327     327             
  Lines       25492   25549     +57     
========================================
+ Hits        12452   19508   +7056     
+ Misses      13040    6041   -6999     

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 feature Is an improvement or enhancement loops Related to the Loop API pl Generic label for PyTorch Lightning package ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trainer.fit() multiple times
5 participants