trainerERA5_v1
==============

.. py:module:: trainerERA5_v1


Attributes
----------

.. autoapisummary::

   trainerERA5_v1.logger


Classes
-------

.. autoapisummary::

   trainerERA5_v1.TOADataLoader
   trainerERA5_v1.Trainer


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

.. py:data:: logger

.. py:class:: TOADataLoader(conf)

   .. py:attribute:: TOA


   .. py:attribute:: times_b
      :value: None



   .. py:attribute:: days_of_year


   .. py:attribute:: hours_of_day


   .. py:method:: __call__(datetime_input)


.. py:class:: Trainer(model: torch.nn.Module, rank: int)

   Bases: :py:obj:`credit.trainers.base_trainer.BaseTrainer`


   Helper class that provides a standard way to create an ABC using
   inheritance.


   .. py:method:: train_one_epoch(epoch: int, conf: Dict[str, Any], trainloader: torch.utils.data.DataLoader, optimizer: torch.optim.Optimizer, criterion: torch.nn.Module, scaler: torch.cuda.amp.GradScaler, scheduler: torch.optim.lr_scheduler._LRScheduler, metrics: Dict[str, Any]) -> Dict[str, float]

      Train the model for one epoch.

      :param epoch: The current epoch number.
      :type epoch: int
      :param conf: The configuration dictionary.
      :type conf: Dict[str, Any]
      :param trainloader: The training data loader.
      :type trainloader: torch.utils.data.DataLoader
      :param optimizer: The optimizer.
      :type optimizer: torch.optim.Optimizer
      :param criterion: The loss function.
      :type criterion: torch.nn.Module
      :param scaler: The gradient scaler for mixed precision training.
      :type scaler: torch.cuda.amp.GradScaler
      :param scheduler: The learning rate scheduler.
      :type scheduler: torch.optim.lr_scheduler.LRScheduler
      :param metrics: The metrics to track during training.
      :type metrics: Dict[str, Any]

      :returns: A dictionary containing the training results.
      :rtype: Dict[str, float]



   .. py:method:: validate(epoch: int, conf: Dict[str, Any], valid_loader: torch.utils.data.DataLoader, criterion: torch.nn.Module, metrics: Dict[str, Any]) -> Dict[str, float]

      Validate the model on the validation set.

      :param epoch: The current epoch number.
      :type epoch: int
      :param conf: The configuration dictionary.
      :type conf: Dict[str, Any]
      :param valid_loader: The validation data loader.
      :type valid_loader: torch.utils.data.DataLoader
      :param criterion: The loss function.
      :type criterion: torch.nn.Module
      :param metrics: The metrics to track during validation.
      :type metrics: Dict[str, Any]

      :returns: A dictionary containing the validation results.
      :rtype: Dict[str, float]



