gemma4/gguf: accept a scalar attention.head_count_kv - #64
Open
Rhycecomley wants to merge 1 commit into
Open
Conversation
llama.cpp writes gemma4.attention.head_count_kv as a single value when every block shares it, so parse_gguf_config raised "'int' object is not subscriptable" on the official google/gemma-4-E2B-it-qat-q4_0-gguf checkpoint. Broadcast the scalar to one entry per block before the per-layer lookups. Fixes FlashML-org#63 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Rhycecomley
marked this pull request as draft
August 22, 2026 22:58
Rhycecomley
marked this pull request as ready for review
August 22, 2026 22:58
Author
|
Scope note: as detailed in #63 (comment), this makes a scalar |
|
Does this relate to my PR? See #59 |
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.
Fixes #63.
parse_gguf_configtreatsgemma4.attention.head_count_kvas a per-layer array and indexesit directly. llama.cpp collapses that array to a single value when every block shares it,
which the official
google/gemma-4-E2B-it-qat-q4_0-ggufcheckpoint hits (
head_count_kv == 1across all 35 blocks), soft servedies during_adjust_configwith:This broadcasts a scalar to one entry per block before the SWA/full lookups. Arrays are
unaffected — the
isinstanceguard only fires on the scalar form.Verification
Before:
ft serve --model gemma-4-E2B_q4_0-it.ggufraises theTypeErrorabove and thefrontend shuts the API server down.
After: config parsing completes and startup proceeds past this point.
Note my machine can't finish a full generation run on this checkpoint for unrelated reasons
(4 GB VRAM), so I've verified the parse fix rather than end-to-end inference — worth a second
look from someone with a supported card.