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: the low-RAM mode's one-GPU warning says why, with the RAM math; --low-ram off --yes installs (#250)
Niko12215a7190de4a64
diff --git a/setup.py b/setup.pyindex 924bd34fa..3f42c38d4 100644--- a/setup.py+++ b/setup.py@@ -1227,6 +1227,40 @@ def low_ram_fits(model, ram, vram_gb) -> bool:return ram - 6 + max(0.0, vram_gb - 5) >= arena+def low_ram_one_gpu_why(model, ram, choice) -> list[str]:+ """#250: why the low-RAM mode leaves the other GPUs out, with the RAM math that turned it on."""+ arena, need = MODELS[model]["arena_gb"], MODELS[model]["arena_gb"] + LOW_RAM_HEADROOM_GB+ if choice == "auto":+ why = [f"Why: {model}'s experts are {arena:.0f} GB and must fit in RAM with ~{LOW_RAM_HEADROOM_GB} GB beside "+ f"them for the OS and the rest: {arena:.0f} + {LOW_RAM_HEADROOM_GB} = {need:.0f} GB, and this PC has "+ f"{ram:.0f} GB.",+ "So setup uses the low-RAM mode: the experts come from the model's file (copied into RAM as far as "+ "it fits), the GPU holds the most-used ones."]+ else:+ why = [f"Why: you chose the low-RAM mode (--low-ram {choice}); without it {model} needs {arena:.0f} + "+ f"{LOW_RAM_HEADROOM_GB} = {need:.0f} GB of RAM, this PC has {ram:.0f} GB."]+ return why + ["That mode runs on one GPU: the engine does not split its layers across GPUs in it (it refuses "+ "--resident-experts with a layer split).",+ f"To use all the GPUs: {need:.0f} GB of RAM or more, a smaller size, or --low-ram off (the experts "+ "then stay in RAM and the OS pages part of them to disk: much slower)."]+++def confirm_paging(model, ram, choice, yes):+ """The model's experts do not fit this PC's RAM and the low-RAM mode is off. #125: a warning and a question, not+ a stop - the user may accept paging. Asked "no" by default, so an unattended --yes install stops here, unless+ the low-RAM mode was turned off explicitly (--low-ram off, #250): that is the choice already made."""+ need_gb, arena = MODELS[model]["ram_gb"], MODELS[model]["arena_gb"]+ warn(f"{model} needs about {need_gb} GB of RAM and this PC has {ram:.0f} GB: its experts alone are "+ f"{arena:.0f} GB and must stay in RAM, so Windows/Linux will page part of them from disk. Expect it "+ "to be much slower, and it may not start at all.")+ say(" A smaller size (Q2_0 or IQ2_XS) fits; more RAM fixes it.")+ explicit = choice == "off"+ if ask(" Install it anyway?", ["y", "n"], "y" if explicit else "n", yes) != "y":+ fail(f"{model} needs about {need_gb} GB of RAM; this PC has {ram:.0f} GB",+ "choose Q2_0 or IQ2_XS, or add RAM" + ("" if explicit else "; or --low-ram off --yes to install it anyway"))+ warn(f"installing {model} with {ram:.0f} GB of RAM, as you chose" + (" (--low-ram off)" if explicit else ""))++def settings_path() -> Path:if WIN:return Path(os.environ.get("APPDATA") or Path.home() / "AppData" / "Roaming") / "Strata" / "settings.json"@@ -1962,20 +1996,12 @@ def main() -> int:low_ram = a.low_ram in ("on", "resident", "mmap") or (a.low_ram == "auto" and low_ram_needed(model, ram))if low_ram and multi:warn("the low-RAM mode runs on one GPU: using " + gpu_name(gpu) + " only")+ for line in low_ram_one_gpu_why(model, ram, a.low_ram):+ say(" " + line)multi, sel, chosen = [], [gpu["index"]], [gpu]# (the low-RAM mode's variant is decided once the context is known, below)if not low_ram and ram < MODELS[model]["ram_gb"] - 4:- # #125: a warning and a question, not a stop: the user may accept paging (asked, "no" by default, so an- # unattended --yes install still stops here)- need_gb, arena = MODELS[model]["ram_gb"], MODELS[model]["arena_gb"]- warn(f"{model} needs about {need_gb} GB of RAM and this PC has {ram:.0f} GB: its experts alone are "- f"{arena:.0f} GB and must stay in RAM, so Windows/Linux will page part of them from disk. Expect it "- "to be much slower, and it may not start at all.")- say(" A smaller size (Q2_0 or IQ2_XS) fits; more RAM fixes it.")- if ask(" Install it anyway?", ["y", "n"], "n", a.yes) != "y":- fail(f"{model} needs about {need_gb} GB of RAM; this PC has {ram:.0f} GB",- "choose Q2_0 or IQ2_XS, or add RAM")- warn(f"installing {model} with {ram:.0f} GB of RAM, as you chose")+ confirm_paging(model, ram, a.low_ram, a.yes)ok(f"size: {model}")tag = fam["tag"] + model # names of the pack, config and start scriptsmall = min(x["vram_gb"] for x in chosen) # each card keeps its layers' KV of the whole contextdiff --git a/tools/test_setup_lowram.py b/tools/test_setup_lowram.pynew file mode 100644index 000000000..5a2279da6--- /dev/null+++ b/tools/test_setup_lowram.py@@ -0,0 +1,82 @@+"""Tests for setup.py's low-RAM messages and the paging question (#250): the one-GPU warning says why and shows the+RAM math, and an explicit --low-ram off installs with --yes instead of stopping at "Install it anyway?" (default+n). Mocked input - no GPU, no downloads.++ python -m unittest tools.test_setup_lowram+"""+from __future__ import annotations++import contextlib+import io+import sys+import unittest+from pathlib import Path+from unittest import mock++ROOT = Path(__file__).resolve().parents[1]+sys.path.insert(0, str(ROOT))+import setup # noqa: E402+++def run(fn, *args, stdin=None):+ """-> (exit code or None, printed text); `stdin` answers input() (None: never asked)."""+ out = io.StringIO()+ asked = []++ def fake_input(prompt=""):+ asked.append(prompt)+ if stdin is None:+ raise AssertionError(f"asked {prompt!r} with --yes")+ return stdin++ code = None+ with contextlib.redirect_stdout(out), mock.patch("builtins.input", fake_input):+ try:+ fn(*args)+ except SystemExit as e:+ code = e.code+ return code, out.getvalue(), asked+++class OneGpuWhy(unittest.TestCase):+ def test_auto_shows_the_ram_math(self):+ lines = setup.low_ram_one_gpu_why("IQ3_XXS", 46, "auto") # the #250 report: 46 GB, IQ3_XXS+ text = "\n".join(lines)+ arena = setup.MODELS["IQ3_XXS"]["arena_gb"]+ need = arena + setup.LOW_RAM_HEADROOM_GB+ self.assertIn(f"{arena:.0f} + {setup.LOW_RAM_HEADROOM_GB} = {need:.0f} GB", text)+ self.assertIn("this PC has 46 GB", text)+ self.assertIn("layer split", text) # why one GPU+ self.assertIn("--low-ram off", text) # and the way to keep them all++ def test_an_explicit_choice_says_so(self):+ text = "\n".join(setup.low_ram_one_gpu_why("Q2_0", 64, "resident"))+ self.assertIn("you chose the low-RAM mode (--low-ram resident)", text)+++class PagingQuestion(unittest.TestCase):+ MODEL, RAM = "IQ3_XXS", 46 # 60 GB wanted, 46 here++ def test_yes_with_low_ram_off_installs(self):+ code, out, asked = run(setup.confirm_paging, self.MODEL, self.RAM, "off", True)+ self.assertIsNone(code, out)+ self.assertEqual(asked, [])+ self.assertIn("installing IQ3_XXS with 46 GB of RAM, as you chose (--low-ram off)", out)++ def test_yes_with_auto_still_stops(self):+ code, out, asked = run(setup.confirm_paging, self.MODEL, self.RAM, "auto", True)+ self.assertEqual(code, 1)+ self.assertIn("IQ3_XXS needs about 60 GB of RAM; this PC has 46 GB", out)+ self.assertIn("--low-ram off --yes", out) # the way to insist++ def test_interactive(self):+ for choice, answer, want in (("off", "", None), ("auto", "", 1), ("auto", "y", None), ("off", "n", 1)):+ with self.subTest(choice=choice, answer=answer):+ code, out, asked = run(setup.confirm_paging, self.MODEL, self.RAM, choice, False, stdin=answer)+ self.assertEqual(code, want, out)+ self.assertEqual(len(asked), 1)+ self.assertIn("[y]" if choice == "off" else "[n]", asked[0])+++if __name__ == "__main__":+ unittest.main()