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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

update documentation for callbacks #4253

Merged
merged 1 commit into from
Oct 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
182 changes: 112 additions & 70 deletions docs/source/callbacks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,170 +134,212 @@ The following are best practices when using/designing callbacks.
Available Callback hooks
------------------------

on_epoch_start
setup
^^^^^

.. automethod:: pytorch_lightning.callbacks.Callback.setup
:noindex:

teardown
^^^^^^^^

.. automethod:: pytorch_lightning.callbacks.Callback.teardown
:noindex:

on_init_start
^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_epoch_start
.. automethod:: pytorch_lightning.callbacks.Callback.on_init_start
:noindex:

on_epoch_end
^^^^^^^^^^^^
on_init_end
^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_epoch_end
.. automethod:: pytorch_lightning.callbacks.Callback.on_init_end
:noindex:

on_fit_start
^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_fit_start
.. automethod:: pytorch_lightning.callbacks.Callback.on_save_checkpoint
:noindex:

on_fit_end
^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_fit_end
.. automethod:: pytorch_lightning.callbacks.Callback.on_fit_end
:noindex:

on_save_checkpoint
on_sanity_check_start
^^^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.callbacks.Callback.on_sanity_check_start
:noindex:

on_sanity_check_end
^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.callbacks.Callback.on_sanity_check_end
:noindex:

on_train_batch_start
^^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.callbacks.Callback.on_train_batch_start
:noindex:

on_train_batch_end
^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.CheckpointHooks.on_save_checkpoint
.. automethod:: pytorch_lightning.callbacks.Callback.on_train_batch_end
:noindex:

on_load_checkpoint
on_train_epoch_start
^^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.callbacks.Callback.on_train_epoch_start
:noindex:

on_train_epoch_end
^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.CheckpointHooks.on_load_checkpoint
.. automethod:: pytorch_lightning.callbacks.Callback.on_train_epoch_end
:noindex:

on_pretrain_routine_start
on_validation_epoch_start
^^^^^^^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_pretrain_routine_start
.. automethod:: pytorch_lightning.callbacks.Callback.on_validation_epoch_start
:noindex:

on_pretrain_routine_end
on_validation_epoch_end
^^^^^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_pretrain_routine_end
.. automethod:: pytorch_lightning.callbacks.Callback.on_validation_epoch_end
:noindex:

on_test_batch_start
on_test_epoch_start
^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_test_batch_start
.. automethod:: pytorch_lightning.callbacks.Callback.on_test_epoch_start
:noindex:

on_test_batch_end
on_test_epoch_end
^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_test_batch_end
.. automethod:: pytorch_lightning.callbacks.Callback.on_test_epoch_end
:noindex:

on_test_epoch_start
^^^^^^^^^^^^^^^^^^^
on_epoch_start
^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_test_epoch_start
.. automethod:: pytorch_lightning.callbacks.Callback.on_epoch_start
:noindex:

on_test_epoch_end
^^^^^^^^^^^^^^^^^
on_epoch_end
^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_test_epoch_end
.. automethod:: pytorch_lightning.callbacks.Callback.on_epoch_end
:noindex:

on_test_model_train
^^^^^^^^^^^^^^^^^^^
on_batch_start
^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_test_model_train
.. automethod:: pytorch_lightning.callbacks.Callback.on_batch_start
:noindex:

on_test_model_eval
^^^^^^^^^^^^^^^^^^
on_validation_batch_start
^^^^^^^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_test_model_eval
.. automethod:: pytorch_lightning.callbacks.Callback.on_validation_batch_start
:noindex:

on_train_batch_start
^^^^^^^^^^^^^^^^^^^^
on_validation_batch_end
^^^^^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_train_batch_start
.. automethod:: pytorch_lightning.callbacks.Callback.on_validation_batch_end
:noindex:

on_train_batch_end
^^^^^^^^^^^^^^^^^^
on_test_batch_start
^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_train_batch_end
.. automethod:: pytorch_lightning.callbacks.Callback.on_test_batch_start
:noindex:

on_train_start
^^^^^^^^^^^^^^
on_test_batch_end
^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_train_start
.. automethod:: pytorch_lightning.callbacks.Callback.on_test_batch_end
:noindex:

on_train_end
on_batch_end
^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_train_end
.. automethod:: pytorch_lightning.callbacks.Callback.on_batch_end
:noindex:

on_train_epoch_start
^^^^^^^^^^^^^^^^^^^^
on_train_start
^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_train_epoch_start
.. automethod:: pytorch_lightning.callbacks.Callback.on_train_start
:noindex:

on_train_epoch_end
^^^^^^^^^^^^^^^^^^
on_train_end
^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_train_epoch_end
.. automethod:: pytorch_lightning.callbacks.Callback.on_train_end
:noindex:

on_validation_batch_start
on_pretrain_routine_start
^^^^^^^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_validation_batch_start
.. automethod:: pytorch_lightning.callbacks.Callback.on_pretrain_routine_start
:noindex:

on_validation_batch_end
on_pretrain_routine_end
^^^^^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_validation_batch_end
.. automethod:: pytorch_lightning.callbacks.Callback.on_pretrain_routine_end
:noindex:

on_validation_epoch_start
^^^^^^^^^^^^^^^^^^^^^^^^^
on_validation_start
^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_validation_epoch_start
.. automethod:: pytorch_lightning.callbacks.Callback.on_validation_start
:noindex:

on_validation_epoch_end
^^^^^^^^^^^^^^^^^^^^^^^
on_validation_end
^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_validation_epoch_end
.. automethod:: pytorch_lightning.callbacks.Callback.on_validation_end
:noindex:

on_validation_model_eval
^^^^^^^^^^^^^^^^^^^^^^^^
on_test_start
^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_validation_model_eval
.. automethod:: pytorch_lightning.callbacks.Callback.on_test_start
:noindex:

on_validation_model_train
^^^^^^^^^^^^^^^^^^^^^^^^^
on_test_end
^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.on_validation_model_train
.. automethod:: pytorch_lightning.callbacks.Callback.on_test_end
:noindex:

setup
^^^^^
on_keyboard_interrupt
^^^^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.setup
.. automethod:: pytorch_lightning.callbacks.Callback.on_keyboard_interrupt
:noindex:

teardown
^^^^^^^^
on_save_checkpoint
^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.callbacks.Callback.on_save_checkpoint
:noindex:

on_load_checkpoint
^^^^^^^^^^^^^^^^^^

.. automethod:: pytorch_lightning.core.hooks.ModelHooks.teardown
.. automethod:: pytorch_lightning.callbacks.Callback.on_load_checkpoint
:noindex: