[Bugfix] Make reward CPU tests collectable without optional runtime deps#309
Open
FeathBow wants to merge 1 commit into
Open
[Bugfix] Make reward CPU tests collectable without optional runtime deps#309FeathBow wants to merge 1 commit into
FeathBow wants to merge 1 commit into
Conversation
Fixes vllm-project#304 Signed-off-by: Feathbow <feathbow@gmail.com>
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #304
Importing any
rm_hubsubmodule executesvime/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 byremote_rmonly),vime.utils.misc/vime.utils.types(pull intorchandhttpx), andsympy/pylatexencat the top ofmath_utils.Changes
rm_hub/__init__.py: deferaiohttpandload_functionto their call sites; moveSample/aiohttpunderTYPE_CHECKING(same lazy-import pattern asrayinvime/utils/misc.py)math_utils.py: defersympy/pylatexencinto_sympy_parse/_parse_latex/are_equal_under_sympytests/test_rm_math.py: skip the two symbolic-equality tests when sympy is absentNo 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.pypre-commit run --all-files: passed.