fix: validate vision projector output dim against LLM hidden size - #1918
Open
fszontagh wants to merge 2 commits into
Open
fix: validate vision projector output dim against LLM hidden size#1918fszontagh wants to merge 2 commits into
fszontagh wants to merge 2 commits into
Conversation
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.
Summary
Pairing an mmproj with an LLM of a different size crashed with an opaque
GGML_ASSERT(a->ne[d] == b->ne[d])insideggml_concat, fromLLM::splice_image_embedssplicing image embeds between text embeds of a different width.The projector output dim is already detected from the weights, so compare it against the LLM hidden size at load time and disable vision with a message naming the cause, matching the existing "no vision weights detected" fallback. The comparison only runs when the dim actually came from a merger tensor, so a checkpoint whose naming is not recognised keeps its previous behaviour instead of being rejected by the default.
Related Issue / Discussion
None.
Additional Information
Reproduced with
Qwen3VL-4B-Instruct-Q4_K_M.gguf(hidden size 2560) and anmmproj-F16.ggufwhose GGUF header isgeneral.name = Qwen3-Vl-8B-Instruct,clip.vision.projection_dim = 4096. Before the change it aborts inggml_concat; after it logsand completes text-only instead of aborting. A correctly paired checkpoint is unaffected: verified with a Qwen3-VL encoder carrying its own vision tower, which still enables vision and produces a normal edit.
Checklist