xlstm_jax.trainer.logger.file_logger
====================================

.. py:module:: xlstm_jax.trainer.logger.file_logger


Attributes
----------

.. autoapisummary::

   xlstm_jax.trainer.logger.file_logger.LOGGER


Classes
-------

.. autoapisummary::

   xlstm_jax.trainer.logger.file_logger.FileLoggerConfig
   xlstm_jax.trainer.logger.file_logger.FileLogger


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

.. py:data:: LOGGER

.. py:class:: FileLoggerConfig

   Bases: :py:obj:`xlstm_jax.trainer.logger.base_logger.LoggerToolsConfig`


   Configuration for the file logger tool.

   .. attribute:: log_step_key

      The key to use for the step in the logs.

   .. attribute:: log_epoch_key

      The key to use for the epoch in the logs.

   .. attribute:: config_format

      The format to use when logging the config.

   .. attribute:: log_dir

      The directory to use for the logs. Is added to the
      log_path in the logger.


   .. py:attribute:: log_step_key
      :type:  str
      :value: 'log_step'



   .. py:attribute:: log_epoch_key
      :type:  str
      :value: 'log_epoch'



   .. py:attribute:: config_format
      :type:  str
      :value: 'json'



   .. py:attribute:: log_dir
      :type:  str
      :value: 'file_logs'



   .. py:method:: create(logger)

      Creates the file logger tool.



.. py:class:: FileLogger(config, logger)

   Bases: :py:obj:`xlstm_jax.trainer.logger.base_logger.LoggerTool`


   .. py:attribute:: config


   .. py:attribute:: config_to_log
      :value: None



   .. py:attribute:: logger


   .. py:attribute:: log_path


   .. py:attribute:: logs


   .. py:method:: log_config(config)

      Log the config to disk.

      :param config: The config to log.



   .. py:method:: setup()

      Set up the file logger.



   .. py:method:: log_metrics(metrics, step, epoch, mode)

      Log a single metric dictionary in the file logger.

      The metrics are logged in a list and saved to disk at the end.

      :param metrics: The metrics to log.
      :param step: The current step.
      :param epoch: The current epoch.
      :param mode: The mode of logging. Commonly "train", "val", or "test".



   .. py:method:: finalize(status)

      Finalize the file logger.

      Writes out the logs to disk.

      :param status: The status of the training run (e.g. success, failure).



