commonpower.control.logging_utils.loggers.MARLWandBLogger

class MARLWandBLogger(log_dir: str, entity_name: str, project_name: str | None = None, callback: ~stable_baselines3.common.callbacks.BaseCallback = <class 'commonpower.control.logging_utils.callbacks.MARLWandBCallback'>, format_strings: list = ['stdout', 'tensorboard'], model_save_freq: int = 100, verbose: int = 2, alg_config: dict | None = None)[source]

Bases: BaseLogger

Class for using Weights&Biases (wandb) logging in single-agent stable-baselines3 algorithms :param log_dir: relative path to logging directory :type log_dir: str :param entity_name: name of the wandb entity to which the runs will be logged :type entity_name: str :param project_name: name of the wandb project to which the runs will be logged :type project_name: str, optional :param callback: object that implements actual logging during training -

by defining a customized callback, additional information can be logged (apart from standard metrics like mean_eps_reward)

Parameters:
  • format_strings (list) – list of output formats for the SB3 logger

  • model_save_freq (int, optional) – after how many episodes the current model should be logged

  • verbose (int, optional) – output verbosity

  • alg_config (dict, optional) – dictionary of algorithm hyperparameters. Can be used to filter runs in wandb API

Methods

finish_logging

Terminates the W&B run.

get_callback

Hands over the callback.

get_log_dir

get_log_function

Hands over the logger we get from stable-baselines3

log_function

finish_logging() None[source]

Terminates the W&B run.

Returns:

None

get_callback() MARLBaseCallback[source]

Hands over the callback.

Returns:

MARLBaseCallback – callback which is used during training to log additional information

get_log_function() Callable[source]

Hands over the logger we get from stable-baselines3

Returns:

Callable – Logger