-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
[Bugfix] Decode Tokenized IDs to Strings for hf_processor
in llm.chat()
with model_impl=transformers
#21353
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
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 PR addresses an issue where tokenized IDs were passed to a Hugging Face processor that expects string inputs. The fix correctly decodes the IDs to strings. My review focuses on improving the robustness of the implementation by avoiding in-place modification of input data, which could lead to unexpected side effects or errors.
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
@DarkLight1337 I have modified the file as suggested. |
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.
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.
LGTM too as long as regression test added!
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.
I am pretty sure this does not fit the bill for the processing
only dir. Any pointers would be great.
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.
You can create a new file called test_transformers.py
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.
Shouldn't the test case for this PR test that the MultiModalProcessor
in vllm/model_executor/models/transformers.py
still works when token IDs are provided to apply
?
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.
We are testing the multi-modal processor here rather than the model implementation, so the test should be under processing
directory. The other tests under processing
directory also only check the multi-modal processor
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.
And like @hmellor said, we should be unit testing the multi-modal processor without instantiating vLLM engine
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.
The fix LGTM, but I think we should change the test to be more specific to the problem we're fixing. Instantiating a full LLM
is quite an expensive way to check that the processor can consume token IDs
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.
Shouldn't the test case for this PR test that the MultiModalProcessor
in vllm/model_executor/models/transformers.py
still works when token IDs are provided to apply
?
Please fix pre-commit |
Head branch was pushed to by a user without write access
Signed-off-by: ariG23498 <[email protected]>
Signed-off-by: ariG23498 <[email protected]>
Signed-off-by: ariG23498 <[email protected]>
Signed-off-by: ariG23498 <[email protected]>
Signed-off-by: ariG23498 <[email protected]>
Signed-off-by: ariG23498 <[email protected]>
82fa186
to
9a42b8b
Compare
hf_processor
in llm.chat()
with model_impl=transformers
hf_processor
in llm.chat()
with model_impl=transformers
…hat()` with `model_impl=transformers` (vllm-project#21353) Signed-off-by: ariG23498 <[email protected]>
…hat()` with `model_impl=transformers` (vllm-project#21353) Signed-off-by: ariG23498 <[email protected]> Signed-off-by: qizixi <[email protected]>
…hat()` with `model_impl=transformers` (vllm-project#21353) Signed-off-by: ariG23498 <[email protected]>
This PR adds a check in the
llm.chat()
processing logic to decode tokenized IDs back to strings when usingmodel_impl="transformers"
. This ensures compatibility with the Hugging Face processor (hf_processor
), which expects string inputs and does not support raw token IDs.To verify the issue without this fix (or confirm the fix works), use the following code:
hf_processor
.CC: @hmellor @zucchini-nlp