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, 03:45 UTC
[Renderer] Deprecate code paths for old input processing (#34775)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Cyrus Leung committed
Feb 18, 2026 at 16:35 UTC
a766b303497bb743defee3f7d0b3477f13477418
6 files changed
+70
-51
docs/design/plugin_system.md
+1
@@ -155,3 +155,4 @@ The interface for the model/module may change during vLLM's development. If you
155
- `use_v1` parameter in `Platform.get_attn_backend_cls` is deprecated. It has been removed in v0.13.0.
156
- `_Backend` in `vllm.attention` is deprecated. It has been removed in v0.13.0. Please use `vllm.v1.attention.backends.registry.register_backend` to add new attention backend to `AttentionBackendEnum` instead.
157
- `seed_everything` platform interface is deprecated. It has been removed in v0.16.0. Please use `vllm.utils.torch_utils.set_random_seed` instead.
158
+ - `prompt` in `Platform.validate_request` is deprecated and will be removed in v0.18.0.
vllm/entrypoints/llm.py
-24
@@ -519,7 +519,6 @@ class LLM:
519
),
520
params=seq_params,
521
lora_requests=seq_lora_requests,
522
- tokenization_kwargs=tokenization_kwargs,
522
priorities=seq_priority,
523
)
524
@@ -1813,7 +1812,6 @@ class LLM:
1812
params=seq_params,
1813
use_tqdm=use_tqdm,
1814
lora_requests=seq_lora_requests,
1816
- tokenization_kwargs=tokenization_kwargs,
1815
priorities=seq_priority,
1816
)
1817
@@ -1872,7 +1870,6 @@ class LLM:
1870
params=seq_params,
1871
lora_requests=seq_lora_requests,
1872
use_tqdm=use_tqdm,
1875
- tokenization_kwargs=tokenization_kwargs,
1873
)
1874
1875
def _render_and_run_requests(
@@ -1881,7 +1878,6 @@ class LLM:
1878
params: Sequence[SamplingParams | PoolingParams],
1879
*,
1880
lora_requests: Sequence[LoRARequest | None] | None = None,
1884
- tokenization_kwargs: dict[str, Any] | None = None,
1881
priorities: Sequence[int] | None = None,
1882
use_tqdm: bool | Callable[..., tqdm] = True,
1883
):
@@ -1899,7 +1895,6 @@ class LLM:
1895
prompts=prompts,
1896
params=params,
1897
lora_requests=lora_requests,
1902
- tokenization_kwargs=tokenization_kwargs,
1898
priorities=priorities,
1899
)
1900
@@ -1911,7 +1906,6 @@ class LLM:
1906
params: Sequence[SamplingParams | PoolingParams],
1907
*,
1908
lora_requests: Sequence[LoRARequest | None] | None = None,
1914
- tokenization_kwargs: dict[str, Any] | None = None,
1909
priorities: Sequence[int] | None = None,
1910
) -> list[str]:
1911
added_request_ids: list[str] = []
@@ -1922,7 +1916,6 @@ class LLM:
1916
prompt,
1917
params[i],
1918
lora_request=None if lora_requests is None else lora_requests[i],
1925
- tokenization_kwargs=tokenization_kwargs,
1919
priority=0 if priorities is None else priorities[i],
1920
)
1921
added_request_ids.append(request_id)
@@ -1938,7 +1931,6 @@ class LLM:
1931
prompt: ProcessorInputs,
1932
params: SamplingParams | PoolingParams,
1933
lora_request: LoRARequest | None = None,
1941
- tokenization_kwargs: dict[str, Any] | None = None,
1934
priority: int = 0,
1935
) -> str:
1936
if isinstance(params, SamplingParams):
@@ -1947,27 +1939,11 @@ class LLM:
1939
1940
request_id = str(next(self.request_counter))
1941
1950
- if params.truncate_prompt_tokens is not None:
1951
- params_type = type(params).__name__
1952
- warnings.warn(
1953
- f"The `truncate_prompt_tokens` parameter in `{params_type}` "
1954
- "is deprecated and will be removed in v0.16. "
1955
- "Please pass it via `tokenization_kwargs` instead.",
1956
- DeprecationWarning,
1957
- stacklevel=2,
1958
- )
1959
-
1960
- tokenization_kwargs = merge_kwargs(
1961
- tokenization_kwargs,
1962
- dict(truncate_prompt_tokens=params.truncate_prompt_tokens),
1963
- )
1964
-
1942
return self.llm_engine.add_request(
1943
request_id,
1944
prompt,
1945
params,
1946
lora_request=lora_request,
1970
- tokenization_kwargs=tokenization_kwargs,
1947
priority=priority,
1948
)
1949
vllm/platforms/interface.py
+2
-3
@@ -17,7 +17,7 @@ if TYPE_CHECKING:
17
from torch.distributed import PrefixStore, ProcessGroup
18
19
from vllm.config import VllmConfig
20
- from vllm.inputs import ProcessorInputs, PromptType
20
+ from vllm.inputs import ProcessorInputs
21
from vllm.pooling_params import PoolingParams
22
from vllm.sampling_params import SamplingParams
23
from vllm.utils.argparse_utils import FlexibleArgumentParser
@@ -568,9 +568,8 @@ class Platform:
568
@classmethod
569
def validate_request(
570
cls,
571
- prompt: "PromptType | ProcessorInputs",
572
- params: "SamplingParams | PoolingParams",
571
processed_inputs: "ProcessorInputs",
572
+ params: "SamplingParams | PoolingParams",
573
) -> None:
574
"""Raises if this request is unsupported on this platform"""
575
vllm/v1/engine/async_llm.py
+7
-16
@@ -27,7 +27,7 @@ from vllm.multimodal import MULTIMODAL_REGISTRY, MultiModalRegistry
27
from vllm.outputs import STREAM_FINISHED, PoolingRequestOutput, RequestOutput
28
from vllm.plugins.io_processors import get_io_processor
29
from vllm.pooling_params import PoolingParams
30
-from vllm.renderers import merge_kwargs, renderer_from_config
30
+from vllm.renderers import renderer_from_config
31
from vllm.renderers.inputs.preprocess import extract_prompt_components
32
from vllm.sampling_params import RequestOutputKind, SamplingParams
33
from vllm.tasks import SupportedTask
@@ -319,21 +319,6 @@ class AsyncLLM(EngineClient):
319
"prompt logprobs"
320
)
321
322
- if params.truncate_prompt_tokens is not None:
323
- params_type = type(params).__name__
324
- warnings.warn(
325
- f"The `truncate_prompt_tokens` parameter in `{params_type}` "
326
- "is deprecated and will be removed in v0.16. "
327
- "Please pass it via `tokenization_kwargs` instead.",
328
- DeprecationWarning,
329
- stacklevel=2,
330
- )
331
-
332
- tokenization_kwargs = merge_kwargs(
333
- tokenization_kwargs,
334
- dict(truncate_prompt_tokens=params.truncate_prompt_tokens),
335
- )
336
-
322
if isinstance(prompt, AsyncGenerator):
323
if reasoning_ended is not None:
324
raise NotImplementedError
@@ -353,6 +338,12 @@ class AsyncLLM(EngineClient):
338
339
# Convert Input --> Request.
340
if isinstance(prompt, EngineCoreRequest):
341
+ logger.warning_once(
342
+ "Passing EngineCoreRequest to AsyncLLM.generate() and .add_requests() "
343
+ "is deprecated and will be removed in v0.18. You should instead pass "
344
+ "the outputs of Renderer.render_cmpl() or Renderer.render_chat()."
345
+ )
346
+
347
request = prompt
348
if request_id != request.request_id:
349
logger.warning_once(
vllm/v1/engine/input_processor.py
+53
-7
@@ -2,6 +2,7 @@
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4
import time
5
+import warnings
6
from collections.abc import Mapping
7
from typing import Any, Literal
8
@@ -28,6 +29,7 @@ from vllm.sampling_params import SamplingParams
29
from vllm.tasks import POOLING_TASKS, SupportedTask
30
from vllm.tokenizers import TokenizerLike
31
from vllm.utils import length_from_prompt_token_ids_or_embeds, random_uuid
32
+from vllm.utils.func_utils import supports_kw
33
from vllm.utils.jsontree import json_iter_leaves
34
from vllm.v1.engine import EngineCoreRequest
35
@@ -72,6 +74,33 @@ class InputProcessor:
74
mm_registry=mm_registry,
75
)
76
77
+ from vllm.platforms import current_platform
78
+
79
+ platform_validate_request = current_platform.validate_request
80
+ if supports_kw(platform_validate_request, "prompt"):
81
+ logger.warning_once(
82
+ "The signature of Platform.validate_request has changed from "
83
+ "`(cls, prompt, params, processed_inputs) -> None` to "
84
+ "`(cls, processed_inputs, params) -> None`. The old signature "
85
+ "will no longer be supported starting from v0.18."
86
+ )
87
+
88
+ orig_validate_request = platform_validate_request
89
+
90
+ def compat_validate_request(
91
+ processed_inputs: ProcessorInputs,
92
+ params: SamplingParams | PoolingParams,
93
+ ):
94
+ return orig_validate_request(
95
+ processed_inputs,
96
+ params,
97
+ processed_inputs, # type: ignore
98
+ ) # type: ignore
99
+
100
+ platform_validate_request = compat_validate_request
101
+
102
+ self._platform_validate_request = platform_validate_request
103
+
104
@property
105
def tokenizer(self) -> TokenizerLike | None:
106
return self.renderer.tokenizer
@@ -87,6 +116,16 @@ class InputProcessor:
116
supported_tasks: tuple[SupportedTask, ...] | None,
117
):
118
"""Raise `ValueError` if SamplingParams or PoolingParams is not valid."""
119
+ if params.truncate_prompt_tokens is not None:
120
+ params_type = type(params).__name__
121
+ warnings.warn(
122
+ f"The `truncate_prompt_tokens` parameter in `{params_type}` "
123
+ "is deprecated and will be removed in v0.17. "
124
+ "Please pass it via `tokenization_kwargs` instead.",
125
+ DeprecationWarning,
126
+ stacklevel=2,
127
+ )
128
+
129
if isinstance(params, SamplingParams):
130
params.verify(
131
self.model_config,
@@ -211,11 +250,24 @@ class InputProcessor:
250
)
251
252
if isinstance(prompt, dict) and "type" in prompt:
253
+ if tokenization_kwargs:
254
+ logger.warning_once(
255
+ "Passing tokenization_kwargs to InputProcessor is deprecated "
256
+ "and will be removed in v0.18. You should instead pass "
257
+ "them to Renderer.render_cmpl() or Renderer.render_chat()."
258
+ )
259
+
260
if arrival_time is None:
261
arrival_time = prompt.get("arrival_time", time.time()) # type: ignore[assignment]
262
263
processed_inputs: ProcessorInputs = prompt # type: ignore[assignment]
264
else:
265
+ logger.warning_once(
266
+ "Passing raw prompts to InputProcessor is deprecated "
267
+ "and will be removed in v0.18. You should instead pass "
268
+ "the outputs of Renderer.render_cmpl() or Renderer.render_chat()."
269
+ )
270
+
271
if arrival_time is None:
272
arrival_time = time.time()
273
@@ -224,13 +276,7 @@ class InputProcessor:
276
tokenization_kwargs=tokenization_kwargs,
277
)
278
227
- from vllm.platforms import current_platform
228
-
229
- current_platform.validate_request(
230
- prompt=prompt,
231
- params=params,
232
- processed_inputs=processed_inputs,
233
- )
279
+ self._platform_validate_request(processed_inputs, params)
280
281
encoder_inputs, decoder_inputs = split_enc_dec_inputs(processed_inputs)
282
self._validate_model_inputs(encoder_inputs, decoder_inputs)
vllm/v1/engine/llm_engine.py
+7
-1
@@ -234,10 +234,16 @@ class LLMEngine:
234
235
# Process raw inputs into the request.
236
if isinstance(prompt, EngineCoreRequest):
237
+ logger.warning_once(
238
+ "Passing EngineCoreRequest to LLMEngine.generate() and .add_requests() "
239
+ "is deprecated and will be removed in v0.18. You should instead pass "
240
+ "the outputs of Renderer.render_cmpl() or Renderer.render_chat()."
241
+ )
242
+
243
request = prompt
244
if request_id != request.request_id:
245
logger.warning_once(
240
- "AsyncLLM.add_request() was passed a request_id parameter that "
246
+ "LLMEngine.add_request() was passed a request_id parameter that "
247
"does not match the EngineCoreRequest.request_id attribute. The "
248
"latter will be used, and the former will be ignored."
249
)