Agent skill

SwanLab Experiment Tracking

by Orchestra-Research in Orchestra-Research/AI-Research-SKILLs

Shows how to log ML runs, configs, metrics and media with SwanLab and view them in cloud, local or self-hosted dashboards.

MITAuto-check passedAI & LLM Engineering

Install SwanLab Experiment Tracking

skills CLI
$ npx skills add Orchestra-Research/AI-Research-SKILLs --skill experiment-tracking-swanlab -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Orchestra-Research/AI-Research-SKILLs experiment-tracking-swanlab --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Orchestra-Research/AI-Research-SKILLs.git skills-src && mkdir -p .claude/skills && cp -r skills-src/13-mlops/swanlab .claude/skills/experiment-tracking-swanlab && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
experiment-tracking-swanlab
GitHub stars
13k
Token cost
~2.4k tokens
SKILL.md length
248 words
Files
3 (incl. references)
Skills in repo
96
Repo updated
First seen
Licence
MIT

At a glance

Shows how to log ML runs, configs, metrics and media with SwanLab and view them in cloud, local or self-hosted dashboards.

  • Works in 10 steps: Projects and Experiments → Configuration Tracking → Metric Logging → …
  • Tracking training runs and comparing seeds or hyperparameters
  • SKILL.md covers When to Use This Skill, Installation, Quick Start and Core Concepts, plus 4 more sections
  • Calls pip; needs SWANLAB_API_KEY

What it does

Setup starts with `swanlab` plus `pillow` and `soundfile` for media logging, and the dashboard extra of swanlab, which local mode and `swanlab watch` need. From there the skill walks through `swanlab.init` for projects and experiments, tracking a config such as model name and seed, logging scalars with `swanlab.log`, and logging images, audio, text and custom ECharts charts.

Examples include a PyTorch training loop and integrations with Hugging Face Transformers, PyTorch Lightning and Fastai, and reference files cover integrations and visualization. Local logs can be viewed with `swanlab watch -l ./swanlog`. The skill recommends SwanLab when you want open-source tracking that works locally or self-hosted and does not depend on a managed SaaS.

When your agent uses it

  • Tracking training runs and comparing seeds or hyperparameters
  • Keeping experiment logs local or on a self-hosted server
  • Logging images, audio or custom charts next to training metrics

Example prompts

  • “Add SwanLab tracking to my PyTorch training loop and log loss and accuracy.”
  • “Switch SwanLab to local mode and show me how to open the dashboard.”
  • “Log sample images and audio from each epoch to SwanLab.”

Requirements

  • Python with `swanlab`, `pillow` and `soundfile` installed

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. Projects and Experiments
  2. Configuration Tracking
  3. Metric Logging
  4. Media and Chart Logging
  5. Local and Self-Hosted Workflows
  6. Use Stable Metric Names
  7. Initialize Early and Capture Config Once
  8. Save Checkpoints Locally
  9. Use Local Mode for Offline-First Workflows
  10. Keep Advanced Patterns in References

What it can do on your machine

Read from SKILL.md and the folder at commit 773a529. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.swanlab.cn
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • SWANLAB_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

SwanLab Experiment Tracking loads about 2.4k tokens when it runs, and up to ~5.9k if it reads all its reference files. Until then it costs about 52 tokens; SKILL.md has 248 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~52
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Orchestra-Research/AI-Research-SKILLs at commit 773a529, republished under its MIT licence (© Orchestra-Research). 248 words, ~2,440 tokens.

Download SKILL.mdSave it as .claude/skills/experiment-tracking-swanlab/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
experiment-tracking-swanlab
description
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.
version
1.0.0
author
Orchestra Research
license
MIT
tags
MLOps, SwanLab, Experiment Tracking, Open Source, Visualization, PyTorch, Transformers, PyTorch Lightning, Fastai, Self-Hosted
dependencies
swanlab>=0.7.11, pillow>=9.0.0, soundfile>=0.12.0

SwanLab: Open-Source Experiment Tracking

When to Use This Skill

