[Chore][1/2] Drop v0.14 deprecations (#31285)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
Cyrus Leung
2025-12-24 09:54:01 -08:00
committed by GitHub
parent 506eb0f454
commit 09dc7c690c
22 changed files with 28 additions and 427 deletions
+8 -64
View File
@@ -20,7 +20,7 @@ from typing import (
)
import numpy as np
from typing_extensions import NotRequired, TypeVar, deprecated
from typing_extensions import NotRequired, TypeVar
from vllm.utils.collection_utils import full_groupby, is_list_of
from vllm.utils.import_utils import LazyLoader
@@ -356,8 +356,8 @@ class MultiModalFeatureSpec:
@dataclass
class MultiModalFieldElem:
"""
Represents a keyword argument corresponding to a multi-modal item
in [`MultiModalKwargs`][vllm.multimodal.inputs.MultiModalKwargs].
Represents a keyword argument inside a
[`MultiModalKwargsItem`][vllm.multimodal.inputs.MultiModalKwargsItem].
"""
modality: str
@@ -369,14 +369,14 @@ class MultiModalFieldElem:
key: str
"""
The key of this field in
[`MultiModalKwargs`][vllm.multimodal.inputs.MultiModalKwargs],
[`MultiModalKwargsItem`][vllm.multimodal.inputs.MultiModalKwargsItem],
i.e. the name of the keyword argument to be passed to the model.
"""
data: NestedTensors
"""
The tensor data of this field in
[`MultiModalKwargs`][vllm.multimodal.inputs.MultiModalKwargs],
[`MultiModalKwargsItem`][vllm.multimodal.inputs.MultiModalKwargsItem],
i.e. the value of the keyword argument to be passed to the model.
It may be set to `None` if it is determined that the item is cached
@@ -410,9 +410,9 @@ class MultiModalFieldElem:
@dataclass(frozen=True, kw_only=True)
class BaseMultiModalField(ABC):
"""
Defines how to interpret tensor data belonging to a keyword argument in
[`MultiModalKwargs`][vllm.multimodal.inputs.MultiModalKwargs] for multiple
multi-modal items, and vice versa.
Defines how to interpret tensor data belonging to a keyword argument for
[`MultiModalKwargsItems`][vllm.multimodal.inputs.MultiModalKwargsItems],
and vice versa.
"""
keep_on_cpu: bool = False
@@ -985,62 +985,6 @@ MultiModalKwargsOptionalItems: TypeAlias = (
)
@deprecated("`MultiModalKwargs` is deprecated and will be removed in v0.14.")
class MultiModalKwargs(UserDict[str, NestedTensors]):
"""
A dictionary that represents the keyword arguments to
[`torch.nn.Module.forward`][].
"""
@staticmethod
@deprecated(
"`MultiModalKwargs.from_hf_inputs` is deprecated and "
"will be removed in v0.14. "
"Please use `MultiModalKwargsItems.from_hf_inputs` and "
"access the tensor data using `.get_data()`."
)
def from_hf_inputs(
hf_inputs: "BatchFeature",
config_by_key: Mapping[str, MultiModalFieldConfig],
):
return MultiModalKwargsItems.from_hf_inputs(hf_inputs, config_by_key).get_data()
@staticmethod
@deprecated(
"`MultiModalKwargs.from_items` is deprecated and "
"will be removed in v0.14. "
"Please use `MultiModalKwargsItems.from_seq` and "
"access the tensor data using `.get_data()`."
)
def from_items(
items: Sequence[MultiModalKwargsItem],
*,
pin_memory: bool = False,
):
return MultiModalKwargsItems.from_seq(items).get_data(pin_memory=pin_memory)
def __getitem__(self, key: str):
if key not in self:
raise KeyError(
f"Keyword argument {key!r} not found. "
f"Available keys: {set(self.keys())}"
)
return super().__getitem__(key)
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return False
for k in self:
if k not in other:
return False
if not nested_tensors_equal(self[k], other[k]):
return False
return True
MultiModalPlaceholderDict: TypeAlias = Mapping[str, Sequence[PlaceholderRange]]
"""
A dictionary containing placeholder ranges for each modality.