fix(gallery): match mmproj/model quant as a whole token so F16 no longer selects BF16 (#10559)#10564
Merged
Merged
Conversation
…ger selects BF16 (#10559) pickPreferredGroup matched a quant preference against the shard base filename with strings.Contains. Because `f16` is a substring of `bf16`, asking for the `F16` mmproj quant would wrongly satisfy a `BF16` file and select it when its group came first. Match the preference as a whole token instead: it must be delimited by a non-alphanumeric character (or the string start/end) on both outer edges. Separators inside the preference itself (e.g. `ud-q4_k_xl`) are left untouched, and all occurrences are scanned before rejecting. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:claude-opus-4-8 [Claude Code]
mudler
approved these changes
Jun 27, 2026
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.
Description
When importing a multimodal GGUF model from HuggingFace, the importer picks the mmproj/model file whose quant matches the requested preference.
pickPreferredGroupmatched the preference against the shard base filename withstrings.Contains. Sincef16is a substring ofbf16, asking for theF16mmproj quant (mmproj_quantizations: "F16") wrongly satisfied aBF16file and installed theBF16variant when its group was ordered first.The fix makes the match boundary-aware: the preference must appear in the base filename as a whole token, delimited by a non-alphanumeric character (or the string start/end) on both outer edges. So
f16insidebf16is rejected (precedingbis alphanumeric), whilef16inside...-F16.ggufis accepted. Separators inside the preference itself (e.g.ud-q4_k_xl) are left untouched, and all occurrences are scanned before rejecting. The rest of the selection behavior (priority order, last-group fallback, empty guard) is unchanged.Fixes #10559
Notes for Reviewers
quantTokenMatches+isAlphaNum) in the same file; comments explain thef16⊂bf16confusion.mmproj-...-BF16.ggufandmmproj-...-F16.gguf(and reversed order), plus a normalud-q4_k_xlregression and a no-match fallback case. The BF16-first case was a functional red before the fix.Signed commits