xlstm_jax.utils.error_logging_utils

xlstm_jax.utils.error_logging_utils#

Attributes#

R

P

Functions#

with_error_handling([flush_output, logger])

A decorator that provides consistent error handling with optional output flushing.

Module Contents#

xlstm_jax.utils.error_logging_utils.R#
xlstm_jax.utils.error_logging_utils.P#
xlstm_jax.utils.error_logging_utils.with_error_handling(flush_output=True, logger=None)#

A decorator that provides consistent error handling with optional output flushing.

This decorator is used to circumvent a bug in Hydra. See here: facebookresearch/hydra#2664

Parameters:
  • flush_output (bool) – Whether to flush stdout and stderr in the finally block. Defaults to True.

  • logger (logging.Logger | None) – Optional logger instance to use for error logging. If None errors will be printed to stderr.

Returns:

A decorator function that wraps the target function.

Return type:

collections.abc.Callable[[collections.abc.Callable[P, R]], collections.abc.Callable[P, R]]