From f84066a29123d3b8a93cf79f7a4fb643bf31eb5c Mon Sep 17 00:00:00 2001 From: tzhouam Date: Sat, 11 Jul 2026 23:38:59 +0800 Subject: [PATCH] rebase: align vllm-omni with vLLM dd10e03f95f9 Signed-off-by: tzhouam --- vllm_omni/engine/output_processor.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/vllm_omni/engine/output_processor.py b/vllm_omni/engine/output_processor.py index c9044e29e..71303269f 100644 --- a/vllm_omni/engine/output_processor.py +++ b/vllm_omni/engine/output_processor.py @@ -28,6 +28,12 @@ from vllm_omni.outputs import OmniRequestOutput logger = init_logger(__name__) +# Keys whose values may arrive as scalar tensors (e.g. sample rate) but +# represent metadata, not concatenatable data. When these appear in +# ``MultimodalPayload.tensors`` they must be relocated to ``.metadata`` +# before consolidation so the tensor concatenation path does not attempt +# a dimensioned cat on a 0-d tensor. +_METADATA_TENSOR_KEYS: frozenset[str] = frozenset({"sr", "sample_rate", "audio_sample_rate"}) # --------------------------------------------------------------------------- # Module-level helpers @@ -212,6 +218,18 @@ class OmniRequestState(RequestState): modality = OutputModality.TEXT strategy = get_accumulation_strategy(modality) + # Move known metadata scalar tensors (e.g. sample rate) from + # tensors to metadata so they are handled by the REPLACE path + # below instead of failing tensor concatenation. + for key in _METADATA_TENSOR_KEYS: + v = self.mm_accumulated.tensors.pop(key, None) + if v is not None: + if isinstance(v, list): + # Keep the last value (REPLACE semantics) + self.mm_accumulated.metadata[key] = v[-1] + else: + self.mm_accumulated.metadata[key] = v + try: for k, v in list(self.mm_accumulated.tensors.items()): if isinstance(v, list) and v and isinstance(v[0], torch.Tensor):