Skip to content

[Bugfix] Make reward CPU tests collectable without optional runtime deps#309

Open
FeathBow wants to merge 1 commit into
vllm-project:mainfrom
FeathBow:fix/rm-tests-import-boundary
Open

[Bugfix] Make reward CPU tests collectable without optional runtime deps#309
FeathBow wants to merge 1 commit into
vllm-project:mainfrom
FeathBow:fix/rm-tests-import-boundary

Conversation

@FeathBow

@FeathBow FeathBow commented Jul 1, 2026

Copy link
Copy Markdown

Description

Fixes #304

Importing any rm_hub submodule executes vime/rollout/rm_hub/__init__.py, which imports runtime-only deps at module level, so the reward CPU tests fail at pytest collection in lightweight environments. The chain is deeper than the issue's traceback shows: aiohttp (used by remote_rm only), vime.utils.misc / vime.utils.types (pull in torch and httpx), and sympy / pylatexenc at the top of math_utils.

Changes

  • rm_hub/__init__.py: defer aiohttp and load_function to their call sites; move Sample / aiohttp under TYPE_CHECKING (same lazy-import pattern as ray in vime/utils/misc.py)
  • math_utils.py: defer sympy / pylatexenc into _sympy_parse / _parse_latex / are_equal_under_sympy
  • tests/test_rm_math.py: skip the two symbolic-equality tests when sympy is absent

No behaviour change.

Testing

tests/ CPU unit tests are not on CI, local results:

PYTHONPATH=$PWD python -m pytest -q tests/test_rm_math.py tests/test_rm_deepscaler.py \
  tests/test_rm_math_dapo.py tests/test_rm_f1.py tests/test_rm_gpqa.py
lightweight env (pytest only) full deps
main 5 collection errors (reproduces #304) 106 passed
this PR 104 passed, 2 skipped 106 passed

pre-commit run --all-files: passed.

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

Copy link
Copy Markdown

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 optimizes imports across the rm_hub module by deferring heavy or optional dependencies (such as sympy, pylatexenc, and aiohttp) to local scopes or TYPE_CHECKING blocks. Additionally, it updates the test suite to conditionally skip tests that require sympy or pylatexenc if they are not installed. There are no review comments, so I have no feedback to provide.

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.

[Bug] Reward CPU tests fail during collection in lightweight dev environments

1 participant