Skip to content

Does Qwen_2_5_VL support variable length attention computation? #38007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
yingtongxiong opened this issue May 8, 2025 · 2 comments
Open

Does Qwen_2_5_VL support variable length attention computation? #38007

yingtongxiong opened this issue May 8, 2025 · 2 comments
Assignees
Labels
Feature request Request for a new feature

Comments

@yingtongxiong
Copy link

Feature request

Qwen_2_5_VL support variable length attention computation

Motivation

Hello, I try to run qwen25_vl with packing samples, however, I found that it seems this function only passes the attention_mask, not the position_ids in https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py#L908. So I pass the position_ids to this function and met the illegal memory access. Finally, I found that the position_ids has been expanded 3 times in dim 0, so how can I use the position_ids, what if I want to use varlen flash attention? Would anyone be able to help me with this?

Your contribution

no

@yingtongxiong yingtongxiong added the Feature request Request for a new feature label May 8, 2025
@zucchini-nlp
Copy link
Member

@yingtongxiong Qwen VL position ids are different from simple LLMs, so simply passing position_ids tp FA2 for packing will not solve the issue. Probably we'll need to pass different set of position_ids or infer it from 3D ids. I will take a look at it

@zucchini-nlp zucchini-nlp self-assigned this May 8, 2025
@yingtongxiong
Copy link
Author

@zucchini-nlp thank you very much. I see in verl, it passes position_ids[0] to flash attention. I am not sure it is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants