[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XGHB93PBRQP236GW9HW63G":3,"skill-same:01M6XGHB93PBRQP236GW9HW63G":95},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":61,"commitSha":62,"skillDirectory":63,"forksCount":14,"repositoryHtmlUrl":64,"repositoryHomepageUrl":6,"ownerHtmlUrl":65,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":66,"install":67,"resources":80},"01M6XGHB93PBRQP236GW9HW63G","weights-and-biases",null,"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","fadrienne\u002FMyGitHub","fadrienne","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F197874571?v=4","01M6X64V8VWCRSMFZ4EPS2BWXG","Francesca Adrienne","01M6X64VD5MW4F9PHDWQKS7ZAF",0,"MIT","https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub\u002Fblob\u002Fmain\u002Fopenscience\u002Fbackend\u002Fcli\u002Fskills\u002Fml-training\u002Fweights-and-biases\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000013","分析与可视化","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"weights and biases","optimize","automatic","track","Real-Time Visualization","WandB","Hyperparameter Tuning","Model Registry","Experiment Tracking","synthetic","time","experiments","experiment","model","tuning","logging","registry","visualization","training","pytorch","2026-11-10 10:12:30",false,"---\nname: weights-and-biases\ndescription: 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\ncategory: ml-training\nversion: 1.0.0\nauthor: Synthetic Sciences\nlicense: MIT\ntags: [MLOps, Weights And Biases, WandB, Experiment Tracking, Hyperparameter Tuning, Model Registry, Collaboration, Real-Time Visualization, PyTorch, TensorFlow, HuggingFace]\ndependencies: [wandb]\n---\n\n# Weights & Biases: ML Experiment Tracking & MLOps\n\n## When to Use This Skill\n\nUse Weights & Biases (W&B) when you need to:\n- **Track ML experiments** with automatic metric logging\n- **Visualize training** in real-time dashboards\n- **Compare runs** across hyperparameters and configurations\n- **Optimize hyperparameters** with automated sweeps\n- **Manage model registry** with versioning and lineage\n- **Collaborate on ML projects** with team workspaces\n- **Track artifacts** (datasets, models, code) with lineage\n\n**Users**: 200,000+ ML practitioners | **GitHub Stars**: 10.5k+ | **Integrations**: 100+\n\n\n## Credential Setup\n\nCredentials are auto-injected by openscience when connected via the dashboard.\n\n```bash\n# Verify credentials\n[ -n \"$WANDB_API_KEY\" ] && echo \"WANDB_API_KEY set\" || echo \"NOT SET\"\n```\n\nIf not set: connect Weights & Biases at https:\u002F\u002Fapp.syntheticsciences.ai -> Services, then restart openscience.\n\n## Installation\n\n```bash\n# Install W&B\npip install wandb\n\n# Login (creates API key)\nwandb login\n\n# Or set API key programmatically\nexport WANDB_API_KEY=your_api_key_here\n```\n\n## Quick Start\n\n### Basic Experiment Tracking\n\n```python\nimport wandb\n\n# Initialize a run\nrun = wandb.init(\n    project=\"my-project\",\n    config={\n        \"learning_rate\": 0.001,\n        \"epochs\": 10,\n        \"batch_size\": 32,\n        \"architecture\": \"ResNet50\"\n    }\n)\n\n# Training loop\nfor epoch in range(run.config.epochs):\n    # Your training code\n    train_loss = train_epoch()\n    val_loss = validate()\n\n    # Log metrics\n    wandb.log({\n        \"epoch\": epoch,\n        \"train\u002Floss\": train_loss,\n        \"val\u002Floss\": val_loss,\n        \"train\u002Faccuracy\": train_acc,\n        \"val\u002Faccuracy\": val_acc\n    })\n\n# Finish the run\nwandb.finish()\n```\n\n### With PyTorch\n\n```python\nimport torch\nimport wandb\n\n# Initialize\nwandb.init(project=\"pytorch-demo\", config={\n    \"lr\": 0.001,\n    \"epochs\": 10\n})\n\n# Access config\nconfig = wandb.config\n\n# Training loop\nfor epoch in range(config.epochs):\n    for batch_idx, (data, target) in enumerate(train_loader):\n        # Forward pass\n        output = model(data)\n        loss = criterion(output, target)\n\n        # Backward pass\n        optimizer.zero_grad()\n        loss.backward()\n        optimizer.step()\n\n        # Log every 100 batches\n        if batch_idx % 100 == 0:\n            wandb.log({\n                \"loss\": loss.item(),\n                \"epoch\": epoch,\n                \"batch\": batch_idx\n            })\n\n# Save model\ntorch.save(model.state_dict(), \"model.pth\")\nwandb.save(\"model.pth\")  # Upload to W&B\n\nwandb.finish()\n```\n\n## Core Concepts\n\n### 1. Projects and Runs\n\n**Project**: Collection of related experiments\n**Run**: Single execution of your training script\n\n```python\n# Create\u002Fuse project\nrun = wandb.init(\n    project=\"image-classification\",\n    name=\"resnet50-experiment-1\",  # Optional run name\n    tags=[\"baseline\", \"resnet\"],    # Organize with tags\n    notes=\"First baseline run\"      # Add notes\n)\n\n# Each run has unique ID\nprint(f\"Run ID: {run.id}\")\nprint(f\"Run URL: {run.url}\")\n```\n\n### 2. Configuration Tracking\n\nTrack hyperparameters automatically:\n\n```python\nconfig = {\n    # Model architecture\n    \"model\": \"ResNet50\",\n    \"pretrained\": True,\n\n    # Training params\n    \"learning_rate\": 0.001,\n    \"batch_size\": 32,\n    \"epochs\": 50,\n    \"optimizer\": \"Adam\",\n\n    # Data params\n    \"dataset\": \"ImageNet\",\n    \"augmentation\": \"standard\"\n}\n\nwandb.init(project=\"my-project\", config=config)\n\n# Access config during training\nlr = wandb.config.learning_rate\nbatch_size = wandb.config.batch_size\n```\n\n### 3. Metric Logging\n\n```python\n# Log scalars\nwandb.log({\"loss\": 0.5, \"accuracy\": 0.92})\n\n# Log multiple metrics\nwandb.log({\n    \"train\u002Floss\": train_loss,\n    \"train\u002Faccuracy\": train_acc,\n    \"val\u002Floss\": val_loss,\n    \"val\u002Faccuracy\": val_acc,\n    \"learning_rate\": current_lr,\n    \"epoch\": epoch\n})\n\n# Log with custom x-axis\nwandb.log({\"loss\": loss}, step=global_step)\n\n# Log media (images, audio, video)\nwandb.log({\"examples\": [wandb.Image(img) for img in images]})\n\n# Log histograms\nwandb.log({\"gradients\": wandb.Histogram(gradients)})\n\n# Log tables\ntable = wandb.Table(columns=[\"id\", \"prediction\", \"ground_truth\"])\nwandb.log({\"predictions\": table})\n```\n\n### 4. Model Checkpointing\n\n```python\nimport torch\nimport wandb\n\n# Save model checkpoint\ncheckpoint = {\n    'epoch': epoch,\n    'model_state_dict': model.state_dict(),\n    'optimizer_state_dict': optimizer.state_dict(),\n    'loss': loss,\n}\n\ntorch.save(checkpoint, 'checkpoint.pth')\n\n# Upload to W&B\nwandb.save('checkpoint.pth')\n\n# Or use Artifacts (recommended)\nartifact = wandb.Artifact('model', type='model')\nartifact.add_file('checkpoint.pth')\nwandb.log_artifact(artifact)\n```\n\n## Hyperparameter Sweeps\n\nAutomatically search for optimal hyperparameters.\n\n### Define Sweep Configuration\n\n```python\nsweep_config = {\n    'method': 'bayes',  # or 'grid', 'random'\n    'metric': {\n        'name': 'val\u002Faccuracy',\n        'goal': 'maximize'\n    },\n    'parameters': {\n        'learning_rate': {\n            'distribution': 'log_uniform',\n            'min': 1e-5,\n            'max': 1e-1\n        },\n        'batch_size': {\n            'values': [16, 32, 64, 128]\n        },\n        'optimizer': {\n            'values': ['adam', 'sgd', 'rmsprop']\n        },\n        'dropout': {\n            'distribution': 'uniform',\n            'min': 0.1,\n            'max': 0.5\n        }\n    }\n}\n\n# Initialize sweep\nsweep_id = wandb.sweep(sweep_config, project=\"my-project\")\n```\n\n### Define Training Function\n\n```python\ndef train():\n    # Initialize run\n    run = wandb.init()\n\n    # Access sweep parameters\n    lr = wandb.config.learning_rate\n    batch_size = wandb.config.batch_size\n    optimizer_name = wandb.config.optimizer\n\n    # Build model with sweep config\n    model = build_model(wandb.config)\n    optimizer = get_optimizer(optimizer_name, lr)\n\n    # Training loop\n    for epoch in range(NUM_EPOCHS):\n        train_loss = train_epoch(model, optimizer, batch_size)\n        val_acc = validate(model)\n\n        # Log metrics\n        wandb.log({\n            \"train\u002Floss\": train_loss,\n            \"val\u002Faccuracy\": val_acc\n        })\n\n# Run sweep\nwandb.agent(sweep_id, function=train, count=50)  # Run 50 trials\n```\n\n### Sweep Strategies\n\n```python\n# Grid search - exhaustive\nsweep_config = {\n    'method': 'grid',\n    'parameters': {\n        'lr': {'values': [0.001, 0.01, 0.1]},\n        'batch_size': {'values': [16, 32, 64]}\n    }\n}\n\n# Random search\nsweep_config = {\n    'method': 'random',\n    'parameters': {\n        'lr': {'distribution': 'uniform', 'min': 0.0001, 'max': 0.1},\n        'dropout': {'distribution': 'uniform', 'min': 0.1, 'max': 0.5}\n    }\n}\n\n# Bayesian optimization (recommended)\nsweep_config = {\n    'method': 'bayes',\n    'metric': {'name': 'val\u002Floss', 'goal': 'minimize'},\n    'parameters': {\n        'lr': {'distribution': 'log_uniform', 'min': 1e-5, 'max': 1e-1}\n    }\n}\n```\n\n## Artifacts\n\nTrack datasets, models, and other files with lineage.\n\n### Log Artifacts\n\n```python\n# Create artifact\nartifact = wandb.Artifact(\n    name='training-dataset',\n    type='dataset',\n    description='ImageNet training split',\n    metadata={'size': '1.2M images', 'split': 'train'}\n)\n\n# Add files\nartifact.add_file('data\u002Ftrain.csv')\nartifact.add_dir('data\u002Fimages\u002F')\n\n# Log artifact\nwandb.log_artifact(artifact)\n```\n\n### Use Artifacts\n\n```python\n# Download and use artifact\nrun = wandb.init(project=\"my-project\")\n\n# Download artifact\nartifact = run.use_artifact('training-dataset:latest')\nartifact_dir = artifact.download()\n\n# Use the data\ndata = load_data(f\"{artifact_dir}\u002Ftrain.csv\")\n```\n\n### Model Registry\n\n```python\n# Log model as artifact\nmodel_artifact = wandb.Artifact(\n    name='resnet50-model',\n    type='model',\n    metadata={'architecture': 'ResNet50', 'accuracy': 0.95}\n)\n\nmodel_artifact.add_file('model.pth')\nwandb.log_artifact(model_artifact, aliases=['best', 'production'])\n\n# Link to model registry\nrun.link_artifact(model_artifact, 'model-registry\u002Fproduction-models')\n```\n\n## Integration Examples\n\n### HuggingFace Transformers\n\n```python\nfrom transformers import Trainer, TrainingArguments\nimport wandb\n\n# Initialize W&B\nwandb.init(project=\"hf-transformers\")\n\n# Training arguments with W&B\ntraining_args = TrainingArguments(\n    output_dir=\".\u002Fresults\",\n    report_to=\"wandb\",  # Enable W&B logging\n    run_name=\"bert-finetuning\",\n    logging_steps=100,\n    save_steps=500\n)\n\n# Trainer automatically logs to W&B\ntrainer = Trainer(\n    model=model,\n    args=training_args,\n    train_dataset=train_dataset,\n    eval_dataset=eval_dataset\n)\n\ntrainer.train()\n```\n\n### PyTorch Lightning\n\n```python\nfrom pytorch_lightning import Trainer\nfrom pytorch_lightning.loggers import WandbLogger\nimport wandb\n\n# Create W&B logger\nwandb_logger = WandbLogger(\n    project=\"lightning-demo\",\n    log_model=True  # Log model checkpoints\n)\n\n# Use with Trainer\ntrainer = Trainer(\n    logger=wandb_logger,\n    max_epochs=10\n)\n\ntrainer.fit(model, datamodule=dm)\n```\n\n### Keras\u002FTensorFlow\n\n```python\nimport wandb\nfrom wandb.keras import WandbCallback\n\n# Initialize\nwandb.init(project=\"keras-demo\")\n\n# Add callback\nmodel.fit(\n    x_train, y_train,\n    validation_data=(x_val, y_val),\n    epochs=10,\n    callbacks=[WandbCallback()]  # Auto-logs metrics\n)\n```\n\n## Visualization & Analysis\n\n### Custom Charts\n\n```python\n# Log custom visualizations\nimport matplotlib.pyplot as plt\n\nfig, ax = plt.subplots()\nax.plot(x, y)\nwandb.log({\"custom_plot\": wandb.Image(fig)})\n\n# Log confusion matrix\nwandb.log({\"conf_mat\": wandb.plot.confusion_matrix(\n    probs=None,\n    y_true=ground_truth,\n    preds=predictions,\n    class_names=class_names\n)})\n```\n\n### Reports\n\nCreate shareable reports in W&B UI:\n- Combine runs, charts, and text\n- Markdown support\n- Embeddable visualizations\n- Team collaboration\n\n## Best Practices\n\n### 1. Organize with Tags and Groups\n\n```python\nwandb.init(\n    project=\"my-project\",\n    tags=[\"baseline\", \"resnet50\", \"imagenet\"],\n    group=\"resnet-experiments\",  # Group related runs\n    job_type=\"train\"             # Type of job\n)\n```\n\n### 2. Log Everything Relevant\n\n```python\n# Log system metrics\nwandb.log({\n    \"gpu\u002Futil\": gpu_utilization,\n    \"gpu\u002Fmemory\": gpu_memory_used,\n    \"cpu\u002Futil\": cpu_utilization\n})\n\n# Log code version\nwandb.log({\"git_commit\": git_commit_hash})\n\n# Log data splits\nwandb.log({\n    \"data\u002Ftrain_size\": len(train_dataset),\n    \"data\u002Fval_size\": len(val_dataset)\n})\n```\n\n### 3. Use Descriptive Names\n\n```python\n# ✅ Good: Descriptive run names\nwandb.init(\n    project=\"nlp-classification\",\n    name=\"bert-base-lr0.001-bs32-epoch10\"\n)\n\n# ❌ Bad: Generic names\nwandb.init(project=\"nlp\", name=\"run1\")\n```\n\n### 4. Save Important Artifacts\n\n```python\n# Save final model\nartifact = wandb.Artifact('final-model', type='model')\nartifact.add_file('model.pth')\nwandb.log_artifact(artifact)\n\n# Save predictions for analysis\npredictions_table = wandb.Table(\n    columns=[\"id\", \"input\", \"prediction\", \"ground_truth\"],\n    data=predictions_data\n)\nwandb.log({\"predictions\": predictions_table})\n```\n\n### 5. Use Offline Mode for Unstable Connections\n\n```python\nimport os\n\n# Enable offline mode\nos.environ[\"WANDB_MODE\"] = \"offline\"\n\nwandb.init(project=\"my-project\")\n# ... your code ...\n\n# Sync later\n# wandb sync \u003Crun_directory>\n```\n\n## Team Collaboration\n\n### Share Runs\n\n```python\n# Runs are automatically shareable via URL\nrun = wandb.init(project=\"team-project\")\nprint(f\"Share this URL: {run.url}\")\n```\n\n### Team Projects\n\n- Create team account at wandb.ai\n- Add team members\n- Set project visibility (private\u002Fpublic)\n- Use team-level artifacts and model registry\n\n## Pricing\n\n- **Free**: Unlimited public projects, 100GB storage\n- **Academic**: Free for students\u002Fresearchers\n- **Teams**: $50\u002Fseat\u002Fmonth, private projects, unlimited storage\n- **Enterprise**: Custom pricing, on-prem options\n\n## Resources\n\n- **Documentation**: https:\u002F\u002Fdocs.wandb.ai\n- **GitHub**: https:\u002F\u002Fgithub.com\u002Fwandb\u002Fwandb (10.5k+ stars)\n- **Examples**: https:\u002F\u002Fgithub.com\u002Fwandb\u002Fexamples\n- **Community**: https:\u002F\u002Fwandb.ai\u002Fcommunity\n- **Discord**: https:\u002F\u002Fwandb.me\u002Fdiscord\n\n## See Also\n\n- `references\u002Fsweeps.md` - Comprehensive hyperparameter optimization guide\n- `references\u002Fartifacts.md` - Data and model versioning patterns\n- `references\u002Fintegrations.md` - Framework-specific examples\n\n\n","# Weights & Biases: ML Experiment Tracking & MLOps\n\n## When to Use This Skill\n\nUse Weights & Biases (W&B) when you need to:\n- **Track ML experiments** with automatic metric logging\n- **Visualize training** in real-time dashboards\n- **Compare runs** across hyperparameters and configurations\n- **Optimize hyperparameters** with automated sweeps\n- **Manage model registry** with versioning and lineage\n- **Collaborate on ML projects** with team workspaces\n- **Track artifacts** (datasets, models, code) with lineage\n\n**Users**: 200,000+ ML practitioners | **GitHub Stars**: 10.5k+ | **Integrations**: 100+\n\n\n## Credential Setup\n\nCredentials are auto-injected by openscience when connected via the dashboard.\n\n```bash\n# Verify credentials\n[ -n \"$WANDB_API_KEY\" ] && echo \"WANDB_API_KEY set\" || echo \"NOT SET\"\n```\n\nIf not set: connect Weights & Biases at https:\u002F\u002Fapp.syntheticsciences.ai -> Services, then restart openscience.\n\n## Installation\n\n```bash\n# Install W&B\npip install wandb\n\n# Login (creates API key)\nwandb login\n\n# Or set API key programmatically\nexport WANDB_API_KEY=your_api_key_here\n```\n\n## Quick Start\n\n### Basic Experiment Tracking\n\n```python\nimport wandb\n\n# Initialize a run\nrun = wandb.init(\n    project=\"my-project\",\n    config={\n        \"learning_rate\": 0.001,\n        \"epochs\": 10,\n        \"batch_size\": 32,\n        \"architecture\": \"ResNet50\"\n    }\n)\n\n# Training loop\nfor epoch in range(run.config.epochs):\n    # Your training code\n    train_loss = train_epoch()\n    val_loss = validate()\n\n    # Log metrics\n    wandb.log({\n        \"epoch\": epoch,\n        \"train\u002Floss\": train_loss,\n        \"val\u002Floss\": val_loss,\n        \"train\u002Faccuracy\": train_acc,\n        \"val\u002Faccuracy\": val_acc\n    })\n\n# Finish the run\nwandb.finish()\n```\n\n### With PyTorch\n\n```python\nimport torch\nimport wandb\n\n# Initialize\nwandb.init(project=\"pytorch-demo\", config={\n    \"lr\": 0.001,\n    \"epochs\": 10\n})\n\n# Access config\nconfig = wandb.config\n\n# Training loop\nfor epoch in range(config.epochs):\n    for batch_idx, (data, target) in enumerate(train_loader):\n        # Forward pass\n        output = model(data)\n        loss = criterion(output, target)\n\n        # Backward pass\n        optimizer.zero_grad()\n        loss.backward()\n        optimizer.step()\n\n        # Log every 100 batches\n        if batch_idx % 100 == 0:\n            wandb.log({\n                \"loss\": loss.item(),\n                \"epoch\": epoch,\n                \"batch\": batch_idx\n            })\n\n# Save model\ntorch.save(model.state_dict(), \"model.pth\")\nwandb.save(\"model.pth\")  # Upload to W&B\n\nwandb.finish()\n```\n\n## Core Concepts\n\n### 1. Projects and Runs\n\n**Project**: Collection of related experiments\n**Run**: Single execution of your training script\n\n```python\n# Create\u002Fuse project\nrun = wandb.init(\n    project=\"image-classification\",\n    name=\"resnet50-experiment-1\",  # Optional run name\n    tags=[\"baseline\", \"resnet\"],    # Organize with tags\n    notes=\"First baseline run\"      # Add notes\n)\n\n# Each run has unique ID\nprint(f\"Run ID: {run.id}\")\nprint(f\"Run URL: {run.url}\")\n```\n\n### 2. Configuration Tracking\n\nTrack hyperparameters automatically:\n\n```python\nconfig = {\n    # Model architecture\n    \"model\": \"ResNet50\",\n    \"pretrained\": True,\n\n    # Training params\n    \"learning_rate\": 0.001,\n    \"batch_size\": 32,\n    \"epochs\": 50,\n    \"optimizer\": \"Adam\",\n\n    # Data params\n    \"dataset\": \"ImageNet\",\n    \"augmentation\": \"standard\"\n}\n\nwandb.init(project=\"my-project\", config=config)\n\n# Access config during training\nlr = wandb.config.learning_rate\nbatch_size = wandb.config.batch_size\n```\n\n### 3. Metric Logging\n\n```python\n# Log scalars\nwandb.log({\"loss\": 0.5, \"accuracy\": 0.92})\n\n# Log multiple metrics\nwandb.log({\n    \"train\u002Floss\": train_loss,\n    \"train\u002Faccuracy\": train_acc,\n    \"val\u002Floss\": val_loss,\n    \"val\u002Faccuracy\": val_acc,\n    \"learning_rate\": current_lr,\n    \"epoch\": epoch\n})\n\n# Log with custom x-axis\nwandb.log({\"loss\": loss}, step=global_step)\n\n# Log media (images, audio, video)\nwandb.log({\"examples\": [wandb.Image(img) for img in images]})\n\n# Log histograms\nwandb.log({\"gradients\": wandb.Histogram(gradients)})\n\n# Log tables\ntable = wandb.Table(columns=[\"id\", \"prediction\", \"ground_truth\"])\nwandb.log({\"predictions\": table})\n```\n\n### 4. Model Checkpointing\n\n```python\nimport torch\nimport wandb\n\n# Save model checkpoint\ncheckpoint = {\n    'epoch': epoch,\n    'model_state_dict': model.state_dict(),\n    'optimizer_state_dict': optimizer.state_dict(),\n    'loss': loss,\n}\n\ntorch.save(checkpoint, 'checkpoint.pth')\n\n# Upload to W&B\nwandb.save('checkpoint.pth')\n\n# Or use Artifacts (recommended)\nartifact = wandb.Artifact('model', type='model')\nartifact.add_file('checkpoint.pth')\nwandb.log_artifact(artifact)\n```\n\n## Hyperparameter Sweeps\n\nAutomatically search for optimal hyperparameters.\n\n### Define Sweep Configuration\n\n```python\nsweep_config = {\n    'method': 'bayes',  # or 'grid', 'random'\n    'metric': {\n        'name': 'val\u002Faccuracy',\n        'goal': 'maximize'\n    },\n    'parameters': {\n        'learning_rate': {\n            'distribution': 'log_uniform',\n            'min': 1e-5,\n            'max': 1e-1\n        },\n        'batch_size': {\n            'values': [16, 32, 64, 128]\n        },\n        'optimizer': {\n            'values': ['adam', 'sgd', 'rmsprop']\n        },\n        'dropout': {\n            'distribution': 'uniform',\n            'min': 0.1,\n            'max': 0.5\n        }\n    }\n}\n\n# Initialize sweep\nsweep_id = wandb.sweep(sweep_config, project=\"my-project\")\n```\n\n### Define Training Function\n\n```python\ndef train():\n    # Initialize run\n    run = wandb.init()\n\n    # Access sweep parameters\n    lr = wandb.config.learning_rate\n    batch_size = wandb.config.batch_size\n    optimizer_name = wandb.config.optimizer\n\n    # Build model with sweep config\n    model = build_model(wandb.config)\n    optimizer = get_optimizer(optimizer_name, lr)\n\n    # Training loop\n    for epoch in range(NUM_EPOCHS):\n        train_loss = train_epoch(model, optimizer, batch_size)\n        val_acc = validate(model)\n\n        # Log metrics\n        wandb.log({\n            \"train\u002Floss\": train_loss,\n            \"val\u002Faccuracy\": val_acc\n        })\n\n# Run sweep\nwandb.agent(sweep_id, function=train, count=50)  # Run 50 trials\n```\n\n### Sweep Strategies\n\n```python\n# Grid search - exhaustive\nsweep_config = {\n    'method': 'grid',\n    'parameters': {\n        'lr': {'values': [0.001, 0.01, 0.1]},\n        'batch_size': {'values': [16, 32, 64]}\n    }\n}\n\n# Random search\nsweep_config = {\n    'method': 'random',\n    'parameters': {\n        'lr': {'distribution': 'uniform', 'min': 0.0001, 'max': 0.1},\n        'dropout': {'distribution': 'uniform', 'min': 0.1, 'max': 0.5}\n    }\n}\n\n# Bayesian optimization (recommended)\nsweep_config = {\n    'method': 'bayes',\n    'metric': {'name': 'val\u002Floss', 'goal': 'minimize'},\n    'parameters': {\n        'lr': {'distribution': 'log_uniform', 'min': 1e-5, 'max': 1e-1}\n    }\n}\n```\n\n## Artifacts\n\nTrack datasets, models, and other files with lineage.\n\n### Log Artifacts\n\n```python\n# Create artifact\nartifact = wandb.Artifact(\n    name='training-dataset',\n    type='dataset',\n    description='ImageNet training split',\n    metadata={'size': '1.2M images', 'split': 'train'}\n)\n\n# Add files\nartifact.add_file('data\u002Ftrain.csv')\nartifact.add_dir('data\u002Fimages\u002F')\n\n# Log artifact\nwandb.log_artifact(artifact)\n```\n\n### Use Artifacts\n\n```python\n# Download and use artifact\nrun = wandb.init(project=\"my-project\")\n\n# Download artifact\nartifact = run.use_artifact('training-dataset:latest')\nartifact_dir = artifact.download()\n\n# Use the data\ndata = load_data(f\"{artifact_dir}\u002Ftrain.csv\")\n```\n\n### Model Registry\n\n```python\n# Log model as artifact\nmodel_artifact = wandb.Artifact(\n    name='resnet50-model',\n    type='model',\n    metadata={'architecture': 'ResNet50', 'accuracy': 0.95}\n)\n\nmodel_artifact.add_file('model.pth')\nwandb.log_artifact(model_artifact, aliases=['best', 'production'])\n\n# Link to model registry\nrun.link_artifact(model_artifact, 'model-registry\u002Fproduction-models')\n```\n\n## Integration Examples\n\n### HuggingFace Transformers\n\n```python\nfrom transformers import Trainer, TrainingArguments\nimport wandb\n\n# Initialize W&B\nwandb.init(project=\"hf-transformers\")\n\n# Training arguments with W&B\ntraining_args = TrainingArguments(\n    output_dir=\".\u002Fresults\",\n    report_to=\"wandb\",  # Enable W&B logging\n    run_name=\"bert-finetuning\",\n    logging_steps=100,\n    save_steps=500\n)\n\n# Trainer automatically logs to W&B\ntrainer = Trainer(\n    model=model,\n    args=training_args,\n    train_dataset=train_dataset,\n    eval_dataset=eval_dataset\n)\n\ntrainer.train()\n```\n\n### PyTorch Lightning\n\n```python\nfrom pytorch_lightning import Trainer\nfrom pytorch_lightning.loggers import WandbLogger\nimport wandb\n\n# Create W&B logger\nwandb_logger = WandbLogger(\n    project=\"lightning-demo\",\n    log_model=True  # Log model checkpoints\n)\n\n# Use with Trainer\ntrainer = Trainer(\n    logger=wandb_logger,\n    max_epochs=10\n)\n\ntrainer.fit(model, datamodule=dm)\n```\n\n### Keras\u002FTensorFlow\n\n```python\nimport wandb\nfrom wandb.keras import WandbCallback\n\n# Initialize\nwandb.init(project=\"keras-demo\")\n\n# Add callback\nmodel.fit(\n    x_train, y_train,\n    validation_data=(x_val, y_val),\n    epochs=10,\n    callbacks=[WandbCallback()]  # Auto-logs metrics\n)\n```\n\n## Visualization & Analysis\n\n### Custom Charts\n\n```python\n# Log custom visualizations\nimport matplotlib.pyplot as plt\n\nfig, ax = plt.subplots()\nax.plot(x, y)\nwandb.log({\"custom_plot\": wandb.Image(fig)})\n\n# Log confusion matrix\nwandb.log({\"conf_mat\": wandb.plot.confusion_matrix(\n    probs=None,\n    y_true=ground_truth,\n    preds=predictions,\n    class_names=class_names\n)})\n```\n\n### Reports\n\nCreate shareable reports in W&B UI:\n- Combine runs, charts, and text\n- Markdown support\n- Embeddable visualizations\n- Team collaboration\n\n## Best Practices\n\n### 1. Organize with Tags and Groups\n\n```python\nwandb.init(\n    project=\"my-project\",\n    tags=[\"baseline\", \"resnet50\", \"imagenet\"],\n    group=\"resnet-experiments\",  # Group related runs\n    job_type=\"train\"             # Type of job\n)\n```\n\n### 2. Log Everything Relevant\n\n```python\n# Log system metrics\nwandb.log({\n    \"gpu\u002Futil\": gpu_utilization,\n    \"gpu\u002Fmemory\": gpu_memory_used,\n    \"cpu\u002Futil\": cpu_utilization\n})\n\n# Log code version\nwandb.log({\"git_commit\": git_commit_hash})\n\n# Log data splits\nwandb.log({\n    \"data\u002Ftrain_size\": len(train_dataset),\n    \"data\u002Fval_size\": len(val_dataset)\n})\n```\n\n### 3. Use Descriptive Names\n\n```python\n# ✅ Good: Descriptive run names\nwandb.init(\n    project=\"nlp-classification\",\n    name=\"bert-base-lr0.001-bs32-epoch10\"\n)\n\n# ❌ Bad: Generic names\nwandb.init(project=\"nlp\", name=\"run1\")\n```\n\n### 4. Save Important Artifacts\n\n```python\n# Save final model\nartifact = wandb.Artifact('final-model', type='model')\nartifact.add_file('model.pth')\nwandb.log_artifact(artifact)\n\n# Save predictions for analysis\npredictions_table = wandb.Table(\n    columns=[\"id\", \"input\", \"prediction\", \"ground_truth\"],\n    data=predictions_data\n)\nwandb.log({\"predictions\": predictions_table})\n```\n\n### 5. Use Offline Mode for Unstable Connections\n\n```python\nimport os\n\n# Enable offline mode\nos.environ[\"WANDB_MODE\"] = \"offline\"\n\nwandb.init(project=\"my-project\")\n# ... your code ...\n\n# Sync later\n# wandb sync \u003Crun_directory>\n```\n\n## Team Collaboration\n\n### Share Runs\n\n```python\n# Runs are automatically shareable via URL\nrun = wandb.init(project=\"team-project\")\nprint(f\"Share this URL: {run.url}\")\n```\n\n### Team Projects\n\n- Create team account at wandb.ai\n- Add team members\n- Set project visibility (private\u002Fpublic)\n- Use team-level artifacts and model registry\n\n## Pricing\n\n- **Free**: Unlimited public projects, 100GB storage\n- **Academic**: Free for students\u002Fresearchers\n- **Teams**: $50\u002Fseat\u002Fmonth, private projects, unlimited storage\n- **Enterprise**: Custom pricing, on-prem options\n\n## Resources\n\n- **Documentation**: https:\u002F\u002Fdocs.wandb.ai\n- **GitHub**: https:\u002F\u002Fgithub.com\u002Fwandb\u002Fwandb (10.5k+ stars)\n- **Examples**: https:\u002F\u002Fgithub.com\u002Fwandb\u002Fexamples\n- **Community**: https:\u002F\u002Fwandb.ai\u002Fcommunity\n- **Discord**: https:\u002F\u002Fwandb.me\u002Fdiscord\n\n## See Also\n\n- `references\u002Fsweeps.md` - Comprehensive hyperparameter optimization guide\n- `references\u002Fartifacts.md` - Data and model versioning patterns\n- `references\u002Fintegrations.md` - Framework-specific examples\n\n\n",{"name":5,"tags":49,"author":56,"license":15,"version":57,"category":58,"description":7,"dependencies":59},[50,51,29,32,30,31,52,28,53,54,55],"MLOps","Weights And Biases","Collaboration","PyTorch","TensorFlow","HuggingFace","Synthetic Sciences","1.0.0","ml-training",[60],"wandb","main","4aa39efd1cdab0b4657ecee16c92a92011a5b10f","openscience\u002Fbackend\u002Fcli\u002Fskills\u002Fml-training\u002Fweights-and-biases","https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub","https:\u002F\u002Fgithub.com\u002Ffadrienne","2026-10-28 00:43:09",{"source":8,"skillName":5,"commands":68,"prompt":78,"zipAvailable":79},[69,72,75],{"tool":70,"command":71},"npx","npx skills add fadrienne\u002FMyGitHub --skill weights-and-biases",{"tool":73,"command":74},"bunx","bunx skills add fadrienne\u002FMyGitHub --skill weights-and-biases",{"tool":76,"command":77},"pnpm","pnpm dlx skills add fadrienne\u002FMyGitHub --skill weights-and-biases","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub\u002Fblob\u002Fmain\u002Fopenscience\u002Fbackend\u002Fcli\u002Fskills\u002Fml-training\u002Fweights-and-biases\u002FSKILL.md",true,[81,87,91],{"path":82,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":85,"sourceHtmlUrl":86},"references\u002Fartifacts.md","REFERENCE","参考文档",13425,"https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub\u002Fblob\u002Fmain\u002Fopenscience\u002Fbackend\u002Fcli\u002Fskills\u002Fml-training\u002Fweights-and-biases\u002Freferences\u002Fartifacts.md",{"path":88,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":89,"sourceHtmlUrl":90},"references\u002Fintegrations.md",16219,"https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub\u002Fblob\u002Fmain\u002Fopenscience\u002Fbackend\u002Fcli\u002Fskills\u002Fml-training\u002Fweights-and-biases\u002Freferences\u002Fintegrations.md",{"path":92,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":93,"sourceHtmlUrl":94},"references\u002Fsweeps.md",17675,"https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub\u002Fblob\u002Fmain\u002Fopenscience\u002Fbackend\u002Fcli\u002Fskills\u002Fml-training\u002Fweights-and-biases\u002Freferences\u002Fsweeps.md",[96,126,153,187,211,238],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":105,"publishedAt":44},"01M7167B28PK20HP7R7ZED2DY0","statistical-power","Sample size calculation, power analysis, and effect size conversion for scientific studies. Use BEFORE data collection (a priori) to determine required N, or after (post-hoc) to compute achieved power. Covers parametric tests (t-test, ANOVA, chi-square, proportions, correlation, regression), simulation-based power for complex\u002Fclustered\u002Fnested designs, and power curves. Use this skill when someone asks 'how many samples do I need', 'what is my power', 'what effect size can I detect', or any variant. Pairs with \u002Fexperimental-design (choose design first, then compute power) and \u002Fstatistical-analysis (analyze data after collection).","https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub\u002Fblob\u002Fmain\u002Fscientific-agent-skills\u002Fskills\u002Fstatistical-power\u002FSKILL.md",[102],{"categoryNo":103,"categoryName":104,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125],"power","statistical power","effect","scipy","regression","choose","design","uv","when","Bash","collection","analysis","calculation","ANOVA","conversion","analyze","t-test","chi-square","simulation","sample",{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":130,"categories":131,"keywords":135,"publishedAt":44},"01M71677EBCM8EPCE9BZCK8505","statistical-analysis","Guided statistical analysis with test selection and reporting. Use when you need help choosing appropriate tests for your data, assumption checking, power analysis, and APA-formatted results. Best for academic research reporting, test selection guidance. For implementing specific models programmatically use statsmodels.","https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub\u002Fblob\u002Fmain\u002Fscientific-agent-skills\u002Fskills\u002Fstatistical-analysis\u002FSKILL.md",[132],{"categoryNo":133,"categoryName":134,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",[117,136,106,137,138,139,114,140,141,142,143,144,145,146,147,148,149,150,151,152],"statistical analysis","academic research","implementing","selection","you","reporting","data","for","tests","use","with","test","research","results","statsmodels","models","help",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":168,"publishedAt":44},"01M71673R93XAHFH81DBNVNG7H","scientific-writing","Core skill for the deep research and writing tool. Write scientific manuscripts in full paragraphs (never bullet points). Use two-stage process with (1) section outlines with key points using research-lookup then (2) convert to flowing prose. IMRAD structure, citations (APA\u002FAMA\u002FVancouver), figures\u002Ftables, reporting guidelines (CONSORT\u002FSTROBE\u002FPRISMA), for research papers and journal submissions.","https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub\u002Fblob\u002Fmain\u002Fscientific-agent-skills\u002Fskills\u002Fscientific-writing\u002FSKILL.md",[159,162,163],{"categoryNo":160,"categoryName":161,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":103,"categoryName":104,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":164,"categoryName":165,"taxonomyType":166,"taxonomyTypeDesc":167},"01JBSEEDCAT000000000000036","内容创作者","PROFESSION","适用职业",[169,170,171,172,173,174,175,176,177,178,115,179,180,181,182,183,184,185,141,186],"writing","scientific","scientific writing","Citations","deep","deep research","never","papers","journal","false","api","prisma","structure","openrouter","Outlines","core skill","read","features",{"skillNo":188,"name":189,"nameZh":6,"description":190,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":191,"categories":192,"keywords":195,"publishedAt":44},"01M7166ZPKXBF4EBPHVTJPQBB1","scientific-visualization","Meta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib\u002Fseaborn\u002Fplotly with publication styles. For quick exploration use seaborn or plotly directly.","https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub\u002Fblob\u002Fmain\u002Fscientific-agent-skills\u002Fskills\u002Fscientific-visualization\u002FSKILL.md",[193,194],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":103,"categoryName":104,"taxonomyType":21,"taxonomyTypeDesc":22},[41,170,196,197,198,199,200,201,202,177,114,203,204,205,206,207,208,209,143,210],"scientific visualization","error","ready","quick","exploration","meta-skill","Meta","safe","plotly","annotations","formatting","Publication","figures","panel","submission",{"skillNo":212,"name":213,"nameZh":6,"description":214,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":215,"categories":216,"keywords":223,"publishedAt":44},"01M7166VXJWQSSC3RQZP60WBGR","research-code","Debug, profile, review, and restructure Python research and analysis code. Use when analysis scripts crash, produce wrong results, run too slowly, or need a correctness review. Covers: reading tracebacks and diagnosing root causes, hypothesis-driven debugging, reviewing code for common statistical\u002Fnumerical errors, profiling data pipelines, improving reproducibility (seeds, environments, determinism), and structuring analysis scripts for sharing. Distinct from \u002Fexploratory-data-analysis (which understands data) and \u002Fstatistical-analysis (which chooses and runs tests) — this skill focuses on the code itself.","https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub\u002Fblob\u002Fmain\u002Fscientific-agent-skills\u002Fskills\u002Fresearch-code\u002FSKILL.md",[217,220],{"categoryNo":218,"categoryName":219,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000021","资料检索与研究",{"categoryNo":221,"categoryName":222,"taxonomyType":166,"taxonomyTypeDesc":167},"01JBSEEDCAT000000000000030","开发工程师",[224,225,148,226,227,228,229,113,230,114,115,117,231,232,233,234,235,236,185,237],"code","research code","which","memory","data-analysis","errors","debugging","common","review","data pipelines","run","scripts","line","write",{"skillNo":239,"name":240,"nameZh":6,"description":241,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":242,"licenseFileUrl":6,"sourceHtmlUrl":243,"categories":244,"keywords":251,"publishedAt":44},"01M7166CF5HSR7SVZYZFWTDX55","markdown-mermaid-writing","Comprehensive markdown and Mermaid diagram writing skill. Use when creating any scientific document, report, analysis, or visualization. Establishes text-based diagrams as the default documentation standard with full style guides (markdown + mermaid), 24 diagram type references, and 9 document templates.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub\u002Fblob\u002Fmain\u002Fscientific-agent-skills\u002Fskills\u002Fmarkdown-mermaid-writing\u002FSKILL.md",[245,248,249,250],{"categoryNo":246,"categoryName":247,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理",{"categoryNo":160,"categoryName":161,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":103,"categoryName":104,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":164,"categoryName":165,"taxonomyType":166,"taxonomyTypeDesc":167},[169,252,253,254,255,256,41,257,258,114,115,117,259,260,261,262,263,264,170,185],"markdown mermaid writing","mermaid","markdown","community","diagrams","project","default","team","guides","text","documentation","references","diagram"]