From bb1ed8d4c057110780c0ef47dd56e94f78b072ca Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Tue, 13 Oct 2026 06:08:19 +0200 Subject: [PATCH] setup: Qwen3.6 sizes recommended by RAM (UD-Q4_K_XL 32, UD-Q6_K_XL 44, Q8_0 52 GB) The engine keeps every expert in RAM when they do not all fit in VRAM, so a size's RAM need is its file plus room for the rest. The largest size this PC's RAM holds is the default; any size can still be chosen (a bigger one is asked about, as before, never refused). --- setup.py | 20 ++++++++++++++++---- tools/test_setup_qwen36.py | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index ef5eae23..84c4b2dc 100644 --- a/setup.py +++ b/setup.py @@ -377,10 +377,12 @@ OWN_PATH_FAMILIES = { "hf": hf("unsloth/Qwen3.6-35B-A3B-MTP-GGUF"), "file": "Qwen3.6-35B-A3B-{q}.gguf", "tag": "qwen36-", "mmproj_hf": hf("unsloth/Qwen3.6-35B-A3B-MTP-GGUF"), "mmproj": "mmproj-F16.gguf", "name": "qwen3.6-35b-a3b", "license": "Apache 2.0: https://huggingface.co/Qwen/Qwen3.6-35B-A3B", - # RAM floors from the iGPU baselines (llama.cpp: 21 / 30 / 38 GB in use, plus the OS) + # RAM: the engine keeps a copy of every expert in RAM when they do not all fit in VRAM (the hybrid mode), + # so the file's size plus room for the OS and the rest (measured: UD-Q4_K_XL on a 46 GB PC with a 12 GB + # card, 18.75 GiB of experts pinned) "models": {"UD-Q4_K_XL": {"about": "4-bit (Unsloth Dynamic), the smallest", "ram_gb": 32}, - "UD-Q6_K_XL": {"about": "6-bit (Unsloth Dynamic)", "ram_gb": 48}, - "Q8_0": {"about": "8-bit, the closest to the full model", "ram_gb": 48}}, + "UD-Q6_K_XL": {"about": "6-bit (Unsloth Dynamic), closer to the full model", "ram_gb": 44}, + "Q8_0": {"about": "8-bit, the closest to the full model", "ram_gb": 52}}, "sha256": QWEN36_FILES, # the engine's KV cache per context token: 10 attention layers + the MTP block, 2 KV heads x 256, K and # V in fp32 (strata-q36) @@ -5003,6 +5005,12 @@ def own_path_context(fam: dict, vram_gb: float) -> int: return 32768 if vram_gb <= 16.5 else 65536 if vram_gb <= 24.5 else 131072 +def own_path_size(fam: dict, ram: float) -> str: + """The recommended size: the largest file whose RAM need this PC has (the smallest when none fits).""" + fits = [m for m, d in fam["models"].items() if ram >= d["ram_gb"]] + return max(fits, key=lambda m: fam["sha256"][fam["file"].format(q=m)][0]) if fits else next(iter(fam["models"])) + + def install_own_path(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted): """Steps 2-7 for a family with its own engine path (OWN_PATH_FAMILIES: Qwen3.6-35B-A3B): the size, the context, the engine, the GGUF (pinned revision, size and SHA-256), the tokenizer from the GGUF, the config and the start @@ -5025,7 +5033,11 @@ def install_own_path(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopte size = fam["sha256"][fam["file"].format(q=m)][0] fit = "" if ram >= d["ram_gb"] else f" <- needs {d['ram_gb']} GB RAM, you have {ram:.0f}" say(f" {i}) {m:10s} {d['about']}; download {size / 1e9:.1f} GB{fit}") - model = a.model or names[int(ask("Which size?", [str(i) for i in range(1, len(names) + 1)], "1", a.yes)) - 1] + rec = own_path_size(fam, ram) + if not a.model: + say(f" Recommended for {ram:.0f} GB of RAM: {rec} (the largest that fits; any size can be chosen)") + model = a.model or names[int(ask("Which size?", [str(i) for i in range(1, len(names) + 1)], + str(names.index(rec) + 1), a.yes)) - 1] if ram < fam["models"][model]["ram_gb"]: confirm_risk(f"{model} needs about {fam['models'][model]['ram_gb']} GB of RAM; this PC has {ram:.0f} GB: the " "OS may page and it may not start", bool(a.model), a.yes, diff --git a/tools/test_setup_qwen36.py b/tools/test_setup_qwen36.py index 60491325..7358a3d8 100644 --- a/tools/test_setup_qwen36.py +++ b/tools/test_setup_qwen36.py @@ -66,6 +66,13 @@ class Qwen36Entries(unittest.TestCase): for m, d in setup.MODELS.items(): self.assertNotIn("qwen36", d.get("families", ())) + def test_size_recommendation(self): + fam = setup.OWN_PATH_FAMILIES["qwen36"] + self.assertEqual(setup.own_path_size(fam, 24.0), "UD-Q4_K_XL") # none fits: the smallest + self.assertEqual(setup.own_path_size(fam, 32.0), "UD-Q4_K_XL") + self.assertEqual(setup.own_path_size(fam, 46.0), "UD-Q6_K_XL") + self.assertEqual(setup.own_path_size(fam, 64.0), "Q8_0") + def test_context_recommendation(self): fam = setup.OWN_PATH_FAMILIES["qwen36"] self.assertEqual(setup.own_path_context(fam, 12.0), 32768) @@ -136,6 +143,20 @@ class InstallOwnPath(unittest.TestCase): self.assertEqual(Path(self.cfg["exe"]).parent, self.root / "engine") self.assertIn(("config", "strata-qwen36-ud-q4_k_xl.json"), self.calls) + def test_default_size_follows_the_ram(self): + rc, out = self.install(ram=64.0) + self.assertEqual(rc, 0, out) + self.assertIn("Recommended for 64 GB of RAM: Q8_0", out) + self.assertTrue(self.cfg["args"][self.cfg["args"].index("--native") + 1].endswith("Qwen3.6-35B-A3B-Q8_0.gguf")) + rc, out = self.install(ram=46.0) + self.assertTrue(self.cfg["args"][self.cfg["args"].index("--native") + 1].endswith("UD-Q6_K_XL.gguf")) + + def test_a_bigger_size_than_the_ram_is_asked_not_refused(self): + with mock.patch.object(setup, "confirm_risk", lambda *a, **k: None): + rc, out = self.install(ram=32.0, model="Q8_0") + self.assertEqual(rc, 0, out) + self.assertIn("installing Q8_0 with 32 GB of RAM, as you chose", out) + def test_an_engine_without_the_family_is_refused_before_the_download(self): self.families = {"qwen4exp"} rc, out = self.install(model="UD-Q4_K_XL")