Skip to content

Bugfix/19990 log when done#21705

Open
chillerb wants to merge 2 commits into
Lightning-AI:masterfrom
chillerb:bugfix/19990_log_when_done
Open

Bugfix/19990 log when done#21705
chillerb wants to merge 2 commits into
Lightning-AI:masterfrom
chillerb:bugfix/19990_log_when_done

Conversation

@chillerb
Copy link
Copy Markdown

@chillerb chillerb commented May 8, 2026

What does this PR do?

The _LoggerConnector's should_update_logs method checks, if the trainer should_stop to log one final time. However, for _FitLoop type loops, this results in a logic flaw, in combination with a EarlyStopping like callback, and having min_epochs or min_steps set on the Trainer object. Since the trainer's should_stop is set to True by the callback, should_update_logs now returns True - but the _FitLoop has its own done logic, which returns False unless min_epochs or min_steps has been reached, resulting in an effective log_every_n_steps of 1.

Fixes #19990

image

Changes:

  • logging should now behave differently if training with EarlyStopping type callbacks and requiring min_epochs or min_steps
Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs). See EarlyStopping override disrupts wandb logging frequency #19990
  • 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? (I hope so)
  • 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--21705.org.readthedocs.build/en/21705/

@github-actions github-actions Bot added the pl Generic label for PyTorch Lightning package label May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pl Generic label for PyTorch Lightning package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EarlyStopping override disrupts wandb logging frequency

1 participant