[CI] add reward-fn cpu tests + cpu-on-main trigger (port slime #1939+#1940) - #129
[CI] add reward-fn cpu tests + cpu-on-main trigger (port slime #1939+#1940)#129aoshen02 wants to merge 1 commit into
Conversation
…#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>
There was a problem hiding this comment.
Code Review
This pull request adds comprehensive CPU unit tests for several reward model scoring modules, including deepscaler, f1, gpqa, math_utils, and math_dapo_utils. It also updates vime/utils/misc.py to lazily import ray inside get_current_node_ip(), allowing CPU-only paths to run without requiring the ray library. The review feedback correctly identifies two issues in the new tests where integer values were used instead of floats, which prevents the float coercion and parsing logic from being properly exercised in test_rm_deepscaler.py and test_rm_math_dapo.py.
| """float labels: stringified to e.g. "42.0". The current grader path | ||
| (mathd or sympy) handles "42.0" vs "42" via normalization — pinning | ||
| the wiring, not the equality logic.""" | ||
| assert get_deepscaler_rule_based_reward(r"</think>\boxed{42}", 42) == 1 |
There was a problem hiding this comment.
The test is intended to verify float labels, but it passes the integer 42 instead of the float 42.0. This makes it identical to test_label_as_int_is_coerced_to_string and fails to actually test float coercion.
| assert get_deepscaler_rule_based_reward(r"</think>\boxed{42}", 42) == 1 | |
| assert get_deepscaler_rule_based_reward(r"</think>\boxed{42}", 42.0) == 1 |
| """Minerva path expects gt to coerce via ``int(float(gt))`` (line 210), | ||
| so floats / int-strings collapse to canonical int strings before | ||
| comparison.""" | ||
| correct, pred = is_correct_minerva("Long solution. Answer: 42", "42") |
There was a problem hiding this comment.
The test docstring mentions that floats collapse to canonical int strings, but the test currently passes "42" as the ground truth, which does not exercise the float parsing path. Passing "42.0" instead would properly validate this behavior.
| correct, pred = is_correct_minerva("Long solution. Answer: 42", "42") | |
| correct, pred = is_correct_minerva("Long solution. Answer: 42", "42.0") |
|
Closing for now (slime→vime sync being restructured). Branch is preserved — can reopen anytime. |
Ports THUDM/slime#1939 (add more cpu ci) + #1940 (run cpu test on main).
What
tests/test_rm_{deepscaler,f1,gpqa,math,math_dapo}.py— pure-cpu unit tests forvime/rollout/rm_hubreward fns. 107 tests, validated locally (all pass).vime/utils/misc.py— lazyimport rayso cpu-only paths 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).Port notes (sglang→vllm / vime divergence)
tests/test_sample.py, which referencesSample.rollout_id(introduced by the #1926-chain → vime [Train] Micro-batch scheduling on rollout side + variable global batch size (port slime #1926+#1930+#1933) #119). That test is stacked on [Train] Micro-batch scheduling on rollout side + variable global batch size (port slime #1926+#1930+#1933) #119, not here.test_sample.py's arg fixture usedsglang_speculative_algorithm; vime'sSamplereadsvllm_speculative_config— translated on the [Train] Micro-batch scheduling on rollout side + variable global batch size (port slime #1926+#1930+#1933) #119 branch.Validation
pytest tests/test_rm_*.py→ 107 passed.Part of the #107 slime→vime sync. 🤖 Generated with Claude Code