Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
artifact: read_geometry refuses another architecture by name before reading any qwen4exp key
Shawn Jackson51329cff3c1c
diff --git a/include/strata/artifact/gguf_reader.hpp b/include/strata/artifact/gguf_reader.hppindex 4b5baef0d..e756c3fd6 100644--- a/include/strata/artifact/gguf_reader.hpp+++ b/include/strata/artifact/gguf_reader.hpp@@ -584,12 +584,16 @@ private:// and then checked against the shape the kernels are compiled for (core/geometry.hpp), so a file of another// shape is refused with the key that differs rather than silently mis-run.-/// Fills `g` from the metadata shard `f`. Returns "" or the first problem. The six keys every qwen4exp file-/// has carried since the first guard are required; any other key the file does not carry keeps the compiled-/// value. The keys that describe one thing twice (the interval and `compress_ratios`, the key and value head-/// widths, the routed and shared expert widths) must agree.+/// Fills `g` from the metadata shard `f`. Returns "" or the first problem. Another architecture is refused by+/// name first: its keys carry another prefix, and "missing qwen4exp.block_count" would hide what is wrong. The six+/// keys every qwen4exp file has carried since the first guard are required; any other key the file does not carry+/// keeps the compiled value. The keys that describe one thing twice (the interval and `compress_ratios`, the key+/// and value head widths, the routed and shared expert widths) must agree.inline std::string read_geometry(const GgufFile& f, core::ModelGeometry& g) {g = core::kCompiledGeometry;+ const MetaValue* arch = f.get("general.architecture");+ if (!arch) return "missing general.architecture";+ if (arch->s != "qwen4exp") return "architecture is '" + arch->s + "', this engine requires 'qwen4exp'";const std::string p = "qwen4exp.";std::string err;// an integer key into `out`: present and positive, or absent and not `required`@@ -741,9 +745,6 @@ inline std::string geometry_unsupported(const core::ModelGeometry& g) {/// The architecture guard: "" when the engine can run the model whose metadata shard is `f`.inline std::string check_architecture(const GgufFile& f) {- const MetaValue* arch = f.get("general.architecture");- if (!arch) return "missing general.architecture";- if (arch->s != "qwen4exp") return "architecture is '" + arch->s + "', this engine requires 'qwen4exp'";core::ModelGeometry g;std::string err = read_geometry(f, g);if (err.empty()) err = geometry_unsupported(g);diff --git a/tests/core/gguf_geometry_test.cpp b/tests/core/gguf_geometry_test.cppindex 564a46a74..49d946010 100644--- a/tests/core/gguf_geometry_test.cpp+++ b/tests/core/gguf_geometry_test.cpp@@ -249,9 +249,22 @@ int main(int argc, char** argv) {check(run(d.path, with(full_keys(151936), vocab.key, &vocab)).guard.empty(),"another vocabulary size is accepted (the head and embedding take their tensors' shapes)");const fixture::Kv arch = fixture::str("general.architecture", "glm5next");- check(run(d.path, with(full_keys(), arch.key, &arch)).guard ==- "architecture is 'glm5next', this engine requires 'qwen4exp'",- "another architecture is refused by name");+ const Result a = run(d.path, with(full_keys(), arch.key, &arch));+ check(a.read_err == "architecture is 'glm5next', this engine requires 'qwen4exp'" && a.guard == a.read_err,+ "another architecture is refused by name, by the reader and the guard");+ }+ {+ // Qwen3.8-27B's own keys (qwen35, dense): the reader names the architecture, not the first qwen4exp key it+ // misses (which is what generate printed before the reader checked the name)+ const std::vector<fixture::Kv> dense = {+ fixture::str("general.architecture", "qwen35"), fixture::u32("qwen35.block_count", 65),+ fixture::u32("qwen35.embedding_length", 5120), fixture::u32("qwen35.feed_forward_length", 17408),+ fixture::u32("qwen35.attention.head_count", 24), fixture::u32("qwen35.attention.head_count_kv", 4)};+ const Result r = run(d.path, dense);+ check(r.read_err == "architecture is 'qwen35', this engine requires 'qwen4exp'",+ "a dense qwen35 file is refused by its architecture: " + r.read_err);+ const Result none = run(d.path, with(dense, "general.architecture", nullptr));+ check(none.read_err == "missing general.architecture", "a file without general.architecture says so");}std::printf(g_fail ? "gguf_geometry_test: %d FAILED\n" : "gguf_geometry_test: all passed\n", g_fail);return g_fail ? 1 : 0;