fix: match dtype when assigning position_ids in get_rope_index#109
Open
auto-yun wants to merge 2 commits intoISEEKYAN:mainfrom
Open
fix: match dtype when assigning position_ids in get_rope_index#109auto-yun wants to merge 2 commits intoISEEKYAN:mainfrom
auto-yun wants to merge 2 commits intoISEEKYAN:mainfrom
Conversation
When input_ids are int32, position_ids defaults to long (int64), causing a dtype mismatch during assignment. Fix by explicitly passing dtype=position_ids.dtype in the .to() call for both qwen3_5 and qwen3_vl rope_utils.py.
Same dtype mismatch issue as qwen3_5 and qwen3_vl: when input_ids are int32, position_ids defaults to long (int64), causing assignment errors. Fix by passing dtype=position_ids.dtype in .to() for: - mbridge/models/glm4_vl/vl_mixin.py - mbridge/models/qwen2_5_vl/rope_utils.py - mbridge/models/qwen3_omni_moe/rope_utils.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
input_idsareint32,position_idsdefaults totorch.long(int64). The assignment:only moves
llm_positionsto the correct device but does not cast its dtype, causing a dtype mismatch error during assignment.Fix
Pass
dtype=position_ids.dtypein the.to()call to ensure the dtype is always consistent:Files Changed
mbridge/models/qwen3_5/rope_utils.pymbridge/models/qwen3_vl/rope_utils.py