Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
modelscope.cn avatar

Swanlab Skill

  • 1 installs
  • modelscope.cn

Write SwanLab tracking code (init/log/finish/media) and query experiment metrics, logs, and runs via the swanlab api CLI.

About

Covers both instrumenting training runs with the SwanLab Python SDK and reading experiment data through the swanlab api CLI. A developer uses it to log metrics and media, list and filter runs, and plot or benchmark experiments.

  • Run modes online/local/offline/disabled control local vs cloud storage
  • Helper scripts plot single-run charts and compare metrics across runs

Swanlab Skill by the numbers

  • 1 all-time installs (skills.sh)
  • Ranked #1,803 of 2,064 Data Science & ML skills by installs in the Skillselion catalog
  • Data as of Jul 8, 2026 (Skillselion catalog sync)
npx skills add https://github.com/modelscope.cn --skill swanlab-skill

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1
Repositorymodelscope.cn

What it does

Write SwanLab tracking code (init/log/finish/media) and query experiment metrics, logs, and runs via the swanlab api CLI.

Files

SKILL.mdMarkdownGitHub ↗

SwanLab Skill

SwanLab is an AI training experiment tracking platform. This skill covers two usage patterns:

  • Writing tracking code — use the Python SDK (swanlab.init, swanlab.log, swanlab.finish, media helpers)
  • Reading experiment data — use the swanlab api CLI to query metrics, logs, summaries, media, etc.

---

Reference Routing

If the user wants to...Read this reference
Write tracking code (init/log/finish/media)references/SDK_QUICKSTART.md
Query data via CLI (metrics/summary/logs/filter/etc.)references/CLI_REFERENCE.md
Understand data model / terminology / filter syntaxreferences/SWANLAB_CONCEPTS.md
Plot metrics or compare experiments visuallySee Scripts below

---

Run Modes

swanlab.init(mode=...) controls where data goes:

ModeLocal StorageCloud UploadUse Case
onlineYes (protobuf)Yes (Transport → HTTP)Normal cloud usage. Requires login.
localYes (protobuf)NoAir-gapped / no account needed.
offlineYes (protobuf)No (syncable later via swanlab sync)Save locally, upload to cloud later.
disabledNoNoCompletely disable all logging.

Default is online if logged in, otherwise the user is prompted interactively (or falls back to offline).

---

Scripts

Two helper scripts are available for visualizing experiment data:

scripts/plot_metrics.py — Single Experiment Line Chart

Trigger when the user wants to visualize scalar metrics from one experiment (e.g. "plot my loss curve", "show training metrics chart").

python scripts/plot_metrics.py username/project_name/run_id --keys loss,acc
python scripts/plot_metrics.py user/proj/run1 -k loss -o loss_chart.png -s 500
python scripts/plot_metrics.py --data metrics.json -k loss,acc -o chart.png   # from saved JSON

scripts/runs_benchmark.py — Cross-Experiment Comparison

Trigger when the user wants to compare the same metric across multiple experiments (e.g. "compare loss across runs", "benchmark these experiments").

python scripts/runs_benchmark.py user/proj/run1 user/proj/run2 user/proj/run3 -k loss
python scripts/runs_benchmark.py user/proj/run1 user/proj/run2 -k loss --direction lower
python scripts/runs_benchmark.py user/proj/run1 user/proj/run2 -k loss,acc --normalize
python scripts/runs_benchmark.py --data benchmark_data.json -k loss              # from saved JSON

Both scripts require swanlab login (or --api-key / --host flags).

---

Path Convention

CLI commands use username/project_name (project) or username/project_name/run_id (experiment). See SWANLAB_CONCEPTS.md > Path Convention for details.

---

Quick Disambiguation

User says...They probably mean...Route
"track my training" / "log metrics"Write tracking codeSDK_QUICKSTART.md
"log images/audio/text"Log media dataSDK_QUICKSTART.md
"my loss curve" / "experiment metrics"Query scalar dataCLI_REFERENCE.md > run metrics
"filter experiments"Query by conditionsCLI_REFERENCE.md > run filter
"my experiments" / "list runs"List experimentsCLI_REFERENCE.md > run list
"compare runs visually"Cross-experiment chartscripts/runs_benchmark.py
"plot metric chart"Single-experiment chartscripts/plot_metrics.py
"experiment config"HyperparametersCLI_REFERENCE.md > run info
"console output"Captured logsCLI_REFERENCE.md > run logs
"what columns are tracked"Metric definitionsCLI_REFERENCE.md > run columns
"check connectivity" / "can I reach swanlab"Environment checkswanlab ping
"check login status" / "am I logged in"Verify credentialsswanlab verify

---

Environment Connectivity

Before writing tracking code or running CLI queries, especially in online mode, run these two checks to confirm the environment is ready:

1. swanlab ping — Test network reachability

The fastest way to diagnose connectivity issues. Run it first when a user reports upload failures, login problems, or unknown mode fallbacks.

swanlab ping
# Reports: API host, web host, latency, and login status.
# If ping fails, check SWANLAB_API_HOST / network proxy / firewall settings.

2. swanlab verify — Validate login credentials

After confirming the server is reachable, use swanlab verify to check that stored credentials are valid and have not expired. This reads the API key and host from the local .netrc file (created by swanlab login).

swanlab verify
# Validates stored API key against the server.
# Reports: which host (default https://swanlab.cn) and the logged-in username.
# Fails if: not logged in, API key is invalid, or key has expired.

swanlab verify --local
# Check local login status (.swanlab in current directory) instead of the global one.

Recommended pre-flight sequence:

1. swanlab ping → confirm the server is reachable 2. swanlab verify → confirm credentials are valid 3. Proceed with swanlab api queries or SDK code

---

Behavioral Constraints

See CLI_REFERENCE.md > Behavioral Constraints for the full list. Key rules:

  • Use `--all` only when the user explicitly asks for it (e.g. "fetch all", "get everything", "complete list"). For paginated list commands, always use default pagination (--page_num / --page_size).
  • Always ask for specific column keys before running `run metrics`, `run medias`, or `run column`. If the user doesn't know the key names, first run run columns PATH to discover them.
  • Always persist large metric data to file via `--save`, then visualize with scripts/plot_metrics.py --data file.json or use run summary for aggregate stats.

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.