Skip to content

Add SwanLab tracking support#1898

Open
asckaya wants to merge 2 commits into
THUDM:mainfrom
asckaya:feature/swanlab-tracking
Open

Add SwanLab tracking support#1898
asckaya wants to merge 2 commits into
THUDM:mainfrom
asckaya:feature/swanlab-tracking

Conversation

@asckaya
Copy link
Copy Markdown

@asckaya asckaya commented May 9, 2026

Summary

  • Add SwanLab as an optional tracking backend alongside W&B.
  • Wire SwanLab into logging, argument parsing, open-metrics collection, and test helpers.
  • Align test scripts to a shared tracking-args helper so mock and real runs behave consistently.

Verification

  • python -m pytest tests/utils/test_swanlab_support.py tests/test_qwen3_4B_ppo.py tests/test_quick_start_glm4_9B.py -q
  • Real SwanLab smoke test: swanlab.init -> swanlab.log -> swanlab.finish

Copilot AI review requested due to automatic review settings May 9, 2026 10:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 into logging_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.

Comment on lines +199 to +207
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
Comment thread slime/utils/swanlab_utils.py
Comment thread slime/utils/logging_utils.py
Comment thread examples/retool/generate_with_retool.py
@asckaya
Copy link
Copy Markdown
Author

asckaya commented May 9, 2026

@copilot apply changes based on the comments in this thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants