imitation.scripts.ingredients.logging#

This ingredient provides a number of logging utilities.

It is responsible for logging to WandB, TensorBoard, and stdout. It will also create a symlink to the sacred logging directory in the log directory.

Functions

hook(config, command_name, logger)

make_log_dir(_run, log_dir, log_level)

Creates log directory and sets up symlink to Sacred logs.

setup_logging(_run, log_format_strs)

Builds the imitation logger.

imitation.scripts.ingredients.logging.hook(config, command_name, logger)[source]#
imitation.scripts.ingredients.logging.make_log_dir(_run, log_dir, log_level)[source]#

Creates log directory and sets up symlink to Sacred logs.

Parameters
  • log_dir (str) – The directory to log to.

  • log_level (Union[int, str]) – The threshold of the logger. Either an integer level (10, 20, …), a string of digits (‘10’, ‘20’), or a string of the designated level (‘DEBUG’, ‘INFO’, …).

Return type

Path

Returns

The log_dir. This avoids the caller needing to capture this argument.

imitation.scripts.ingredients.logging.setup_logging(_run, log_format_strs)[source]#

Builds the imitation logger.

Parameters

log_format_strs (Sequence[str]) – The types of formats to log to.

Return type

Tuple[HierarchicalLogger, Path]

Returns

The configured imitation logger and log_dir. Returning log_dir avoids the caller needing to capture this value.