From 0e54a69548885a1f3394c38a81f876b3ec60ab57 Mon Sep 17 00:00:00 2001 From: Siyuan Chen <41201609+SYChen123@users.noreply.github.com> Date: Thu, 11 Dec 2025 03:38:51 +0800 Subject: [PATCH] [bugfix] qwen25-VL support lora (#14638) --- python/sglang/srt/models/qwen2_5_vl.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python/sglang/srt/models/qwen2_5_vl.py b/python/sglang/srt/models/qwen2_5_vl.py index 32efa19d8..284bdfcfd 100644 --- a/python/sglang/srt/models/qwen2_5_vl.py +++ b/python/sglang/srt/models/qwen2_5_vl.py @@ -23,6 +23,7 @@ # limitations under the License. """Inference-only Qwen2-VL model compatible with HuggingFace weights.""" import logging +import re from functools import partial from typing import Iterable, List, Optional, Tuple, Type @@ -534,6 +535,13 @@ class Qwen2_5_VLForConditionalGeneration(nn.Module): image_embeds = self.visual(pixel_values, grid_thw=image_grid_thw) return image_embeds + _lora_pattern = re.compile( + r"^model\.layers\.(\d+)\.(?:self_attn|mlp)\.(?:qkv_proj|o_proj|down_proj|gate_up_proj)$" + ) + + def should_apply_lora(self, module_name: str) -> bool: + return bool(self._lora_pattern.match(module_name)) + def get_video_feature(self, items: List[MultimodalDataItem]) -> torch.Tensor: # in qwen-vl, last dim is the same pixel_values = torch.cat([item.feature for item in items], dim=0).type(