-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[Chore] Separate out hashing utilities from vllm.utils #27151
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] Separate out hashing utilities from vllm.utils #27151
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 hashing-related utility functions from vllm.utils
into a new dedicated module vllm.utils.hashing
. The changes are well-structured and improve code organization. I've identified a performance issue in the new hashing.py
module where pickle
is imported dynamically within a function that is likely on a hot path, and I've provided a suggestion to move the import to the module level to avoid repeated execution.
8e49069
to
33d35f7
Compare
vllm/utils/hashing.py
Outdated
import cbor2 | ||
|
||
# Avoid direct `import pickle` to satisfy pre-commit policy on new imports | ||
pickle = importlib.import_module("pickle") |
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.
Please update tools/pre_commit/check_pickle_imports.py
instead
33d35f7
to
e048d1d
Compare
3c2862d
to
f93dbcd
Compare
Thanks for the review! I've addressed all the feedback: Changes made:
Verification:
Let me know if anything else needs adjustment. |
Head branch was pushed to by a user without write access
f93dbcd
to
6e5925d
Compare
This pull request has merge conflicts that must be resolved before it can be |
- Move sha256, sha256_cbor, and get_hash_fn_by_name from vllm.utils.__init__ to vllm/utils/hashing.py - Update import in vllm/v1/engine/core.py to use new module path - Add vllm/utils/hashing.py to pickle import allowlist - Use direct 'import pickle' instead of importlib workaround These hashing functions are internal-only, so no backward compatibility is needed. This refactoring improves code organization while keeping the implementation cleaner. Signed-off-by: dongbo910220 <[email protected]>
6e5925d
to
e3e2f33
Compare
@DarkLight1337 |
Part of #26900
This PR continues the effort to clean up
vllm.utils
by extracting hashing-related helper functions into a new, dedicated modulevllm/utils/hashing.py
.The following functions have been moved:
CC: @DarkLight1337
Test Plan
Test Result