[Sync][C] CI/docs/mechanical sweep (slime #1939/#1940/#1942/#1943/#1980/#1967/#1938/#1988) - #138
Conversation
There was a problem hiding this comment.
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.
| # 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: |
There was a problem hiding this comment.
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.
| # 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: |
8d716b8 to
53a8f83
Compare
…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>
…#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>
53a8f83 to
de89d92
Compare
…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.
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-contractsjob (ubuntu-latest) is the cpu gate.Ported
pr-test.yml(.j2),tests/test_rm_*.py(5),vime/utils/misc.py(lazy ray)docs/{en,zh}/...(6)unwrap_modelimport-compattools/replay_openai_jsonl.py(−535),model.pymulti_latent_attention)vime/utils/flops_utils.pyPYTHONBUFFERED=16→PYTHONUNBUFFERED=1(name and value)command_utils.pyvllm_speculative_configread under--debug-train-only(getattr)vime/ray/rollout.py/health_generate→/health, linkvllm-config.md)docs/en/advanced/fault-tolerance.mdDropped after source review (evidence for #107 disposition)
b1009dd"Backports slime #1987 + #1990"); identical two-file, two-guard change.examples/coding_agent_rl+ its README bullet; that feature isn't in vime yet → move to the agent mega-PR.test_qwen3_0.6B_parallel_check.py) + abuild_conda.shmicromamba fix; no real version-file port for vime → N/A.Deferred to after the rollout-data-model PR
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.pyconstructsSample(rollout_id=...), andSample.rollout_idonly 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 inc8a0b99. It came from slime #1961 (not #1942, despite the earlier commit message), documentslist[Sample]return +group_id+Sample.rollout_id, depends on the same data-model refactor (vime code has 0 occurrences ofgroup_id/rollout_id), and is out of mega-C scope. Re-add with the data-model PR.Validation
py_compileclean (flops_utils / rollout / command_utils);pr-test.ymlre-rendered from.j2— no drift.q_lora_rank=Nonefallback confirmed against slime'smoonlight.sh).🤖 Generated with Claude Code
Corrections (
c8a0b99)#1938rollout.py: dropped the extra 4-line comment — slime #1938 is a pure one-linegetattrchange.#1943model.py: moved theunwrap_modeltry/except to slime's exact position (aftertqdm) — import block now byte-identical to slime.Fidelity ledger (audited 2026-06-04)