Skip to content

Commit e4dd180

Browse files
simonJJJBernardZach
authored andcommitted
fix-qwen2vl-no-position_ids (huggingface#33487)
1 parent 5a2753d commit e4dd180

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/transformers/models/qwen2_vl/modeling_qwen2_vl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,9 @@ def forward(
17191719
if attention_mask is not None:
17201720
attention_mask = attention_mask.to(inputs_embeds.device)
17211721

1722+
if position_ids is None and input_ids is not None:
1723+
position_ids, _ = self.get_rope_index(input_ids, image_grid_thw, video_grid_thw, attention_mask)
1724+
17221725
outputs = self.model(
17231726
input_ids=None,
17241727
position_ids=position_ids,

0 commit comments

Comments
 (0)