@@ -908,10 +908,8 @@ def validation_epoch_end(self, *args, **kwargs):
908
908
assert model .validation_epoch_end_invoked , "did not run `validation_epoch_end` with `fast_dev_run=True`"
909
909
910
910
911
- def test_irrevelance_between_non_default_overfit_batches_and_non_default_batch_limitation (tmpdir ):
912
- """Verify that when `overfit_batches` > 0, `limit_train/val/test_batches` won't be resetted to
913
- `overfit_batches` unless they are of default value."""
914
- """Assure that non-default value of `limit_train/val/test_batches` won't be reset by `DebuggingConnector` when `overfit_batches` > 0"""
911
+ def test_disable_validation_when_overfit_batches_larger_than_zero (tmpdir ):
912
+ """Verify that when `overfit_batches` > 0, there will be no validation"""
915
913
916
914
class CurrentModel (EvalModelTemplate ):
917
915
@@ -942,28 +940,11 @@ def validation_epoch_end(self, *args, **kwargs):
942
940
trainer = Trainer (** trainer_options )
943
941
trainer .fit (model )
944
942
945
- # check that limit_xxx_batches won't be reset when they are non-default value and overfit_batches > 0
946
943
assert trainer .state .finished , f"Training failed with { trainer .state } "
947
944
assert trainer .current_epoch == 1
948
945
assert trainer .limit_train_batches == 1
949
- assert trainer .limit_val_batches == 0.0
950
- assert not model .validation_step_invoked , "`validation_step` should not run when `limit_val_batches=0`"
951
- assert not model .validation_epoch_end_invoked , "`validation_epoch_end` should not run when `limit_val_batches=0`"
952
-
953
- # check that limit_xxx_batches will be reset when they are default value and overfit_batches > 0
954
- model = CurrentModel (** hparams )
955
- trainer_options .update (overfit_batches = 2 )
956
- trainer_options .update (limit_train_batches = 1.0 )
957
- trainer_options .update (limit_val_batches = 1.0 )
958
- trainer = Trainer (** trainer_options )
959
- trainer .fit (model )
960
-
961
- assert trainer .state .finished , f"Training failed with { trainer .state } "
962
- assert trainer .current_epoch == 1
963
- assert trainer .limit_train_batches == 2
964
- assert trainer .limit_val_batches == 2
965
- assert model .validation_step_invoked , "did not run `validation_step` with `fast_dev_run=True`"
966
- assert model .validation_epoch_end_invoked , "did not run `validation_epoch_end` with `fast_dev_run=True`"
946
+ assert not model .validation_step_invoked , "`validation_step` should not run when `overfit_batches>0`"
947
+ assert not model .validation_epoch_end_invoked , "`validation_step` should not run when `overfit_batches>0`"
967
948
968
949
969
950
@mock .patch ("torch.Tensor.backward" )
0 commit comments