[CI][Entrypoints] Validate detokenize token IDs to prevent int64 overflow causing 500 (#34468)
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||||
|
|
||||||
|
|
||||||
from typing import Any, TypeAlias
|
from typing import Annotated, Any, TypeAlias
|
||||||
|
|
||||||
from pydantic import ConfigDict, Field, model_validator
|
from pydantic import ConfigDict, Field, model_validator
|
||||||
|
|
||||||
@@ -156,7 +156,10 @@ class TokenizeResponse(OpenAIBaseModel):
|
|||||||
|
|
||||||
class DetokenizeRequest(OpenAIBaseModel):
|
class DetokenizeRequest(OpenAIBaseModel):
|
||||||
model: str | None = None
|
model: str | None = None
|
||||||
tokens: list[int]
|
# TODO: Factor `torch.iinfo` out. `torch.iinfo` pulls torch into a
|
||||||
|
# Pydantic protocol file that currently has no torch dependency.
|
||||||
|
# See: https://github.com/vllm-project/vllm/pull/34468#discussion_r2801173630
|
||||||
|
tokens: list[Annotated[int, Field(ge=0, le=2**63 - 1)]]
|
||||||
|
|
||||||
def build_tok_params(self, model_config: ModelConfig) -> TokenizeParams:
|
def build_tok_params(self, model_config: ModelConfig) -> TokenizeParams:
|
||||||
return TokenizeParams(
|
return TokenizeParams(
|
||||||
|
|||||||
Reference in New Issue
Block a user