-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
add qwen2.5vl #35569
base: main
Are you sure you want to change the base?
add qwen2.5vl #35569
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brought changes from #35466
Thanks for the new model!
|
||
def get_rope_index( | ||
self, | ||
input_ids: torch.LongTensor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
input_ids: torch.LongTensor, | |
input_ids: Optional[torch.LongTensor] = None, |
if attention_mask is not None: | ||
position_ids = attention_mask.long().cumsum(-1) - 1 | ||
position_ids.masked_fill_(attention_mask == 0, 1) | ||
position_ids = position_ids.unsqueeze(0).expand(3, -1, -1).to(input_ids.device) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
position_ids = position_ids.unsqueeze(0).expand(3, -1, -1).to(input_ids.device) | |
position_ids = position_ids.unsqueeze(0).expand(3, -1, -1).to(attention_mask.device) |
attention_mask = attention_mask.to(inputs_embeds.device) | ||
|
||
# if we get 4D attention mask we cannot calculate rope deltas anymore. TODO @raushan fixme | ||
if position_ids is None and input_ids is not None and (attention_mask is None or attention_mask.ndim == 2): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if position_ids is None and input_ids is not None and (attention_mask is None or attention_mask.ndim == 2): | |
if position_ids is None and (attention_mask is None or attention_mask.ndim == 2): |
Hey @ShuaiBai623 , thanks for the addition! 🎉 before reviewing, the main thing here is that since Qwen2.5VL is very similar to Qwen2VL, it's best to use modular transformers, that is, building a shorter |
What does this PR do?
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.