Skip to content

Commit

Permalink
Merge 9332e5a into 46617d9
Browse files Browse the repository at this point in the history
  • Loading branch information
carmocca authored Feb 24, 2021
2 parents 46617d9 + 9332e5a commit a286eb4
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 24 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed support for passing a bool value to `profiler` argument of Trainer ([#6164](https://github.com/PyTorchLightning/pytorch-lightning/pull/6164))


- Removed passing a `ModelCheckpoint` instance to `Trainer(checkpoint_callback)` ([#6166](https://github.com/PyTorchLightning/pytorch-lightning/pull/6166))


- Removed deprecated Trainer argument `enable_pl_optimizer` and `automatic_optimization` ([#6163](https://github.com/PyTorchLightning/pytorch-lightning/pull/6163))


Expand Down
11 changes: 1 addition & 10 deletions pytorch_lightning/trainer/connectors/callback_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from pytorch_lightning.callbacks import Callback, ModelCheckpoint, ProgressBar, ProgressBarBase
from pytorch_lightning.core.lightning import LightningModule
from pytorch_lightning.utilities import rank_zero_info, rank_zero_warn
from pytorch_lightning.utilities import rank_zero_info
from pytorch_lightning.utilities.exceptions import MisconfigurationException


Expand Down Expand Up @@ -63,15 +63,6 @@ def on_trainer_init(
self.trainer.callbacks = self._reorder_callbacks(self.trainer.callbacks)

def configure_checkpoint_callbacks(self, checkpoint_callback: Union[ModelCheckpoint, bool]):
if isinstance(checkpoint_callback, ModelCheckpoint):
# TODO: deprecated, remove this block in v1.3.0
rank_zero_warn(
"Passing a ModelCheckpoint instance to Trainer(checkpoint_callbacks=...)"
" is deprecated since v1.1 and will no longer be supported in v1.3."
" Use `callbacks` argument instead.", DeprecationWarning
)
self.trainer.callbacks.append(checkpoint_callback)

if self._trainer_has_checkpoint_callbacks() and checkpoint_callback is False:
raise MisconfigurationException(
"Trainer was configured with checkpoint_callback=False but found ModelCheckpoint"
Expand Down
3 changes: 0 additions & 3 deletions pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ def __init__(
It will configure a default ModelCheckpoint callback if there is no user-defined ModelCheckpoint in
:paramref:`~pytorch_lightning.trainer.trainer.Trainer.callbacks`.
.. warning:: Passing a ModelCheckpoint instance to this argument is deprecated since
v1.1 and will be unsupported from v1.3. Use `callbacks` argument instead.
check_val_every_n_epoch: Check val every n train epochs.
default_root_dir: Default path for logs and weights when no logger/ckpt_callback passed.
Expand Down
10 changes: 0 additions & 10 deletions tests/checkpointing/test_model_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,16 +899,6 @@ def test_configure_model_checkpoint(tmpdir):
assert trainer.checkpoint_callback == callback1
assert trainer.checkpoint_callbacks == [callback1, callback2]

with pytest.warns(DeprecationWarning, match='will no longer be supported in v1.3'):
trainer = Trainer(checkpoint_callback=callback1, **kwargs)
assert [c for c in trainer.callbacks if isinstance(c, ModelCheckpoint)] == [callback1]
assert trainer.checkpoint_callback == callback1

with pytest.warns(DeprecationWarning, match="will no longer be supported in v1.3"):
trainer = Trainer(checkpoint_callback=callback1, callbacks=[callback2], **kwargs)
assert trainer.checkpoint_callback == callback2
assert trainer.checkpoint_callbacks == [callback2, callback1]

with pytest.raises(MisconfigurationException, match="checkpoint_callback=False but found ModelCheckpoint"):
Trainer(checkpoint_callback=False, callbacks=[callback1], **kwargs)

Expand Down
1 change: 0 additions & 1 deletion tests/deprecated_api/test_remove_1-3.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


def test_v1_3_0_deprecated_arguments(tmpdir):

with pytest.deprecated_call(match="The setter for self.hparams in LightningModule is deprecated"):

class DeprecatedHparamsModel(LightningModule):
Expand Down

0 comments on commit a286eb4

Please sign in to comment.