Skip to content

Commit 8bbb6d5

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 014d3da commit 8bbb6d5

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/lightning/pytorch/callbacks/early_stopping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class EarlyStopping(Callback):
7979
>>> from pytorch_lightning.callbacks import EarlyStopping
8080
>>> early_stopping = EarlyStopping('val_loss')
8181
>>> trainer = Trainer(callbacks=[early_stopping])
82-
82+
8383
>>> # Start monitoring only from epoch 5
8484
>>> early_stopping = EarlyStopping('val_loss', start_from_epoch=5)
8585
>>> trainer = Trainer(callbacks=[early_stopping])

tests/tests_pytorch/callbacks/test_early_stopping.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,15 +511,14 @@ def test_early_stopping_start_from_epoch(tmp_path):
511511
"""Test that early stopping checks only activate after start_from_epoch."""
512512
losses = [6, 5, 4, 3, 2, 1] # decreasing losses
513513
start_from_epoch = 3
514-
expected_stop_epoch = None # Should not stop early
515514

516515
class CurrentModel(BoringModel):
517516
def on_validation_epoch_end(self):
518517
val_loss = losses[self.current_epoch]
519518
self.log("val_loss", val_loss)
520519

521520
model = CurrentModel()
522-
521+
523522
# Mock the _run_early_stopping_check method to verify when it's called
524523
with mock.patch("lightning.pytorch.callbacks.early_stopping.EarlyStopping._evaluate_stopping_criteria") as es_mock:
525524
es_mock.return_value = (False, "")

0 commit comments

Comments
 (0)