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 15, 08:30 UTC
[Deprecation] Disallow pos-args other than `model` when initializing `LLM` (#18802)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Cyrus Leung committed
May 30, 2025 at 00:36 UTC
c29034037d73e4f774796c661d3fc48038fc1067
2 files changed
+3
-41
tests/entrypoints/llm/test_init.py
deleted
-24
@@ -1,24 +0,0 @@
1
-# SPDX-License-Identifier: Apache-2.0
2
-
3
-import pytest
4
-
5
-from vllm import LLM
6
-
7
-from ...utils import error_on_warning
8
-
9
-MODEL_NAME = "facebook/opt-125m"
10
-
11
-
12
-def test_pos_args_deprecated():
13
- with error_on_warning(DeprecationWarning):
14
- LLM(model=MODEL_NAME, tokenizer=MODEL_NAME)
15
-
16
- with error_on_warning(DeprecationWarning):
17
- LLM(MODEL_NAME, tokenizer=MODEL_NAME)
18
-
19
- with pytest.warns(DeprecationWarning, match="'tokenizer'"):
20
- LLM(MODEL_NAME, MODEL_NAME)
21
-
22
- with pytest.warns(DeprecationWarning,
23
- match="'tokenizer', 'tokenizer_mode'"):
24
- LLM(MODEL_NAME, MODEL_NAME, "auto")
vllm/entrypoints/llm.py
+3
-17
@@ -45,8 +45,7 @@ from vllm.sampling_params import (BeamSearchParams, GuidedDecodingParams,
45
from vllm.transformers_utils.tokenizer import (AnyTokenizer, MistralTokenizer,
46
get_cached_tokenizer)
47
from vllm.usage.usage_lib import UsageContext
48
-from vllm.utils import (Counter, Device, deprecate_args, deprecate_kwargs,
49
- is_list_of)
48
+from vllm.utils import Counter, Device, deprecate_kwargs, is_list_of
49
50
if TYPE_CHECKING:
51
from vllm.v1.metrics.reader import Metric
@@ -143,12 +142,6 @@ class LLM:
142
DEPRECATE_LEGACY: ClassVar[bool] = True
143
"""A flag to toggle whether to deprecate the legacy generate/encode API."""
144
146
- DEPRECATE_INIT_POSARGS: ClassVar[bool] = True
147
- """
148
- A flag to toggle whether to deprecate positional arguments in
149
- [LLM.__init__][].
150
- """
151
-
145
@classmethod
146
@contextmanager
147
def deprecate_legacy_api(cls):
@@ -158,16 +151,11 @@ class LLM:
151
152
cls.DEPRECATE_LEGACY = False
153
161
- @deprecate_args(
162
- start_index=2, # Ignore self and model
163
- is_deprecated=lambda: LLM.DEPRECATE_INIT_POSARGS,
164
- additional_message=(
165
- "All positional arguments other than `model` will be "
166
- "replaced with keyword arguments in an upcoming version."),
167
- )
154
def __init__(
155
self,
156
model: str,
157
+ *,
158
+ task: TaskOption = "auto",
159
tokenizer: Optional[str] = None,
160
tokenizer_mode: TokenizerMode = "auto",
161
skip_tokenizer_init: bool = False,
@@ -189,8 +177,6 @@ class LLM:
177
hf_token: Optional[Union[bool, str]] = None,
178
hf_overrides: Optional[HfOverrides] = None,
179
mm_processor_kwargs: Optional[dict[str, Any]] = None,
192
- # After positional args are removed, move this right below `model`
193
- task: TaskOption = "auto",
180
override_pooler_config: Optional[PoolerConfig] = None,
181
compilation_config: Optional[Union[int, dict[str, Any]]] = None,
182
**kwargs,