tests: --real modes for gguf_split_test and expert_layout_test (a real model's shards / a real pack's spans, headers only)

`gguf_split_test --real SHARD` opens a real model's shards (GgufModel), checks the architecture on the
metadata shard and prints where output / token_embd / the PLE table and key / layer 11's experts are.
`expert_layout_test --real PACK NATIVE_SHARD` checks a real pack's native_experts.txt against its model
(check_experts_gguf; no expert byte is read).  Both pass on the Q2_0, IQ3_XXS (v2), IQ3_S, Coder IQ1_M
and Swift IQ2_XS packs and models on the reference PC.
This commit is contained in:
Niko1221 committed 2026-09-30 22:30:11 +02:00
1 parent 24bba1743b
commit dc24332249
2 files changed
+50 -1

No files matched your search

+15
View File
@@ -256,6 +256,21 @@ void arena() {
} // namespace
int main(int argc, char** argv) {
// `expert_layout_test --real PACK_DIR NATIVE_SHARD`: a real pack's native_experts.txt against its model's files
// (headers only - check_experts_gguf reads no expert byte)
if (argc == 4 && std::string(argv[1]) == "--real") {
std::string err;
if (!load(argv[2], 48, 512, err)) { std::printf("layout refused: %s\n", err.c_str()); return 1; }
const ExpertLayout& L = strata::kernels::cpu::expert_layout();
const bool ok = strata::core::check_experts_gguf(argv[3], L, err);
size_t split = 0;
for (int64_t l = 0; l < L.n_layers && !L.gguf_file.empty(); ++l)
split += L.gguf_file[(size_t) (3 * l)] != L.gguf_file[(size_t) (3 * l + 2)];
std::printf("%s: v%d, %lld layers x %lld experts, %.2f GiB, %zu layer(s) split per role: %s%s\n", argv[2],
L.version, (long long) L.n_layers, (long long) L.n_expert, (double) L.total / (1u << 30), split,
ok ? "every span is its tensor" : "REFUSED: ", ok ? "" : err.c_str());
return ok ? 0 : 1;
}
std::printf("expert_layout_test\n");
if (argc < 2) {
std::printf("usage: expert_layout_test <tests/data/native_experts>\n");