Skip to content

Commit c290340

Browse files
[Deprecation] Disallow pos-args other than model when initializing LLM (vllm-project#18802)
Signed-off-by: DarkLight1337 <[email protected]>
1 parent 1b7cfd5 commit c290340

File tree

2 files changed

+3
-41
lines changed

2 files changed

+3
-41
lines changed

tests/entrypoints/llm/test_init.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

vllm/entrypoints/llm.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@
4545
from vllm.transformers_utils.tokenizer import (AnyTokenizer, MistralTokenizer,
4646
get_cached_tokenizer)
4747
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
5049

5150
if TYPE_CHECKING:
5251
from vllm.v1.metrics.reader import Metric
@@ -143,12 +142,6 @@ class LLM:
143142
DEPRECATE_LEGACY: ClassVar[bool] = True
144143
"""A flag to toggle whether to deprecate the legacy generate/encode API."""
145144

146-
DEPRECATE_INIT_POSARGS: ClassVar[bool] = True
147-
"""
148-
A flag to toggle whether to deprecate positional arguments in
149-
[LLM.__init__][].
150-
"""
151-
152145
@classmethod
153146
@contextmanager
154147
def deprecate_legacy_api(cls):
@@ -158,16 +151,11 @@ def deprecate_legacy_api(cls):
158151

159152
cls.DEPRECATE_LEGACY = False
160153

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-
)
168154
def __init__(
169155
self,
170156
model: str,
157+
*,
158+
task: TaskOption = "auto",
171159
tokenizer: Optional[str] = None,
172160
tokenizer_mode: TokenizerMode = "auto",
173161
skip_tokenizer_init: bool = False,
@@ -189,8 +177,6 @@ def __init__(
189177
hf_token: Optional[Union[bool, str]] = None,
190178
hf_overrides: Optional[HfOverrides] = None,
191179
mm_processor_kwargs: Optional[dict[str, Any]] = None,
192-
# After positional args are removed, move this right below `model`
193-
task: TaskOption = "auto",
194180
override_pooler_config: Optional[PoolerConfig] = None,
195181
compilation_config: Optional[Union[int, dict[str, Any]]] = None,
196182
**kwargs,

0 commit comments

Comments
 (0)