Skip to content

Conversation

Sohaib-Ahmed21
Copy link
Contributor

@Sohaib-Ahmed21 Sohaib-Ahmed21 commented Aug 14, 2025

What does this PR do?

  • Adds an option to run validation by time (e.g., every 15 seconds) via val_check_interval (string, timedelta, or dict).
  • The timer starts at fit, triggers validation when elapsed, respects check_val_every_n_epoch, and resets after each validation.
  • In time mode we skip epoch-end checkpoints unless save_on_train_epoch_end is set to True.
  • Existing int/float behavior stays the same.
  • Docs updated and tested by building them.
  • Tests updated.

Fixes #13324

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
    yes
  • 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)
    Yes
  • Did you write any new necessary tests? (not for typos and docs)
  • Yes
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
    No breaking changes introduced
  • 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--21071.org.readthedocs.build/en/21071/

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Aug 14, 2025
@github-actions github-actions bot added the docs Documentation related label Aug 30, 2025
@Sohaib-Ahmed21 Sohaib-Ahmed21 force-pushed the feature/13324_validation-interval branch from 9af43d7 to 64eb3c7 Compare August 30, 2025 19:29
@Sohaib-Ahmed21 Sohaib-Ahmed21 marked this pull request as ready for review August 30, 2025 20:38
Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

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

I like the extension and I think it valuable use-case for continues training, but leaving the decision to @lantiga

Copy link
Collaborator

@lantiga lantiga left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution @Sohaib-Ahmed21

Goes without saying, runs become non reproducible, as in:

  • it's not possible to re-run and have validation happen at the same intervals
  • interrupting a run and resuming will not lead to the same validation curves

I would make sure users understand this, so in case they use validation loss as a criterion for scheduling or stopping they will be fully aware.

@Borda Borda merged commit 1fc077b into Lightning-AI:master Sep 4, 2025
90 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation related pl Generic label for PyTorch Lightning package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validation takes place every N time
4 participants