Skip to content

Commit 06ea3a0

Browse files
author
Alexander Jipa
authored
Fix resetting epoch loop restarting flag in LearningRateFinder (#19819)
1 parent 5fa32d9 commit 06ea3a0

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

src/lightning/pytorch/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
6363
- Fixed an issue causing ValueError for certain object such as TorchMetrics when dumping hyperparameters to YAML ([#19804](https://github.com/Lightning-AI/pytorch-lightning/pull/19804))
6464

6565

66+
- Fixed resetting `epoch_loop.restarting` to avoid full validation run after `LearningRateFinder` ([#19818](https://github.com/Lightning-AI/pytorch-lightning/issues/19818))
67+
68+
6669
## [2.2.2] - 2024-04-11
6770

6871
### Fixed

src/lightning/pytorch/tuner/lr_finder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ def _lr_find(
301301
trainer._checkpoint_connector.restore(ckpt_path)
302302
trainer.strategy.remove_checkpoint(ckpt_path)
303303
trainer.fit_loop.restarting = False # reset restarting flag as checkpoint restoring sets it to True
304+
trainer.fit_loop.epoch_loop.restarting = False # reset restarting flag as checkpoint restoring sets it to True
304305
trainer.fit_loop.epoch_loop.val_loop._combined_loader = None
305306

306307
return lr_finder

tests/tests_pytorch/tuner/test_lr_finder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ def lr_find(self, trainer, pl_module) -> None:
434434
super().lr_find(trainer, pl_module)
435435
pl_module._expected_max_steps = None
436436
assert not trainer.fit_loop.restarting
437+
assert not trainer.fit_loop.epoch_loop.restarting
437438

438439
def on_train_epoch_start(self, trainer, pl_module):
439440
if trainer.current_epoch in self.milestones or trainer.current_epoch == 0:

0 commit comments

Comments
 (0)