Skip to content

Commit c9f7081

Browse files
authored
[LoRA]: Add lora support to qwen-2.5-omni (#24231)
1 parent 16ded21 commit c9f7081

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

docs/models/supported_models.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ These models primarily accept the [`LLM.generate`](./generative_models.md#llmgen
662662
| `Qwen2AudioForConditionalGeneration` | Qwen2-Audio | T + A<sup>+</sup> | `Qwen/Qwen2-Audio-7B-Instruct` | | ✅︎ | ✅︎ |
663663
| `Qwen2VLForConditionalGeneration` | QVQ, Qwen2-VL | T + I<sup>E+</sup> + V<sup>E+</sup> | `Qwen/QVQ-72B-Preview`, `Qwen/Qwen2-VL-7B-Instruct`, `Qwen/Qwen2-VL-72B-Instruct`, etc. | ✅︎ | ✅︎ | ✅︎ |
664664
| `Qwen2_5_VLForConditionalGeneration` | Qwen2.5-VL | T + I<sup>E+</sup> + V<sup>E+</sup> | `Qwen/Qwen2.5-VL-3B-Instruct`, `Qwen/Qwen2.5-VL-72B-Instruct`, etc. | ✅︎ | ✅︎ | ✅︎ |
665-
| `Qwen2_5OmniThinkerForConditionalGeneration` | Qwen2.5-Omni | T + I<sup>E+</sup> + V<sup>E+</sup> + A<sup>+</sup> | `Qwen/Qwen2.5-Omni-7B` | | ✅︎ | ✅︎ |
665+
| `Qwen2_5OmniThinkerForConditionalGeneration` | Qwen2.5-Omni | T + I<sup>E+</sup> + V<sup>E+</sup> + A<sup>+</sup> | `Qwen/Qwen2.5-Omni-3B`, `Qwen/Qwen2.5-Omni-7B` | ✅︎ | ✅︎ | ✅︎ |
666666
| `RForConditionalGeneration` | R-VL-4B | T + I<sup>E+</sup> | `YannQi/R-4B` | | ✅︎ | ✅︎ |
667667
| `SkyworkR1VChatModel` | Skywork-R1V-38B | T + I | `Skywork/Skywork-R1V-38B` | | ✅︎ | ✅︎ |
668668
| `SmolVLMForConditionalGeneration` | SmolVLM2 | T + I | `SmolVLM2-2.2B-Instruct` | ✅︎ | | ✅︎ |

vllm/model_executor/models/qwen2_5_omni_thinker.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
from vllm.config import VllmConfig
4242
from vllm.logger import init_logger
4343
from vllm.model_executor.layers.rotary_embedding import MRotaryEmbedding
44+
from vllm.model_executor.models.module_mapping import MultiModelKeys
4445
from vllm.model_executor.models.qwen2_5_vl import (
4546
Qwen2_5_VisionTransformer, Qwen2_5_VLImageEmbeddingInputs,
4647
Qwen2_5_VLImageInputs, Qwen2_5_VLImagePixelInputs,
@@ -66,7 +67,8 @@
6667
from vllm.sequence import IntermediateTensors
6768
from vllm.transformers_utils.tokenizer import decode_tokens, encode_tokens
6869

69-
from .interfaces import MultiModalEmbeddings, SupportsMultiModal, SupportsPP
70+
from .interfaces import (MultiModalEmbeddings, SupportsLoRA,
71+
SupportsMultiModal, SupportsPP)
7072
from .utils import (AutoWeightsLoader, WeightsMapper,
7173
init_vllm_registered_model, maybe_prefix,
7274
merge_multimodal_embeddings)
@@ -705,7 +707,7 @@ def _process_video_input(
705707
dummy_inputs=Qwen2_5OmniThinkerDummyInputsBuilder,
706708
)
707709
class Qwen2_5OmniThinkerForConditionalGeneration(
708-
nn.Module, SupportsMultiModal, SupportsPP,
710+
nn.Module, SupportsMultiModal, SupportsPP, SupportsLoRA,
709711
Qwen2_5OmniConditionalGenerationMixin):
710712
hf_to_vllm_mapper = WeightsMapper(
711713
orig_to_new_prefix={
@@ -798,6 +800,15 @@ def _parse_and_validate_multimodal_inputs(self, **kwargs: object) -> dict:
798800
def get_language_model(self) -> torch.nn.Module:
799801
return self.language_model
800802

803+
def get_mm_mapping(self) -> MultiModelKeys:
804+
"""Get module prefix for multimodal models to filter LoRA modules."""
805+
return MultiModelKeys.from_string_field(
806+
language_model="language_model",
807+
connector=[], # No explicit connector in this model
808+
tower_model=["visual",
809+
"audio_tower"], # Exclude vision and audio towers
810+
)
811+
801812
def get_multimodal_embeddings(self,
802813
**kwargs: object) -> MultiModalEmbeddings:
803814

0 commit comments

Comments
 (0)