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++
DeepSeek on a Mac: the fit plan and the model list (dsv41_fit._plan_mac, strata_mcp._mac_deepseek)
Niko12212e7af09a8628
diff --git a/strata_control/dsv41_fit.py b/strata_control/dsv41_fit.pyindex 69492c15f..e04ce0cd9 100644--- a/strata_control/dsv41_fit.py+++ b/strata_control/dsv41_fit.py@@ -342,6 +342,9 @@ def plan(cards: list[dict] | None, ram_gb: float | None, disk_free_gb: float | NOn a unified-memory APU (Ryzen AI Max, gfx1151) the plan counts one pool: also `uma: True` and `streamed_gb` (the expertsread from the SSD), tp 1 and no args (nothing to split between cards)."""if variant(model):+ mac = mac_card(cards)+ if mac is not None and variant_key(model) in MAC_SET_PACK:+ return _plan_mac(variant_key(model), model, mac, ram_gb, disk_free_gb, context)mine = gpu_fit.for_vendor(list(cards or []), vendor)[0] if vendor else list(cards or [])card = uma_card(mine)if card is not None:@@ -510,7 +513,10 @@ def mac_expert_cap_gb(ram_gb: float) -> float:if p <= 0:return 0.0keep = max(7.0, 0.15 * p)- leave = max(keep, 0.40 * p, MAC_FILECACHE_FLOOR_GB + MAC_HEADROOM_GB) if p >= 64.0 else keep+ # the file-cache floor (vm.vm_page_filecache_min) was read on the 128 GiB M5 Max (37.2 GB) and on a 32 GiB M4 mini (11.1 GB, a third+ # of its RAM): it grows with the memory, so a Mac between the two gets it by that share, an estimate (only the 128 GiB one was run)+ floor = MAC_FILECACHE_FLOOR_GB * min(1.0, p / (128.0 * gib))+ leave = max(keep, 0.40 * p, floor + MAC_HEADROOM_GB) if p >= 64.0 else keepcap = min(p - leave, MAC_DEVICE_SHARE * p)return max(0.0, cap - MAC_ENGINE_FOOTPRINT_GB - 1.0)@@ -552,7 +558,8 @@ def mac_plan(ram_gb: float, quant: str = "IQ2_XS", disk_free_gb: float | None =elif resident < 0.25 * routed:out["verdict"] = "small"warns.append(f"Only about {resident:.0f} GB of {routed:.0f} GB of experts fit in memory (under a quarter): "- "most of the model is read from the SSD for every word. Expect seconds a word rather than tokens a second.")+ "most of the model is read from the SSD for every word, so answers are much slower than on a Mac with 128 GB "+ "(nothing this small was measured). It still runs; a 64 GB or bigger Mac is the better fit.")else:out["verdict"] = "streams"lines.append("The model streams: answers are slower than on a machine that holds all the experts, and they still "@@ -562,3 +569,61 @@ def mac_plan(ram_gb: float, quant: str = "IQ2_XS", disk_free_gb: float | None =lines.append("Measured on " + MAC_MEASURED + ".")out["words"] = " ".join(lines)return out+++# ---------------------------------------------------------------------------------------------------------------------+# The Mac in the launch flow: plan() answers for an Apple Silicon Mac in the shape the catalog, `strata launch` and the app read+# for any other computer, from mac_plan's numbers. The official sets that were run on a Mac (2.00 and 2.25 bpw, 2026-10-25);+# the 1.75 bpw set shares the 2.00 set's IQ1_M kernel but was never run there, so it is not offered on a Mac.++MAC_SET_PACK = {"IST-DAS-2.00bpw": "IQ2_XXS", "IST-DAS-2.25bpw": "IQ2_XS"}+MAC_SMALL_RAM_GB = 64.0 # below this the measured M5 Max numbers do not apply (nothing smaller than 32 GB was ever started)+++def mac_card(cards: list[dict] | None) -> dict | None:+ """The Apple Silicon "graphics card" of the hardware report (vendor apple, its unified memory in `unified_gb`), None on any other computer."""+ return next((c for c in cards or [] if str(c.get("vendor")) == "apple" or float(c.get("unified_gb") or 0) > 0), None)+++def _plan_mac(key: str, model: str, card: dict, ram_gb: float | None, disk_free_gb: float | None, context: int) -> dict[str, Any]:+ """plan() for an official IST-DAS set on an Apple Silicon Mac. One pool of unified memory: the engine keeps the experts it can+ beside the dense weights resident (mac_expert_cap_gb) and reads the rest from the SSD in place. Never a refusal: a smaller Mac+ gets a plain warning, not a block."""+ v = ISTA_SETS[key]+ ram = float(ram_gb or card.get("unified_gb") or 0.0)+ mp = mac_plan(ram, MAC_SET_PACK[key], disk_free_gb)+ expert_gb = v["experts_gb"] / EXPERTS+ resident = float(mp["resident_gb"])+ streamed = float(mp["streaming_gb"])+ in_mem = int(resident / expert_gb)+ download = ista_download_bytes(model) / GB+ need_disk = download + DISK_HEADROOM_GB+ verdict = {"fits": "fits", "streams": "tight", "small": "spills"}[mp["verdict"]]+ out: dict[str, Any] = {+ "variant": model, "mac": True, "mac_verdict": mp["verdict"],+ "cards": [{"index": card.get("index", 0), "name": card.get("name") or "Apple Silicon", "vram_gb": _round1(ram),+ "layers": [0, LAYERS - 1], "dense_gb": _round1(ISTA_DENSE_GB), "experts_gb": _round1(resident), "experts": in_mem}],+ "experts_total": EXPERTS, "experts_in_vram": in_mem, "vram_experts_gb": _round1(resident), "cpu_experts_gb": 0.0,+ "weights_gb": _round1(v["set_bytes"] / GB), "experts_gb": _round1(v["experts_gb"]), "dense_gb": _round1(ISTA_DENSE_GB),+ "engram_gb": _round1(ISTA_ENGRAM_BYTES / GB), "download_gb": _round1(download), "tp": 1, "args": [],+ "measured": MAC_MEASURED, "lines": [], "warnings": [], "ram_gb": ram_gb, "context": context,+ "disk_total_gb": v["disk_total"], "disk_need_gb": _round1(need_disk),+ "disk_ok": None if disk_free_gb is None else disk_free_gb >= need_disk,+ "streamed_gb": _round1(streamed), "ram_needed_gb": _round1(resident + ISTA_DENSE_GB + MAC_ENGINE_FOOTPRINT_GB),+ "spill_gb": _round1(streamed), "spare_ram_gb": _round1(max(0.0, ram - resident - ISTA_DENSE_GB - MAC_ENGINE_FOOTPRINT_GB)),+ "verdict": verdict,+ }+ lines, warns = out["lines"], out["warnings"]+ lines.append(f"DeepSeek-V4.1-Flash, {v['title']}: a {download:.0f} GB download ({v['set_bytes'] / GB:.0f} GB of model, "+ f"{ISTA_ENGRAM_BYTES / GB:.0f} GB n-gram table, {ISTA_DSPARK_BYTES / GB:.0f} GB drafter). Quality: {v['quality']}.")+ lines.extend(l for l in mp["lines"][1:] if not l.startswith("Measured on "))+ lines.append("Measured on " + MAC_MEASURED + ".")+ warns.extend(mp["warnings"])+ if ram and ram < MAC_SMALL_RAM_GB and mp["verdict"] != "small":+ warns.append(f"This Mac has {ram:.0f} GB of memory and the set was measured on one with 128 GB: with less, more experts come from "+ "the SSD for every word, so answers are slower. It still runs.")+ if disk_free_gb is not None and disk_free_gb < need_disk:+ warns.append(f"The download needs about {need_disk:.0f} GB of free disk space and {disk_free_gb:.0f} GB are free where the files go. "+ "Use --models-dir on a bigger drive, or --gguf-dir for files you already have.")+ out["words"] = " ".join(lines)+ return outdiff --git a/tools/strata_mcp.py b/tools/strata_mcp.pyindex c6e282468..7fa021f96 100644--- a/tools/strata_mcp.py+++ b/tools/strata_mcp.py@@ -1152,8 +1152,40 @@ class Strata:if sizes:out.append({"family": family, "title": fd["title"], "about": fd.get("about"), "experimental": False,"images": any(x["images"] for x in sizes), "sizes": sizes})+ ds = self._mac_deepseek(hw, have) # DeepSeek-V4.1-Flash on the Mac (0.2.7.1): after Qwen, never the default+ if ds is not None:+ out.append(ds)return out+ def _mac_deepseek(self, hw: dict, have: set) -> dict | None:+ """DeepSeek-V4.1-Flash for a Mac: the official sets that were run on one (strata_control/dsv41_fit.MAC_SET_PACK), with the Mac fit words.+ None when setup.py has no DeepSeek family (an older Terminal)."""+ big = self.multi_family("deepseek41")+ if not big:+ return None+ from strata_control import dsv41_fit+ mf, ram = self.mac(), float(hw.get("ram_gb") or 0)+ sizes = []+ for m in big["models"]:+ if m not in dsv41_fit.MAC_SET_PACK:+ continue+ d = self.own_size("deepseek41", m)+ if d is None:+ continue+ tag = (big.get("tag", "") + m).lower()+ sizes.append({"model": m, "about": d["about"], "download_gb": d["download_gb"], "experimental": False,+ "images": False, "images_reader": "none", # the Mac engine's picture tower: see docs/DEEPSEEK_MAC.md+ "ram_needed_gb": d["ram_gb"], "experts_gb": d.get("arena_gb"), "mem_total": True, "multi_file": True,+ "disk_gb": self.dsv41_disk_gb(d), "engine_min": None,+ "memory_gb": round(float(d["ram_gb"]), 1),+ "on_this_pc": ("does not fit: this Mac has too little memory" if ram and ram < mf.MIN_STREAM_RAM_GB+ else self.dsv41_words(hw, m, installed=tag in have)),+ "installed": tag in have, "id": tag, "gpu_options": None})+ if not sizes:+ return None+ return {"family": "deepseek41", "title": big["title"], "about": big.get("about"), "experimental": False,+ "images": False, "sizes": sizes}+def recommend(self, hw: dict) -> dict:"""setup.py's own rules: the size it preselects (IQ3_XXS from 60 GB of RAM, else the first, Q2_0), theCoder below the full model's RAM (setup's RAM table), the low-RAM mode when the GPU makes up for the RAM, and@@ -1363,6 +1395,16 @@ class Strata:v = pl["verdict"]if v == "no_card":return "does not fit: it needs one or more graphics cards"+ if pl.get("mac"): # an Apple Silicon Mac (0.2.7.1): one pool of unified memory, the rest of the experts streams from the SSD+ streamed, kept = pl["streamed_gb"], pl["vram_experts_gb"]+ if pl["mac_verdict"] == "fits":+ return f"fits: every expert stays in this Mac's memory ({pl['experts_gb']:.0f} GB)"+ if pl["mac_verdict"] == "small":+ return (f"slow here: this Mac's memory holds about {kept:.0f} GB of the {pl['experts_gb']:.0f} GB of experts and the other "+ f"{streamed:.0f} GB are read from the SSD for every word; it can still be installed (nothing this small was measured, "+ "a Mac with 64 GB or more suits it better)")+ return (f"runs on this Mac's memory: about {kept:.0f} GB of the {pl['experts_gb']:.0f} GB of experts stay in memory and the other "+ f"{streamed:.0f} GB are read from the SSD while it answers; measured 12-19 tokens a second on an M5 Max with 128 GB")if pl.get("uma"): # Ryzen AI Max (Strix Halo, Windows): the graphics memory is the RAM, counted oncereturn (f"runs on this PC's shared memory: about {pl['vram_experts_gb']:.0f} GB of the {pl['experts_gb']:.0f} GB of experts stay "f"in memory and the other {pl['streamed_gb']:.0f} GB are read from the SSD; measured 14-16 tokens a second on code and "