Skip to main content
Stable Baselines 3 (SB3) is a set of reliable implementations of reinforcement learning algorithms in PyTorch. The W&B SB3 integration:
  • Records metrics such as losses and episodic returns.
  • Uploads videos of agents playing the games.
  • Saves the trained model.
  • Logs the model’s hyperparameters.
  • Logs the model’s gradient histograms.
Review an example SB3 training run.

Log your SB3 experiments

To log SB3 training to W&B, pass WandbCallback to your model’s learn method:
Stable Baselines 3 training with W&B

WandbCallback arguments

The following table describes the arguments you can pass to WandbCallback:
ArgumentUsage
verboseThe verbosity of SB3 output.
model_save_pathPath to the folder where the model is saved. The default is None, so the model isn’t logged.
model_save_freqFrequency to save the model.
gradient_save_freqFrequency to log gradients. The default is 0, so gradients aren’t logged.

Basic example

The W&B SB3 integration uses the logs output from TensorBoard to log your metrics.