[Frontend][Core] Standardize request error handling with VLLMError hierarchy (#49665)
Signed-off-by: Zach Zhu <zzqshu@126.com>
This commit is contained in:
@@ -10,6 +10,7 @@ from typing import TYPE_CHECKING
|
||||
|
||||
import torch
|
||||
|
||||
from vllm.exceptions import VLLMValidationError
|
||||
from vllm.logger import init_logger
|
||||
from vllm.logits_process import LogitsProcessor as RequestLogitsProcessor
|
||||
from vllm.sampling_params import SamplingParams
|
||||
@@ -228,7 +229,12 @@ def validate_logits_processors_parameters(
|
||||
tuple(logits_processors) if logits_processors is not None else None
|
||||
)
|
||||
for logits_procs in cached_load_custom_logitsprocs(logits_processors):
|
||||
logits_procs.validate_params(sampling_params)
|
||||
try:
|
||||
logits_procs.validate_params(sampling_params)
|
||||
except ValueError as e:
|
||||
# Legacy custom logitsprocs may still raise ValueError from
|
||||
# validate_params; convert for backward compatibility.
|
||||
raise VLLMValidationError(str(e)) from e
|
||||
|
||||
|
||||
class AdapterLogitsProcessor(LogitsProcessor):
|
||||
|
||||
@@ -62,7 +62,9 @@ class LogitsProcessor(ABC):
|
||||
def validate_params(cls, sampling_params: SamplingParams):
|
||||
"""Validate sampling params for this logits processor.
|
||||
|
||||
Raise ValueError for invalid ones.
|
||||
Raise ``VLLMValidationError`` (preferred) / ``ValueError`` (backward compatible)
|
||||
for invalid params. Bare ``ValueError`` is converted to ``VLLMValidationError``
|
||||
at the engine boundary so online serving returns HTTP 400.
|
||||
"""
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user