Remove deprecated `disable_validation` property from Trainer (#10450)

This commit is contained in:
Kaushik B 2021-11-16 00:12:00 +05:30 committed by GitHub
parent 01cf7a2ac5
commit ae71284627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 15 deletions

View File

@ -127,8 +127,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed deprecated `Trainer.train_loop` property in favor of `Trainer.fit_loop` ([#10482](https://github.com/PyTorchLightning/pytorch-lightning/pull/10482)) - Removed deprecated `Trainer.train_loop` property in favor of `Trainer.fit_loop` ([#10482](https://github.com/PyTorchLightning/pytorch-lightning/pull/10482))
- Removed deprecated `disable_validation` property from Trainer ([#10450](https://github.com/PyTorchLightning/pytorch-lightning/pull/10450))
- Removed deprecated `CheckpointConnector.hpc_load` property in favor of `CheckpointConnector.restore` ([#10525](https://github.com/PyTorchLightning/pytorch-lightning/pull/10525)) - Removed deprecated `CheckpointConnector.hpc_load` property in favor of `CheckpointConnector.restore` ([#10525](https://github.com/PyTorchLightning/pytorch-lightning/pull/10525))
### Fixed ### Fixed
- Fixed an issue where class or init-only variables of dataclasses were passed to the dataclass constructor in `utilities.apply_to_collection` ([#9702](https://github.com/PyTorchLightning/pytorch-lightning/issues/9702)) - Fixed an issue where class or init-only variables of dataclasses were passed to the dataclass constructor in `utilities.apply_to_collection` ([#9702](https://github.com/PyTorchLightning/pytorch-lightning/issues/9702))

View File

@ -1783,15 +1783,6 @@ class Trainer(
n_epochs = self.reload_dataloaders_every_n_epochs n_epochs = self.reload_dataloaders_every_n_epochs
return n_epochs and (not self.current_epoch % n_epochs) return n_epochs and (not self.current_epoch % n_epochs)
@property
def disable_validation(self) -> bool:
"""Check if validation is disabled during training."""
rank_zero_deprecation(
"`trainer.disable_validation` is deprecated in v1.4 and will be removed in v1.6."
" Use `not trainer.enable_validation` instead."
)
return not self.enable_validation
@property @property
def enable_validation(self) -> bool: def enable_validation(self) -> bool:
"""Check if we should run validation during training.""" """Check if we should run validation during training."""

View File

@ -47,9 +47,3 @@ def test_v1_6_0_reload_dataloaders_every_epoch(tmpdir):
[call.val_dataloader()] + [call.train_dataloader(), call.val_dataloader()] * 3 + [call.test_dataloader()] [call.val_dataloader()] + [call.train_dataloader(), call.val_dataloader()] * 3 + [call.test_dataloader()]
) )
assert tracker.mock_calls == expected_sequence assert tracker.mock_calls == expected_sequence
def test_v1_6_0_deprecated_disable_validation():
trainer = Trainer()
with pytest.deprecated_call(match="disable_validation` is deprecated in v1.4"):
_ = trainer.disable_validation