Remove type error handling in _configure_checkpoint_callbacks (#9823)

* remove type error handling in _configure_checkpoint_callbacks

* rm test

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
This commit is contained in:
Danielle Pintz 2021-10-12 13:13:02 -07:00 committed by GitHub
parent dc27c72dc1
commit dd6d797e0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 15 deletions

View File

@ -150,15 +150,6 @@ class CallbackConnector:
# if both are set then checkpoint only if both are True
enable_checkpointing = checkpoint_callback and enable_checkpointing
# TODO: Remove this error in v1.5 so we rely purely on the type signature
if not isinstance(enable_checkpointing, bool):
error_msg = (
"Invalid type provided for `enable_checkpointing`: "
f"Expected bool but received {type(enable_checkpointing)}."
)
if isinstance(enable_checkpointing, Callback):
error_msg += " Pass callback instances to the `callbacks` argument in the Trainer constructor instead."
raise MisconfigurationException(error_msg)
if self._trainer_has_checkpoint_callbacks() and enable_checkpointing is False:
raise MisconfigurationException(
"Trainer was configured with `enable_checkpointing=False`"

View File

@ -1187,12 +1187,6 @@ def test_model_checkpoint_mode_options():
ModelCheckpoint(mode="unknown_option")
def test_trainer_checkpoint_callback_bool(tmpdir):
mc = ModelCheckpoint(dirpath=tmpdir)
with pytest.raises(MisconfigurationException, match="Invalid type provided for `enable_checkpointing`"):
Trainer(enable_checkpointing=mc)
def test_check_val_every_n_epochs_top_k_integration(tmpdir):
model = BoringModel()
mc = ModelCheckpoint(dirpath=tmpdir, monitor="epoch", save_top_k=-1, filename="{epoch}")