Skip to content

Fix bug in prepare_inputs_for_generation function: in Qwen2-VL (#36037)#36038

Open
JamesHujy wants to merge 2 commits intohuggingface:mainfrom
JamesHujy:fix-bug-36037
Open

Fix bug in prepare_inputs_for_generation function: in Qwen2-VL (#36037)#36038
JamesHujy wants to merge 2 commits intohuggingface:mainfrom
JamesHujy:fix-bug-36037

Conversation

@JamesHujy
Copy link
Copy Markdown

Fix the problem in Qwen2-VL. A similar problem is mentioned in PR #34095.

When using synced_gpus, after one peer finishes generating, the cache position in the generation process continues to increase. This leads to the input IDs going out of bounds, resulting in errors. The issue specifically occurs in the following line of code:
modeling_qwen2_vl.py#L1739.

The root cause seems to be the difference in the implementation of the prepare_inputs_for_generation function compared to the default implementation found here:
utils.py#L388.

@Rocketknight1
Copy link
Copy Markdown
Member

cc @gante (and sorry!)

Copy link
Copy Markdown
Contributor

@gante gante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for fixing 🙏

@gante
Copy link
Copy Markdown
Contributor

gante commented Feb 14, 2025

@JamesHujy after sorting the conflicts, it seems like the fix is already on main :D Can you confirm that your intended fix is indeed already present?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants