Skip to content

Commit

Permalink
fix-qwen2vl-no-position_ids (#33487)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonJJJ authored Oct 29, 2024
1 parent 8755dd2 commit 0ab0a42
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/transformers/models/qwen2_vl/modeling_qwen2_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1719,6 +1719,9 @@ def forward(
if attention_mask is not None:
attention_mask = attention_mask.to(inputs_embeds.device)

if position_ids is None and input_ids is not None:
position_ids, _ = self.get_rope_index(input_ids, image_grid_thw, video_grid_thw, attention_mask)

outputs = self.model(
input_ids=None,
position_ids=position_ids,
Expand Down

0 comments on commit 0ab0a42

Please sign in to comment.