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

Clarify checkpoint deprecation message #4640

Merged
merged 13 commits into from
Nov 22, 2020
10 changes: 9 additions & 1 deletion docs/source/trainer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,17 @@ You can override the default behavior by initializing the :class:`~pytorch_light
callback, and adding it to the :paramref:`~pytorch_lightning.trainer.trainer.Trainer.callbacks` list.
See :ref:`Saving and Loading Weights <weights_loading>` for how to customize checkpointing.

.. code-block:: python
Borda marked this conversation as resolved.
Show resolved Hide resolved

# Init ModelCheckpoint callback, monitoring 'val_loss'
Borda marked this conversation as resolved.
Show resolved Hide resolved
checkpoint_callback = ModelCheckpoint(monitor='val_loss')

# Add your callback to the callbacks list
trainer = Trainer(callbacks=[checkpoint_callback])


.. warning:: Passing a ModelCheckpoint instance to this argument is deprecated since
v1.1.0 and will be unsupported from v1.3.0.
v1.1.0 and will be unsupported from v1.3.0. Use `callbacks` argument instead.
Borda marked this conversation as resolved.
Show resolved Hide resolved


default_root_dir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def configure_checkpoint_callbacks(self, checkpoint_callback: Union[ModelCheckpo
# 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.",
" 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)
Expand Down
2 changes: 1 addition & 1 deletion pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def __init__(
:paramref:`~pytorch_lightning.trainer.trainer.Trainer.callbacks`. Default: ``True``.

.. warning:: Passing a ModelCheckpoint instance to this argument is deprecated since
v1.1.0 and will be unsupported from v1.3.0.
v1.1.0 and will be unsupported from v1.3.0. Use `callbacks` argument instead.
Borda marked this conversation as resolved.
Show resolved Hide resolved

check_val_every_n_epoch: Check val every n train epochs.

Expand Down