15.1. Weights & Biases (WandB)#
15.1.1. Wandb#
Weights & Biases (W&B) is a platform designed to streamline experiment tracking and visualization, enabling effective collaboration on large teams. Weights and Biases gives researchers great flexibility in deciding what metrics to log.
15.1.1.1. Logging In#
To get started, first sign up for an account at https://wandb.ai/site/. Next, generate an API key at https://wandb.ai/authorize . Finally, install the wandb package and log in:
pip install wandb
wandb login
Logging in using the W&B Command Line Interface 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
15.1.1.2. Simple Tracking#
In your python script, import wandb 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 at https://wandb.ai/home. Additionally, invite any collaborators you have to your project at this page. Refer to the quickstart guide for more details.