@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 761e63e541
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 7, 20:15 UTC

[Frontend] Always pass `supported_tasks` to validation (#35186)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>

Cyrus Leung committed Feb 24, 2026 at 20:16 UTC 761e63e5418e9c3d5c0086eb91eace11d406e786
4 files changed +21 -20
vllm/entrypoints/openai/speech_to_text/speech_to_text.py
+1 -1
@@ -194,7 +194,7 @@ class OpenAISpeechToText(OpenAIServing):
194 def _warmup_input_processor(self) -> None:
195 """Warm up input processor with dummy audio to avoid first-request latency.
196
197 - The first call to input_processor.process_inputs() with multimodal audio
197 + The first call to renderer.render_cmpl() with multimodal audio
198 triggers multimodal processing initialization which can take ~2.5s.
199 This method processes a dummy audio request to warm up the pipeline.
200 """
vllm/v1/engine/async_llm.py
+2 -1
@@ -356,13 +356,13 @@ class AsyncLLM(EngineClient):
356 request_id,
357 prompt,
358 params,
359 + supported_tasks=await self.get_supported_tasks(),
360 arrival_time=arrival_time,
361 lora_request=lora_request,
362 tokenization_kwargs=tokenization_kwargs,
363 trace_headers=trace_headers,
364 priority=priority,
365 data_parallel_rank=data_parallel_rank,
365 - supported_tasks=await self.get_supported_tasks(),
366 )
367 prompt_text, _, _ = extract_prompt_components(self.model_config, prompt)
368
@@ -433,6 +433,7 @@ class AsyncLLM(EngineClient):
433 self._validate_streaming_input_sampling_params(sampling_params)
434
435 inputs = dict(
436 + supported_tasks=await self.get_supported_tasks(),
437 arrival_time=arrival_time,
438 lora_request=lora_request,
439 tokenization_kwargs=tokenization_kwargs,
vllm/v1/engine/input_processor.py
+13 -13
@@ -26,7 +26,7 @@ from vllm.multimodal.utils import argsort_mm_positions
26 from vllm.pooling_params import PoolingParams
27 from vllm.renderers import BaseRenderer, renderer_from_config
28 from vllm.sampling_params import SamplingParams
29 -from vllm.tasks import POOLING_TASKS, SupportedTask
29 +from vllm.tasks import GENERATION_TASKS, POOLING_TASKS, SupportedTask
30 from vllm.tokenizers import TokenizerLike
31 from vllm.utils import length_from_prompt_token_ids_or_embeds, random_uuid
32 from vllm.utils.func_utils import supports_kw
@@ -111,10 +111,8 @@ class InputProcessor:
111 def _validate_params(
112 self,
113 params: SamplingParams | PoolingParams,
114 - # TODO: Validate generation tasks as well once `supported_tasks`
115 - # is passed to all `process_inputs` calls
116 - supported_tasks: tuple[SupportedTask, ...] | None,
117 - ):
114 + supported_tasks: tuple[SupportedTask, ...],
115 + ) -> None:
116 """Raise `ValueError` if SamplingParams or PoolingParams is not valid."""
117 if params.truncate_prompt_tokens is not None:
118 params_type = type(params).__name__
@@ -127,6 +125,12 @@ class InputProcessor:
125 )
126
127 if isinstance(params, SamplingParams):
128 + supported_generation_tasks = [
129 + task for task in supported_tasks if task in GENERATION_TASKS
130 + ]
131 + if not supported_generation_tasks:
132 + raise ValueError("This model does not support generation")
133 +
134 params.verify(
135 self.model_config,
136 self.speculative_config,
@@ -134,17 +138,13 @@ class InputProcessor:
138 self.tokenizer,
139 )
140 elif isinstance(params, PoolingParams):
137 - if supported_tasks is None:
138 - raise RuntimeError("`supported_tasks` must be passed for pooling")
139 -
141 supported_pooling_tasks = [
142 task for task in supported_tasks if task in POOLING_TASKS
143 ]
144 + if not supported_pooling_tasks:
145 + raise ValueError("This model does not support pooling")
146
147 if params.task is None:
145 - if not supported_pooling_tasks:
146 - raise ValueError("Pooling tasks are not supported")
147 -
148 if "token_embed" in supported_pooling_tasks:
149 params.task = "token_embed"
150 elif "token_classify" in supported_pooling_tasks:
@@ -227,17 +227,17 @@ class InputProcessor:
227 request_id: str,
228 prompt: PromptType | ProcessorInputs,
229 params: SamplingParams | PoolingParams,
230 + supported_tasks: tuple[SupportedTask, ...],
231 arrival_time: float | None = None,
232 lora_request: LoRARequest | None = None,
233 tokenization_kwargs: dict[str, Any] | None = None,
234 trace_headers: Mapping[str, str] | None = None,
235 priority: int = 0,
236 data_parallel_rank: int | None = None,
236 - supported_tasks: tuple[SupportedTask, ...] | None = None,
237 resumable: bool = False,
238 ) -> EngineCoreRequest:
239 - self._validate_lora(lora_request)
239 self._validate_params(params, supported_tasks)
240 + self._validate_lora(lora_request)
241
242 parallel_config = self.vllm_config.parallel_config
243 dp_size = parallel_config.data_parallel_size
vllm/v1/engine/llm_engine.py
+5 -5
@@ -248,12 +248,12 @@ class LLMEngine:
248 request_id,
249 prompt,
250 params,
251 - arrival_time,
252 - lora_request,
253 - tokenization_kwargs,
254 - trace_headers,
255 - priority,
251 supported_tasks=self.get_supported_tasks(),
252 + arrival_time=arrival_time,
253 + lora_request=lora_request,
254 + tokenization_kwargs=tokenization_kwargs,
255 + trace_headers=trace_headers,
256 + priority=priority,
257 )
258 prompt_text, _, _ = extract_prompt_components(self.model_config, prompt)
259