Weights & Biases Cheat Sheet
A guide to Weights & Biases for experiment tracking, hyperparameter sweeps, artifact versioning, and logging metrics and media during model training.
2 PagesIntermediateMar 15, 2026
Quickstart Logging
Initialize a run and log metrics over training.
python
import wandbwandb.init(project='my-project', config={'lr': 0.001, 'epochs': 10})config = wandb.configfor epoch in range(config.epochs): loss = train_one_epoch() wandb.log({'loss': loss, 'epoch': epoch})wandb.finish()
CLI Commands
Authenticate and manage sweeps from the terminal.
bash
wandb login # Authenticate with your API keywandb init # Link the current directory to a projectwandb sweep sweep.yaml # Create a hyperparameter sweep from a configwandb agent <sweep_id> # Launch an agent to run sweep trialswandb artifact get <name>:latest # Download the latest version of an artifact
Logging Media & Plots
Log images and built-in chart types.
python
wandb.log({ 'predictions': wandb.Image(image, caption='Predicted: cat'), 'confusion_matrix': wandb.plot.confusion_matrix( y_true=y_true, preds=y_pred, class_names=class_names ),})
Core Concepts
Key building blocks of the W&B platform.
- Run- A single execution of your training or evaluation script, logged with a unique ID
- Project- A collection of related runs compared together on shared dashboards
- Artifact- Versioned reference to datasets or model checkpoints, tracked via wandb.Artifact()
- Sweep- Automated hyperparameter search (grid, random, or Bayesian) defined in a YAML config
- Report- Shareable, interactive document combining charts, tables, and markdown notes
Pro Tip
Log datasets and model checkpoints as wandb.Artifact() objects instead of plain files — artifacts are versioned and content-hashed, so every run records the exact lineage of which data and weights produced it.
Was this cheat sheet helpful?
Explore Topics
#WeightsBiases#WeightsBiasesCheatSheet#DataScience#Intermediate#QuickstartLogging#CLICommands#LoggingMediaPlots#CoreConcepts#MachineLearning#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech
Professional Web Designing Services
- Responsive Websites
- E-commerce Solutions
- SEO Friendly Design
- Fast & Secure
- Support & Maintenance