Skip to content

Commit 7f570f1

Browse files
authored
[V0 deprecation] Remove unreachable model_config.supported_tasks (vllm-project#25642)
Signed-off-by: wang.yuqi <noooop@126.com>
1 parent eaeca3c commit 7f570f1

File tree

5 files changed

+7
-76
lines changed

5 files changed

+7
-76
lines changed

tests/test_config.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ def test_auto_task(model_id, expected_runner_type, expected_convert_type,
9797

9898
assert config.runner_type == expected_runner_type
9999
assert config.convert_type == expected_convert_type
100-
assert expected_task in config.supported_tasks
101100

102101

103102
# Can remove once --task option is fully deprecated
@@ -120,7 +119,6 @@ def test_score_task(model_id, expected_runner_type, expected_convert_type,
120119

121120
assert config.runner_type == expected_runner_type
122121
assert config.convert_type == expected_convert_type
123-
assert expected_task in config.supported_tasks
124122

125123

126124
# Can remove once --task option is fully deprecated
@@ -137,7 +135,6 @@ def test_transcription_task(model_id, expected_runner_type,
137135

138136
assert config.runner_type == expected_runner_type
139137
assert config.convert_type == expected_convert_type
140-
assert expected_task in config.supported_tasks
141138

142139

143140
@pytest.mark.parametrize(

vllm/config/model.py

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
model_validator)
1515
from pydantic.dataclasses import dataclass
1616
from safetensors.torch import _TYPES as _SAFETENSORS_TO_TORCH_DTYPE
17-
from typing_extensions import assert_never
1817

1918
import vllm.envs as envs
2019
from vllm.config.multimodal import (MMCacheType, MMEncoderTPMode,
@@ -534,9 +533,6 @@ def _task_to_convert(task: TaskOption) -> ConvertType:
534533
f"You can pass `--convert {convert_option} to adapt "
535534
"it into a pooling model.")
536535

537-
self.supported_tasks = self._get_supported_tasks(
538-
architectures, self.runner_type, self.convert_type)
539-
540536
# Note: Initialize these attributes early because transformers fallback
541537
# may fail to load dynamic modules in child processes
542538
model_info, arch = registry.inspect_model_cls(architectures, self)
@@ -834,27 +830,6 @@ def _get_convert_type(
834830

835831
return convert_type
836832

837-
def _get_supported_generation_tasks(
838-
self,
839-
architectures: list[str],
840-
convert_type: ConvertType,
841-
) -> list[_ResolvedTask]:
842-
registry = self.registry
843-
844-
if registry.is_transcription_only_model(architectures, self):
845-
return ["transcription"]
846-
847-
# TODO: Use get_supported_generation_tasks once V0 is removed
848-
supported_tasks = list[_ResolvedTask]()
849-
if (registry.is_text_generation_model(architectures, self)
850-
or convert_type in _RUNNER_CONVERTS["generate"]):
851-
supported_tasks.append("generate")
852-
853-
if registry.is_transcription_model(architectures, self):
854-
supported_tasks.append("transcription")
855-
856-
return supported_tasks
857-
858833
def _get_default_pooling_task(
859834
self,
860835
architectures: list[str],
@@ -872,42 +847,6 @@ def _get_default_pooling_task(
872847

873848
return "embed"
874849

875-
def _get_supported_pooling_tasks(
876-
self,
877-
architectures: list[str],
878-
convert_type: ConvertType,
879-
) -> list[_ResolvedTask]:
880-
registry = self.registry
881-
882-
# TODO: Use get_supported_pooling_tasks once V0 is removed
883-
supported_tasks = list[_ResolvedTask]()
884-
if (registry.is_pooling_model(architectures, self)
885-
or convert_type in _RUNNER_CONVERTS["pooling"]):
886-
supported_tasks.append("encode")
887-
888-
extra_task = (self._get_default_pooling_task(architectures)
889-
if convert_type == "none" else convert_type)
890-
supported_tasks.append(extra_task)
891-
892-
return supported_tasks
893-
894-
def _get_supported_tasks(
895-
self,
896-
architectures: list[str],
897-
runner_type: RunnerType,
898-
convert_type: ConvertType,
899-
) -> list[_ResolvedTask]:
900-
if runner_type == "generate":
901-
return self._get_supported_generation_tasks(
902-
architectures, convert_type)
903-
if runner_type == "pooling":
904-
return self._get_supported_pooling_tasks(architectures,
905-
convert_type)
906-
if runner_type == "draft":
907-
return ["draft"]
908-
909-
assert_never(runner_type)
910-
911850
def _parse_quant_hf_config(self, hf_config: PretrainedConfig):
912851
quant_cfg = getattr(hf_config, "quantization_config", None)
913852
if quant_cfg is None:

vllm/engine/protocol.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from vllm.plugins.io_processors.interface import IOProcessor
1717
from vllm.pooling_params import PoolingParams
1818
from vllm.sampling_params import BeamSearchParams, SamplingParams
19+
from vllm.tasks import SupportedTask
1920
from vllm.transformers_utils.tokenizer import AnyTokenizer
2021
from vllm.utils import Device, collect_from_async_generator, random_uuid
2122

@@ -326,3 +327,7 @@ async def collective_rpc(self,
326327
kwargs: Optional[dict] = None):
327328
"""Perform a collective RPC call to the given path."""
328329
raise NotImplementedError
330+
331+
async def get_supported_tasks(self) -> tuple[SupportedTask, ...]:
332+
"""Get supported tasks"""
333+
raise NotImplementedError

vllm/entrypoints/openai/api_server.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,11 +1609,7 @@ async def init_app_state(
16091609
state.vllm_config = vllm_config
16101610
model_config = vllm_config.model_config
16111611

1612-
if envs.VLLM_USE_V1:
1613-
supported_tasks = await engine_client \
1614-
.get_supported_tasks() # type: ignore
1615-
else:
1616-
supported_tasks = model_config.supported_tasks
1612+
supported_tasks = await engine_client.get_supported_tasks()
16171613

16181614
logger.info("Supported_tasks: %s", supported_tasks)
16191615

vllm/entrypoints/openai/run_batch.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from prometheus_client import start_http_server
1515
from tqdm import tqdm
1616

17-
import vllm.envs as envs
1817
from vllm.config import VllmConfig
1918
from vllm.engine.arg_utils import AsyncEngineArgs, optional_type
2019
from vllm.engine.protocol import EngineClient
@@ -334,12 +333,7 @@ async def run_batch(
334333

335334
model_config = vllm_config.model_config
336335

337-
if envs.VLLM_USE_V1:
338-
supported_tasks = await engine_client \
339-
.get_supported_tasks() # type: ignore
340-
else:
341-
supported_tasks = model_config.supported_tasks
342-
336+
supported_tasks = await engine_client.get_supported_tasks()
343337
logger.info("Supported_tasks: %s", supported_tasks)
344338

345339
# Create the openai serving objects.

0 commit comments

Comments
 (0)