-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
[V1][Frontend] Coalesce bunched RequestOutput
s
#12298
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
Changes from 2 commits
0431ddf
c20997a
a4f49d5
0d2f3dd
3ff92d0
e7aa463
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
from vllm.outputs import RequestOutput | ||
from vllm.pooling_params import PoolingParams | ||
from vllm.prompt_adapter.request import PromptAdapterRequest | ||
from vllm.sampling_params import SamplingParams | ||
from vllm.sampling_params import RequestOutputKind, SamplingParams | ||
from vllm.transformers_utils.tokenizer import AnyTokenizer | ||
from vllm.transformers_utils.tokenizer_group import init_tokenizer_from_configs | ||
from vllm.usage.usage_lib import UsageContext | ||
|
@@ -205,17 +205,22 @@ async def generate( | |
|
||
# The output_handler task pushes items into the queue. | ||
# This task pulls from the queue and yields to caller. | ||
while True: | ||
finished = False | ||
while not finished: | ||
# Note: drain queue without await if possible (avoids | ||
# task switching under load which helps performance). | ||
out = q.get_nowait() if q.qsize() > 0 else await q.get() | ||
out = q.get_nowait() if not q.empty() else await q.get() | ||
|
||
# Coalesce any additional queued outputs | ||
while not q.empty(): | ||
if sampling_params.output_kind == RequestOutputKind.DELTA: | ||
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. Can be in a future PR, but we should check for invalid sampling params like 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. Yes I guess that's a general V1 thing, we should be explicitly rejecting requests that include unsupported parameters if we aren't already. |
||
out.add(q.get_nowait()) | ||
else: | ||
out = q.get_nowait() | ||
|
||
# Note: both OutputProcessor and EngineCore handle their | ||
# own request cleanup based on finished. | ||
if out.finished: | ||
yield out | ||
break | ||
|
||
finished = out.finished | ||
yield out | ||
|
||
# If the request is disconnected by the client, the | ||
|
Uh oh!
There was an error while loading. Please reload this page.