Skip to content

Commit bb881a2

Browse files
committed
fit_loop.min_epochs cannot be None
1 parent cfc69b7 commit bb881a2

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/pytorch_lightning/loops/utilities.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def _extract_hiddens(training_step_output: STEP_OUTPUT, truncated_bptt_steps: in
6969

7070

7171
def _parse_loop_limits(
72-
min_steps: Optional[int], max_steps: int, min_epochs: Optional[int], max_epochs: int, trainer: "pl.Trainer"
72+
min_steps: Optional[int], max_steps: int, min_epochs: int, max_epochs: int, trainer: "pl.Trainer"
7373
) -> Tuple[int, int]:
7474
"""This utility computes the default values for the minimum and maximum number of steps and epochs given the
7575
values the user has selected.
@@ -95,14 +95,10 @@ def _parse_loop_limits(
9595
else:
9696
max_epochs = -1
9797

98-
if min_epochs is None and min_steps is not None:
98+
if min_epochs == 0 and min_steps is not None:
9999
# setting this allows FitLoop.done to re-evaluate should_stop when it gets triggered `on_fit_start`
100100
min_epochs = 1
101101

102-
if min_epochs is None:
103-
# the default value is 0 so no training will be done when should_stop is triggered `on_fit_start`
104-
min_epochs = 0
105-
106102
return min_epochs, max_epochs
107103

108104

0 commit comments

Comments
 (0)