Merge Gemma 4 31B: PRs #74, #75, #81 and #86 (sfjes, keptn42), with fixes

The gemma4_bf16 architecture (sliding and global attention, the proportional RoPE ladder, the
assistant head as a drafter that reads the trunk's cache, the vision tower), its w4a8 decode
junctions, the h512/gqa8 and h256/gqa2 attention kernels, compressed-tensors int4 import, multi-EOS
from generation_config, the call/reasoning reply format, a window group that keeps the keys a
prefill chunk still reads, and window snapshots in checkpoint slots so a prefix hit on a
sliding-window trunk resumes.

Fixes on top: the investigation switches and diagnostic blocks out of the served paths; int4 import
through the checkpoint import framework; attention_k_eq_v from the config; the fused junctions only
where every reader takes their pair; a shared-KV head binds no group of its own; the compose file
without HSA_ENABLE_IPC_MODE_LEGACY (TP2 fails with it on ROCm 10.1); a checkpoint carries a window
only where a hit resumes from it; the README says the linked container is keptn42's calibrated GPTQ
build and what the in-tree recipe gives.
This commit is contained in:
Deadcode committed 2026-10-12 20:46:37 +02:00
84 files changed
+10292 -230

No files matched your search

+20
View File
@@ -957,6 +957,26 @@ TEST(vocab_treats_an_out_of_range_special_id_as_absent) {
CHECK_EQ(v->pad(), -1);
}
/* The checkpoint's own end-of-generation list -- generation_config.json's eos_token_id, which the
* container carries as `generation.eos_token_id` -- ends a generation on every id it names: Gemma 4
* names <|tool_response> there, where the model stops after its calls. An id naming no token is
* no id. */
TEST(vocab_ends_a_generation_on_every_id_the_checkpoint_names) {
VocabBuild vb;
vb.kind = RAD_TOK_BPE;
vb.tokens = { "a", "<eos>", "<|tool_response>", "<|tool_call>" };
vb.types = { RAD_TT_NORMAL, RAD_TT_CONTROL, RAD_TT_CONTROL, RAD_TT_CONTROL };
vb.eos = 1;
vb.eos_ids = { 1, 2, 99, -3 };
auto v = std::make_shared<Vocab>();
CHECK_OK(v->load(std::move(vb)));
CHECK(v->is_eog(1));
CHECK(v->is_eog(2));
CHECK(!v->is_eog(3));
CHECK(!v->is_eog(0));
CHECK_EQ(v->eog().size(), (size_t)2);
}
/* ================================================================== chain steps */
TEST(step_chain_units) {