Install any skill in seconds. Free to start, no credit card required.
Get Started Free →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
.claude/skills/graniet-weights-and-biases/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-06 | ✗→✓ | ▲ Improved | 465% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 238% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 327% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 360% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 722% | 0% |
This skill is repo-local and stays inactive until explicitly activated.
When the original instructions refer to legacy tool names, use these Kheish mappings:
terminal => bashweb_extract => web_fetch, plus web_search when discovery is neededsearch_files => grep_search and glob_searchbrowser_* tools require a browser-capable surfaced tool or MCP; if none is available, use the closest available surface and say so explicitlyWhen the instructions mention local helper files, resolve them from ${KHEISH_SKILL_DIR}.
Use Weights & Biases (W&B) when you need to:
Users: 200,000+ ML practitioners | GitHub Stars: 10.5k+ | Integrations: 100+
bash# Install W&B pip install wandb # Login (creates API key) wandb login # Or set API key programmatically export WANDB_API_KEY=your_api_key_here
pythonimport wandb # Initialize a run run = wandb.init( project="my-project", config={ "learning_rate": 0.001, "epochs": 10, "batch_size": 32, "architecture": "ResNet50" } ) # Training loop for epoch in range(run.config.epochs): # Your training code train_loss = train_epoch() val_loss = validate() # Log metrics wandb.log({ "epoch": epoch, "train/loss": train_loss, "val/loss": val_loss, "train/accuracy": train_acc, "val/accuracy": val_acc }) # Finish the run wandb.finish()
pythonimport torch import wandb # Initialize wandb.init(project="pytorch-demo", config={ "lr": 0.001, "epochs": 10 }) # Access config config = wandb.config # Training loop for epoch in range(config.epochs): for batch_idx, (data, target) in enumerate(train_loader): # Forward pass output = model(data) loss = criterion(output, target) # Backward pass optimizer.zero_grad() loss.backward() optimizer.step() # Log every 100 batches if batch_idx % 100 == 0: wandb.log({ "loss": loss.item(), "epoch": epoch, "batch": batch_idx }) # Save model torch.save(model.state_dict(), "model.pth") wandb.save("model.pth") # Upload to W&B wandb.finish()
Project: Collection of related experiments Run: Single execution of your training script
python# 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 ID print(f"Run ID: {run.id}") print(f"Run URL: {run.url}")
Track hyperparameters automatically:
pythonconfig = { # 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
python# Log scalars wandb.log({"loss": 0.5, "accuracy": 0.92}) # Log multiple metrics wandb.log({ "train/loss": train_loss, "train/accuracy": train_acc, "val/loss": val_loss, "val/accuracy": val_acc, "learning_rate": current_lr, "epoch": epoch }) # Log with custom x-axis wandb.log({"loss": loss}, step=global_step) # Log media (images, audio, video) wandb.log({"examples": [wandb.Image(img) for img in images]}) # Log histograms wandb.log({"gradients": wandb.Histogram(gradients)}) # Log tables table = wandb.Table(columns=["id", "prediction", "ground_truth"]) wandb.log({"predictions": table})
pythonimport torch import wandb # Save model checkpoint checkpoint = { 'epoch': epoch, 'model_state_dict': model.state_dict(), 'optimizer_state_dict': optimizer.state_dict(), 'loss': loss, } torch.save(checkpoint, 'checkpoint.pth') # Upload to W&B wandb.save('checkpoint.pth') # Or use Artifacts (recommended) artifact = wandb.Artifact('model', type='model') artifact.add_file('checkpoint.pth') wandb.log_artifact(artifact)
Automatically search for optimal hyperparameters.
pythonsweep_config = { 'method': 'bayes', # or 'grid', 'random' 'metric': { 'name': 'val/accuracy', 'goal': 'maximize' }, 'parameters': { 'learning_rate': { 'distribution': 'log_uniform', 'min': 1e-5, 'max': 1e-1 }, 'batch_size': { 'values': [16, 32, 64, 128] }, 'optimizer': { 'values': ['adam', 'sgd', 'rmsprop'] }, 'dropout': { 'distribution': 'uniform', 'min': 0.1, 'max': 0.5 } } } # Initialize sweep sweep_id = wandb.sweep(sweep_config, project="my-project")
pythondef train(): # Initialize run run = wandb.init() # Access sweep parameters lr = wandb.config.learning_rate batch_size = wandb.config.batch_size optimizer_name = wandb.config.optimizer # Build model with sweep config model = build_model(wandb.config) optimizer = get_optimizer(optimizer_name, lr) # Training loop for epoch in range(NUM_EPOCHS): train_loss = train_epoch(model, optimizer, batch_size) val_acc = validate(model) # Log metrics wandb.log({ "train/loss": train_loss, "val/accuracy": val_acc }) # Run sweep wandb.agent(sweep_id, function=train, count=50) # Run 50 trials
python# Grid search - exhaustive sweep_config = { 'method': 'grid', 'parameters': { 'lr': {'values': [0.001, 0.01, 0.1]}, 'batch_size': {'values': [16, 32, 64]} } } # Random search sweep_config = { 'method': 'random', 'parameters': { 'lr': {'distribution': 'uniform', 'min': 0.0001, 'max': 0.1}, 'dropout': {'distribution': 'uniform', 'min': 0.1, 'max': 0.5} } } # Bayesian optimization (recommended) sweep_config = { 'method': 'bayes', 'metric': {'name': 'val/loss', 'goal': 'minimize'}, 'parameters': { 'lr': {'distribution': 'log_uniform', 'min': 1e-5, 'max': 1e-1} } }
Track datasets, models, and other files with lineage.
python# Create artifact artifact = wandb.Artifact( name='training-dataset', type='dataset', description='ImageNet training split', metadata={'size': '1.2M images', 'split': 'train'} ) # Add files artifact.add_file('data/train.csv') artifact.add_dir('data/images/') # Log artifact wandb.log_artifact(artifact)
python# 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")
python# 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')
pythonfrom transformers import Trainer, TrainingArguments import wandb # Initialize W&B wandb.init(project="hf-transformers") # Training arguments with W&B training_args = TrainingArguments( output_dir="./results", report_to="wandb", # Enable W&B logging run_name="bert-finetuning", logging_steps=100, save_steps=500 ) # Trainer automatically logs to W&B trainer = Trainer( model=model, args=training_args, train_dataset=train_dataset, eval_dataset=eval_dataset ) trainer.train()
pythonfrom pytorch_lightning import Trainer from pytorch_lightning.loggers import WandbLogger import wandb # Create W&B logger wandb_logger = WandbLogger( project="lightning-demo", log_model=True # Log model checkpoints ) # Use with Trainer trainer = Trainer( logger=wandb_logger, max_epochs=10 ) trainer.fit(model, datamodule=dm)
pythonimport wandb from wandb.keras import WandbCallback # Initialize wandb.init(project="keras-demo") # Add callback model.fit( x_train, y_train, validation_data=(x_val, y_val), epochs=10, callbacks=[WandbCallback()] # Auto-logs metrics )
python# Log custom visualizations import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.plot(x, y) wandb.log({"custom_plot": wandb.Image(fig)}) # Log confusion matrix wandb.log({"conf_mat": wandb.plot.confusion_matrix( probs=None, y_true=ground_truth, preds=predictions, class_names=class_names )})
Create shareable reports in W&B UI:
pythonwandb.init( project="my-project", tags=["baseline", "resnet50", "imagenet"], group="resnet-experiments", # Group related runs job_type="train" # Type of job )
python# 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) })
python# ✅ Good: Descriptive run names wandb.init( project="nlp-classification", name="bert-base-lr0.001-bs32-epoch10" ) # ❌ Bad: Generic names wandb.init(project="nlp", name="run1")
python# Save final model artifact = wandb.Artifact('final-model', type='model') artifact.add_file('model.pth') wandb.log_artifact(artifact) # Save predictions for analysis predictions_table = wandb.Table( columns=["id", "input", "prediction", "ground_truth"], data=predictions_data ) wandb.log({"predictions": predictions_table})
pythonimport os # Enable offline mode os.environ["WANDB_MODE"] = "offline" wandb.init(project="my-project") # ... your code ... # Sync later # wandb sync <run_directory>
python# Runs are automatically shareable via URL run = wandb.init(project="team-project") print(f"Share this URL: {run.url}")
references/sweeps.md - Comprehensive hyperparameter optimization guidereferences/artifacts.md - Data and model versioning patternsreferences/integrations.md - Framework-specific examples| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-04 | pass→pass | 6,356 | 8,772 | +38% | 1 | 1 | 0% | 1,283 | 5,478 | +327% | 0 | 0 | — |
case-05 | pass→pass | 5,531 | 5,041 | -9% | 1 | 1 | 0% | 1,047 | 4,819 | +360% | 0 | 0 | — |
case-01 | pass→pass | 2,694 | 5,046 | +87% | 1 | 1 | 0% | 536 | 4,408 | +722% | 0 | 0 | — |
case-02 | pass→pass | 10,905 | 7,024 | -36% | 1 | 1 | 0% | 2,172 | 5,183 | +139% | 0 | 0 | — |
case-03 | pass→pass | 11,151 | 6,973 | -37% | 1 | 1 | 0% | 2,143 | 5,120 | +139% | 0 | 0 | — |
case-06 | fail→pass | 4,500 | 5,481 | +22% | 1 | 1 | 0% | 870 | 4,919 | +465% | 0 | 0 | — |
case-07 | pass→pass | 2,877 | 2,880 | +0% | 1 | 1 | 0% | 518 | 4,336 | +737% | 0 | 0 | — |
case-08 | fail→pass | 7,258 | 4,341 | -40% | 1 | 1 | 0% | 1,364 | 4,607 | +238% | 0 | 0 | — |
case-09 | fail→fail | 7,946 | 5,122 | -36% | 1 | 1 | 0% | 1,639 | 4,884 | +198% | 0 | 0 | — |
case-10 | pass→pass | 4,134 | 4,062 | -2% | 1 | 1 | 0% | 680 | 4,612 | +578% | 0 | 0 | — |
case-11 | pass→pass | 3,591 | 2,848 | -21% | 1 | 1 | 0% | 671 | 4,369 | +551% | 0 | 0 | — |
case-12 | pass→pass | 8,737 | 6,105 | -30% | 1 | 1 | 0% | 1,640 | 4,964 | +203% | 0 | 0 | — |
case-13 | pass→pass | 4,965 | 2,451 | -51% | 1 | 1 | 0% | 931 | 4,251 | +357% | 0 | 0 | — |
case-14 | pass→pass | 3,359 | 3,247 | -3% | 1 | 1 | 0% | 675 | 4,398 | +552% | 0 | 0 | — |
case-15 | pass→pass | 4,890 | 3,119 | -36% | 1 | 1 | 0% | 916 | 4,453 | +386% | 0 | 0 | — |
case-16 | pass→pass | 3,062 | 2,578 | -16% | 1 | 1 | 0% | 608 | 4,338 | +613% | 0 | 0 | — |
case-17 | pass→pass | 6,135 | 3,693 | -40% | 1 | 1 | 0% | 1,155 | 4,475 | +287% | 0 | 0 | — |
case-18 | pass→pass | 2,638 | 3,302 | +25% | 1 | 1 | 0% | 472 | 4,458 | +844% | 0 | 0 | — |
case-19 | pass→pass | 9,175 | 7,604 | -17% | 1 | 1 | 0% | 1,844 | 5,256 | +185% | 0 | 0 | — |
case-20 | pass→pass | 8,999 | 6,409 | -29% | 1 | 1 | 0% | 1,852 | 5,116 | +176% | 0 | 0 | — |
case-21 | pass→pass | 3,704 | 3,697 | -0% | 1 | 1 | 0% | 739 | 4,486 | +507% | 0 | 0 | — |
case-22 | pass→pass | 3,250 | 2,975 | -8% | 1 | 1 | 0% | 600 | 4,358 | +626% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +9 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.