commonpower.control.logging_utils.loggers.WandBLogger

class WandBLogger(log_dir: str, entity_name: str, run_name: str, project_name: str | None = None, callback: ~stable_baselines3.common.callbacks.BaseCallback = <class 'commonpower.control.logging_utils.callbacks.WandBSafetyCallback'>, 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.

Parameters:
  • log_dir (str) – relative path to logging directory

  • entity_name (str) – name of the wandb entity to which the runs will be logged

  • run_name (str) – name under which the run will be displayed in WandB

  • project_name (str, optional) – name of the wandb project to which the runs will be logged

  • callback (BaseCallback, optional) – 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)

  • 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_log_dir

log_function

Hands over the callback so it can be used by the stable-baselines3 internal logging.

Attributes

run_id

finish_logging() None[source]

Terminates the W&B run.

Returns:

None

log_function() BaseCallback[source]

Hands over the callback so it can be used by the stable-baselines3 internal logging.

Returns:

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