Use SwanLab when you need to:

  • Track ML experiments with metrics, configs, tags, and descriptions
  • Visualize training with scalar charts and logged media
  • Compare runs across seeds, checkpoints, and hyperparameters
  • Work locally or self-hosted instead of depending on managed SaaS
  • Integrate with PyTorch, Transformers, PyTorch Lightning, or Fastai

Deployment: Cloud, local, or self-hosted | Media: images, audio, text, GIFs, point clouds, molecules | Integrations: PyTorch, Transformers, PyTorch Lightning, Fastai

Installation

bash
# Install SwanLab plus the media dependencies used in this skill
pip install "swanlab>=0.7.11" "pillow>=9.0.0" "soundfile>=0.12.0"

# Add local dashboard support for mode="local" and swanlab watch
pip install "swanlab[dashboard]>=0.7.11"

# Optional framework integrations
pip install transformers pytorch-lightning fastai

# Login for cloud or self-hosted usage
swanlab login

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.

Quick Start

Basic Experiment Tracking
python
import swanlab

run = swanlab.init(
    project="my-project",
    experiment_name="baseline",
    config={
        "learning_rate": 1e-3,
        "epochs": 10,
        "batch_size": 32,
        "model": "resnet18",
    },
)

for epoch in range(run.config.epochs):
    train_loss = train_epoch()
    val_loss = validate()

    swanlab.log(
        {
            "train/loss": train_loss,
            "val/loss": val_loss,
            "epoch": epoch,
        }
    )

run.finish()
With PyTorch
python
import torch
import torch.nn as nn
import torch.optim as optim
import swanlab

run = swanlab.init(
    project="pytorch-demo",
    experiment_name="mnist-mlp",
    config={
        "learning_rate": 1e-3,
        "batch_size": 64,
        "epochs": 10,
        "hidden_size": 128,
    },
)

model = nn.Sequential(
    nn.Flatten(),
    nn.Linear(28 * 28, run.config.hidden_size),
    nn.ReLU(),
    nn.Linear(run.config.hidden_size, 10),
)
optimizer = optim.Adam(model.parameters(), lr=run.config.learning_rate)
criterion = nn.CrossEntropyLoss()

for epoch in range(run.config.epochs):
    model.train()
    for batch_idx, (data, target) in enumerate(train_loader):
        optimizer.zero_grad()
        logits = model(data)
        loss = criterion(logits, target)
        loss.backward()
        optimizer.step()

        if batch_idx % 100 == 0:
            swanlab.log(
                {
                    "train/loss": loss.item(),
                    "train/epoch": epoch,
                    "train/batch": batch_idx,
                }
            )

run.finish()

Core Concepts

1. Projects and Experiments

Project: Collection of related experiments
Experiment: Single execution of a training or evaluation workflow

python
import swanlab

run = swanlab.init(
    project="image-classification",
    experiment_name="resnet18-seed42",
    description="Baseline run on ImageNet subset",
    tags=["baseline", "resnet18"],
    config={
        "model": "resnet18",
        "seed": 42,
        "batch_size": 64,
        "learning_rate": 3e-4,
    },
)

print(run.id)
print(run.config.learning_rate)
2. Configuration Tracking
python
config = {
    "model": "resnet18",
    "seed": 42,
    "batch_size": 64,
    "learning_rate": 3e-4,
    "epochs": 20,
}

run = swanlab.init(project="my-project", config=config)

learning_rate = run.config.learning_rate
batch_size = run.config.batch_size
3. Metric Logging
python
# Log scalars
swanlab.log({"loss": 0.42, "accuracy": 0.91})

# Log multiple metrics
swanlab.log(
    {
        "train/loss": train_loss,
        "train/accuracy": train_acc,
        "val/loss": val_loss,
        "val/accuracy": val_acc,
        "lr": current_lr,
        "epoch": epoch,
    }
)

# Log with custom step
swanlab.log({"loss": loss}, step=global_step)
4. Media and Chart Logging
python
import numpy as np
import swanlab

# Image
image = np.random.randint(0, 255, (224, 224, 3), dtype=np.uint8)
swanlab.log({"examples/image": swanlab.Image(image, caption="Augmented sample")})

