TensorBoard and TensorboardX

W&B supports patching TensorBoard or TensorboardX to automatically log all summaries.

import wandb

Under the hood the patch tries to guess which version of TensorBoard to patch. We support TensorBoard with all versions of TensorFlow. If you're using TensorBoard with another framework W&B supports tensorboard > 1.14 with PyTorch as well as TensorboardX.

Custom Metrics

If you need to log additional custom metrics that aren't being logged to TensorBoard, you can call wandb.log in your code with the same step argument that TensorBoard is using: i.e. wandb.log({"custom": 0.8}, step=global_step)

Advanced Configuration

If you want more control over how TensorBoard is patched you can call wandb.tensorboard.patch instead of passing sync_tensorboard=True to init. You can pass tensorboardX=False to this method to ensure vanilla TensorBoard is patched, if you're using tensorboard > 1.14 with PyTorch you can pass pytorch=True to ensure it's patched. Both of these options are have smart defaults depending on what versions of these libraries have been imported.

By default we also sync the tfevents files and any *.pbtxt files. This enables us to launch a TensorBoard instance on your behalf. You will see a TensorBoard tab on the run page. This behavior can be disabled by passing save=False to wandb.tensorboard.patch

import wandb
wandb.tensorboard.patch(save=False, tensorboardX=True)

Syncing Previous TensorBoard Runs

If you have existing experiments you would like to import into wandb, you can run wandb sync log_dir where log_dir is a local directory containing the tfevents files.

Google Colab and Tensorboard

To run commands from the command line in Colab, you must run !wandb sync directoryname . Currently tensorboard syncing does not work in a notebook environment for Tensorflow 2.1+. You can have your colab use an earlier version of tensorboard, or run a script from the commandline with !python your_script.py