Skip to content

Commit 75aa7e9

Browse files
authored
adapt new transformers to loading qwen2.5-vl with turbomind (#3771)
1 parent 46c70ff commit 75aa7e9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lmdeploy/vl/model/qwen2.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ def build_model(self):
7575
# disable accelerate check_tied_parameters_in_config for Qwen2-VL-2B-Instruct
7676
config.tie_word_embeddings = False
7777
model = AutoModelCls._from_config(config)
78+
if hasattr(AutoModelCls, 'visual'):
79+
# transformers >= 4.52.0 modified model structure
80+
# https://github.com/huggingface/transformers/blob/v4.52.0/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py#L1791-L1800
81+
model.visual = model.model.visual
7882
del model.model
7983
del model.lm_head
8084
model.half()

0 commit comments

Comments
 (0)