First thing first, you need to install wandb with
pip install wandb
Create a free account then run
in your terminal. Follow the link to get an API token that you will need to paste, then you're all set!
Optionally logs weights and or gradients depending on
log (can be "gradients", "parameters", "all" or None), sample predictions if
log_preds=True that will come from
valid_dl or a random sample pf the validation set (determined by
n_preds are logged in this case.
If used in combination with
SaveModelCallback, the best model is saved as well (can be deactivated with
Datasets can also be tracked:
True, tracked folder is retrieved from
log_datasetcan explicitly be set to the folder to track
- the name of the dataset can explicitly be given through
dataset_name, otherwise it is set to the folder name
- Note: the subfolder "models" is always ignored
Once your have defined your
Learner, before you call to
fit_one_cycle, you need to initialize wandb:
import wandb wandb.init()
To use Weights & Biases without an account, you can call
from fastai.callback.wandb import * # To log only during one training phase learn.fit(..., cbs=WandbCallback()) # To log continuously for all training phases learn = learner(..., cbs=WandbCallback())
For more details, refer to W&B documentation.