-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
[Frontend] API support for beam search for MQLLMEngine #9117
Merged
youkaichao
merged 13 commits into
vllm-project:main
from
LunrEclipse:beam-search-mq-refactor
Oct 8, 2024
Merged
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5add5d7
port over beam search logic
LunrEclipse 1375b59
integrate mqllm engine
LunrEclipse b57bff2
fix engine differences
LunrEclipse 8384451
update from comments
LunrEclipse f9843df
update from review and refactor
LunrEclipse a33ea39
remove assert and add kwarg
LunrEclipse ac5520c
add asserts back
LunrEclipse b3c5d05
change input
LunrEclipse b22e8bd
add typing
LunrEclipse 097479d
change serving_completion back
LunrEclipse 44334ee
move beam search classes
LunrEclipse 4918f6a
add new file for beam search
LunrEclipse e65ed31
fix import
LunrEclipse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
from vllm.config import ModelConfig | ||
from vllm.engine.async_llm_engine import AsyncLLMEngine | ||
from vllm.engine.multiprocessing.client import MQLLMEngineClient | ||
from vllm.engine.protocol import EngineClient | ||
from vllm.entrypoints.logger import RequestLogger | ||
# yapf conflicts with isort for this block | ||
|
@@ -150,15 +151,20 @@ async def create_completion( | |
log_tracing_disabled_warning() | ||
|
||
if isinstance(sampling_params, BeamSearchParams): | ||
if not isinstance(self.engine_client, AsyncLLMEngine): | ||
if isinstance(self.engine_client, AsyncLLMEngine): | ||
generator = self.engine_client.beam_search( | ||
prompt_inputs["prompt_token_ids"], request_id_item, | ||
sampling_params) | ||
elif isinstance(self.engine_client, MQLLMEngineClient): | ||
generator = self.engine_client.beam_search( | ||
prompt_inputs["prompt_token_ids"], request_id_item, | ||
sampling_params, lora_request) | ||
else: | ||
raise ValueError( | ||
"Beam search in the API server is only supported" | ||
" with AsyncLLMEngine. please add " | ||
"`--disable-frontend-multiprocessing` to " | ||
"use beam search.") | ||
generator = self.engine_client.beam_search( | ||
prompt_inputs["prompt_token_ids"], request_id_item, | ||
sampling_params) | ||
" with AsyncLLMEngine and MQLLMEngineClient." | ||
" please add `--disable-frontend-multiprocessing`" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
" to use beam search.") | ||
else: | ||
generator = self.engine_client.generate( | ||
{ | ||
|
Oops, something went wrong.
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.
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.
Is beam search supported with LoRA?
It seems like it does not work through the
AsyncLLMEngine
since we aren't passing thelora_request
parameter there. So I think you could collapse these two cases sincelora_request
will always be none when passed toMQLLMEngine