medkit.training.callbacks
=========================

.. py:module:: medkit.training.callbacks


Classes
-------

.. autoapisummary::

   medkit.training.callbacks.TrainerCallback
   medkit.training.callbacks.DefaultPrinterCallback


Module Contents
---------------

.. py:class:: TrainerCallback

   
   A TrainerCallback is the base class for trainer callbacks.
















   ..
       !! processed by numpydoc !!

   .. py:method:: on_train_begin(config: medkit.training.trainer_config.TrainerConfig)

      
      Event called at the beginning of training.
















      ..
          !! processed by numpydoc !!


   .. py:method:: on_train_end()

      
      Event called at the end of training.
















      ..
          !! processed by numpydoc !!


   .. py:method:: on_epoch_begin(epoch: int)

      
      Event called at the beginning of an epoch.
















      ..
          !! processed by numpydoc !!


   .. py:method:: on_epoch_end(metrics: dict[str, float], epoch: int, epoch_time: float)

      
      Event called at the end of an epoch.
















      ..
          !! processed by numpydoc !!


   .. py:method:: on_step_begin(step_idx: int, nb_batches: int, phase: str)

      
      Event called at the beginning of a step in training.
















      ..
          !! processed by numpydoc !!


   .. py:method:: on_step_end(step_idx: int, nb_batches: int, phase: str)

      
      Event called at the end of a step in training.
















      ..
          !! processed by numpydoc !!


   .. py:method:: on_save(checkpoint_dir: str)

      
      Event called on saving a checkpoint.
















      ..
          !! processed by numpydoc !!


.. py:class:: DefaultPrinterCallback

   Bases: :py:obj:`TrainerCallback`


   
   Default implementation of :class:`~.training.TrainerCallback`.
















   ..
       !! processed by numpydoc !!

   .. py:method:: on_train_begin(config)

      
      Event called at the beginning of training.
















      ..
          !! processed by numpydoc !!


   .. py:method:: on_epoch_end(metrics, epoch, epoch_duration)

      
      Event called at the end of an epoch.
















      ..
          !! processed by numpydoc !!


   .. py:method:: on_train_end()

      
      Event called at the end of training.
















      ..
          !! processed by numpydoc !!


   .. py:method:: on_save(checkpoint_dir)

      
      Event called on saving a checkpoint.
















      ..
          !! processed by numpydoc !!


   .. py:method:: on_step_begin(step_idx: int, nb_batches: int, phase: str)

      
      Event called at the beginning of a step in training.
















      ..
          !! processed by numpydoc !!


   .. py:method:: on_step_end(step_idx: int, nb_batches: int, phase: str)

      
      Event called at the end of a step in training.
















      ..
          !! processed by numpydoc !!


