@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 1501a4070e
Fork 0

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 11, 03:45 UTC

[Bugfix] Read truncate_prompt_tokens from pooling_params in AsyncLLM.encode() (#31013)

Signed-off-by: Jeffrey Wang <jeffreywang@anyscale.com>

Jeffrey Wang committed Dec 20, 2025 at 02:29 UTC 1501a4070ec1f5e3f8f1ffd0099dc32d85a9ad98
2 files changed +20 -2
vllm/engine/protocol.py
+5 -1
@@ -71,7 +71,11 @@ class EngineClient(ABC):
71 truncate_prompt_tokens: int | None = None,
72 tokenization_kwargs: dict[str, Any] | None = None,
73 ) -> AsyncGenerator[PoolingRequestOutput, None]:
74 - """Generate outputs for a request from a pooling model."""
74 + """Generate outputs for a request from a pooling model.
75 +
76 + NOTE: truncate_prompt_tokens is deprecated in v0.14.
77 + TODO: Remove this argument in v0.15.
78 + """
79 ...
80
81 @abstractmethod
vllm/v1/engine/async_llm.py
+15 -1
@@ -4,6 +4,7 @@ import asyncio
4 import os
5 import socket
6 import time
7 +import warnings
8 from collections.abc import AsyncGenerator, Iterable, Mapping
9 from copy import copy
10 from typing import Any, cast
@@ -627,6 +628,9 @@ class AsyncLLM(EngineClient):
628
629 The caller of generate() iterates the returned AsyncGenerator,
630 returning the RequestOutput back to the caller.
631 +
632 + NOTE: truncate_prompt_tokens is deprecated in v0.14.
633 + TODO: Remove truncate_prompt_tokens in v0.15.
634 """
635
636 try:
@@ -641,9 +645,19 @@ class AsyncLLM(EngineClient):
645
646 if tokenization_kwargs is None:
647 tokenization_kwargs = {}
648 +
649 + if truncate_prompt_tokens is not None:
650 + warnings.warn(
651 + "The `truncate_prompt_tokens` parameter in `AsyncLLM.encode()` "
652 + "is deprecated and will be removed in v0.15. "
653 + "Please use `pooling_params.truncate_prompt_tokens` instead.",
654 + DeprecationWarning,
655 + stacklevel=2,
656 + )
657 +
658 _validate_truncation_size(
659 self.model_config.max_model_len,
646 - truncate_prompt_tokens,
660 + pooling_params.truncate_prompt_tokens,
661 tokenization_kwargs,
662 )
663