From 94d189fca4da3d0925ecf0466337a8067158e0bc Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Wed, 14 Oct 2026 11:16:26 +0200 Subject: [PATCH] gguf_reader: an all-zero attention.compress_ratios list is a converter's placeholder and is treated as absent, with a one-line note (#2396: orcarouter Qwen3.8-Flash-Next-Uncensored GGUFs refused since 0.1.44); real lists are still checked in full --- include/strata/artifact/gguf_reader.hpp | 16 ++++++++++++++++ tests/core/gguf_geometry_test.cpp | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/strata/artifact/gguf_reader.hpp b/include/strata/artifact/gguf_reader.hpp index efa60701..71bf8378 100644 --- a/include/strata/artifact/gguf_reader.hpp +++ b/include/strata/artifact/gguf_reader.hpp @@ -723,6 +723,22 @@ inline std::string read_geometry(const GgufFile& f, core::ModelGeometry& g) { if (v->type != MetaType::ARRAY || v->count != (uint64_t) g.n_layers || v->items.size() != v->count) return p + "attention.compress_ratios must list one entry for each of the " + std::to_string(g.n_layers) + " layers"; + // A list of zeros only is a converter's placeholder, not a layer split (#2396: orcarouter's + // Qwen3.8-Flash-Next-Uncensored GGUFs carry 48 zeros; 0.1.43 never read the key): it is treated as absent + // and the compiled pooling block is used. A list with any non-zero entry is checked in full below. + bool given = false; + for (int64_t l = 0; l < g.n_layers && !given; ++l) given = v->items[(size_t) l].u != 0; + if (!given) { + static bool said = false; // the guard runs several times in one process: one line + if (!said) { + said = true; + std::fprintf(stderr, "strata: %sattention.compress_ratios is all zeros (a converter's placeholder): " + "using the compiled pooling block of %lld cells (#2396) +", + p.c_str(), (long long) g.idx_block); + } + return {}; + } int64_t block = 0; for (int64_t l = 0; l < g.n_layers; ++l) { const int64_t r = (int64_t) v->items[(size_t) l].u; diff --git a/tests/core/gguf_geometry_test.cpp b/tests/core/gguf_geometry_test.cpp index 49d94601..63d02f22 100644 --- a/tests/core/gguf_geometry_test.cpp +++ b/tests/core/gguf_geometry_test.cpp @@ -223,6 +223,18 @@ int main(int argc, char** argv) { const fixture::Kv mx = fixture::u32s(p + "attention.compress_ratios", mixed); check(has(run(d.path, with(full_keys(), mx.key, &mx)).read_err, "compress_ratios[7] = 8"), "two pooling blocks in one model are refused"); + // #2396: 48 zeros are a converter's placeholder (orcarouter's Uncensored GGUFs): read as absent, the compiled block stays + const fixture::Kv zeros = fixture::u32s(p + "attention.compress_ratios", std::vector(48, 0)); + const Result z = run(d.path, with(full_keys(), zeros.key, &zeros)); + check(z.read_err.empty() && z.guard.empty() && z.g.idx_block == 4, "an all-zero compress_ratios list is treated as absent"); + const fixture::Kv zshort = fixture::u32s(p + "attention.compress_ratios", std::vector(40, 0)); + check(has(run(d.path, with(full_keys(), zshort.key, &zshort)).read_err, "one entry for each of the 48"), + "an all-zero list of another length is still refused"); + std::vector one_set(48, 0); + one_set[3] = 4; // a real (but partial) list: layer 7 would be full attention with a 0 + const fixture::Kv partial = fixture::u32s(p + "attention.compress_ratios", one_set); + check(has(run(d.path, with(full_keys(), partial.key, &partial)).read_err, "compress_ratios[7] = 0"), + "a list with one non-zero entry is checked in full"); const fixture::Kv fl = fixture::f32(p + "block_count", 48.0f); check(has(run(d.path, with(full_keys(), fl.key, &fl)).read_err, "is not an integer"), "a float where a count belongs is refused");