[Mypy] Fix mypy typing for N/O models (#54142)

Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
This commit is contained in:
Taneem Ibrahim
2026-09-18 12:50:01 +01:00
committed by GitHub
parent e562003adb
commit 2b8a5495a8
19 changed files with 321 additions and 143 deletions
+10 -3
View File
@@ -59,7 +59,12 @@ from vllm.sequence import IntermediateTensors
from vllm.transformers_utils.processors.ovis import OvisProcessor
from vllm.utils.tensor_schema import TensorSchema, TensorShape
from .interfaces import MultiModalEmbeddings, SupportsMultiModal, SupportsPP
from .interfaces import (
MultiModalEmbeddings,
SupportsMultiModal,
SupportsPP,
supports_pp,
)
# Cannot find the following number from hf config.
IMAGE_TOKEN = "<image>"
@@ -281,7 +286,7 @@ class OvisProcessingInfo(BaseProcessingInfo):
# minus 1 for presented image token
return (patch_grid_length // hidden_stride) ** 2 - 1
def get_image_pad_token(self) -> str:
def get_image_pad_token(self) -> str | None:
hf_text_config = self.get_hf_config().get_text_config()
text_model_type = hf_text_config.model_type
return IMAGE_PAD_TOKEN_MAP.get(text_model_type)
@@ -439,8 +444,10 @@ class Ovis(nn.Module, SupportsMultiModal, SupportsPP):
text_model_type = self.config.get_text_config().model_type
self.image_pad_token_id = IMAGE_PAD_TOKEN_ID_MAP[text_model_type]
language_model = self.get_language_model()
assert supports_pp(language_model)
self.make_empty_intermediate_tensors = (
self.get_language_model().make_empty_intermediate_tensors
language_model.make_empty_intermediate_tensors
)
def _parse_and_validate_image_input(