mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 23:08:36 +00:00
Ling-3.2-Air on a Mac: a row in the Mac model table, and its own setup path (found by the real run on m1002)
- tools/strata_mcp.py: the Mac model table lists Ling (the Metal engine keeps the whole model in memory, tier A, no pictures yet) with the same ling32 row and its Mac memory note. - setup.py: mac_ling32_setup (like mac_hy4_setup / mac_inkling_setup) runs install_ling32_air with the Metal backend; main() sends Ling there before the Qwen-only mac_control_setup (the app) and `strata setup` no longer sends Ling to metal/setup_mac.py. Before this the app's install on a Mac said "ling-3.2-air is not one of them" and, past that, "no NVIDIA GPU found". - tests/terminal/test_ling32_gui.py: OnAMac. The app host flow on m1002 with these (packaged host, pinned sandbox, real Metal engine package, local model adopted in place): 20 of 20 steps.
This commit is contained in:
1 parent
571e98c70d
commit
e4a532c1ee
3 files changed
+81
-1
No files matched your search
+29
-1
@@ -12382,6 +12382,31 @@ def mac_inkling_setup(a) -> int:
|
||||
return install_inkling2(a, a.family or inkling_family.FAMILY, gpu, False, False, None, False, a.port or 8080, ram, None)
|
||||
|
||||
|
||||
def mac_ling32_setup(a) -> int:
|
||||
"""inclusionAI Ling-3.2-Air on a Mac (Apple Silicon, Metal): unified memory, the whole model in memory (no tiers), strata-ling32 Metal component, no pictures yet. The same installer as every
|
||||
other platform (install_ling32_air with the Metal backend); this only does what the Mac needs before it: the check of the Mac and the unified-memory card."""
|
||||
from strata_control import mac_fit as MF
|
||||
say("Strata - inclusionAI Ling-3.2-Air on a Mac (Apple Silicon, Metal)")
|
||||
step(1, "checking your Mac")
|
||||
info = MF.mac_info()
|
||||
ram = float(info["ram_gb"] or ram_gb())
|
||||
ok(f"{info['chip']}, {ram:.0f} GB unified memory, macOS {info['macos'] or '?'}")
|
||||
problems = MF.mac_problems(info, need_compiler=False)
|
||||
for p in problems:
|
||||
warn(p)
|
||||
data, _ = data_folder_for(a)
|
||||
if a.models_dir is None:
|
||||
a.models_dir = str(data / "models")
|
||||
free = free_gb(data if data.exists() else home())
|
||||
ok(f"free disk: {free:.0f} GB at {data}")
|
||||
if a.check:
|
||||
return 1 if problems else 0
|
||||
if problems:
|
||||
fail(problems[0])
|
||||
gpu = {"index": 0, "name": info["chip"], "vendor": "apple", "vram_gb": 0.0, "unified_gb": ram, "uma": True, "count": 1}
|
||||
return install_ling32_air(a, a.family or ling32_family.FAMILY, gpu, False, False, None, False, a.port or 8080, ram, None)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
try: # the engine programs setup runs start no debugger on a user's machine (strata_control/childenv.py)
|
||||
from strata_control.childenv import quiet_crash_env
|
||||
@@ -12402,7 +12427,8 @@ def main() -> int:
|
||||
return 2
|
||||
_hy4_ask = _peek("--family") in HY4_FAMILIES or bool(_peek("--model") and model_alias(_peek("--model")) in HY4_FAMILIES["hy4-flash"]["models"])
|
||||
_ink_ask = _peek("--family") in INKLING_FAMILIES or bool(_peek("--model") and model_alias(_peek("--model")) in sizes_of_family(INKLING_FAMILIES["inkling-2-mini"]))
|
||||
if sys.platform == "darwin" and not CONTROL and not _hy4_ask and not _ink_ask: # a Mac: metal/setup_mac.py (the Metal engine); the app (Control mode), Hy4-Flash and Inkling-2-Mini go on below.
|
||||
_ling_ask = _peek("--family") in LING32_FAMILIES or bool(_peek("--model") and model_alias(_peek("--model")) in sizes_of_family(LING32_FAMILIES[ling32_family.FAMILY]))
|
||||
if sys.platform == "darwin" and not CONTROL and not _hy4_ask and not _ink_ask and not _ling_ask: # a Mac: metal/setup_mac.py (the Metal engine); the app (Control mode), Hy4-Flash and Inkling-2-Mini go on below.
|
||||
return mac_setup(sys.argv[1:]) # (after the retired names above, so a Mac gets the same sentence and exit 2, M1 11-16)
|
||||
if (_peek("--family") and _peek("--family") not in {**FAMILIES, **OWN_PATH_FAMILIES, **HY4_FAMILIES, **INKLING_FAMILIES, **LING32_FAMILIES}) \
|
||||
or (_peek("--model") and not _peek("--family") and model_alias(_peek("--model")) not in MODELS
|
||||
@@ -12631,6 +12657,8 @@ def main() -> int:
|
||||
return mac_hy4_setup(a)
|
||||
if a.family in INKLING_FAMILIES or (not a.family and a.model in sizes_of_family(INKLING_FAMILIES["inkling-2-mini"])):
|
||||
return mac_inkling_setup(a)
|
||||
if a.family in LING32_FAMILIES or (not a.family and a.model in sizes_of_family(LING32_FAMILIES[ling32_family.FAMILY])):
|
||||
return mac_ling32_setup(a)
|
||||
if CONTROL: # the app on a Mac: model files only; the Metal engine is a component
|
||||
return mac_control_setup(a)
|
||||
if a.backend == "sycl": # Intel Arc: the app / Terminal's installer mode prepares the files and writes the config; a checkout builds from source
|
||||
|
||||
@@ -160,6 +160,37 @@ class ControlModeTokenizer(unittest.TestCase):
|
||||
self.assertLess(body.index('sys.path.insert(0, str(ROOT / "tools"))'), body.index("import ling32_tokenizer"))
|
||||
|
||||
|
||||
class OnAMac(unittest.TestCase):
|
||||
"""Found by the real run on the Mac (m1002): the Mac model table had no Ling row, and the Mac's setup paths (the app's Control mode, `strata setup`) sent it to the Qwen installer or to the NVIDIA check."""
|
||||
|
||||
def _mac_hw(self, ram_gib: float) -> dict:
|
||||
return {"ram_gb": ram_gib, "cpu": {"name": "Apple M5 Max", "cores": 18, "avx2": None, "avx512": None},
|
||||
"gpus": [{"index": 0, "name": "Apple M5 Max", "vendor": "apple", "vram_gb": 0.0, "unified_gb": ram_gib, "arch": "apple-gpu", "problem": None, "usable": True}],
|
||||
"mac": {"chip": "Apple M5 Max", "macos": "27.2", "unified_gb": ram_gib}, "nvidia_smi": False}
|
||||
|
||||
def test_the_mac_model_table_lists_ling_with_the_whole_model_in_memory_and_no_pictures(self):
|
||||
from tools import strata_mcp as M
|
||||
with mock.patch.dict(os.environ, {"STRATA_LING32_SHOW": "1"}):
|
||||
s = M.Strata(ROOT)
|
||||
fam = next(f for f in s.model_table(self._mac_hw(128.0)) if f["family"] == "ling-3.2-air")
|
||||
size = fam["sizes"][0]
|
||||
self.assertEqual((size["model"], size["id"], size["images"], fam["images"]), ("SQ-96", "ling-3.2-air-sq-96", False, False))
|
||||
row = size["ling32"]
|
||||
self.assertEqual((row["backend"], row["mac"], row["engine_exists"], row["tier"]), ("metal", True, True, "A"))
|
||||
self.assertFalse(row["notes"][0]["below"])
|
||||
small = next(f for f in s.model_table(self._mac_hw(64.0)) if f["family"] == "ling-3.2-air")["sizes"][0]["ling32"]
|
||||
self.assertTrue(small["notes"][0]["below"]) # a smaller Mac is warned, never refused
|
||||
|
||||
def test_the_mac_paths_of_setup_go_to_the_ling_installer(self):
|
||||
text = (ROOT / "setup.py").read_text(encoding="utf-8")
|
||||
self.assertIn("def mac_ling32_setup(a)", text)
|
||||
self.assertIn("return install_ling32_air(a, a.family or ling32_family.FAMILY, gpu, False, False, None, False, a.port or 8080, ram, None)", text)
|
||||
at = text.index("if sys.platform == \"darwin\":\n if a.family in HY4_FAMILIES")
|
||||
block = text[at:at + 900]
|
||||
self.assertLess(block.index("return mac_ling32_setup(a)"), block.index("return mac_control_setup(a)"), "Ling goes before the Qwen-only Control path")
|
||||
self.assertIn("and not _ling_ask:", text, "`strata setup` on a Mac does not send Ling to metal/setup_mac.py")
|
||||
|
||||
|
||||
class ContextOfTheInstalledModel(unittest.TestCase):
|
||||
def test_the_context_comes_from_ling32s_own_flag(self):
|
||||
from strata_control import models
|
||||
|
||||
@@ -1703,6 +1703,27 @@ class Strata:
|
||||
if sizes:
|
||||
out.append({"family": f, "title": fd["title"], "about": fd.get("about"), "experimental": False,
|
||||
"images": True, "sizes": sizes})
|
||||
if self.ling32_visible(): # inclusionAI Ling-3.2-Air on a Mac: the Metal engine keeps the whole model in memory (no tiers), no pictures yet
|
||||
usable = self.engine_gpus(hw) or ([{"vendor": "apple", "unified_gb": ram, "usable": True, "arch": "apple-gpu"}] if ram else [])
|
||||
for f, fd in (getattr(S, "LING32_FAMILIES", None) or {}).items():
|
||||
sizes = []
|
||||
for m in self.sizes_of(models, f):
|
||||
d = self.ling32_size(f, m)
|
||||
if not d:
|
||||
continue
|
||||
tag = (fd.get("tag", "") + m).lower()
|
||||
ling = self.ling32_fit_row(m, ram if ram else None, usable)
|
||||
on_disk, rem_gb = (False, None) if tag in have else self._local_build_status(S, f, m, d, fd)
|
||||
sizes.append({"model": m, "about": d["about"], "download_gb": d["download_gb"],
|
||||
**({"ling32": ling} if ling else {}),
|
||||
**({"files_on_disk": True, "remaining_download_gb": rem_gb} if on_disk else {}),
|
||||
"experimental": False, "images": False,
|
||||
"ram_needed_gb": d["ram_gb"], "experts_gb": d.get("arena_gb"), "mem_total": False,
|
||||
"memory_gb": d["footprint_gb"], "fit_gb": d["footprint_gb"],
|
||||
"on_this_pc": None if ling is None else "fits", "installed": tag in have, "id": tag, "gpu_options": None})
|
||||
if sizes:
|
||||
out.append({"family": f, "title": fd["title"], "about": fd.get("about"), "experimental": False,
|
||||
"images": False, "sizes": sizes})
|
||||
return self._feed_rows(out, S)
|
||||
|
||||
def recommend(self, hw: dict) -> dict:
|
||||
|
||||
Reference in new issue
Block a user