-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[Core] Factor out input preprocessing to a separate class #7329
[Core] Factor out input preprocessing to a separate class #7329
Conversation
👋 Hi! Thank you for contributing to the vLLM project. Once the PR is approved and ready to go, please make sure to run full CI as it is required to merge (or just use auto-merge). To run full CI, you can do one of these:
🚀 |
caec7bf
to
5a97c5b
Compare
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 @DarkLight1337, just some minor comments.
We may need to re-think some of this soon since we're hoping to get rid of AsyncLLMEngine altogether. I'm thinking we'll hopefully no longer need both sync and async versions of these things.
"""Async version of :meth:`_extract_prompt_components`.""" | ||
parsed = parse_singleton_prompt(inputs) | ||
|
||
if parsed["type"] == "str": |
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.
have a prompt_type = parsed["type"]
and reuse instead of repeated lookups? (same for parsed["content"]
)
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 tried this, and unfortunately this breaks the type checker's capability to narrow down the type of parsed
. So I'm keeping the code as is.
|
||
parsed = parse_singleton_prompt(inputs) | ||
|
||
if parsed["type"] == "str": |
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.
have a prompt_type = parsed["type"]
and reuse instead of repeated lookups? (same for parsed["content"]
)
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.
As above.
Thanks for the review! I'll address the detailed comments shortly.
Even without |
I have finished addressing your other comments. |
Following up to #7258, this PR implements the suggestion by @robertgshaw2-neuralmagic to create a new class for prompt parsing. This helps keep the sync/async versions of the preprocessing code together so they can be updated together easily, while also slimming down the existing engine classes to focus on request processing.