Add SwanLab tracking support#1898
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds SwanLab as an additional experiment tracking backend (alongside existing W&B support) and updates CLI args, logging, and CI/test utilities so runs can be configured consistently via a shared tracking-args helper.
Changes:
- Introduce
slime.utils.swanlab_utils(init/finish + optional open-metrics scraping) and wire it intologging_utils. - Add SwanLab CLI arguments and a unified
get_default_tracking_args()helper used by many test launchers. - Update examples/plugins to log via
logging_utils.log, and register SwanLab as a dependency / isort third-party package.
Reviewed changes
Copilot reviewed 31 out of 32 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/utils/test_swanlab_support.py | Adds unit tests for tracking-args helpers, dual-backend logging, and SwanLab open-metrics polling. |
| tests/test_sglang_config_mixed_offload.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_sglang_config_mixed_offload_ft.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen3.6_35B_A3B_pd_mooncake.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen3.5_0.8B_gsm8k_short.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen3.5_0.8B_gsm8k_async_short.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen3_4B_ppo.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen3_4B_ppo_train_critic_only.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen3_4B_ppo_disaggregate.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen3_4B_ckpt.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen3_30B_A3B.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen3_30B_A3B_r3.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen3_0.6B_parallel_check.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen2.5_0.5B_short.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen2.5_0.5B_sglang_config.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen2.5_0.5B_sglang_config_distributed.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen2.5_0.5B_ppo_critic_only_short.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen2.5_0.5B_opd_sglang.py | Switches teacher launcher from W&B-only helper to unified tracking helper. |
| tests/test_qwen2.5_0.5B_async_short.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_quick_start_glm4_9B.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_moonlight_16B_A3B.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_moonlight_16B_A3B_r3.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_mimo_7B_mtp_only_grad.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| tests/test_glm4.7_30B_A3B_pd_mooncake.py | Switches test launcher from W&B-only helper to unified tracking helper. |
| slime/utils/swanlab_utils.py | New SwanLab integration module: init/secondary init, finish, and open-metrics monitor. |
| slime/utils/logging_utils.py | Wires SwanLab into init/update/finish and metric logging dispatch. |
| slime/utils/external_utils/command_utils.py | Adds get_default_tracking_args() and SwanLab/W&B wrappers used by tests/scripts. |
| slime/utils/arguments.py | Adds SwanLab CLI arguments and registers them in the main arg builder. |
| slime_plugins/rollout_buffer/rollout_buffer_example.py | Routes rollout logging through logging_utils.log (now supports SwanLab). |
| requirements.txt | Adds swanlab dependency. |
| pyproject.toml | Registers swanlab as a third-party import for isort config. |
| examples/retool/generate_with_retool.py | Routes debug logging through logging_utils.log with optional backends. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| wandb_run_id = getattr(args, "swanlab_run_id", None) | ||
| if wandb_run_id is None: | ||
| return | ||
|
|
||
| _require_swanlab() | ||
| _maybe_login(args) | ||
|
|
||
| init_kwargs = _build_init_kwargs(args, primary=False) | ||
| init_kwargs["id"] = wandb_run_id |
|
@copilot apply changes based on the comments in this thread |
|
Hey man, I came across your GitHub project earlier and honestly the architecture caught my attention — especially the backend/infrastructure side. You clearly know what you’re doing. I spend a lot of time around builders, launch people, and growth-side communities, so I naturally pay attention to projects that look serious early on. Not trying to pitch anything weird lol. Just curious — are you building this more as a personal project, long-term startup idea, or something you eventually want to scale publicly? |
Summary
Verification
swanlab.init->swanlab.log->swanlab.finish