Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project

import pytest

from vllm_omni.model_executor.models.minicpmo_4_5.minicpmo_4_5_omni_llm import (
MiniCPMO45OmniLLMForConditionalGeneration,
)

pytestmark = [pytest.mark.core_model, pytest.mark.cpu]


def test_embed_multimodal_delegates_to_get_multimodal_embeddings(monkeypatch):
"""vLLM V1 encoder profiling calls embed_multimodal; without an override the
SupportsMultiModal protocol stub returns None and startup fails downstream."""
sentinel = (object(),)
seen: dict[str, object] = {}

def fake_get_multimodal_embeddings(self, **kwargs):
seen.update(kwargs)
return sentinel

monkeypatch.setattr(
MiniCPMO45OmniLLMForConditionalGeneration,
"get_multimodal_embeddings",
fake_get_multimodal_embeddings,
)
model = object.__new__(MiniCPMO45OmniLLMForConditionalGeneration)

out = model.embed_multimodal(pixel_values="pv", audio_features="af")

assert out is sentinel
assert seen == {"pixel_values": "pv", "audio_features": "af"}
Original file line number Diff line number Diff line change
Expand Up @@ -4528,6 +4528,10 @@ def get_multimodal_embeddings(self, **kwargs: object) -> MultiModalEmbeddings:
multimodal_embeddings += tuple(audio_embeddings)
return multimodal_embeddings

def embed_multimodal(self, **kwargs: object) -> MultiModalEmbeddings:
"""vLLM V1 encoder profiling calls this; the inherited Protocol stub returns None."""
return self.get_multimodal_embeddings(**kwargs)

def get_input_embeddings(
self,
input_ids: torch.Tensor,
Expand Down
Loading