Notebooks
W
Weights and Biases
Interactive W&B Charts Inside Jupyter

Interactive W&B Charts Inside Jupyter

jupyterwandb-examplescolabs

Open In Colab

Weights & Biases

Use Weights & Biases for machine learning experiment tracking, dataset versioning, and project collaboration.

Weights & Biases

Use W&B without leaving Jupyter

Jupyter is the preferred development environment for many ML practitioners because it supports rapid experimentation and highly visual workflows (including creating charts). Plus tools like Google Colab, Kaggle Kernels, and Paperspace Gradient make it easy to share and collaborate on notebooks.

Quick experiments, visualization, and collaboration are core values of W&B, so we've made it easy to use W&B inside Jupyter.

In a nutshell, the steps are:

  1. Use one of two methods to get hold of a Run, Sweep, or Report object, depending on whether you're logging to a new experiment or analyzing an old one.
  2. .display the object to get a live dashboard beneath a cell.
  3. Interact with the dashboard: log new results, create charts, or review metadata.

Here's a (static) preview of one such dashboard:

weights and biases jupyter integration

Import, install, and log in

[ ]
[ ]
[ ]

Method 1: display and log to a live W&B Run

The result of the last line of each cell in a Jupyter notebook is "displayed" automatically.

Our W&B pages hook into this system: they are rendered as an interactive window.

First we need to kick the run off with wandb.init.

[ ]

Then we create an interactive dashboard of the size we want for the run and display it.

[ ]

Anything logged as part of this experiment (until you call wandb.finish) will be added to that chart.

Run the cell below to watch the metrics stream in live!

[ ]

Anything else you can do from the Run Page can be done here -- edit a chart, create a shareable link to it, and send it to collaborator; review your system metrics or the logs from the standard out or the datasets and models you've logged; check the configuration metadata.

wandb also prints a URL. That URL points to the webpage where your run's results are stored -- nothing to worry about if your notebook crashes or your kernel dies, it's all there!

Finishing the run

When you are done with your experiment, call wandb.finish to let us know there's nothing more to log.

We'll print out a handy summary and history of your run, plus links to the webpages where all your run's information is stored.

Hot Tip! If you turn on code saving in your W&B settings, we'll also save a copy of the notebook and its "session history": all the cells you ran, in order, in the state that you ran them in, with their outputs. Handy!

[ ]

Method 2: display and analyze a finished W&B Run

Interaction with W&B dashboards for training runs isn't limited to watching information come in live from the comfort of a notebook interface.

All of the information you log to or create within W&B is available in perpetuity and programmatically via the W&B Public API.

[ ]

In this example, we'll take a look at the training run for a chess piece detector created using YOLOv5, which includes a W&B integration.

You can train your own with this colab.

[ ]

But it's not just about Runs

Anything you can do in a W&B workspace can be done from inside Jupyter if you have the URL for the workspace.

That means that, without leaving Jupyter, you can use W&B to:

Interactively analyze data in Tables

And it doesn't have to be your own work -- it can be a coworker's page as well.

[ ]

Analyze the results of hyperparameter Sweeps

[ ]

Share results in Reports

[ ]