Skip to content

Commit 191fa8d

Browse files
CopilotBorda
andcommitted
Apply ruff lint suggestion - combine nested if statements
Co-authored-by: Borda <[email protected]>
1 parent 8172433 commit 191fa8d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/lightning/pytorch/loops/fit_loop.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -481,12 +481,15 @@ def on_advance_end(self) -> None:
481481

482482
trainer._logger_connector.on_epoch_end()
483483

484-
if not self.restarting and self.epoch_loop._num_ready_batches_reached():
485-
# since metric-based schedulers require access to metrics and those are not currently saved in the
486-
# checkpoint, the plateau schedulers shouldn't be updated when restarting
487-
# only update plateau schedulers if validation ran this epoch to ensure monitored metrics are available
488-
if self.epoch_loop._should_check_val_epoch():
489-
self.epoch_loop.update_lr_schedulers("epoch", update_plateau_schedulers=True)
484+
# since metric-based schedulers require access to metrics and those are not currently saved in the
485+
# checkpoint, the plateau schedulers shouldn't be updated when restarting
486+
# only update plateau schedulers if validation ran this epoch to ensure monitored metrics are available
487+
if (
488+
not self.restarting
489+
and self.epoch_loop._num_ready_batches_reached()
490+
and self.epoch_loop._should_check_val_epoch()
491+
):
492+
self.epoch_loop.update_lr_schedulers("epoch", update_plateau_schedulers=True)
490493

491494
# we manually decrease here because loggers expect that the same step is used when logging epoch-end metrics
492495
# even when the batch loop has finished

0 commit comments

Comments
 (0)