# Audio
wave = np.sin(np.linspace(0, 8 * np.pi, 16000)).astype("float32")
swanlab.log({"examples/audio": swanlab.Audio(wave, sample_rate=16000)})

# Text
swanlab.log({"examples/text": swanlab.Text("Training notes for this run.")})

# GIF video
swanlab.log({"examples/video": swanlab.Video("predictions.gif", caption="Validation rollout")})

# Point cloud
points = np.random.rand(128, 3).astype("float32")
swanlab.log({"examples/point_cloud": swanlab.Object3D(points, caption="Point cloud sample")})

# Molecule
swanlab.log({"examples/molecule": swanlab.Molecule.from_smiles("CCO", caption="Ethanol")})
python
# Custom chart with swanlab.echarts
line = swanlab.echarts.Line()
line.add_xaxis(["epoch-1", "epoch-2", "epoch-3"])
line.add_yaxis("train/loss", [0.92, 0.61, 0.44])
line.set_global_opts(
    title_opts=swanlab.echarts.options.TitleOpts(title="Training Loss")
)

swanlab.log({"charts/loss_curve": line})

See references/visualization.md for more chart and media patterns.

5. Local and Self-Hosted Workflows
python
import os
import swanlab

# Self-hosted or cloud login
swanlab.login(
    api_key=os.environ["SWANLAB_API_KEY"],
    host="http://your-server:5092",
)

# Local-only logging
run = swanlab.init(
    project="offline-demo",
    mode="local",
    logdir="./swanlog",
)

swanlab.log({"loss": 0.35, "epoch": 1})
run.finish()
bash
# View local logs
swanlab watch -l ./swanlog

# Sync local logs later
swanlab sync ./swanlog

Integration Examples

HuggingFace Transformers
python
from transformers import Trainer, TrainingArguments

training_args = TrainingArguments(
    output_dir="./results",
    per_device_train_batch_size=8,
    evaluation_strategy="epoch",
    logging_steps=50,
    report_to="swanlab",
    run_name="bert-finetune",
)

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=train_dataset,
    eval_dataset=eval_dataset,
)

trainer.train()

See references/integrations.md for callback-based setups and additional framework patterns.

PyTorch Lightning
python
import pytorch_lightning as pl
from swanlab.integration.pytorch_lightning import SwanLabLogger

swanlab_logger = SwanLabLogger(
    project="lightning-demo",
    experiment_name="mnist-classifier",
    config={"batch_size": 64, "max_epochs": 10},
)

trainer = pl.Trainer(
    logger=swanlab_logger,
    max_epochs=10,
    accelerator="auto",
)

trainer.fit(model, train_loader, val_loader)
Fastai
python
from fastai.vision.all import accuracy, resnet34, vision_learner
from swanlab.integration.fastai import SwanLabCallback

learn = vision_learner(dls, resnet34, metrics=accuracy)
learn.fit(
    5,
    cbs=[
        SwanLabCallback(
            project="fastai-demo",
            experiment_name="pets-classification",
            config={"arch": "resnet34", "epochs": 5},
        )
    ],
)

See references/integrations.md for fuller framework examples.

Best Practices

1. Use Stable Metric Names
python
# Good: grouped metric namespaces
swanlab.log({
    "train/loss": train_loss,
    "train/accuracy": train_acc,
    "val/loss": val_loss,
    "val/accuracy": val_acc,
})

# Avoid mixing flat and grouped names for the same metric family
2. Initialize Early and Capture Config Once
python
run = swanlab.init(
    project="image-classification",
    experiment_name="resnet18-baseline",
    config={
        "model": "resnet18",
        "learning_rate": 3e-4,
        "batch_size": 64,
        "seed": 42,
    },
)
3. Save Checkpoints Locally
python
import torch
import swanlab

checkpoint_path = "checkpoints/best.pth"
torch.save(model.state_dict(), checkpoint_path)

