Skip to content

Commit 98844bf

Browse files
Fix typo in engine run method (#2671)
* Fix typo * Fix a tiny typo
1 parent 32ba9cd commit 98844bf

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

ignite/engine/engine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,8 @@ def switch_batch(engine):
671671
if max_epochs is not None:
672672
if max_epochs < self.state.epoch:
673673
raise ValueError(
674-
"Argument max_epochs should be larger than the start epoch "
675-
f"defined in the state: {max_epochs} vs {self.state.epoch}. "
674+
"Argument max_epochs should be greater than or equal to the start "
675+
f"epoch defined in the state: {max_epochs} vs {self.state.epoch}. "
676676
"Please, set engine.state.max_epochs = None "
677677
"before calling engine.run() in order to restart the training from the beginning."
678678
)

tests/ignite/engine/test_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ def check_iter_epoch(first_epoch_iter):
12071207
assert engine.state.iteration == 7 * real_epoch_length
12081208

12091209
# error
1210-
with pytest.raises(ValueError, match="Argument max_epochs should be larger than the start epoch"):
1210+
with pytest.raises(ValueError, match="Argument max_epochs should be greater than or equal to the start epoch"):
12111211
engine.run(data, max_epochs=4, epoch_length=epoch_length)
12121212

12131213
# restart from 0 to 7 (As state.epoch == max_epochs(=7),

tests/ignite/engine/test_engine_state_dict.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def test_load_state_dict_with_params_overriding_integration():
144144
assert state.iteration == state_dict["epoch_length"] * new_max_epochs
145145
assert state.epoch == new_max_epochs
146146

147-
with pytest.raises(ValueError, match=r"Argument max_epochs should be larger than the start epoch"):
147+
with pytest.raises(ValueError, match=r"Argument max_epochs should be greater than or equal to the start epoch"):
148148
engine.load_state_dict(state_dict)
149149
engine.run(data, max_epochs=3)
150150

@@ -270,7 +270,7 @@ def test_restart_training():
270270
state = engine.run(data, max_epochs=5)
271271
with pytest.raises(
272272
ValueError,
273-
match=r"Argument max_epochs should be larger than the start epoch defined in the state: 2 vs 5. "
273+
match=r"Argument max_epochs should be greater than or equal to the start epoch defined in the state: 2 vs 5. "
274274
r"Please, .+ "
275275
r"before calling engine.run\(\) in order to restart the training from the beginning.",
276276
):

0 commit comments

Comments
 (0)