Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
Merge origin/dev into fix/metal-i4-gpu-path
Andrey Aristov7da954a57fff
diff --cc c/coliindex 12d746d9,999e166b..91e08a7f--- a/c/coli+++ b/c/coli@@@ -916,17 -1225,12 +1240,17 @@@ def cmd_chat(a)if _drain_box["done"]: breaktime.sleep(0.05)errlog.flush()+ mload=re.search(r"loaded in ([0-9.]+)s \| resident dense: ([0-9.]+) MB",+ _preamble.decode("utf-8","replace"))+ if mload: print(f" {C.grn}✓{C.r} ready in {mload.group(1)}s {C.dim}· resident {float(mload.group(2))/1000:.1f} GB · RSS {st.get('rss','?')} GB{C.r}")try:elog=open(errlog.name).read()- mload=re.search(r"loaded in ([0-9.]+)s \| resident dense: ([0-9.]+) MB", elog)- if mload: print(f" {C.grn}✓{C.r} ready in {mload.group(1)}s {C.dim}· resident {float(mload.group(2))/1000:.1f} GB · RSS {st.get('rss','?')} GB{C.r}")for l in elog.splitlines(): # una riga di stato per riga, senza path- # [METAL]/[CUDA] first: the splash tagline (backend_tag) only reflects the- # REQUESTED backend from the environment — this engine line is the actual- # confirmation the GPU tier engaged (it can still fall back per-block). The- if l.startswith(("[RAM_GB","[PIN]","[MTP]","[USAGE]","[DSA]","[KV]")):++ # [METAL]/[CUDA] first: the splash tagline (model_banner_line) names the++ # checkpoint, not the backend — this engine line is the only confirmation++ # the GPU tier actually engaged (it can still fall back per-block). The+ # engine prints it to stderr, we drain it into errlog; keep it whitelisted.+ if l.startswith(("[METAL]","[CUDA]","[RAM_GB","[PIN]","[MTP]","[USAGE]","[DSA]","[KV]")):l=re.sub(r" ?\(?/[^ )]+\)?","",l.strip()) # via i percorsi lunghil=re.sub(r" from$","",l)for chunk in textwrap.wrap(l, term_w()-4) or [l]:@@@ -1107,12 -1450,19 +1470,19 @@@ def cmd_web(a)print(f"dashboard: {url} (opens automatically when the engine is ready)")cmd_serve(a)+ def project_python():+ if sys.platform == "win32":+ candidate = os.path.join(HERE, "mio_env", "Scripts", "python.exe")+ else:+ candidate = os.path.join(HERE, "mio_env", "bin", "python3")+ return candidate if os.path.exists(candidate) else sys.executable++def cmd_bench(a):need_model(a.model)- banner("bench")+ banner("bench", model=a.model)# python con `tokenizers`: l'ambiente del progetto se c'e', altrimenti quello corrente- venv_py = os.path.join(HERE, "mio_env", "Scripts" if sys.platform == "win32" else "bin", "python3")- py = venv_py if os.path.exists(venv_py) else sys.executable+ py = project_python()tasks = ",".join(a.tasks) if a.tasks else "hellaswag,arc_challenge,mmlu"# dataset mancanti -> li scarica una volta (fetch_benchmarks.py li mette in --data come JSONL)missing=[t for t in tasks.split(",") if not os.path.exists(os.path.join(a.data,f"{t}.jsonl"))]diff --cc c/tests/test_backend_metal.mmindex d0a9c077,921e24f5..2acdba9b--- a/c/tests/test_backend_metal.mm+++ b/c/tests/test_backend_metal.mm@@@ -252,9 -257,9 +257,10 @@@ static int run_fp8_gemm_gate(const cha// up with no routed expert already fixing `mfmt`, it would submit the WRONG pointer// (q4, NULL/stale for an fmt=8 tensor whose weights live in q8) tagged as fmt=8.// This is safe ANYWAY, but only incidentally: moe_submit() (backend_metal.mm) gates- // on its fmt allowlist ({1,2,4,6}) as its very FIRST statement, before any of-// `fmt != 1 && fmt != 2` as its very FIRST statement, before any of g/u/d/gs/us/ds is-// dereferenced or even resolve()'d -- so an fmt=8 submission is refused before the-// bad pointer would ever be read, no matter what garbage MB_BUILD packed into it. This++// on its fmt allowlist ({1,2,4,5,6}) as its very FIRST statement, before any of+// g/u/d/gs/us/ds is dereferenced or even resolve()'d -- so an fmt=8 submission is- // refused before the bad pointer would ever be read, no matter what garbage MB_BUILD packed into it. This++// refused before the bad pointer would ever be read, no matter what garbage++// MB_BUILD packed into it. This// test uses deliberately-invalid weight/scale pointers (never dereferenced if the gate// holds) to prove the fence BY TEST rather than leaving it an artifact of moe_submit's// fmt allowlist happening not to include 8 (yet) -- same discipline