Documentation
Search…
Fastai
If you're using fastai to train your models, W&B has an easy integration using the WandbCallback. Explore the details in interactive docs with examples →

Start Logging with W&B

First install Weights & Biases and log in:
Notebook
Command Line
1
!pip install wandb
2
3
import wandb
4
wandb.login()
Copied!
1
pip install wandb
2
wandb login
Copied!
Then add the callback to the learner or fit method:
1
import wandb
2
from fastai.callback.wandb import *
3
4
# start logging a wandb run
5
wandb.init(project='my_project')
6
7
# To log only during one training phase
8
learn.fit(..., cbs=WandbCallback())
9
10
# To log continuously for all training phases
11
learn = learner(..., cbs=WandbCallback())
Copied!
If you use version 1 of Fastai, refer to the Fastai v1 docs.

WandbCallback Arguments

WandbCallback accepts the following arguments:
Args
Description
log
"gradients" (default), "parameters", "all" or None. Losses & metrics are always logged.
log_preds
whether we want to log prediction samples (default to True).
log_model
whether we want to log our model (default to True). This also requires SaveModelCallback.
log_dataset
  • False (default)
  • True will log folder referenced by learn.dls.path.
  • a path can be defined explicitly to reference which folder to log.
Note: subfolder "models" is always ignored.
dataset_name
name of logged dataset (default to folder name).
valid_dl
DataLoaders containing items used for prediction samples (default to random items from learn.dls.valid.
n_preds
number of logged predictions (default to 36).
seed
used for defining random samples.
For custom workflows, you can manually log your datasets and models:
  • log_dataset(path, name=None, medata={})
  • log_model(path, name=None, metadata={})
Note: any subfolder "models" will be ignored.

Examples

Last modified 3mo ago