fix(qwen3_vl): fix IndexPutBackward0 invalid gradient shape in vision…#100
Open
alexqdh wants to merge 1 commit intoISEEKYAN:mainfrom
Open
fix(qwen3_vl): fix IndexPutBackward0 invalid gradient shape in vision…#100alexqdh wants to merge 1 commit intoISEEKYAN:mainfrom
alexqdh wants to merge 1 commit intoISEEKYAN:mainfrom
Conversation
… token injection
Problem
-------
IndexPutBackward0 reads the now-stale
mask (sum=225 instead of 224), producing a gradient with the wrong shape.
Error: Function IndexPutBackward0 returned an invalid gradient at
index 1 - got [225, 2560] but expected shape compatible with [224, 2560]
In the pure-image / pure-video early-return path of
reorganize_inputs(), the T*H*W consistency check present in the mixed
(image+video) path is skipped. HF tokenizer placeholder count and
image_grid_thw-derived ViT output count can differ by ±1 due to a data
preprocessing inconsistency, which propagates silently to IndexPut.
* utils.py:
- Add mask-vs-grid_thw alignment in the pure-image and pure-video
early-return paths of reorganize_inputs(), mirroring the existing
assertion in the mixed path. Trusts image_grid_thw as ground truth
and trims any excess True entries from the mask.
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
IndexPutBackward0 reads the now-stale
mask (sum=225 instead of 224), producing a gradient with the wrong shape.
Error: Function IndexPutBackward0 returned an invalid gradient at index 1 - got [225, 2560] but expected shape compatible with [224, 2560]
In the pure-image / pure-video early-return path of reorganize_inputs(), the THW consistency check present in the mixed (image+video) path is skipped. HF tokenizer placeholder count and image_grid_thw-derived ViT output count can differ by ±1 due to a data preprocessing inconsistency, which propagates silently to IndexPut.