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: Gyro-M per-tensor parity (--experts-first on a sparse copy), moe_mm_parity takes the trellis types
Niko12216b93b42877ac
diff --git a/metal/tests/expert_parity.cpp b/metal/tests/expert_parity.cppindex 70c985f39..5a596a74e 100644--- a/metal/tests/expert_parity.cpp+++ b/metal/tests/expert_parity.cpp@@ -222,7 +222,7 @@ int main(int argc, char** argv) {bool bench = false, sweep = false, had_test = false, decode_check = false;double share = 0.0;std::string gguf_path, had_pack;- int real_layer = 0;+ int real_layer = 0, experts_first = 0;uint64_t seed = 1;bool cfg_gu_set = false, cfg_dn_set = false;for (int i = 1; i < argc; ++i) {@@ -241,6 +241,7 @@ int main(int argc, char** argv) {else if (a == "--dn-prep") g_dn_prep = true;else if (a == "--gguf") gguf_path = nx();else if (a == "--layer") real_layer = std::atoi(nx());+ else if (a == "--experts-first") experts_first = std::atoi(nx()); // only experts 0..N-1 of the layer are in the file (a sparse copy)else if (a == "--had-pack") had_pack = nx();else if (a == "--had-test") had_test = true;else if (a == "--decode-check") decode_check = true;@@ -470,14 +471,15 @@ int main(int argc, char** argv) {if (!bench) {// ---------------- parity ----------------- const int NE = 64;+ const int NE = tg_ && experts_first ? std::max(experts_first, 2 * TOPK) : 64;mtl::Buffer W = cx.alloc(L.blob * NE);std::vector<int> pick;for (int e = 0; e < NE; ++e) {uint8_t* b = W.as<uint8_t>() + e * L.blob;if (tg_) { // real experts of the file: expert `ex` of the layer's three tensorsint ex;- do ex = (int)(rng.next() % 512); while (std::find(pick.begin(), pick.end(), ex) != pick.end());+ if (experts_first) ex = e % experts_first; // (a sparse copy holds only the first experts: reused when NE is larger)+ else do ex = (int)(rng.next() % 512); while (std::find(pick.begin(), pick.end(), ex) != pick.end());pick.push_back(ex);std::memcpy(b, (const uint8_t*)gf.map + tg_->offset + (size_t)ex * L.gu_row * N_FF, L.gu_row * N_FF);std::memcpy(b + L.up_off, (const uint8_t*)gf.map + tu_->offset + (size_t)ex * L.gu_row * N_FF, L.gu_row * N_FF);diff --git a/metal/tests/moe_mm_parity.cpp b/metal/tests/moe_mm_parity.cppindex 565439c2d..3ce737164 100644--- a/metal/tests/moe_mm_parity.cpp+++ b/metal/tests/moe_mm_parity.cpp@@ -23,7 +23,7 @@ struct MmPlanArgs { uint32_t n_ent, topk, n_expert, tm, n_blocks; };struct MmArgs { uint64_t gate_off, up_off, down_off, gu_stride, d_stride; uint32_t gu_row, d_row, n_embd, n_ff; };double median(std::vector<double> v) { std::sort(v.begin(), v.end()); return v[v.size() / 2]; }int type_of(const std::string& s) {- for (int t : {ref::Q2_0, ref::IQ3_XXS, ref::IQ2_XXS, ref::IQ2_XS, ref::IQ2_S, ref::IQ3_S, ref::IQ4_NL, ref::IQ4_XS, ref::Q4_K, ref::Q5_K, ref::Q6_K, ref::Q8_0, ref::Q5_1})+ for (int t : {ref::TQ2_T, ref::TQK6, ref::TQK7, ref::Q2_0, ref::IQ3_XXS, ref::IQ2_XXS, ref::IQ2_XS, ref::IQ2_S, ref::IQ3_S, ref::IQ4_NL, ref::IQ4_XS, ref::Q4_K, ref::Q5_K, ref::Q6_K, ref::Q8_0, ref::Q5_1})if (s == ref::type_name(t)) return t;std::exit(2);}diff --git a/tools/test_setup_mac.py b/tools/test_setup_mac.pyindex e796ee1c9..fd0b5a95e 100644--- a/tools/test_setup_mac.py+++ b/tools/test_setup_mac.py@@ -346,6 +346,36 @@ class ControlMode(unittest.TestCase):with self.assertRaises(SystemExit):self.run_setup(argv=("--yes", "--no-start", "--model", "UD-Q4_K_XL"))+ def test_gyro_is_offered_on_a_mac_as_one_file_with_a_compat_bf16_pack(self):+ fam = setup.FAMILIES["gyro"]+ g = self.models / setup.model_file(fam, "Gyro-S", 1)+ g.write_bytes(b"x")+ g.with_name(g.name + ".done").write_text("whole")+ rc, ran = self.run_setup(argv=("--yes", "--no-start", "--family", "gyro", "--model", "Gyro-S", "--context", "8192"))+ self.assertEqual(rc, 0)+ cfg = self.config("gyro-gyro-s")+ args = cfg["args"]+ self.assertEqual(args[args.index("--native") + 1], str(g), "the one file is the model")+ self.assertEqual(args[args.index("--ple-gguf") + 1], str(g), "... and holds its n-gram table")+ self.assertEqual(cfg["backend"], "metal")+ self.assertEqual(cfg["env"], {"STRATA_METAL_STREAM": "1"}, "29.7 GB of weights stream on a 32 GB Mac")+ self.assertNotIn("--mtp", args)+ self.assertTrue(ran[0][1].endswith("iq_pack.py"))+ self.assertIn("--compat-bf16", ran[0], "Gyro's pack converts the small Q6_K / Q5_K tensors (docs/GYRO.md)")+ self.assertEqual(cfg["tokenizer"], str(self.data / "packs" / "gyro-gyro-s" / "tokenizer"))++ def test_gyro_m_on_a_small_mac_is_a_warning_not_a_refusal(self):+ fam = setup.FAMILIES["gyro"]+ g = self.models / setup.model_file(fam, "Gyro-M", 1)+ g.write_bytes(b"x")+ g.with_name(g.name + ".done").write_text("whole")+ rc, _ = self.run_setup(argv=("--yes", "--no-start", "--family", "gyro", "--model", "Gyro-M", "--context", "8192"))+ self.assertEqual(rc, 0)+ said = " ".join(self.warnings)+ self.assertIn("Gyro-M", said)+ self.assertIn("stream from the SSD", said)+ self.assertIn("not been measured on a Mac", said)+def test_other_platforms_and_the_terminal_still_use_their_own_setup(self):src = (ROOT / "setup.py").read_text(encoding="utf-8")self.assertIn('if sys.platform == "darwin" and not CONTROL:', src)