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 14, 05:30 UTC
[V0 deprecation] Remove unreachable model_config.supported_tasks (#25642)
Signed-off-by: wang.yuqi <noooop@126.com>
wang.yuqi committed
Sep 25, 2025 at 19:26 UTC
7f570f1caa472dcb4143488d9406eb339f87e359
5 files changed
+7
-76
tests/test_config.py
-3
@@ -97,7 +97,6 @@ def test_auto_task(model_id, expected_runner_type, expected_convert_type,
97
98
assert config.runner_type == expected_runner_type
99
assert config.convert_type == expected_convert_type
100
- assert expected_task in config.supported_tasks
100
101
102
# Can remove once --task option is fully deprecated
@@ -120,7 +119,6 @@ def test_score_task(model_id, expected_runner_type, expected_convert_type,
119
120
assert config.runner_type == expected_runner_type
121
assert config.convert_type == expected_convert_type
123
- assert expected_task in config.supported_tasks
122
123
124
# Can remove once --task option is fully deprecated
@@ -137,7 +135,6 @@ def test_transcription_task(model_id, expected_runner_type,
135
136
assert config.runner_type == expected_runner_type
137
assert config.convert_type == expected_convert_type
140
- assert expected_task in config.supported_tasks
138
139
140
@pytest.mark.parametrize(
vllm/config/model.py
-61
@@ -14,7 +14,6 @@ from pydantic import (ConfigDict, SkipValidation, field_validator,
14
model_validator)
15
from pydantic.dataclasses import dataclass
16
from safetensors.torch import _TYPES as _SAFETENSORS_TO_TORCH_DTYPE
17
-from typing_extensions import assert_never
17
18
import vllm.envs as envs
19
from vllm.config.multimodal import (MMCacheType, MMEncoderTPMode,
@@ -534,9 +533,6 @@ class ModelConfig:
533
f"You can pass `--convert {convert_option} to adapt "
534
"it into a pooling model.")
535
537
- self.supported_tasks = self._get_supported_tasks(
538
- architectures, self.runner_type, self.convert_type)
539
-
536
# Note: Initialize these attributes early because transformers fallback
537
# may fail to load dynamic modules in child processes
538
model_info, arch = registry.inspect_model_cls(architectures, self)
@@ -834,27 +830,6 @@ class ModelConfig:
830
831
return convert_type
832
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
-
833
def _get_default_pooling_task(
834
self,
835
architectures: list[str],
@@ -872,42 +847,6 @@ class ModelConfig:
847
848
return "embed"
849
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
-
850
def _parse_quant_hf_config(self, hf_config: PretrainedConfig):
851
quant_cfg = getattr(hf_config, "quantization_config", None)
852
if quant_cfg is None:
vllm/engine/protocol.py
+5
@@ -16,6 +16,7 @@ from vllm.outputs import CompletionOutput, PoolingRequestOutput, RequestOutput
16
from vllm.plugins.io_processors.interface import IOProcessor
17
from vllm.pooling_params import PoolingParams
18
from vllm.sampling_params import BeamSearchParams, SamplingParams
19
+from vllm.tasks import SupportedTask
20
from vllm.transformers_utils.tokenizer import AnyTokenizer
21
from vllm.utils import Device, collect_from_async_generator, random_uuid
22
@@ -326,3 +327,7 @@ class EngineClient(ABC):
327
kwargs: Optional[dict] = None):
328
"""Perform a collective RPC call to the given path."""
329
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
+1
-5
@@ -1609,11 +1609,7 @@ async def init_app_state(
1609
state.vllm_config = vllm_config
1610
model_config = vllm_config.model_config
1611
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()
1613
1614
logger.info("Supported_tasks: %s", supported_tasks)
1615
vllm/entrypoints/openai/run_batch.py
+1
-7
@@ -14,7 +14,6 @@ import torch
14
from prometheus_client import start_http_server
15
from tqdm import tqdm
16
17
-import vllm.envs as envs
17
from vllm.config import VllmConfig
18
from vllm.engine.arg_utils import AsyncEngineArgs, optional_type
19
from vllm.engine.protocol import EngineClient
@@ -334,12 +333,7 @@ async def run_batch(
333
334
model_config = vllm_config.model_config
335
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()
337
logger.info("Supported_tasks: %s", supported_tasks)
338
339
# Create the openai serving objects.