Unverified Commit e18464a5 authored by Wentao Ye's avatar Wentao Ye Committed by GitHub
Browse files

[Perf] Optimize async scheduling placeholder using empty (#32056)


Signed-off-by: default avataryewentao256 <zhyanwentao@126.com>
parent 1963245e
...@@ -31,6 +31,9 @@ from vllm.v1.metrics.stats import ( ...@@ -31,6 +31,9 @@ from vllm.v1.metrics.stats import (
SchedulerStats, SchedulerStats,
) )
# shared empty CPU tensor used as a placeholder pooling output
EMPTY_CPU_TENSOR = torch.empty(0, device="cpu")
class RequestOutputCollector: class RequestOutputCollector:
""" """
...@@ -426,7 +429,7 @@ class OutputProcessor: ...@@ -426,7 +429,7 @@ class OutputProcessor:
new_token_ids=[], new_token_ids=[],
# Set pooling_output is not None to # Set pooling_output is not None to
# correctly enter the abort pooling branch # correctly enter the abort pooling branch
pooling_output=torch.randn(0, device="cpu") pooling_output=EMPTY_CPU_TENSOR
if req_state.detokenizer is None if req_state.detokenizer is None
else None, else None,
finish_reason=FinishReason.ABORT, finish_reason=FinishReason.ABORT,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment