medkit.training.trainer_config
==============================

.. py:module:: medkit.training.trainer_config


Classes
-------

.. autoapisummary::

   medkit.training.trainer_config.TrainerConfig


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

.. py:class:: TrainerConfig

   
   Trainer configuration.


   :Parameters:

       **output_dir:**
           The output directory where the checkpoint will be saved.

       **learning_rate:**
           The initial learning rate.

       **nb_training_epochs:**
           Total number of training/evaluation epochs to do.

       **dataloader_nb_workers:**
           Number of subprocess for the data loading. The default value is 0,
           the data will be loaded in the main process. If this config is for a
           HuggingFace model, do not change this value.

       **batch_size:**
           Number of samples per batch to load.

       **seed:**
           Random seed to use with PyTorch and numpy. It should be set to ensure
           reproducibility between experiments.

       **gradient_accumulation_steps:**
           Number of steps to accumulate gradient before performing an optimization step.

       **do_metrics_in_training:**
           By default, only the custom metrics are computed using `eval_data`. If set to
           True, the custom metrics are computed also using `training_data`.

       **metric_to_track_lr:**
           Name of the eval metric to be tracked for updating the learning rate.
           By default, eval `loss` is tracked.

       **checkpoint_period:**
           How often, in number of epochs, should we save a checkpoint. Use 0 to
           only save last checkpoint.

       **checkpoint_metric:**
           Name of the eval metric to be tracked for selecting the best checkpoint.
           By default, eval `loss` is tracked.

       **minimize_checkpoint_metric:**
           If `True`, the checkpoint with the lowest metric value will be selected
           as best, otherwise the checkpoint with the highest metric value.














   ..
       !! processed by numpydoc !!

   .. py:attribute:: output_dir
      :type:  str


   .. py:attribute:: learning_rate
      :type:  float
      :value: 1e-05



   .. py:attribute:: nb_training_epochs
      :type:  int
      :value: 3



   .. py:attribute:: dataloader_nb_workers
      :type:  int
      :value: 0



   .. py:attribute:: batch_size
      :type:  int
      :value: 1



   .. py:attribute:: seed
      :type:  int | None
      :value: None



   .. py:attribute:: gradient_accumulation_steps
      :type:  int
      :value: 1



   .. py:attribute:: do_metrics_in_training
      :type:  bool
      :value: False



   .. py:attribute:: metric_to_track_lr
      :type:  str
      :value: 'loss'



   .. py:attribute:: checkpoint_period
      :type:  int
      :value: 1



   .. py:attribute:: checkpoint_metric
      :type:  str
      :value: 'loss'



   .. py:attribute:: minimize_checkpoint_metric
      :type:  bool
      :value: True



   .. py:method:: to_dict() -> dict[str, Any]


