A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 8, 06:15 UTC
[CI][Entrypoints] Validate detokenize token IDs to prevent int64 overflow causing 500 (#34468)
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
Andreas Karatzas committed
Feb 15, 2026 at 01:08 UTC
98bcc6ca593293cf650699e54e499e7189c24ac1
1 file changed
+5
-2
vllm/entrypoints/serve/tokenize/protocol.py
+5
-2
@@ -2,7 +2,7 @@
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4
5
-from typing import Any, TypeAlias
5
+from typing import Annotated, Any, TypeAlias
6
7
from pydantic import ConfigDict, Field, model_validator
8
@@ -156,7 +156,10 @@ class TokenizeResponse(OpenAIBaseModel):
156
157
class DetokenizeRequest(OpenAIBaseModel):
158
model: str | None = None
159
- tokens: list[int]
159
+ # TODO: Factor `torch.iinfo` out. `torch.iinfo` pulls torch into a
160
+ # Pydantic protocol file that currently has no torch dependency.
161
+ # See: https://github.com/vllm-project/vllm/pull/34468#discussion_r2801173630
162
+ tokens: list[Annotated[int, Field(ge=0, le=2**63 - 1)]]
163
164
def build_tok_params(self, model_config: ModelConfig) -> TokenizeParams:
165
return TokenizeParams(