[Misc] Use VLLMValidationError in scoring input validation (#51753)

Signed-off-by: frank-suwen <suwenw2@outlook.com>
This commit is contained in:
Frank
2026-08-11 04:12:22 +00:00
committed by GitHub
parent 07443bea29
commit adc1200597
2 changed files with 72 additions and 4 deletions
+7 -4
View File
@@ -15,6 +15,7 @@ from vllm.entrypoints.chat_utils import (
MultiModalItemTracker,
_parse_chat_message_content_parts,
)
from vllm.exceptions import VLLMValidationError
from vllm.inputs import MultiModalDataDict, MultiModalUUIDDict
from .typing import (
@@ -85,7 +86,9 @@ def _validate_mm_score_input(
out.append(d)
else:
if not is_multimodal_model:
raise ValueError(f"MultiModalParam is not supported for {architecture}")
raise VLLMValidationError(
f"MultiModalParam is not supported for {architecture}"
)
content = cast(list[ScoreContentPartParam], d.get("content", []))
out.append(content)
return out
@@ -99,11 +102,11 @@ def _validate_score_input_lens(
len_2 = len(data_2)
if len_1 > 1 and len_1 != len_2:
raise ValueError("Input lengths must be either 1:1, 1:N or N:N")
raise VLLMValidationError("Input lengths must be either 1:1, 1:N or N:N")
if len_1 == 0:
raise ValueError("At least one text element must be given")
raise VLLMValidationError("At least one text element must be given")
if len_2 == 0:
raise ValueError("At least one text_pair element must be given")
raise VLLMValidationError("At least one text_pair element must be given")
def validate_score_input(