Skip to content

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++

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

Niko1221dc24332249f4
diff --git a/tests/core/expert_layout_test.cpp b/tests/core/expert_layout_test.cpp
index d532d746c..f69e5c559 100644
--- a/tests/core/expert_layout_test.cpp
+++ b/tests/core/expert_layout_test.cpp
@@ -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");
diff --git a/tests/core/gguf_split_test.cpp b/tests/core/gguf_split_test.cpp
index 22b668b6f..3f137ccb7 100644
--- a/tests/core/gguf_split_test.cpp
+++ b/tests/core/gguf_split_test.cpp
@@ -79,7 +79,41 @@ std::string error_of(const std::vector<std::string>& paths) {
}
} // namespace
-int main() {
+// `gguf_split_test --real SHARD`: the same view of a real model (headers only): its shards, the architecture
+// check on the metadata shard, and where the tensors the engine reads by name live.
+int real_model(const std::string& any) {
+ try {
+ const strata::GgufModel m = strata::GgufModel::open(any);
+ size_t tensors = 0;
+ for (size_t i = 0; i < m.size(); ++i) {
+ std::printf(" shard %zu: %s, %zu tensors, data at %llu\n", i + 1, m.shard(i).path().c_str(),
+ m.shard(i).tensors().size(), (unsigned long long) m.shard(i).data_start());
+ tensors += m.shard(i).tensors().size();
+ }
+ const std::string arch = strata::check_architecture(m.meta());
+ std::printf(" %zu tensors; architecture check on the metadata shard: %s\n", tensors,
+ arch.empty() ? "ok" : arch.c_str());
+ int bad = arch.empty() ? 0 : 1;
+ for (const char* name : {"output.weight", "token_embd.weight", "per_layer_token_embd.weight",
+ "blk.1.ple_key.weight", "blk.11.ffn_gate_exps.weight", "blk.11.ffn_up_exps.weight",
+ "blk.11.ffn_down_exps.weight"}) {
+ size_t s = 0;
+ const strata::TensorInfo* t = m.find(name, &s);
+ if (!t) { std::printf(" %-30s absent\n", name); continue; }
+ const bool ok = m.in_bounds(*t, s);
+ bad += !ok;
+ std::printf(" %-30s shard %zu, %s, %llu B, %s\n", name, s + 1, t->type_name(),
+ (unsigned long long) strata::tensor_payload_bytes(*t), ok ? "in bounds" : "OUT OF BOUNDS");
+ }
+ return bad ? 1 : 0;
+ } catch (const std::exception& e) {
+ std::printf(" refused: %s\n", e.what());
+ return 1;
+ }
+}
+
+int main(int argc, char** argv) {
+ if (argc == 3 && std::string(argv[1]) == "--real") return real_model(argv[2]);
std::printf("gguf_split_test\n");
{
TempDir d;