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

setup: run again over an installed model keeps its size; the three env entries 0.1.44 made setup's own stay the user's in a GSQ-RCO config

Niko1221de9115fac7a6
diff --git a/setup.py b/setup.py
index aac1bc1b8..4cbb6804d 100644
--- a/setup.py
+++ b/setup.py
@@ -2250,8 +2250,23 @@ def recommended_size(family: str, names: list, ram: float) -> str:
return "UD-IQ4_XS" if family == "unsloth" and "UD-IQ4_XS" in names else names[0]
-def size_tag(family: str, m: str) -> str:
- return " (recommended)" if m in RECOMMENDED_SIZES.get(family, ()) else ""
+def size_tag(family: str, m: str, installed: str | None = None) -> str:
+ rec, have = m in RECOMMENDED_SIZES.get(family, ()), m == installed
+ return " (recommended, installed)" if rec and have else " (recommended)" if rec else " (installed)" if have else ""
+
+
+def installed_size(family: str, names: list, have: list) -> str | None:
+ """0.1.44.1: the size of this family that is already installed (the most recently used config first), or None. Setup
+ run again (SETUP.bat, --setup) pre-selects it: the 0.1.44 recommendation (IQ3_S, about 15% slower than IQ3_XXS and
+ 7 GB more RAM) is for a first install, and Enter must not move an installed model to another size."""
+ for c in have:
+ try:
+ ch = choices_from_config(c)
+ except (OSError, ValueError, KeyError, TypeError, IndexError):
+ continue
+ if ch.get("family") == family and ch.get("model") in names:
+ return ch["model"]
+ return None
def unsloth_default_env(family: str, model: str, hip: bool, in_budget: bool) -> dict:
@@ -4401,6 +4416,10 @@ SETUP_KEYS = frozenset({"exe", "args", "cwd", "tokenizer", "model_name", "log",
"gpu", "gpus_asked", "layer_split", "host", "api_key", "draft_vocab", "vision"})
SETUP_ENV = frozenset({"STRATA_HIPBLASLT_TUNING", "STRATA_RESIDENT_PIN", "STRATA_NO_ARENA_THP", "STRATA_MMQ_KQ", "STRATA_HC_Q8",
"STRATA_ROUTE_TAIL_SKIP"}) # the "env" entries setup writes
+# 0.1.44 added these three, written for Unsloth's files only (unsloth_default_env). In any other model's config they are the
+# user's own (STRATA_ROUTE_TAIL_SKIP=0 to turn the tail skip off, STRATA_MMQ_KQ=1 ...): a setup run again keeps them there
+# (0.1.44 dropped them with the rest of SETUP_ENV).
+SETUP_ENV_UNSLOTH = frozenset({"STRATA_MMQ_KQ", "STRATA_HC_Q8", "STRATA_ROUTE_TAIL_SKIP"})
SETUP_VISION = frozenset({"exe", "mmproj", "model", "gpu", "max_tokens", "threads"})
@@ -4415,7 +4434,8 @@ def carry_over(old: dict, cfg: dict) -> list[str]:
if k not in SETUP_KEYS and k not in cfg:
cfg[k] = v
kept.append(k)
- env = {k: v for k, v in (old.get("env") or {}).items() if k not in SETUP_ENV and k not in (cfg.get("env") or {})} \
+ mine = SETUP_ENV if "-unsloth-" in str(cfg.get("model_name") or "") else SETUP_ENV - SETUP_ENV_UNSLOTH
+ env = {k: v for k, v in (old.get("env") or {}).items() if k not in mine and k not in (cfg.get("env") or {})} \
if isinstance(old.get("env"), dict) else {}
if env:
cfg["env"] = {**(cfg.get("env") or {}), **env}
@@ -6140,20 +6160,21 @@ def main() -> int:
+ (f" (or {a.model}: " + ", ".join(f"--family {f} --model {a.model}" for f in elsewhere_fams) + ")"
if elsewhere_fams else "")
+ (f".\n {SUPPORTED_GGUFS}" if a.gguf_dir else ""))
+ installed = installed_size(family, names, have)
for i, m in enumerate(names, 1):
d = MODELS[m]
fit = "" if ram >= d["ram_gb"] else f" <- needs {d['ram_gb']} GB RAM, you have {ram:.0f}"
if d.get("budget"):
keeps = (f"~{resident_budget_gib(m, ram)} GB" if unsloth_budget(m, ram, gpu, a.resident_budget_gib)
else "all")
- say(f" {i}) {m}{size_tag(family, m)} {d['about']}; download {d['download_gb']:.0f} GB, keeps {keeps} of its "
+ say(f" {i}) {m}{size_tag(family, m, installed)} {d['about']}; download {d['download_gb']:.0f} GB, keeps {keeps} of its "
f"{d['arena_gb']:.0f} GB of experts in RAM{fit}")
continue
if low_ram_needed(m, ram) and low_ram_fits(m, ram, low_ram_vram(gpu)) and a.low_ram != "off":
fit = (f" <- fits in the low-RAM mode (the GPU holds ~{100 * low_ram_gpu_share(m, low_ram_vram(gpu)):.0f}%, "
+ ("the rest in RAM)" if low_ram_resident(m, ram, low_ram_vram(gpu)) else "the rest from the SSD)"))
- say(f" {i}) {m:8s}{size_tag(family, m)} {d['about']}; download {d['download_gb']:.0f} GB, uses ~{d['arena_gb']:.0f} GB of RAM{fit}")
- rec = str(names.index(recommended_size(family, names, ram)) + 1)
+ say(f" {i}) {m:8s}{size_tag(family, m, installed)} {d['about']}; download {d['download_gb']:.0f} GB, uses ~{d['arena_gb']:.0f} GB of RAM{fit}")
+ rec = str(names.index(installed or recommended_size(family, names, ram)) + 1)
model = a.model or names[int(ask("Which size?", [str(i) for i in range(1, len(names) + 1)], rec, a.yes)) - 1]
budget, q4_split = None, False
in_budget = bool(MODELS[model].get("budget")) and unsloth_budget(model, ram, gpu, a.resident_budget_gib)
diff --git a/tools/test_setup_rerun_size.py b/tools/test_setup_rerun_size.py
new file mode 100644
index 000000000..82f42ff61
--- /dev/null
+++ b/tools/test_setup_rerun_size.py
@@ -0,0 +1,104 @@
+"""0.1.44.1: setup run again over an installed model keeps its size.
+
+0.1.44 made IQ3_S the recommended Qwen size on a PC with 64 GB or more (IQ3_S: about 15% slower decode than IQ3_XXS on an
+RTX 5070, docs/MODELS.md, and about 7 GB more RAM). A first install takes the recommendation; SETUP.bat / --setup on a
+folder that already has a model pre-selects the installed size (and `--yes` takes it), so Enter never moves a working
+install to a slower size. The recommended size stays marked, every size stays a choice.
+
+ python -m unittest tools.test_setup_rerun_size
+"""
+from __future__ import annotations
+
+import sys
+import unittest
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[1]
+sys.path.insert(0, str(ROOT))
+sys.path.insert(0, str(ROOT / "tools"))
+import setup # noqa: E402
+import test_setup_golden as g # noqa: E402
+
+PC64 = (63.7, [g.card(0, "NVIDIA GeForce RTX 5070", 11.9, "120")])
+
+
+def earlier(model: str, family_tag: str = "") -> tuple:
+ tag = f"{family_tag}{model.lower()}"
+ return (f"strata-{tag}.json", {"exe": "x", "args": ["--pack", f"p/{tag}", "--max-context", "32768"], "cwd": ".",
+ "tokenizer": "t", "model_name": f"qwen3.8-flash-next-{tag}", "log": "l", "port": 8080})
+
+
+class RerunKeepsSize(unittest.TestCase):
+ def run_setup(self, argv, configs, answers=""):
+ ram, found = PC64
+ code, out, cfg, asked = g.install(ram, found, argv, answers=answers, configs=configs)
+ self.assertEqual(code, 0, out[-2000:])
+ return out, cfg, asked
+
+ def test_first_install_takes_the_recommendation(self):
+ out, cfg, _ = self.run_setup(["--family", "qwen", "--no-start"], [])
+ self.assertEqual(cfg["model_name"], "qwen3.8-flash-next-iq3_s")
+ self.assertNotIn("(installed)", out)
+
+ def test_enter_over_an_installed_iq3_xxs_keeps_it(self):
+ out, cfg, asked = self.run_setup(["--family", "qwen", "--setup", "--no-start"], [earlier("IQ3_XXS")])
+ self.assertEqual(cfg["model_name"], "qwen3.8-flash-next-iq3_xxs", out[-1500:])
+ line_s = next(x for x in out.splitlines() if " IQ3_S " in x or " IQ3_S\t" in x or "IQ3_S " in x)
+ self.assertIn("(recommended)", line_s) # still marked, still a choice
+ line_xxs = next(x for x in out.splitlines() if "IQ3_XXS" in x and "download" in x)
+ self.assertIn("(installed)", line_xxs)
+ self.assertTrue(any("Which size?" in a for a in asked))
+
+ def test_yes_over_an_installed_size_keeps_it_too(self):
+ _, cfg, asked = self.run_setup(["--family", "qwen", "--setup", "--no-start"], [earlier("Q2_0")], answers=None)
+ self.assertEqual(cfg["model_name"], "qwen3.8-flash-next-q2_0")
+ self.assertEqual(asked, [])
+
+ def test_a_named_size_still_wins(self):
+ _, cfg, _ = self.run_setup(["--family", "qwen", "--model", "IQ3_S", "--setup", "--no-start"], [earlier("IQ3_XXS")])
+ self.assertEqual(cfg["model_name"], "qwen3.8-flash-next-iq3_s")
+
+ def test_another_family_is_not_touched(self):
+ # a Qwen IQ3_XXS install does not pre-select anything for the Unsloth family
+ _, cfg, _ = self.run_setup(["--family", "unsloth", "--setup", "--no-start"], [earlier("IQ3_XXS")])
+ self.assertIn("unsloth", cfg["model_name"])
+
+ def test_the_helper_prefers_the_most_recent_config_of_the_family(self):
+ import json
+ import tempfile
+ with tempfile.TemporaryDirectory() as tmp:
+ t = Path(tmp)
+ paths = []
+ for name, cfg in (earlier("IQ3_S"), earlier("Q2_0")):
+ p = t / name
+ p.write_text(json.dumps(cfg))
+ paths.append(p)
+ names = [m for m in setup.MODELS if "qwen" in setup.MODELS[m].get("families", ("qwen", "swift"))]
+ self.assertEqual(setup.installed_size("qwen", names, paths), "IQ3_S") # first = most recently used
+ self.assertEqual(setup.installed_size("qwen", names, paths[1:]), "Q2_0")
+ self.assertIsNone(setup.installed_size("qwen", names, []))
+
+
+class RerunKeepsOwnEnv(unittest.TestCase):
+ """0.1.44 put STRATA_MMQ_KQ / STRATA_HC_Q8 / STRATA_ROUTE_TAIL_SKIP into SETUP_ENV (the entries setup writes, which a
+ setup run again does not carry over): a GSQ-RCO config of the user's own STRATA_ROUTE_TAIL_SKIP=0 was dropped with them.
+ Those three are setup's only in an Unsloth config."""
+
+ OLD = {"env": {"STRATA_ROUTE_TAIL_SKIP": "0", "STRATA_MMQ_KQ": "1", "STRATA_HC_Q8": "0", "STRATA_RESIDENT_PIN": "0",
+ "MY_VAR": "1"}}
+
+ def test_a_gsq_rco_config_keeps_the_users_values(self):
+ new = {"model_name": "qwen3.8-flash-next-iq3_xxs"}
+ kept = setup.carry_over(dict(self.OLD), new)
+ self.assertEqual(new["env"], {"STRATA_ROUTE_TAIL_SKIP": "0", "STRATA_MMQ_KQ": "1", "STRATA_HC_Q8": "0", "MY_VAR": "1"})
+ self.assertIn("env STRATA_ROUTE_TAIL_SKIP", kept)
+ self.assertNotIn("env STRATA_RESIDENT_PIN", kept) # the older entries stay setup's own
+
+ def test_an_unsloth_config_gets_setups_values_not_the_old_ones(self):
+ new = {"model_name": "qwen3.8-flash-next-unsloth-ud-q4_k_xl", "env": {"STRATA_HC_Q8": "1"}}
+ setup.carry_over(dict(self.OLD), new)
+ self.assertEqual(new["env"], {"STRATA_HC_Q8": "1", "MY_VAR": "1"})
+
+
+if __name__ == "__main__":
+ unittest.main()