Unverified Commit 98bcc6ca authored by Andreas Karatzas's avatar Andreas Karatzas Committed by GitHub
Browse files

[CI][Entrypoints] Validate detokenize token IDs to prevent int64 overflow causing 500 (#34468)


Signed-off-by: default avatarAndreas Karatzas <akaratza@amd.com>
parent f13e86d8
...@@ -2,7 +2,7 @@ ...@@ -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): ...@@ -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(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment