Skip to content

Latest commit

 

History

History
91 lines (69 loc) · 3.44 KB

hooks.rst

File metadata and controls

91 lines (69 loc) · 3.44 KB

Model Hooks

There are cases when you might want to do something different at different parts of the training/validation loop. To enable a hook, simply override the method in your LightningModule and the trainer will call it at the correct time.

Contributing If there's a hook you'd like to add, simply:

  1. Fork PyTorchLightning.
  2. Add the hook to :class:`pytorch_lightning.core.hooks.ModelHooks`.
  3. Add it in the correct place in :mod:`pytorch_lightning.trainer` where it should be called.

Hooks lifecycle

Training set-up

Warning

prepare_data is only called from global_rank=0. Don't assign state (self.something), use setup for that


Training loop


Validation loop


Test loop


General hooks

.. automodule:: pytorch_lightning.core.hooks
    :noindex: