fix-qwen2vl-no-position_ids (#33487)

This commit is contained in:
Shijie 2024-10-29 22:27:34 +08:00 committed by GitHub
parent 8755dd26b7
commit 0ab0a42651
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1719,6 +1719,9 @@ class Qwen2VLForConditionalGeneration(Qwen2VLPreTrainedModel, GenerationMixin):
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,