19.1. Weights & Biases - Intro#
Weights & Biases (W&B) is an online platform designed to streamline experiment tracking and visualization, enabling effective collaboration on large teams. W&B gives researchers great flexibility in deciding what metrics to log.
19.1.1. Getting Started#
To get started, first sign up for an account at wandb.ai website. Next, generate an API key here. Finally, install the wandb
package and log in:
pip install wandb
wandb login
19.1.2. Authentication#
Logging in using the wandb
Command Line Interface (CLI) adds your API key to your .netrc
file at ~/.netrc
(Mac and Linux). Alternatively, you can also manually add your API key to this file following this format:
machine api.wandb.ai
login user
password YOUR_API_KEY
19.1.3. Simple Tracking#
In your Python script, import wandb
module and start a W&B run object. Set the project name and decide which hyperparameters and metrics to track:
import wandb
run = wandb.init(
project = "project_name"
config = {
"metric_1": metric_1,
"metric_2": metric_2,
}
)
for epoch in range(epochs):
...
wandb.log({"accuracy": acc, "loss": loss})
Access your project and view your runs on wandb.ai website. Additionally, invite any collaborators you have to your project at this page. Refer to the W&B Quickstart for more details.