Lightning-AI / Lightning-AI/pytorch-lightning

Add `start_from_epoch` parameter to `EarlyStopping`

Open
#16,881 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

callback: early stopping feature
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

### Description & Motivation

It would be great if EarlyStopping callback could have an additional parameter, start_from_epoch/star_from_iteration.

The parameter would represent the number of epochs/iterations to wait before starting to monitor improvement.
This would allow a warm-up period (in which no improvement is expected) and thus training will not be stopped in this period, and the patience can still be as short as the user would want it to be.

Keras has this feature: https://keras.io/api/callbacks/early_stopping/

### Pitch

_No response_

### Alternatives

_No response_

### Additional context

_No response_

cc @borda @carmocca @awaelchli

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the EarlyStopping callback implementation and its existing tests. Compare the requested start_from_epoch or start_from_iteration behavior with the current monitoring and patience flow, then verify that monitoring is skipped during the warm-up period while existing stopping behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.