commonpower.control.logging_utils.callbacks.WandBSafetyCallback

class WandBSafetyCallback(verbose: int = 0, model_save_path: str | None = None, model_save_freq: int = 0, gradient_save_freq: int = 0)[source]

Bases: WandbCallback

Callback for logging safety information during training of a single agent.

Parameters:
  • verbose (int) – The verbosity of sb3 output

  • model_save_path (str) – Path to the folder where the model will be saved, The default value is None so the model is not logged

  • model_save_freq (int) – Frequency to save the model

  • gradient_save_freq (int) – Frequency to log gradient. The default value is 0 so the gradients are not logged.

Methods

init_callback

Initialize the callback by saving references to the RL model and the training environment for convenience.

on_rollout_end

on_rollout_start

on_step

This method will be called by the model after each call to env.step().

on_training_end

on_training_start

save_model

update_child_locals

Update the references to the local variables on sub callbacks.

update_locals

Update the references to the local variables.

Attributes

model

logger

_on_rollout_end() None[source]

At the end of one training episode, we want to log some information about the safety shield.

Returns:

None