From 640cc9dd7dae3ba08f4dc6e479403fbaf99f2d93 Mon Sep 17 00:00:00 2001 From: allgather Date: Fri, 17 Apr 2026 09:39:19 -0700 Subject: [PATCH] feat: Add LoRA support for Gemma4ForConditionalGeneration (#39291) Signed-off-by: allgather Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- vllm/model_executor/models/gemma4_mm.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/vllm/model_executor/models/gemma4_mm.py b/vllm/model_executor/models/gemma4_mm.py index 08978ec3f44..ff1760dde08 100644 --- a/vllm/model_executor/models/gemma4_mm.py +++ b/vllm/model_executor/models/gemma4_mm.py @@ -67,6 +67,7 @@ from vllm.utils.tensor_schema import TensorSchema, TensorShape from .interfaces import ( MultiModalEmbeddings, SupportsEagle3, + SupportsLoRA, SupportsMultiModal, SupportsPP, ) @@ -880,6 +881,7 @@ class Gemma4ForConditionalGeneration( nn.Module, SupportsMultiModal, SupportsPP, + SupportsLoRA, SupportsEagle3, ): packed_modules_mapping = { @@ -1358,10 +1360,16 @@ class Gemma4ForConditionalGeneration( def get_mm_mapping(self) -> MultiModelKeys: """Get the module prefix mapping for multimodal models.""" + connectors = ["embed_vision"] + tower_models = ["vision_tower"] + if self.audio_tower is not None: + connectors.append("embed_audio") + tower_models.append("audio_tower") + return MultiModelKeys.from_string_field( language_model="language_model", - connector=["embed_vision", "embed_audio"], - tower_model=["vision_tower", "audio_tower"], + connector=connectors, + tower_model=tower_models, ) @classmethod