From 5e33c4e85d7d94fb37beb2e5d88e2ac17a042bfe Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Fri, 16 Oct 2026 00:16:01 +0200 Subject: [PATCH] Gyro: the MCP recommendation asks 4 GB of room beside the memory figure; tests for the Gyro catalog --- tools/strata_mcp.py | 10 +++-- tools/test_setup_gyro.py | 80 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 tools/test_setup_gyro.py diff --git a/tools/strata_mcp.py b/tools/strata_mcp.py index dc37773c..7612ef26 100644 --- a/tools/strata_mcp.py +++ b/tools/strata_mcp.py @@ -108,6 +108,7 @@ FALLBACK_FAMILIES = { "~80 GB of RAM to keep every expert in RAM", "tag": "nvfp4-"}, } +GYRO_ROOM_GB = 4.0 # recommend() suggests a Gyro size only when VRAM + RAM exceed its memory figure by this much FALLBACK_CONTEXTS = [8192, 32768, 65536, 131072, 204800, 262144, 393216, 524288] BENCH_PROMPT = ("Write a short story (about 300 words) about a lighthouse keeper who finds a message in a bottle. " "Plain prose, no title.") @@ -707,10 +708,11 @@ class Strata: elif low_fits("IQ1_M"): fam, model, why = "coder", "IQ1_M", (f"{ram:.0f} GB of RAM is below the Coder's 32 GB, but the GPU's " f"{vram:.0f} GB make up for it (setup's low-RAM mode: slower)") - elif "Gyro-S" in models and ram + vram >= models["Gyro-S"]["ram_gb"]: - # Gyro (agentionai): only where the sizes above do not fit; the smaller memory total, the 27.6 GB of Gyro-S, - # is VRAM + RAM together. Gyro-M (35 GB) when this PC has that much, else Gyro-S. - model = "Gyro-M" if ram + vram >= models["Gyro-M"]["ram_gb"] else "Gyro-S" + elif "Gyro-S" in models and ram + vram >= models["Gyro-S"]["ram_gb"] + GYRO_ROOM_GB: + # Gyro (agentionai): only where the sizes above do not fit. Their memory figure (Gyro-S 27.6 GB, Gyro-M 35 GB) + # is VRAM + RAM together and the system needs room beside it, so GYRO_ROOM_GB more is asked for here. + # Gyro-M when this PC has that much, else Gyro-S. + model = "Gyro-M" if ram + vram >= models["Gyro-M"]["ram_gb"] + GYRO_ROOM_GB else "Gyro-S" fam, why = "gyro", (f"{ram:.0f} GB of RAM is below the Coder's 32 GB, but RAM + VRAM = {ram + vram:.0f} GB " f"holds {model} ({models[model]['ram_gb']} GB of memory in total; the quality is lower " "than the 2-3-bit sizes, and it needs the whole download on a fast SSD)") diff --git a/tools/test_setup_gyro.py b/tools/test_setup_gyro.py new file mode 100644 index 00000000..e4bcf627 --- /dev/null +++ b/tools/test_setup_gyro.py @@ -0,0 +1,80 @@ +"""The Gyro entries of setup's catalog (agentionai/Qwen3.8-Flash-Next-Gyro-GGUF): sizes, pins, the VRAM + RAM memory rule, +never a default, and the MCP server's recommendation naming them only where nothing else fits. Offline.""" +import pathlib +import sys +import unittest + +ROOT = pathlib.Path(__file__).resolve().parent.parent +sys.path.insert(0, str(ROOT)) +sys.path.insert(0, str(ROOT / "tools")) +import setup # noqa: E402 +import strata_mcp as M # noqa: E402 + + +def hardware(ram, vram): + return {"ram_gb": ram, "gpus": [{"usable": True, "vram_gb": vram, "vendor": "nvidia", "index": 0, "name": "RTX"}], + "cpu": {"avx2": True}} + + +class GyroCatalog(unittest.TestCase): + def test_the_two_sizes_and_their_numbers(self): + self.assertEqual(setup.FAMILIES["gyro"]["file"].format(q="Gyro-S"), "Qwen3.8-Flash-Next-Gyro-S.gguf") + for model, name, download, memory in (("Gyro-S", "Qwen3.8-Flash-Next-Gyro-S-TQ1_0.gguf", 58.5, 27.6), + ("Gyro-M", "Qwen3.8-Flash-Next-Gyro-M-TQ2_0.gguf", 92.0, 35.0)): + d = setup.MODELS[model] + self.assertEqual(setup.model_file(setup.FAMILIES["gyro"], model, 1), name) + self.assertEqual((d["download_gb"], d["ram_gb"]), (download, memory)) + size, sha = setup.GYRO_FILES[name] + self.assertAlmostEqual(size / 1e9, download, delta=0.05) + self.assertEqual(len(sha), 64) + self.assertEqual(setup.model_shards(setup.FAMILIES["gyro"], model), 1) + self.assertIs(d.get("vision"), False) + self.assertTrue(d["mem_total"]) + self.assertEqual(d["families"], ("gyro",)) + + def test_pinned_revision_and_license(self): + repo = "agentionai/Qwen3.8-Flash-Next-Gyro-GGUF" + self.assertEqual(len(setup.HF_REVISIONS[repo]), 40) + self.assertIn(setup.HF_REVISIONS[repo], setup.FAMILIES["gyro"]["hf"]) + self.assertIn("Qwen Community License 1.0", setup.FAMILIES["gyro"]["license"]) + + def test_never_the_default_family(self): + self.assertEqual(setup.menu_families(False)[0], "qwen") + self.assertNotIn("gyro", setup.RECOMMENDED_SIZES) + + def test_memory_is_vram_plus_ram(self): + self.assertEqual(setup.mem_have("Gyro-S", 16.0, 12.0), 28.0) + self.assertEqual(setup.mem_have("Q2_0", 16.0, 12.0), 16.0) + names = ["Gyro-S", "Gyro-M"] + self.assertEqual(setup.recommended_size("gyro", names, 24.0, 12.0), "Gyro-M") # 36 GB + self.assertEqual(setup.recommended_size("gyro", names, 16.0, 12.0), "Gyro-S") # 28 GB + self.assertEqual(setup.recommended_size("gyro", names, 8.0, 8.0), "Gyro-S") # nothing fits: the first + + def test_mcp_table_matches(self): + for m in ("Gyro-S", "Gyro-M"): + for k in ("download_gb", "ram_gb", "arena_gb", "mem_total", "vision"): + self.assertEqual(setup.MODELS[m][k], M.FALLBACK_MODELS[m][k], (m, k)) + self.assertEqual(setup.FAMILIES["gyro"]["tag"], M.FALLBACK_FAMILIES["gyro"]["tag"]) + + def test_mcp_recommends_gyro_only_where_nothing_else_fits(self): + s = M.Strata(ROOT) + for ram, vram, family in ((64.0, 12.0, "qwen"), (48.0, 12.0, "qwen"), (32.0, 12.0, "coder")): + self.assertEqual(s.recommend(hardware(ram, vram))["family"], family, (ram, vram)) + got = s.recommend(hardware(20.0, 12.0)) # 32 GB in total, the Coder's 32 GB of RAM missing + self.assertEqual((got["family"], got["model"]), ("gyro", "Gyro-S")) + got = s.recommend(hardware(24.0, 16.0)) # 40 GB in total: the Coder fits in the low-RAM mode, so it wins + self.assertEqual((got["family"], got["model"]), ("coder", "IQ1_M")) + self.assertIsNone(s.recommend(hardware(12.0, 8.0))["family"]) + self.assertIsNone(s.recommend(hardware(16.0, 11.0))["family"]) # 27 GB: below Gyro-S's 27.6 + room + + def test_mcp_table_verdict_counts_vram(self): + s = M.Strata(ROOT) + fam = next(f for f in s.model_table(hardware(16.0, 16.0)) if f["family"] == "gyro") + by = {x["model"]: x for x in fam["sizes"]} + self.assertEqual(by["Gyro-S"]["on_this_pc"], "fits") + self.assertEqual(by["Gyro-M"]["on_this_pc"], "tight") + self.assertFalse(by["Gyro-S"]["images"]) + + +if __name__ == "__main__": + unittest.main()