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 (Mac): say when an update was asked for a model that is not installed (#3848)

Demetree Kallergiscc2c628cbe09
diff --git a/metal/setup_mac.py b/metal/setup_mac.py
index b939e2460..774ac3b29 100644
--- a/metal/setup_mac.py
+++ b/metal/setup_mac.py
@@ -433,6 +433,18 @@ def main(argv=None) -> int:
(BUILD_DIR / "BUILD.json").unlink(missing_ok=True)
exe = build_engine(llama)
if a.update:
+ # update.sh's own text: "The model files are not touched". The questions are asked anyway, so when the
+ # answers name a model (or an image encoder) that is not here, say it: a silent exit reads like a broken
+ # download (an M1 Max chose IQ3_S in update.sh and got no model and no message).
+ files = [Path(a.gguf_dir) / n if a.gguf_dir else models_root / tag / n for n in model_shard_names(model)]
+ pack = S.find_in(roots, f"packs/{tag.lower()}") or data / "packs" / tag.lower()
+ pack_done = (pack / "native_experts.txt").exists() and (pack / "tokenizer" / "vocab.json").exists()
+ if not (all(f.exists() and S.done(f) for f in files) and pack_done):
+ S.warn(f"{model} is not installed here, and an update does not download model files: nothing was installed")
+ S.say(f" to download and prepare {model}: ./setup.sh --setup")
+ elif vision == "yes" and not (models_root / fam["mmproj"]).exists():
+ S.warn("the image encoder is not downloaded here, and an update does not download model files")
+ S.say(" to add image support: ./setup.sh --setup")
return 0
# ---- 5. the model
diff --git a/tools/test_setup_mac.py b/tools/test_setup_mac.py
index 92f2a596b..463a9a726 100644
--- a/tools/test_setup_mac.py
+++ b/tools/test_setup_mac.py
@@ -389,6 +389,56 @@ class ControlMode(unittest.TestCase):
self.assertIn('if sys.platform == "darwin" and CONTROL:', src)
+class UpdateFlow(unittest.TestCase):
+ """update.sh asks the same questions as a setup run but does not download model files: a model chosen there must
+ be named, not dropped in silence (an M1 Max picked IQ3_S in update.sh and got no model and no message)."""
+
+ def setUp(self):
+ self.tmp = tempfile.TemporaryDirectory()
+ self.addCleanup(self.tmp.cleanup)
+ self.data = Path(self.tmp.name).resolve() / "data"
+ self.models = Path(self.tmp.name).resolve() / "own"
+ self.data.mkdir()
+ self.models.mkdir()
+ self.said, self.warned = [], []
+
+ def run_update(self, argv=("--update", "--model", "IQ3_S", "--vision", "no", "--yes")):
+ with mock.patch.object(M, "mac_configs", lambda: []), \
+ mock.patch.object(M.S, "data_folder_for", lambda a: (self.data, [])), \
+ mock.patch.object(M, "mac_info", lambda run=None: {"chip": "Apple M1 Max", "ram_gb": 32.0,
+ "macos": "26.6.2", "arm64": True, "clt": True}), \
+ mock.patch.object(M, "mac_problems", lambda info: []), \
+ mock.patch.object(M.S, "free_gb", lambda p: 200.0), \
+ mock.patch.object(M.S, "step", lambda *a, **k: None), \
+ mock.patch.object(M.S, "say", lambda *a, **k: self.said.append(" ".join(str(x) for x in a))), \
+ mock.patch.object(M.S, "ok", lambda *a, **k: None), \
+ mock.patch.object(M.S, "warn", lambda *a, **k: self.warned.append(" ".join(str(x) for x in a))), \
+ mock.patch.object(M.S, "pip_install", lambda *a, **k: None), \
+ mock.patch.object(M.S, "get_llama_cpp", lambda: self.data / "llama"), \
+ mock.patch.object(M, "build_engine", lambda llama, jobs=None: self.data / "strata"), \
+ mock.patch.object(M.S, "download", side_effect=AssertionError("an update must not download")):
+ return M.main([*argv, "--data-dir", str(self.data), "--gguf-dir", str(self.models)])
+
+ def test_a_model_chosen_in_an_update_is_named_not_dropped(self):
+ self.assertEqual(self.run_update(), 0)
+ self.assertIn("IQ3_S is not installed here", " ".join(self.warned))
+ self.assertIn("does not download model files", " ".join(self.warned))
+ self.assertIn("./setup.sh --setup", " ".join(self.said))
+
+ def test_an_installed_model_keeps_the_update_quiet(self):
+ for n in M.model_shard_names("IQ3_S"):
+ f = self.models / n
+ f.write_bytes(b"x")
+ f.with_name(f.name + ".done").write_text("whole")
+ tag = M.S.FAMILIES["qwen"]["tag"] + "IQ3_S"
+ pack = self.data / "packs" / tag.lower()
+ (pack / "tokenizer").mkdir(parents=True)
+ (pack / "native_experts.txt").write_text("x")
+ (pack / "tokenizer" / "vocab.json").write_text("{}")
+ self.assertEqual(self.run_update(), 0)
+ self.assertFalse([w for w in self.warned if "not installed here" in w], self.warned)
+
+
class Source(unittest.TestCase):
"""setup.py hands a Mac over before its own parser runs, so the Mac parser has to know --source:
source_hint() recommends it on every platform (#2363)."""