swanlab.log(
    {
        "best/val_accuracy": best_val_accuracy,
        "artifacts/checkpoint_path": swanlab.Text(checkpoint_path),
    }
)
4. Use Local Mode for Offline-First Workflows
python
run = swanlab.init(project="offline-demo", mode="local", logdir="./swanlog")
# ... training code ...
run.finish()

# Inspect later with: swanlab watch -l ./swanlog
5. Keep Advanced Patterns in References

Resources

See Also

© Orchestra-Research, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in 13-mlops/swanlab of Orchestra-Research/AI-Research-SKILLs.

  • SKILL.md
  • references/integrations.md
  • references/visualization.md

Open the folder on GitHubat commit 773a529

Compare with similar skills

SwanLab Experiment Tracking next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

SwanLab Experiment Tracking compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
SwanLab Experiment Tracking this skillOrchestra-Research/AI-Research-SKILLs13k—~2.4kAutomated safety check: PassMIT
Databricks ML Trainingdatabricks/databricks-agent-skills345—~4.6kAutomated safety check: PassCustom licence
Senior ML Engineerdavila7/claude-code-templates33k2 repos~1.4kAutomated safety check: PassMIT
Oci Data Scienceoracle/accelerated-data-science125—~2.1kAutomated safety check: PassUPL-1.0
SHAP Model Explainabilitydavila7/claude-code-templates33k11 repos~4.6kAutomated safety check: PassMIT
Editomegaml/omegaml108—~206Automated safety check: PassApache-2.0

Similar skills

  • Databricks ML Training

    databricks/databricks-agent-skills

    Official

    Train ML models on Databricks. An agent skill from databricks/databricks-agent-skills.

    345 GitHub stars~4.6k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Senior ML Engineer

    davila7/claude-code-templates

    World-class ML engineering skill for productionizing ML models, MLOps, and building scalable ML systems.

    33k GitHub starsUsed in 2 repos~1.4k tokens
    AI & LLM EngineeringAuto-check passed
  • Oci Data Science

    oracle/accelerated-data-science

    Official

    OCI Data Science service patterns including Jobs, Pipelines, Model Catalog, authentication, and the ADS SDK beyond AQUA.

    125 GitHub stars~2.1k tokensUpdated 1 mo ago
    AI & LLM EngineeringAuto-check passed
  • SHAP Model Explainability

    davila7/claude-code-templates

    Explains machine learning predictions with SHAP: picking the right explainer, computing Shapley values and drawing waterfall, beeswarm, bar and force plots.

    33k GitHub starsUsed in 11 repos~4.6k tokens
    Data & AnalyticsAuto-check passed
  • Edit

    omegaml/omegaml

    how to use the edit command properly

    108 GitHub stars~206 tokensUpdated yesterday
    DevOps & CloudAuto-check passed
  • ML Engineer

    RightNow-AI/openfang

    Machine learning engineer expert for PyTorch, scikit-learn, model evaluation, and MLOps

    18k GitHub stars~987 tokensUpdated 3 mo ago
    Data & AnalyticsAuto-check passed

More from Orchestra-Research/AI-Research-SKILLs

All 96 skills in this repo
  • AudioCraft Audio Generation

    Orchestra-Research/AI-Research-SKILLs

    Generates music from text descriptions with MusicGen and sound effects with AudioGen, using Meta's AudioCraft PyTorch library with melody and style conditioning.

    13k GitHub starsUsed in 8 repos~3.9k tokens
    Auto-check passed
  • LLM Benchmarking with lm-evaluation-harness

    Orchestra-Research/AI-Research-SKILLs

    Runs lm-evaluation-harness to benchmark language models on academic suites such as MMLU, GSM8K and HumanEval, compare models and track training checkpoints.

    13k GitHub starsUsed in 8 repos~3k tokens
    Auto-check passed
  • Segment Anything Model Guide

    Orchestra-Research/AI-Research-SKILLs

    Guide to using Meta's Segment Anything Model for zero-shot image segmentation with point, box or mask prompts, or automatic mask generation.

    13k GitHub starsUsed in 8 repos~3.3k tokens
    Auto-check passed
  • Chroma Vector Database

    Orchestra-Research/AI-Research-SKILLs

    Shows how to store documents and embeddings in Chroma, query them by similarity with metadata filters, and persist them to disk for RAG and semantic search projects.

    13k GitHub starsUsed in 7 repos~2.3k tokens
    Auto-check passed
  • CLIP Image-Text Matching

    Orchestra-Research/AI-Research-SKILLs

    Explains OpenAI's CLIP model for zero-shot image classification, image-text similarity, semantic image search and content moderation, with install steps and code patterns.

    13k GitHub starsUsed in 7 repos~1.7k tokens
    Auto-check passed
  • Whisper Speech Recognition

    Orchestra-Research/AI-Research-SKILLs

    Transcribes audio with OpenAI's Whisper: 99 languages, translation to English, language detection, six model sizes and word-level timestamps, from Python or the CLI.

    13k GitHub starsUsed in 7 repos~1.9k tokens
    Auto-check: notes

