[Misc] Use VLLMValidationError in pooling input validation (#51931)

Signed-off-by: frank-suwen <suwenw2@outlook.com>
This commit is contained in:
Frank
2026-08-13 06:13:25 +00:00
committed by GitHub
parent b908a21f9a
commit 7bc1660bd6
3 changed files with 83 additions and 5 deletions
@@ -13,6 +13,7 @@ from vllm.config import VllmConfig
from vllm.entrypoints.chat_utils import (
ChatTemplateConfig,
)
from vllm.exceptions import VLLMValidationError
from vllm.lora.request import LoRARequest
from vllm.renderers import BaseRenderer, merge_kwargs
from vllm.renderers.inputs.preprocess import parse_model_prompt, prompt_to_seq
@@ -217,7 +218,7 @@ class PoolingIOProcessor:
pass
elif param.task != pooling_task:
msg = f"You cannot overwrite {param.task=!r} with {pooling_task=!r}!"
raise ValueError(msg)
raise VLLMValidationError(msg)
seq_lora_requests = self._lora_request_to_seq(ctx.lora_request, num_requests)
seq_priority = self._priority_to_seq(ctx.priorities, num_requests)
@@ -293,7 +294,7 @@ class PoolingIOProcessor:
and chat_template_kwargs.get("chat_template") is not None
)
):
raise ValueError(
raise VLLMValidationError(
"Chat template is passed with request, but "
"--trust-request-chat-template is not set. "
"Refused request with untrusted chat template."
@@ -307,7 +308,7 @@ class PoolingIOProcessor:
) -> Sequence[PoolingParams]:
if isinstance(params, Sequence):
if len(params) != num_requests:
raise ValueError(
raise VLLMValidationError(
f"The lengths of prompts ({num_requests}) "
f"and params ({len(params)}) must be the same."
)
@@ -323,7 +324,7 @@ class PoolingIOProcessor:
) -> Sequence[LoRARequest | None]:
if isinstance(lora_request, Sequence):
if len(lora_request) != num_requests:
raise ValueError(
raise VLLMValidationError(
f"The lengths of prompts ({num_requests}) "
f"and lora_request ({len(lora_request)}) must be the same."
)