Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in engine run method #2671

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ignite/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,8 @@ def switch_batch(engine):
if max_epochs is not None:
if max_epochs < self.state.epoch:
raise ValueError(
"Argument max_epochs should be larger than the start epoch "
f"defined in the state: {max_epochs} vs {self.state.epoch}. "
"Argument max_epochs should be greater than or equal to the start "
f"epoch defined in the state: {max_epochs} vs {self.state.epoch}. "
"Please, set engine.state.max_epochs = None "
"before calling engine.run() in order to restart the training from the beginning."
)
Expand Down
2 changes: 1 addition & 1 deletion tests/ignite/engine/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ def check_iter_epoch(first_epoch_iter):
assert engine.state.iteration == 7 * real_epoch_length

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

# restart from 0 to 7 (As state.epoch == max_epochs(=7),
Expand Down
4 changes: 2 additions & 2 deletions tests/ignite/engine/test_engine_state_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def test_load_state_dict_with_params_overriding_integration():
assert state.iteration == state_dict["epoch_length"] * new_max_epochs
assert state.epoch == new_max_epochs

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

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