wandb dashboard explained
Quick answer
The
wandb dashboard is a web interface that visualizes machine learning experiment metrics, logs, and artifacts in real time. It helps developers track training progress, compare runs, and analyze model performance efficiently.PREREQUISITES
Python 3.8+pip install wandbWeights & Biases account (free tier available)Basic knowledge of machine learning training loops
Setup
Install the wandb Python package and log in to your Weights & Biases account to enable experiment tracking.
pip install wandb
wandb login output
wandb: Currently logged in as: your_username (use `wandb login --relogin` to force relogin)
Step by step
Integrate wandb into your training script to log metrics and visualize them on the dashboard.
import wandb
# Initialize a new run
wandb.init(project="my-ml-project", entity="your_username")
for epoch in range(5):
# Simulate training metric
accuracy = 0.8 + epoch * 0.04
loss = 0.5 / (epoch + 1)
# Log metrics to wandb
wandb.log({"epoch": epoch, "accuracy": accuracy, "loss": loss})
print("Training complete. Check your wandb dashboard for live updates.") output
Training complete. Check your wandb dashboard for live updates.
Common variations
You can customize the dashboard by logging additional data types such as images, model checkpoints, and hyperparameters. Use wandb.watch() to automatically log gradients and model topology.
import wandb
import torch
import torch.nn as nn
wandb.init(project="my-ml-project", entity="your_username")
model = nn.Linear(10, 2)
wandb.watch(model, log="all") # Logs gradients and parameters
# Log hyperparameters
wandb.config.update({"learning_rate": 0.001, "batch_size": 32})
# Log an image example
wandb.log({"sample_image": wandb.Image(torch.randn(3, 64, 64))}) Troubleshooting
- If metrics do not appear on the dashboard, ensure you called
wandb.init()before logging and that your internet connection is active. - Use
wandb loginto authenticate if you see authorization errors. - Check the
wandbrun directory for logs if runs fail to sync.
Key Takeaways
- Use
wandb.init()to start tracking experiments andwandb.log()to send metrics to the dashboard. - The dashboard provides real-time visualization of metrics, enabling easy comparison and analysis of multiple runs.
- Log additional data like images, hyperparameters, and model gradients to enrich experiment insights.
- Ensure proper authentication with
wandb loginand stable internet for syncing data. - The dashboard is accessible via your Weights & Biases web account and supports collaboration.