[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73AE31BB1YDC5XYBCJSC4N9":3,"skill-same:01M73AE31BB1YDC5XYBCJSC4N9":73},{"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":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":44,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":47,"ownerDescription":6,"updatedAt":48,"install":49,"resources":62},"01M73AE31BB1YDC5XYBCJSC4N9","experiment-tracking-swanlab",null,"Provides guidance for experiment tracking with SwanLab. Use when you need open-source run tracking, local or self-hosted dashboards, and lightweight media logging for ML workflows.","qhjqhj00\u002Fresearch-skills-pool","qhjqhj00","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F29684092?v=4","01M72AE0ZGXVM5C57N512DGQG8","Tommy Chien","01M72AE107ESJMHT7QC5SXX144",3,"MIT","https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Fskills_collected\u002FOrchestra-Research--AI-research-SKILLs--13-mlops__swanlab\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: experiment-tracking-swanlab\ndescription: Provides guidance for experiment tracking with SwanLab. Use when you need open-source run tracking, local or self-hosted dashboards, and lightweight media logging for ML workflows.\nversion: 1.0.0\nauthor: Orchestra Research\nlicense: MIT\ntags: [MLOps, SwanLab, Experiment Tracking, Open Source, Visualization, PyTorch, Transformers, PyTorch Lightning, Fastai, Self-Hosted]\ndependencies: [swanlab>=0.7.11, pillow>=9.0.0, soundfile>=0.12.0]\n---\n\n# SwanLab: Open-Source Experiment Tracking\n\n## When to Use This Skill\n\nUse SwanLab when you need to:\n- **Track ML experiments** with metrics, configs, tags, and descriptions\n- **Visualize training** with scalar charts and logged media\n- **Compare runs** across seeds, checkpoints, and hyperparameters\n- **Work locally or self-hosted** instead of depending on managed SaaS\n- **Integrate** with PyTorch, Transformers, PyTorch Lightning, or Fastai\n\n**Deployment**: Cloud, local, or self-hosted | **Media**: images, audio, text, GIFs, point clouds, molecules | **Integrations**: PyTorch, Transformers, PyTorch Lightning, Fastai\n\n## Installation\n\n```bash\n# Install SwanLab plus the media dependencies used in this skill\npip install \"swanlab>=0.7.11\" \"pillow>=9.0.0\" \"soundfile>=0.12.0\"\n\n# Add local dashboard support for mode=\"local\" and swanlab watch\npip install \"swanlab[dashboard]>=0.7.11\"\n\n# Optional framework integrations\npip install transformers pytorch-lightning fastai\n\n# Login for cloud or self-hosted usage\nswanlab login\n```\n\n`pillow` and `soundfile` are the media dependencies used by the Image and Audio examples in this skill. `swanlab[dashboard]` adds the local dashboard dependency required by `mode=\"local\"` and `swanlab watch`.\n\n## Quick Start\n\n### Basic Experiment Tracking\n\n```python\nimport swanlab\n\nrun = swanlab.init(\n    project=\"my-project\",\n    experiment_name=\"baseline\",\n    config={\n        \"learning_rate\": 1e-3,\n        \"epochs\": 10,\n        \"batch_size\": 32,\n        \"model\": \"resnet18\",\n    },\n)\n\nfor epoch in range(run.config.epochs):\n    train_loss = train_epoch()\n    val_loss = validate()\n\n    swanlab.log(\n        {\n            \"train\u002Floss\": train_loss,\n            \"val\u002Floss\": val_loss,\n            \"epoch\": epoch,\n        }\n    )\n\nrun.finish()\n```\n\n### With PyTorch\n\n```python\nimport torch\nimport torch.nn as nn\nimport torch.optim as optim\nimport swanlab\n\nrun = swanlab.init(\n    project=\"pytorch-demo\",\n    experiment_name=\"mnist-mlp\",\n    config={\n        \"learning_rate\": 1e-3,\n        \"batch_size\": 64,\n        \"epochs\": 10,\n        \"hidden_size\": 128,\n    },\n)\n\nmodel = nn.Sequential(\n    nn.Flatten(),\n    nn.Linear(28 * 28, run.config.hidden_size),\n    nn.ReLU(),\n    nn.Linear(run.config.hidden_size, 10),\n)\noptimizer = optim.Adam(model.parameters(), lr=run.config.learning_rate)\ncriterion = nn.CrossEntropyLoss()\n\nfor epoch in range(run.config.epochs):\n    model.train()\n    for batch_idx, (data, target) in enumerate(train_loader):\n        optimizer.zero_grad()\n        logits = model(data)\n        loss = criterion(logits, target)\n        loss.backward()\n        optimizer.step()\n\n        if batch_idx % 100 == 0:\n            swanlab.log(\n                {\n                    \"train\u002Floss\": loss.item(),\n                    \"train\u002Fepoch\": epoch,\n                    \"train\u002Fbatch\": batch_idx,\n                }\n            )\n\nrun.finish()\n```\n\n## Core Concepts\n\n### 1. Projects and Experiments\n\n**Project**: Collection of related experiments  \n**Experiment**: Single execution of a training or evaluation workflow\n\n```python\nimport swanlab\n\nrun = swanlab.init(\n    project=\"image-classification\",\n    experiment_name=\"resnet18-seed42\",\n    description=\"Baseline run on ImageNet subset\",\n    tags=[\"baseline\", \"resnet18\"],\n    config={\n        \"model\": \"resnet18\",\n        \"seed\": 42,\n        \"batch_size\": 64,\n        \"learning_rate\": 3e-4,\n    },\n)\n\nprint(run.id)\nprint(run.config.learning_rate)\n```\n\n### 2. Configuration Tracking\n\n```python\nconfig = {\n    \"model\": \"resnet18\",\n    \"seed\": 42,\n    \"batch_size\": 64,\n    \"learning_rate\": 3e-4,\n    \"epochs\": 20,\n}\n\nrun = swanlab.init(project=\"my-project\", config=config)\n\nlearning_rate = run.config.learning_rate\nbatch_size = run.config.batch_size\n```\n\n### 3. Metric Logging\n\n```python\n# Log scalars\nswanlab.log({\"loss\": 0.42, \"accuracy\": 0.91})\n\n# Log multiple metrics\nswanlab.log(\n    {\n        \"train\u002Floss\": train_loss,\n        \"train\u002Faccuracy\": train_acc,\n        \"val\u002Floss\": val_loss,\n        \"val\u002Faccuracy\": val_acc,\n        \"lr\": current_lr,\n        \"epoch\": epoch,\n    }\n)\n\n# Log with custom step\nswanlab.log({\"loss\": loss}, step=global_step)\n```\n\n### 4. Media and Chart Logging\n\n```python\nimport numpy as np\nimport swanlab\n\n# Image\nimage = np.random.randint(0, 255, (224, 224, 3), dtype=np.uint8)\nswanlab.log({\"examples\u002Fimage\": swanlab.Image(image, caption=\"Augmented sample\")})\n\n# Audio\nwave = np.sin(np.linspace(0, 8 * np.pi, 16000)).astype(\"float32\")\nswanlab.log({\"examples\u002Faudio\": swanlab.Audio(wave, sample_rate=16000)})\n\n# Text\nswanlab.log({\"examples\u002Ftext\": swanlab.Text(\"Training notes for this run.\")})\n\n# GIF video\nswanlab.log({\"examples\u002Fvideo\": swanlab.Video(\"predictions.gif\", caption=\"Validation rollout\")})\n\n# Point cloud\npoints = np.random.rand(128, 3).astype(\"float32\")\nswanlab.log({\"examples\u002Fpoint_cloud\": swanlab.Object3D(points, caption=\"Point cloud sample\")})\n\n# Molecule\nswanlab.log({\"examples\u002Fmolecule\": swanlab.Molecule.from_smiles(\"CCO\", caption=\"Ethanol\")})\n```\n\n```python\n# Custom chart with swanlab.echarts\nline = swanlab.echarts.Line()\nline.add_xaxis([\"epoch-1\", \"epoch-2\", \"epoch-3\"])\nline.add_yaxis(\"train\u002Floss\", [0.92, 0.61, 0.44])\nline.set_global_opts(\n    title_opts=swanlab.echarts.options.TitleOpts(title=\"Training Loss\")\n)\n\nswanlab.log({\"charts\u002Floss_curve\": line})\n```\n\nSee [references\u002Fvisualization.md](references\u002Fvisualization.md) for more chart and media patterns.\n\n### 5. Local and Self-Hosted Workflows\n\n```python\nimport os\nimport swanlab\n\n# Self-hosted or cloud login\nswanlab.login(\n    api_key=os.environ[\"SWANLAB_API_KEY\"],\n    host=\"http:\u002F\u002Fyour-server:5092\",\n)\n\n# Local-only logging\nrun = swanlab.init(\n    project=\"offline-demo\",\n    mode=\"local\",\n    logdir=\".\u002Fswanlog\",\n)\n\nswanlab.log({\"loss\": 0.35, \"epoch\": 1})\nrun.finish()\n```\n\n```bash\n# View local logs\nswanlab watch -l .\u002Fswanlog\n\n# Sync local logs later\nswanlab sync .\u002Fswanlog\n```\n\n## Integration Examples\n\n### HuggingFace Transformers\n\n```python\nfrom transformers import Trainer, TrainingArguments\n\ntraining_args = TrainingArguments(\n    output_dir=\".\u002Fresults\",\n    per_device_train_batch_size=8,\n    evaluation_strategy=\"epoch\",\n    logging_steps=50,\n    report_to=\"swanlab\",\n    run_name=\"bert-finetune\",\n)\n\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\nSee [references\u002Fintegrations.md](references\u002Fintegrations.md) for callback-based setups and additional framework patterns.\n\n### PyTorch Lightning\n\n```python\nimport pytorch_lightning as pl\nfrom swanlab.integration.pytorch_lightning import SwanLabLogger\n\nswanlab_logger = SwanLabLogger(\n    project=\"lightning-demo\",\n    experiment_name=\"mnist-classifier\",\n    config={\"batch_size\": 64, \"max_epochs\": 10},\n)\n\ntrainer = pl.Trainer(\n    logger=swanlab_logger,\n    max_epochs=10,\n    accelerator=\"auto\",\n)\n\ntrainer.fit(model, train_loader, val_loader)\n```\n\n### Fastai\n\n```python\nfrom fastai.vision.all import accuracy, resnet34, vision_learner\nfrom swanlab.integration.fastai import SwanLabCallback\n\nlearn = vision_learner(dls, resnet34, metrics=accuracy)\nlearn.fit(\n    5,\n    cbs=[\n        SwanLabCallback(\n            project=\"fastai-demo\",\n            experiment_name=\"pets-classification\",\n            config={\"arch\": \"resnet34\", \"epochs\": 5},\n        )\n    ],\n)\n```\n\nSee [references\u002Fintegrations.md](references\u002Fintegrations.md) for fuller framework examples.\n\n## Best Practices\n\n### 1. Use Stable Metric Names\n\n```python\n# Good: grouped metric namespaces\nswanlab.log({\n    \"train\u002Floss\": train_loss,\n    \"train\u002Faccuracy\": train_acc,\n    \"val\u002Floss\": val_loss,\n    \"val\u002Faccuracy\": val_acc,\n})\n\n# Avoid mixing flat and grouped names for the same metric family\n```\n\n### 2. Initialize Early and Capture Config Once\n\n```python\nrun = swanlab.init(\n    project=\"image-classification\",\n    experiment_name=\"resnet18-baseline\",\n    config={\n        \"model\": \"resnet18\",\n        \"learning_rate\": 3e-4,\n        \"batch_size\": 64,\n        \"seed\": 42,\n    },\n)\n```\n\n### 3. Save Checkpoints Locally\n\n```python\nimport torch\nimport swanlab\n\ncheckpoint_path = \"checkpoints\u002Fbest.pth\"\ntorch.save(model.state_dict(), checkpoint_path)\n\nswanlab.log(\n    {\n        \"best\u002Fval_accuracy\": best_val_accuracy,\n        \"artifacts\u002Fcheckpoint_path\": swanlab.Text(checkpoint_path),\n    }\n)\n```\n\n### 4. Use Local Mode for Offline-First Workflows\n\n```python\nrun = swanlab.init(project=\"offline-demo\", mode=\"local\", logdir=\".\u002Fswanlog\")\n# ... training code ...\nrun.finish()\n\n# Inspect later with: swanlab watch -l .\u002Fswanlog\n```\n\n### 5. Keep Advanced Patterns in References\n\n- Use [references\u002Fvisualization.md](references\u002Fvisualization.md) for advanced chart and media patterns\n- Use [references\u002Fintegrations.md](references\u002Fintegrations.md) for callback-based and framework-specific integration details\n\n## Resources\n\n- [Official docs (Chinese)](https:\u002F\u002Fdocs.swanlab.cn)\n- [Official docs (English)](https:\u002F\u002Fdocs.swanlab.cn\u002Fen)\n- [GitHub repo](https:\u002F\u002Fgithub.com\u002FSwanHubX\u002FSwanLab)\n- [Self-hosted repo](https:\u002F\u002Fgithub.com\u002FSwanHubX\u002Fself-hosted)\n\n## See Also\n\n- [references\u002Fintegrations.md](references\u002Fintegrations.md) - Framework-specific examples\n- [references\u002Fvisualization.md](references\u002Fvisualization.md) - Charts and media logging patterns\n","# SwanLab: Open-Source Experiment Tracking\n\n## When to Use This Skill\n\nUse SwanLab when you need to:\n- **Track ML experiments** with metrics, configs, tags, and descriptions\n- **Visualize training** with scalar charts and logged media\n- **Compare runs** across seeds, checkpoints, and hyperparameters\n- **Work locally or self-hosted** instead of depending on managed SaaS\n- **Integrate** with PyTorch, Transformers, PyTorch Lightning, or Fastai\n\n**Deployment**: Cloud, local, or self-hosted | **Media**: images, audio, text, GIFs, point clouds, molecules | **Integrations**: PyTorch, Transformers, PyTorch Lightning, Fastai\n\n## Installation\n\n```bash\n# Install SwanLab plus the media dependencies used in this skill\npip install \"swanlab>=0.7.11\" \"pillow>=9.0.0\" \"soundfile>=0.12.0\"\n\n# Add local dashboard support for mode=\"local\" and swanlab watch\npip install \"swanlab[dashboard]>=0.7.11\"\n\n# Optional framework integrations\npip install transformers pytorch-lightning fastai\n\n# Login for cloud or self-hosted usage\nswanlab login\n```\n\n`pillow` and `soundfile` are the media dependencies used by the Image and Audio examples in this skill. `swanlab[dashboard]` adds the local dashboard dependency required by `mode=\"local\"` and `swanlab watch`.\n\n## Quick Start\n\n### Basic Experiment Tracking\n\n```python\nimport swanlab\n\nrun = swanlab.init(\n    project=\"my-project\",\n    experiment_name=\"baseline\",\n    config={\n        \"learning_rate\": 1e-3,\n        \"epochs\": 10,\n        \"batch_size\": 32,\n        \"model\": \"resnet18\",\n    },\n)\n\nfor epoch in range(run.config.epochs):\n    train_loss = train_epoch()\n    val_loss = validate()\n\n    swanlab.log(\n        {\n            \"train\u002Floss\": train_loss,\n            \"val\u002Floss\": val_loss,\n            \"epoch\": epoch,\n        }\n    )\n\nrun.finish()\n```\n\n### With PyTorch\n\n```python\nimport torch\nimport torch.nn as nn\nimport torch.optim as optim\nimport swanlab\n\nrun = swanlab.init(\n    project=\"pytorch-demo\",\n    experiment_name=\"mnist-mlp\",\n    config={\n        \"learning_rate\": 1e-3,\n        \"batch_size\": 64,\n        \"epochs\": 10,\n        \"hidden_size\": 128,\n    },\n)\n\nmodel = nn.Sequential(\n    nn.Flatten(),\n    nn.Linear(28 * 28, run.config.hidden_size),\n    nn.ReLU(),\n    nn.Linear(run.config.hidden_size, 10),\n)\noptimizer = optim.Adam(model.parameters(), lr=run.config.learning_rate)\ncriterion = nn.CrossEntropyLoss()\n\nfor epoch in range(run.config.epochs):\n    model.train()\n    for batch_idx, (data, target) in enumerate(train_loader):\n        optimizer.zero_grad()\n        logits = model(data)\n        loss = criterion(logits, target)\n        loss.backward()\n        optimizer.step()\n\n        if batch_idx % 100 == 0:\n            swanlab.log(\n                {\n                    \"train\u002Floss\": loss.item(),\n                    \"train\u002Fepoch\": epoch,\n                    \"train\u002Fbatch\": batch_idx,\n                }\n            )\n\nrun.finish()\n```\n\n## Core Concepts\n\n### 1. Projects and Experiments\n\n**Project**: Collection of related experiments  \n**Experiment**: Single execution of a training or evaluation workflow\n\n```python\nimport swanlab\n\nrun = swanlab.init(\n    project=\"image-classification\",\n    experiment_name=\"resnet18-seed42\",\n    description=\"Baseline run on ImageNet subset\",\n    tags=[\"baseline\", \"resnet18\"],\n    config={\n        \"model\": \"resnet18\",\n        \"seed\": 42,\n        \"batch_size\": 64,\n        \"learning_rate\": 3e-4,\n    },\n)\n\nprint(run.id)\nprint(run.config.learning_rate)\n```\n\n### 2. Configuration Tracking\n\n```python\nconfig = {\n    \"model\": \"resnet18\",\n    \"seed\": 42,\n    \"batch_size\": 64,\n    \"learning_rate\": 3e-4,\n    \"epochs\": 20,\n}\n\nrun = swanlab.init(project=\"my-project\", config=config)\n\nlearning_rate = run.config.learning_rate\nbatch_size = run.config.batch_size\n```\n\n### 3. Metric Logging\n\n```python\n# Log scalars\nswanlab.log({\"loss\": 0.42, \"accuracy\": 0.91})\n\n# Log multiple metrics\nswanlab.log(\n    {\n        \"train\u002Floss\": train_loss,\n        \"train\u002Faccuracy\": train_acc,\n        \"val\u002Floss\": val_loss,\n        \"val\u002Faccuracy\": val_acc,\n        \"lr\": current_lr,\n        \"epoch\": epoch,\n    }\n)\n\n# Log with custom step\nswanlab.log({\"loss\": loss}, step=global_step)\n```\n\n### 4. Media and Chart Logging\n\n```python\nimport numpy as np\nimport swanlab\n\n# Image\nimage = np.random.randint(0, 255, (224, 224, 3), dtype=np.uint8)\nswanlab.log({\"examples\u002Fimage\": swanlab.Image(image, caption=\"Augmented sample\")})\n\n# Audio\nwave = np.sin(np.linspace(0, 8 * np.pi, 16000)).astype(\"float32\")\nswanlab.log({\"examples\u002Faudio\": swanlab.Audio(wave, sample_rate=16000)})\n\n# Text\nswanlab.log({\"examples\u002Ftext\": swanlab.Text(\"Training notes for this run.\")})\n\n# GIF video\nswanlab.log({\"examples\u002Fvideo\": swanlab.Video(\"predictions.gif\", caption=\"Validation rollout\")})\n\n# Point cloud\npoints = np.random.rand(128, 3).astype(\"float32\")\nswanlab.log({\"examples\u002Fpoint_cloud\": swanlab.Object3D(points, caption=\"Point cloud sample\")})\n\n# Molecule\nswanlab.log({\"examples\u002Fmolecule\": swanlab.Molecule.from_smiles(\"CCO\", caption=\"Ethanol\")})\n```\n\n```python\n# Custom chart with swanlab.echarts\nline = swanlab.echarts.Line()\nline.add_xaxis([\"epoch-1\", \"epoch-2\", \"epoch-3\"])\nline.add_yaxis(\"train\u002Floss\", [0.92, 0.61, 0.44])\nline.set_global_opts(\n    title_opts=swanlab.echarts.options.TitleOpts(title=\"Training Loss\")\n)\n\nswanlab.log({\"charts\u002Floss_curve\": line})\n```\n\nSee [references\u002Fvisualization.md](references\u002Fvisualization.md) for more chart and media patterns.\n\n### 5. Local and Self-Hosted Workflows\n\n```python\nimport os\nimport swanlab\n\n# Self-hosted or cloud login\nswanlab.login(\n    api_key=os.environ[\"SWANLAB_API_KEY\"],\n    host=\"http:\u002F\u002Fyour-server:5092\",\n)\n\n# Local-only logging\nrun = swanlab.init(\n    project=\"offline-demo\",\n    mode=\"local\",\n    logdir=\".\u002Fswanlog\",\n)\n\nswanlab.log({\"loss\": 0.35, \"epoch\": 1})\nrun.finish()\n```\n\n```bash\n# View local logs\nswanlab watch -l .\u002Fswanlog\n\n# Sync local logs later\nswanlab sync .\u002Fswanlog\n```\n\n## Integration Examples\n\n### HuggingFace Transformers\n\n```python\nfrom transformers import Trainer, TrainingArguments\n\ntraining_args = TrainingArguments(\n    output_dir=\".\u002Fresults\",\n    per_device_train_batch_size=8,\n    evaluation_strategy=\"epoch\",\n    logging_steps=50,\n    report_to=\"swanlab\",\n    run_name=\"bert-finetune\",\n)\n\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\nSee [references\u002Fintegrations.md](references\u002Fintegrations.md) for callback-based setups and additional framework patterns.\n\n### PyTorch Lightning\n\n```python\nimport pytorch_lightning as pl\nfrom swanlab.integration.pytorch_lightning import SwanLabLogger\n\nswanlab_logger = SwanLabLogger(\n    project=\"lightning-demo\",\n    experiment_name=\"mnist-classifier\",\n    config={\"batch_size\": 64, \"max_epochs\": 10},\n)\n\ntrainer = pl.Trainer(\n    logger=swanlab_logger,\n    max_epochs=10,\n    accelerator=\"auto\",\n)\n\ntrainer.fit(model, train_loader, val_loader)\n```\n\n### Fastai\n\n```python\nfrom fastai.vision.all import accuracy, resnet34, vision_learner\nfrom swanlab.integration.fastai import SwanLabCallback\n\nlearn = vision_learner(dls, resnet34, metrics=accuracy)\nlearn.fit(\n    5,\n    cbs=[\n        SwanLabCallback(\n            project=\"fastai-demo\",\n            experiment_name=\"pets-classification\",\n            config={\"arch\": \"resnet34\", \"epochs\": 5},\n        )\n    ],\n)\n```\n\nSee [references\u002Fintegrations.md](references\u002Fintegrations.md) for fuller framework examples.\n\n## Best Practices\n\n### 1. Use Stable Metric Names\n\n```python\n# Good: grouped metric namespaces\nswanlab.log({\n    \"train\u002Floss\": train_loss,\n    \"train\u002Faccuracy\": train_acc,\n    \"val\u002Floss\": val_loss,\n    \"val\u002Faccuracy\": val_acc,\n})\n\n# Avoid mixing flat and grouped names for the same metric family\n```\n\n### 2. Initialize Early and Capture Config Once\n\n```python\nrun = swanlab.init(\n    project=\"image-classification\",\n    experiment_name=\"resnet18-baseline\",\n    config={\n        \"model\": \"resnet18\",\n        \"learning_rate\": 3e-4,\n        \"batch_size\": 64,\n        \"seed\": 42,\n    },\n)\n```\n\n### 3. Save Checkpoints Locally\n\n```python\nimport torch\nimport swanlab\n\ncheckpoint_path = \"checkpoints\u002Fbest.pth\"\ntorch.save(model.state_dict(), checkpoint_path)\n\nswanlab.log(\n    {\n        \"best\u002Fval_accuracy\": best_val_accuracy,\n        \"artifacts\u002Fcheckpoint_path\": swanlab.Text(checkpoint_path),\n    }\n)\n```\n\n### 4. Use Local Mode for Offline-First Workflows\n\n```python\nrun = swanlab.init(project=\"offline-demo\", mode=\"local\", logdir=\".\u002Fswanlog\")\n# ... training code ...\nrun.finish()\n\n# Inspect later with: swanlab watch -l .\u002Fswanlog\n```\n\n### 5. Keep Advanced Patterns in References\n\n- Use [references\u002Fvisualization.md](references\u002Fvisualization.md) for advanced chart and media patterns\n- Use [references\u002Fintegrations.md](references\u002Fintegrations.md) for callback-based and framework-specific integration details\n\n## Resources\n\n- [Official docs (Chinese)](https:\u002F\u002Fdocs.swanlab.cn)\n- [Official docs (English)](https:\u002F\u002Fdocs.swanlab.cn\u002Fen)\n- [GitHub repo](https:\u002F\u002Fgithub.com\u002FSwanHubX\u002FSwanLab)\n- [Self-hosted repo](https:\u002F\u002Fgithub.com\u002FSwanHubX\u002Fself-hosted)\n\n## See Also\n\n- [references\u002Fintegrations.md](references\u002Fintegrations.md) - Framework-specific examples\n- [references\u002Fvisualization.md](references\u002Fvisualization.md) - Charts and media logging patterns\n",{"name":5,"tags":24,"author":35,"license":15,"version":36,"description":7,"dependencies":37},[25,26,27,28,29,30,31,32,33,34],"MLOps","SwanLab","Experiment Tracking","Open Source","Visualization","PyTorch","Transformers","PyTorch Lightning","Fastai","Self-Hosted","Orchestra Research","1.0.0",[38,39,40],"swanlab>=0.7.11","pillow>=9.0.0","soundfile>=0.12.0","master","c247302c836de6438d746b45670990eb71691166","skills_collected\u002FOrchestra-Research--AI-research-SKILLs--13-mlops__swanlab",1,"https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool","https:\u002F\u002Fgithub.com\u002Fqhjqhj00","chien.io","2026-05-11 15:07:59",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add qhjqhj00\u002Fresearch-skills-pool --skill experiment-tracking-swanlab",{"tool":55,"command":56},"bunx","bunx skills add qhjqhj00\u002Fresearch-skills-pool --skill experiment-tracking-swanlab",{"tool":58,"command":59},"pnpm","pnpm dlx skills add qhjqhj00\u002Fresearch-skills-pool --skill experiment-tracking-swanlab","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Fskills_collected\u002FOrchestra-Research--AI-research-SKILLs--13-mlops__swanlab\u002FSKILL.md",true,[63,69],{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fintegrations.md","REFERENCE","参考文档",8017,"https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Fskills_collected\u002FOrchestra-Research--AI-research-SKILLs--13-mlops__swanlab\u002Freferences\u002Fintegrations.md",{"path":70,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Fvisualization.md",5796,"https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Fskills_collected\u002FOrchestra-Research--AI-research-SKILLs--13-mlops__swanlab\u002Freferences\u002Fvisualization.md",[74,81,88,95,102,109],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M73JJB6EQPFPPVQK2Y9N67Q0","transformer-lens-interpretability","Provides guidance for mechanistic interpretability research using TransformerLens to inspect and manipulate transformer internals via HookPoints and activation caching. Use when reverse-engineering model algorithms, studying attention patterns, or performing activation patching experiments.","https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Ftop100-runs\u002F130-transformer-lens\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M73JHTANRRWEE9HP98TPEHAY","wiki-vitepress","Packages generated wiki Markdown into a VitePress static site with dark theme, dark-mode Mermaid diagrams with click-to-zoom, and production build output. Use when the user wants to create a browsable website from generated wiki pages.","https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Ftop100-runs\u002F126-wiki-vitepress\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M73JHJBMVFW46F1Y8K3SBF43","phoenix-observability","Open-source AI observability platform for LLM tracing, evaluation, and monitoring. Use when debugging LLM applications with detailed traces, running evaluations on datasets, or monitoring production AI systems with real-time insights.","https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Ftop100-runs\u002F124-phoenix\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M73JHFPA3A2806PMP42ZN86Q","frontend-ui-dark-ts","Build dark-themed React applications using Tailwind CSS with custom theming, glassmorphism effects, and Framer Motion animations. Use when creating dashboards, admin panels, or data-rich interfaces with a refined dark aesthetic.","https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Ftop100-runs\u002F123-frontend-ui-dark-ts\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":19},"01M73JFVBVK57NRJS49TT2VDCT","tensorboard","Visualize training metrics, debug models with histograms, compare experiments, visualize model graphs, and profile performance with TensorBoard - Google's ML visualization toolkit","https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Ftop100-runs\u002F113-tensorboard\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":113,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":19},"01M73JFF6PK6ZCN41C89J7HS2B","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\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Ftop100-runs\u002F110-markdown-mermaid-writing\u002FSKILL.md",[],[]]