-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
[Chore]:Extract math and argparse utilities to separate modules #27188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Chore]:Extract math and argparse utilities to separate modules #27188
Conversation
There was a problem hiding this comment.
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 refactors math and argparse utilities into separate modules, which is a great step for improving code organization and maintainability. The changes correctly maintain backward compatibility by re-exporting the moved utilities. My review focuses on the newly created files, where I've identified a few issues: a missing type hint that could lead to a runtime error, a leftover debug print statement, and a couple of instances of incorrect string formatting for error and log messages. These issues could impact usability and debugging. I've provided specific suggestions to address them.
vllm/utils/__init__.py
Outdated
|
|
||
| def round_down(x: int, y: int) -> int: | ||
| return (x // y) * y | ||
| # Math utilities - imported from math_utils module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update vLLM code to use the new module-specific imports
|
Documentation preview: https://vllm--27188.org.readthedocs.build/en/27188/ |
Signed-off-by: Yeshwanth Surya <[email protected]>
Signed-off-by: Yeshwanth Surya <[email protected]>
81a9253 to
7b71513
Compare
Signed-off-by: Yeshwanth N <[email protected]>
21c991b to
75c60a0
Compare
Fixed syntax error where an incomplete 'from vllm.utils import ('
statement was left in the file, causing compilation failures.
Signed-off-by: Yeshwanth Surya <[email protected]>
- Remove unused imports from vllm/utils/__init__.py (argparse, collections, regex) - Add missing 'cache' import from functools - Fix duplicate imports in multiple files causing F811 redefinition errors: - tests/kernels/attention/test_deepgemm_attention.py - vllm/model_executor/layers/fused_moe/config.py - vllm/model_executor/layers/fused_moe/layer.py - vllm/v1/attention/backends/flashinfer.py - vllm/v1/worker/tpu_model_runner.py All imports now use the specific module paths (e.g., vllm.utils.math_utils) instead of importing from vllm.utils directly. Signed-off-by: Yeshwanth Surya <[email protected]>
5a024f8 to
9b5a5fc
Compare
Fixed import ordering in three files to comply with ruff's isort rules: - vllm/entrypoints/utils.py: Reordered transformers_utils before utils imports - vllm/utils/__init__.py: Moved platform_utils after specialized module imports - vllm/utils/deep_gemm.py: Reordered import_utils before math_utils These changes resolve the ruff-check failures in the pre-commit hooks. Signed-off-by: yeshsurya <[email protected]>
ef0d520 to
92535f8
Compare
|
/gemini review |
There was a problem hiding this comment.
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 refactors the codebase by extracting math and argparse utilities into separate modules, vllm/utils/math_utils.py and vllm/utils/argparse_utils.py respectively. This is a good improvement for code organization and maintainability. The changes are well-executed, with imports updated across the codebase and backward compatibility maintained through re-exports in vllm/utils/__init__.py. I have reviewed the changes and found no issues. The refactoring is clean and a positive step for the project's structure.
DarkLight1337
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM
…-project#27188) Signed-off-by: Yeshwanth Surya <[email protected]> Signed-off-by: Yeshwanth N <[email protected]> Signed-off-by: yeshsurya <[email protected]>
…-project#27188) Signed-off-by: Yeshwanth Surya <[email protected]> Signed-off-by: Yeshwanth N <[email protected]> Signed-off-by: yeshsurya <[email protected]>
…-project#27188) Signed-off-by: Yeshwanth Surya <[email protected]> Signed-off-by: Yeshwanth N <[email protected]> Signed-off-by: yeshsurya <[email protected]>
…-project#27188) Signed-off-by: Yeshwanth Surya <[email protected]> Signed-off-by: Yeshwanth N <[email protected]> Signed-off-by: yeshsurya <[email protected]>
Purpose
Contributes to #26900
Test Plan
Verify that the refactoring of math and argparse utilities into separate modules (vllm/utils/math_utils.py and vllm/utils/argparse_utils.py)
maintains backward compatibility and does not break existing functionality
Test Result
tests/utils_/test_utils.py
Passed
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.