Track ML experiments with automatic logging, visualize training in real-time, optimize hyperparameters with sweeps, and manage model registry with W&B - collaborative MLOps platform
Track ML experiments with automatic logging, visualize training in real-time, optimize hyperparameters with sweeps, and manage model registry with W&B - collaborative MLOps platform
version
1.0.0
author
Orchestra Research
license
MIT
dependencies
["wandb"]
metadata
{"argent":{"tags":["MLOps","Weights And Biases","WandB","Experiment Tracking","Hyperparameter Tuning","Model Registry","Collaboration","Real-Time Visualization","PyTorch","TensorFlow","HuggingFace"]},"imported_from":{"original_name":"weights-and-biases","source":"upstream skill profile"}}
Weights & Biases: ML Experiment Tracking & MLOps
When to Use This Skill
Use Weights & Biases (W&B) when you need to:
with automatic metric logging
Track ML experiments
Visualize training in real-time dashboards
Compare runs across hyperparameters and configurations
Optimize hyperparameters with automated sweeps
Manage model registry with versioning and lineage
Collaborate on ML projects with team workspaces
Track artifacts (datasets, models, code) with lineage
Project: Collection of related experiments
Run: Single execution of your training script
# Create/use project
run = wandb.init(
project="image-classification",
name="resnet50-experiment-1", # Optional run name
tags=["baseline", "resnet"], # Organize with tags
notes="First baseline run"# Add notes
)
# Each run has unique IDprint(f"Run ID: {run.id}")
print(f"Run URL: {run.url}")
2. Configuration Tracking
Track hyperparameters automatically:
config = {
# Model architecture"model": "ResNet50",
"pretrained": True,
# Training params"learning_rate": 0.001,
"batch_size": 32,
"epochs": 50,
"optimizer": "Adam",
# Data params"dataset": "ImageNet",
"augmentation": "standard"
}
wandb.init(project="my-project", config=config)
# Access config during training
lr = wandb.config.learning_rate
batch_size = wandb.config.batch_size
# Download and use artifact
run = wandb.init(project="my-project")
# Download artifact
artifact = run.use_artifact('training-dataset:latest')
artifact_dir = artifact.download()
# Use the data
data = load_data(f"{artifact_dir}/train.csv")
Model Registry
# Log model as artifact
model_artifact = wandb.Artifact(
name='resnet50-model',
type='model',
metadata={'architecture': 'ResNet50', 'accuracy': 0.95}
)
model_artifact.add_file('model.pth')
wandb.log_artifact(model_artifact, aliases=['best', 'production'])
# Link to model registry
run.link_artifact(model_artifact, 'model-registry/production-models')
wandb.init(
project="my-project",
tags=["baseline", "resnet50", "imagenet"],
group="resnet-experiments", # Group related runs
job_type="train"# Type of job
)
2. Log Everything Relevant
# Log system metrics
wandb.log({
"gpu/util": gpu_utilization,
"gpu/memory": gpu_memory_used,
"cpu/util": cpu_utilization
})
# Log code version
wandb.log({"git_commit": git_commit_hash})
# Log data splits
wandb.log({
"data/train_size": len(train_dataset),
"data/val_size": len(val_dataset)
})