Skip to content

[Sync][C] CI/docs/mechanical sweep (slime #1939/#1940/#1942/#1943/#1980/#1967/#1938/#1988) - #138

Merged
CalvinXKY merged 10 commits into
mainfrom
sync/slime-mega-C
Jun 7, 2026
Merged

[Sync][C] CI/docs/mechanical sweep (slime #1939/#1940/#1942/#1943/#1980/#1967/#1938/#1988)#138
CalvinXKY merged 10 commits into
mainfrom
sync/slime-mega-C

Conversation

@aoshen02

@aoshen02 aoshen02 commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Mega-PR C — CI / docs / mechanical sweep

Part of the #107 slime→vime sync (mega-PR C, A-independent slice). All cpu-validatable; the GitHub e2e-test-plugin-contracts job (ubuntu-latest) is the cpu gate.

Ported

slime PR what files
#1939 + #1940 reward-fn cpu tests + cpu-on-main push trigger pr-test.yml(.j2), tests/test_rm_*.py (5), vime/utils/misc.py (lazy ray)
#1942 sync customization/trace/pd-disagg docs docs/{en,zh}/... (6)
#1943 remove redundant replay tool + harden unwrap_model import-compat tools/replay_openai_jsonl.py (−535), model.py
#1980 FLOPs accounting fix for non-MLA attention (gate on multi_latent_attention) vime/utils/flops_utils.py
#1967 PYTHONBUFFERED=16PYTHONUNBUFFERED=1 (name and value) 12 scripts + command_utils.py
#1938 guard vllm_speculative_config read under --debug-train-only (getattr) vime/ray/rollout.py
#1988 rewrite fault-tolerance doc (rebranded sglang→vllm, /health_generate/health, link vllm-config.md) docs/en/advanced/fault-tolerance.md

Dropped after source review (evidence for #107 disposition)

  • #1987 / #1990 (R3 ci ref/logprob + kl guards) — already in main via vime [CI] guard initial actor/ref KL checks under R3 (routing replay) #93 (b1009dd "Backports slime #1987 + #1990"); identical two-file, two-guard change.
  • #1974 / #1989 — touch examples/coding_agent_rl + its README bullet; that feature isn't in vime yet → move to the agent mega-PR.
  • #1975 — sglang conda-ci image resolution + a test vime already has (test_qwen3_0.6B_parallel_check.py) + a build_conda.sh micromamba fix; no real version-file port for vime → N/A.

Deferred to after the rollout-data-model PR

  • #1986 / #1985 — they edit that PR's test files (dp_schedule / cp_utils / fanout / rm); will land when rebased on the merged data-model PR.
  • #1939 tests/test_sample.py — the other 7 files of #1939 (5 reward-fn cpu tests + lazy-ray + cpu-on-main trigger) landed here; test_sample.py constructs Sample(rollout_id=...), and Sample.rollout_id only exists after the data-model refactor (slime #1933/#1984), so this one file defers with it. (Drop was previously undocumented; recorded here.)
  • customization.md "Returning multiple training samples" section — removed in c8a0b99. It came from slime #1961 (not #1942, despite the earlier commit message), documents list[Sample] return + group_id + Sample.rollout_id, depends on the same data-model refactor (vime code has 0 occurrences of group_id/rollout_id), and is out of mega-C scope. Re-add with the data-model PR.

Validation

  • py_compile clean (flops_utils / rollout / command_utils); pr-test.yml re-rendered from .j2no drift.
  • codex review VALID (no bugs; MLA q_lora_rank=None fallback confirmed against slime's moonlight.sh).
  • rm cpu tests are unchanged from the previously-green [CI] add reward-fn cpu tests + cpu-on-main trigger (port slime #1939+#1940) #129 (107/107 cpu); local venv lacks pytest/torch so the authoritative cpu run is the GitHub job on this PR.

🤖 Generated with Claude Code

Corrections (c8a0b99)

  • #1938 rollout.py: dropped the extra 4-line comment — slime #1938 is a pure one-line getattr change.
  • #1943 model.py: moved the unwrap_model try/except to slime's exact position (after tqdm) — import block now byte-identical to slime.

Fidelity ledger (audited 2026-06-04)

op detail
Ported #1938/1939/1940/1942/1943/1967/1980/1988 — CI/lint/docs cluster + test_rm_×5 (deepscaler/f1/gpqa/math/math_dapo) wired into cpu job
Translated none (no sglang seam)
Dropped/N-A docs/version-only bits
Verified test_rm_×5 PASS on rebuilt stack (gb200 gate_full 8914)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request rebrands the project from 'slime' to 'vime' across documentation, adds comprehensive CPU unit tests for various reward models (deepscaler, f1, gpqa, math, and dapo), and deletes the OpenAI replay tool. It also introduces several code improvements, such as lazy-importing Ray to support CPU-only execution, refactoring FLOPs calculation for Multi-Latent Attention (MLA), correcting the environment variable to PYTHONUNBUFFERED=1, and adding a guard for speculative decoding metrics. A review comment correctly points out a potential ZeroDivisionError in _compute_spec_metrics if all_samples is empty, which should be addressed by extending the guard condition.

Comment thread vime/ray/rollout.py Outdated
Comment on lines +1253 to +1257
# Guard against --debug-train-only / --load-debug-rollout-data, where the
# vllm arg-parse phase is skipped (skip_vllm) and vllm_speculative_config is
# never set on args. Mirrors slime #1938. getattr(..., None) keeps this safe
# whether or not the vllm parse ran.
if getattr(args, "vllm_speculative_config", None) is None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

If all_samples is empty, num_samples will be 0, which leads to a ZeroDivisionError when calculating spec_accept_rate and spec_accept_length. Adding a check for not all_samples in the guard condition prevents this potential crash.

Suggested change
# Guard against --debug-train-only / --load-debug-rollout-data, where the
# vllm arg-parse phase is skipped (skip_vllm) and vllm_speculative_config is
# never set on args. Mirrors slime #1938. getattr(..., None) keeps this safe
# whether or not the vllm parse ran.
if getattr(args, "vllm_speculative_config", None) is None:
# Guard against --debug-train-only / --load-debug-rollout-data, where the
# vllm arg-parse phase is skipped (skip_vllm) and vllm_speculative_config is
# never set on args. Mirrors slime #1938. getattr(..., None) keeps this safe
# whether or not the vllm parse ran.
if getattr(args, "vllm_speculative_config", None) is None or not all_samples:

@aoshen02
aoshen02 force-pushed the sync/slime-mega-C branch from 8d716b8 to 53a8f83 Compare June 3, 2026 04:35
CalvinXKY pushed a commit that referenced this pull request Jun 3, 2026
…ng debt) (#140)

These are the only two files in the repo that fail the pre-commit gate
(ruff/autoflake/isort/black) on origin/main — confirmed repo-wide:
  - ruff:     only vime/ray/rollout.py:8 (F401 unused `argparse.Namespace`)
  - autoflake:only vime/ray/rollout.py
  - black:    vime/ray/rollout.py + vime/backends/vllm_utils/vllm_engine.py

Apply the exact hook auto-fixes (ruff --fix, autoflake --remove-all-unused-imports,
isort --profile=black, black -l119), no functional change:
  - rollout.py: drop unused `from argparse import Namespace` (zero refs); isort
    blank-line separation between third-party and first-party; order two
    deferred function-local imports (vllm_router before vime.*).
  - vllm_engine.py: two blank lines before `class VLLMEngine` (E302/black).

Decoupled from the slime-sync PRs (#137/#138) on purpose: those two PRs each
touch one of these files, and the auto-fixing gate would reformat them on any
PR that does. Landing the debt once here keeps the sync PRs scoped to behavior.

Verified in vime-vllm cpu image: all four hooks pass on both files afterward;
py_compile clean; `Namespace` has no remaining references.

Signed-off-by: aoshen02 <aoshen@inferact.ai>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
aoshen02 and others added 4 commits June 5, 2026 08:24
…#1940)

Port of THUDM/slime#1939 (add more cpu ci) + #1940 (run cpu test on main):
- tests/test_rm_{deepscaler,f1,gpqa,math,math_dapo}.py: pure-cpu unit tests
  for vime/rollout/rm_hub reward fns (107 tests, validated locally).
- vime/utils/misc.py: lazy 'import ray' so cpu-only paths (rm_hub scoring,
  plugin contracts) don't require ray.
- pr-test.yml.j2: register the 5 rm tests in the cpu (num_gpus:0) matrix;
  enable push-to-main trigger gated to cpu jobs only (GPU/self-hosted jobs
  stay PR/label-gated so push never burns the fleet).

slime #1939 also added tests/test_sample.py, which references Sample.rollout_id
(introduced by the #1926-chain / vime PR #119) — that test is stacked on #119
instead of here.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: aoshen02 <aoshen@inferact.ai>
Port of THUDM/slime#1942 (update docs). Brought the technical doc updates
(customization.md agentic-workflows section, trace.md, pd-disaggregation.md,
en+zh), rebranded slime->vime / sglang_rollout->vllm_rollout / SGLang->vLLM.

Divergence handling:
- README.md / README_zh.md: kept vime's version (slime's changes were
  SGLang-branded architecture text + 'Projects built upon slime' marketing +
  an agentic-examples list — vime uses vLLM and trimmed examples in #126).
- Dropped the broken examples/search-r1 link from the added customization text
  (trimmed in vime); kept examples/multi_agent + examples/fully_async (exist).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: aoshen02 <aoshen@inferact.ai>
…rt slime #1943)

Port of THUDM/slime#1943 (remove redundant file):
- remove tools/replay_openai_jsonl.py (redundant).
- vime/backends/megatron_utils/model.py: make unwrap_model import resilient
  to the Megatron move from megatron.core.utils to
  megatron.core.pipeline_parallel.utils (try/except fallback).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: aoshen02 <aoshen@inferact.ai>
…ult-tolerance docs

Mechanical / docs sweep for the slime→vime sync (mega-PR C additions, on top of
the cherry-picked #1939+#1940 / #1942 / #1943):

- slime #1980: fix FLOPs accounting for non-MLA attention. Gate the MLA-shaped
  qkv/attention flop formulas on `multi_latent_attention` instead of inferring
  MLA from q_lora_rank/qk_pos_emb_head_dim/v_head_dim (which misattributed flops
  for non-MLA models). vime/utils/flops_utils.py.
- slime #1967: fix PYTHONBUFFERED=16 typo -> PYTHONUNBUFFERED=1 across 12 scripts
  + command_utils.py (both name and value, matching slime canonical).
- slime #1938: guard `vllm_speculative_config` read in _compute_spec_metrics with
  getattr(...) so --debug-train-only (skip_vllm leaves the attr unset) doesn't
  AttributeError. vime/ray/rollout.py.
- slime #1988: rewrite docs/en/advanced/fault-tolerance.md (scope, health checks,
  debug/replay path, production pattern), rebranded sglang→vllm / slime→vime,
  /health_generate→/health, link vllm-config.md.

Dropped from this PR after source review:
- #1987/#1990 (R3 ci ref/logprob+kl guards) — already in main via vime #93
  (b1009dd "Backports slime #1987 + #1990").
- #1974/#1989 — touch examples/coding_agent_rl + its README bullet; that feature
  is not in vime yet (lands with the agent mega-PR).
- #1975 — sglang conda-ci image resolution + a test vime already has + build_conda
  micromamba fix; no real version-file port for vime.
Deferred to after the rollout-data-model PR: #1986/#1985 (they edit that PR's tests).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: aoshen02 <aoshen@inferact.ai>
@aoshen02
aoshen02 force-pushed the sync/slime-mega-C branch from 53a8f83 to de89d92 Compare June 5, 2026 08:25
aoshen02 and others added 6 commits June 5, 2026 08:45
…sagg/trace)

Audit (一模一样): mega-C's original #1942 doc port was incomplete — several docs
were stubs or truncated vs slime. Port them faithfully (modulo sglang→vllm):

- fault-tolerance.md en: add trailing (trainer-failure note + Related Docs).
- fault-tolerance.md zh: was a 13-line stub → full 76-line port.
- pd-disaggregation.md en+zh: were 7-line stubs → full 87-line port.
- trace.md en+zh: port slime's build_meta example as
  build_vllm_meta_trace_attrs(output) (vime's real signature).

Translation: SGLang→vLLM, /health_generate→/health (vime's real endpoint),
sglang-config→vllm-config, `sglang:`→`vllm:` YAML key (vime vllm_config.py
requires the 'vllm' key), server→engine; `--prefill-num-servers` flag preserved.
All 6 files now match slime line counts (76/76, 87/87, 119/119).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…n + teacher_log_probs)

Surgically add the two slime #1942 additions that mega-C missed, keeping vime's
legitimate divergences (vllm_rollout path, VIME_CONTRACT_* env, search-r1 removed
in #74):
- "#### Returning multiple training samples for one prompt" section (en+zh):
  custom_generate may return list[Sample] with shared group_id; signature
  updated to `-> Sample | list[Sample]`.
- `teacher_log_probs` field in the Sample-fields dict (en+zh).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…43 placement

- customization.md (en+zh): revert custom_generate signature to `-> Sample`
  and remove the "Returning multiple training samples" section. That content
  is from slime #1961 (not #1942, despite the prior commit message) and
  documents Sample.group_id / Sample.rollout_id + list[Sample] return — all
  tied to the deferred rollout-data-model refactor that vime does not yet
  implement (verified: 0 occurrences of group_id/rollout_id in types.py and
  the rollout loop). Defers with #1986/#1985.
- model.py: move the unwrap_model try/except to slime #1943's exact position
  (after the tqdm import) — import block now byte-identical to slime.
- rollout.py: drop the 4-line comment around the spec-metrics getattr guard;
  slime #1938 is a pure one-line change with no added comment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…t + search-r1 refs

- arguments.py: --rollout-health-check-{interval,timeout} help text said
  `/health_generate` (sglang's endpoint) but the code hits `/health`
  (vllm_engine.py). Fix the help strings to `/health`.
- customization.md (en+zh) + index.rst (en+zh): remove the dead
  `examples/search-r1` references — that example does not exist in vime.

Note: the method name `VLLMEngine.health_generate()` (vllm_engine.py) and its
caller (health_monitor.py) keep the sglang-flavored name but already hit
`/health`; renaming the method is a separate change, left out here.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
examples/retool does not exist in vime (same dead-link situation as
search-r1); drop it from the docs toctree in index.rst (en+zh).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rt slime #2001)

Appends the 'Step-by-Step Debugging with Ray Distributed Debugger' section
(debugpy + RAY_DEBUG_POSTMORTEM + VS Code attach) to developer_guide/debug.md
(en + zh). Content is engine-neutral (Ray/debugpy/VS Code), ported verbatim;
no sglang->vllm translation needed.
@CalvinXKY
CalvinXKY merged commit 5d30a4d into main Jun 7, 2026
10 of 13 checks passed
@aoshen02
aoshen02 deleted the sync/slime-mega-C branch June 8, 2026 14:17
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