From 4f131fcdcc591a6db47ced3a0ab7d3f947dd68b5 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Mon, 5 Oct 2026 21:43:13 +0200 Subject: [PATCH] setup --check: RAM below every model's floor is a warning and the verdict says so (#977) The RAM line was [ok] and the verdict 'This PC can run Strata' although every size said 'does not fit'. Now the line is [!], the verdict says no size fits, and the exit code is 1 for scripts. Check only: --model NAME --yes still installs one anyway. --- setup.py | 13 +++++++++++-- tools/test_setup_unsloth.py | 9 +++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 352e1cab..f63e7858 100644 --- a/setup.py +++ b/setup.py @@ -4118,8 +4118,9 @@ def main() -> int: "copy of the most-used ones: it needs 32 GB of RAM or more (48 GB for the full model); --model " "NAME --yes installs one anyway") warn(f"going on with {ram:.0f} GB of RAM, as you chose") - ok(f"RAM: {ram:.0f} GB" if ram >= need - 4 else f"RAM: {ram:.0f} GB (less than the {need} GB the smallest model needs)" - + ("; the GPU's VRAM makes up for it (the low-RAM mode)" if ram < need - 4 and low_ok else "")) + ram_msg = (f"RAM: {ram:.0f} GB" if ram >= need - 4 else f"RAM: {ram:.0f} GB (less than the {need} GB the smallest model needs)" + + ("; the GPU's VRAM makes up for it (the low-RAM mode)" if ram < need - 4 and low_ok else "")) + (ok if ram >= need - 4 or low_ok else warn)(ram_msg) # #977: a RAM below every model's floor is not [ok] pf = page_file_gb() if pf is not None and pf < 4: warn(f"Windows' page file is {pf:.1f} GB: the graphics card's memory needs room there too (issue #60), so " @@ -4143,6 +4144,7 @@ def main() -> int: a.build = True if a.check: say() + any_fits = False for m, d in MODELS.items(): verdict = "fits" if ram >= d["ram_gb"] else "tight" if ram >= d["ram_gb"] - 8 else "does not fit" if d.get("budget"): @@ -4155,7 +4157,14 @@ def main() -> int: verdict = (f"fits in the low-RAM mode (the GPU holds ~{100 * low_ram_gpu_share(m, gpu['vram_gb']):.0f}% " "of its experts, " + ("the rest stays in RAM)" if low_ram_resident(m, ram, gpu["vram_gb"]) else "the rest is read from the SSD as needed)")) + any_fits = any_fits or not verdict.startswith("does not fit") say(f" {m:8s} needs ~{d['ram_gb']} GB RAM: {verdict}") + if not any_fits: + # #977: every size says "does not fit", so the verdict says so too (and the exit code, for scripts). It only + # reports: --model NAME --yes still installs one anyway. + say(f"\nThis PC cannot run Strata yet: no model size fits {ram:.0f} GB of RAM (the smallest needs about " + f"{need} GB). --model NAME --yes installs one anyway, slowly.") + return 1 say("\nThis PC can run Strata. Run it again without --check to install.") return 0 diff --git a/tools/test_setup_unsloth.py b/tools/test_setup_unsloth.py index faf8bc50..d972f176 100644 --- a/tools/test_setup_unsloth.py +++ b/tools/test_setup_unsloth.py @@ -490,6 +490,15 @@ class IQ4XS(Base): self.assertNotIn("EXPERIMENTAL", line) self.assertIn("EXPERIMENTAL", next(ln for ln in out.splitlines() if ln.strip().startswith(M))) + def test_check_below_every_floor(self): + # #977: 16 GB fits no size; the RAM line is not [ok] and the verdict says so + code, out, _ = self.main(["--check"], ram=16.0, m=X) + self.assertEqual(code, 1, out) + self.assertNotIn("[ok] RAM", out) + self.assertIn("[!] RAM: 16 GB (less than", out) + self.assertIn("This PC cannot run Strata yet", out) + self.assertNotIn("This PC can run Strata", out) + def test_engine_0138(self): code, out, cfg = self.main(["--context", "8192"], version="0.1.37", m=X) self.assertEqual(code, 1)