Questions about SwanLab Experiment Tracking

What does SwanLab Experiment Tracking do?

Shows how to log ML runs, configs, metrics and media with SwanLab and view them in cloud, local or self-hosted dashboards. Setup starts with `swanlab` plus `pillow` and `soundfile` for media logging, and the dashboard extra of swanlab, which local mode and `swanlab watch` need.log`, and logging images, audio, text and custom ECharts charts.

When should I use SwanLab Experiment Tracking?

SwanLab Experiment Tracking fits situations like: tracking training runs and comparing seeds or hyperparameters; keeping experiment logs local or on a self-hosted server; logging images, audio or custom charts next to training metrics.

How do I install SwanLab Experiment Tracking in Claude Code?

Run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill experiment-tracking-swanlab -a claude-code`. Or copy the skill folder (13-mlops/swanlab in Orchestra-Research/AI-Research-SKILLs) into .claude/skills/experiment-tracking-swanlab in your project. Claude Code loads it when a task matches its description.

How do I install SwanLab Experiment Tracking in Codex?

Run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill experiment-tracking-swanlab -a codex`. Or copy the skill folder (13-mlops/swanlab in Orchestra-Research/AI-Research-SKILLs) into .agents/skills/experiment-tracking-swanlab in your project. Codex loads it when a task matches its description.

Can I use SwanLab Experiment Tracking in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill experiment-tracking-swanlab -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/experiment-tracking-swanlab, .gemini/skills/experiment-tracking-swanlab, .github/skills/experiment-tracking-swanlab and .opencode/skills/experiment-tracking-swanlab in your project.

What does SwanLab Experiment Tracking need to run?

Going by SKILL.md and its folder, SwanLab Experiment Tracking needs the command-line tools its instructions call (pip) and credentials named SWANLAB_API_KEY. Our summary lists: Python with `swanlab`, `pillow` and `soundfile` installed.

Does SwanLab Experiment Tracking access the network?

SKILL.md names 2 domains. As links in the text: docs.swanlab.cn and github.com. This is read from the text; nothing was executed.

Is SwanLab Experiment Tracking safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does SwanLab Experiment Tracking use?

SwanLab Experiment Tracking is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does SwanLab Experiment Tracking use?

About 2.4k tokens (SKILL.md is roughly 9.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.5k tokens, read only when the agent opens those files.

What are the alternatives to SwanLab Experiment Tracking?

Skills that share tags, products or a category with SwanLab Experiment Tracking: Databricks ML Training (databricks/databricks-agent-skills, 345 stars), Senior ML Engineer (davila7/claude-code-templates, 33k stars), Oci Data Science (oracle/accelerated-data-science, 125 stars) and SHAP Model Explainability (davila7/claude-code-templates, 33k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains SwanLab Experiment Tracking?

Orchestra-Research (a GitHub organization) maintains it in Orchestra-Research/AI-Research-SKILLs, which has 13,405 GitHub stars. The repository holds 96 skills in this directory. The repository was last updated on June 16, 2026.

Source: Orchestra-Research/AI-Research-SKILLs on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.