[Bugfix] Reject removed pooling parameters (#48984)
Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from typing import Literal, get_args
|
||||
|
||||
from vllm.exceptions import VLLMValidationError
|
||||
|
||||
GenerationTask = Literal["generate", "transcription", "realtime"]
|
||||
GENERATION_TASKS: tuple[GenerationTask, ...] = get_args(GenerationTask)
|
||||
|
||||
@@ -15,6 +17,19 @@ PoolingTask = Literal[
|
||||
]
|
||||
POOLING_TASKS: tuple[PoolingTask, ...] = get_args(PoolingTask)
|
||||
|
||||
_REMOVED_POOLING_TASK_MESSAGES = {
|
||||
"score": "`score` task was removed; use `classify` instead.",
|
||||
"encode": (
|
||||
"`encode` task was removed; use `token_embed` or `token_classify` instead."
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def check_removed_pooling_task(task: object) -> None:
|
||||
if isinstance(task, str) and (message := _REMOVED_POOLING_TASK_MESSAGES.get(task)):
|
||||
raise VLLMValidationError(message, parameter="task")
|
||||
|
||||
|
||||
ScoreType = Literal["bi-encoder", "cross-encoder", "late-interaction"]
|
||||
SCORE_TYPE_MAP: dict[PoolingTask, ScoreType] = {
|
||||
"embed": "bi-encoder",
|
||||
|
||||
Reference in New Issue
Block a user