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

This commit is contained in:
Niko1221 committed 2026-10-14 11:16:26 +02:00
1 parent 44dbf66af5
commit 94d189fca4
2 files changed
+28

No files matched your search

+16
View File
@@ -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;
+12
View File
@@ -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<uint64_t>(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<uint64_t>(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<uint64_t> 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");