DrDroid
Resource Cheatsheet

Weights & Biases (wandb)

Quick reference guide and commands for Weights & Biases (wandb).

Download PDF

Setup and Authentication

wandb login
Authenticate with Weights & Biases server using API key

wandb login --host=URL
Login to a custom W&B server

wandb init
Initialize a new W&B project in your directory

pip install wandb
Install the W&B package

Tracking Experiments

wandb.init(project='project_name')
Initialize a new run in a project

wandb.config.update({'param': value})
Track hyperparameters for a run

wandb.log({'metric_name': value})
Log metrics during training

wandb.watch(model)
Track gradients and parameters of PyTorch, TensorFlow, or Keras models

wandb.finish()
Finish a run and sync final data

Managing Runs

wandb.restore('file_name')
Restore a file from a previous run

wandb.save('file_path')
Save a file to W&B

wandb runs
List runs in terminal

wandb sync folder_path
Sync offline runs to W&B

Artifacts

artifact = wandb.Artifact('name', type='dataset')
Create a new artifact

artifact.add_file('path/to/file')
Add a file to artifact

artifact.add_dir('path/to/dir')
Add a directory to artifact

run.log_artifact(artifact)
Log an artifact to a run

artifact = run.use_artifact('entity/project/artifact:version')
Use an artifact in a run

artifact.download()
Download an artifact

Sweeps (Hyperparameter Optimization)

wandb sweep sweep_config.yaml
Initialize a sweep

wandb agent sweep_id
Start an agent for a sweep

wandb.init(project='project_name', config=sweep_config)
Initialize a run with sweep configuration

Reports and Visualizations

wandb.plot.line_series()
Create a line plot

wandb.plot.scatter()
Create a scatter plot

wandb.plot.confusion_matrix()
Log a confusion matrix

wandb.plot.pr_curve()
Plot precision-recall curve

wandb.plot.roc_curve()
Plot ROC curve

Team Collaboration

wandb.init(project='project_name', entity='team_name')
Initialize a run in a team project

wandb.alert(title='Alert', text='Message')
Send alert to team members