Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

coli: a directory without config.json names no engine

JustVugg60386545f0c0
diff --git a/c/coli b/c/coli
index 06804f1e..9cac181a 100755
--- a/c/coli
+++ b/c/coli
@@ -1084,7 +1084,15 @@ def cmd_info(a):
sz=sum(os.path.getsize(os.path.join(a.model,x)) for x in sts)
row("shards", f"{len(sts)} files · {sz/1e9:.0f} GB on disk")
else:
- print(f" {C.yel}config.json is missing (incomplete conversion?){C.r}")
+ # No config.json means no family, and no family means no engine: say so
+ # instead of letting the GLM default below stand in. A directory of shards
+ # copied without the small files is the usual shape of this (the Qwen3.8
+ # support case: the GLM engine then died on a tensor name it never had).
+ try: n_shards=len([x for x in os.listdir(a.model) if x.endswith('.safetensors')])
+ except OSError: n_shards=0
+ print(f" {C.yel}config.json is missing{C.r}: coli picks the engine from it, so nothing can run here yet.")
+ print(f" Copy the checkpoint's config.json (with tokenizer.json and model.safetensors.index.json)")
+ print(f" from the model repo next to the {n_shards} shard(s) found here, then run coli info again.")
try:
mi=open('/proc/meminfo').read()
tot=int(re.search(r'MemTotal:\s+(\d+)',mi).group(1))/1e6
@@ -1096,8 +1104,11 @@ def cmd_info(a):
row("disk", f"{fs.free/1e9:.0f} GB free")
except OSError:
row("disk", "? GB (unavailable)")
- engine=engine_for(a.model) if family else GLM
- row("engine", "ready ✓" if os.path.exists(engine) else "not built (coli build)")
+ if family:
+ engine=engine_for(a.model)
+ row("engine", "ready ✓" if os.path.exists(engine) else "not built (coli build)")
+ else:
+ row("engine", "unknown until config.json is present")
knobs=[]
if a.ram: knobs.append(f"ram {a.ram}GB")
if a.topp: knobs.append(f"topp {a.topp}")
diff --git a/c/family_registry.py b/c/family_registry.py
index e13fb9b1..f16f1f72 100644
--- a/c/family_registry.py
+++ b/c/family_registry.py
@@ -1426,7 +1426,11 @@ def resolve_model(model_dir):
try:
config = json.loads(path.read_text(encoding="utf-8"))
except OSError as error:
- raise FamilyConfigError(f"cannot read config.json: {model}") from error
+ raise FamilyConfigError(
+ f"cannot read config.json: {model}\n"
+ " coli picks the engine from config.json, so nothing runs without it. Copy the\n"
+ " checkpoint's config.json (with tokenizer.json and model.safetensors.index.json)\n"
+ " from the model repo next to the shards.") from error
except json.JSONDecodeError as error:
raise FamilyConfigError(f"invalid config.json: {error}") from error
family = family_for_config(config)
diff --git a/c/tests/test_cli_output.py b/c/tests/test_cli_output.py
index 61cd3c45..6cb6bdbf 100644
--- a/c/tests/test_cli_output.py
+++ b/c/tests/test_cli_output.py
@@ -54,6 +54,30 @@ class CliOutputLanguageTest(unittest.TestCase):
self.assertIn("disk", result.stdout)
self.assertIn("engine", result.stdout)
+ def test_info_without_config_names_no_engine(self):
+ """A directory of shards without config.json used to show the GLM engine
+ as if it were the one to run: the family is unknown, so the engine is
+ unknown, and the line must say what to copy where."""
+ with tempfile.TemporaryDirectory() as model:
+ for i in (1, 2):
+ (Path(model) / f"model-0000{i}-of-00002.safetensors").write_bytes(b"\0" * 8)
+ result = self.run_cli("info", "--model", model)
+ self.assertEqual(result.returncode, 0, result.stderr)
+ self.assertIn("unknown until config.json is present", result.stdout)
+ self.assertIn("2 shard(s) found here", result.stdout)
+ self.assertIn("model.safetensors.index.json", result.stdout)
+ self.assertNotIn("ready", result.stdout)
+ self.assertNotIn("not built", result.stdout)
+
+ def test_chat_without_config_says_what_to_copy(self):
+ with tempfile.TemporaryDirectory() as model:
+ (Path(model) / "tokenizer.json").write_text("{}", encoding="utf-8")
+ result = self.run_cli("run", "--model", model, "hello")
+ self.assertNotEqual(result.returncode, 0)
+ out = result.stdout + result.stderr
+ self.assertIn("cannot read config.json", out)
+ self.assertIn("coli picks the engine from config.json", out)
+
def test_info_reads_registered_nested_text_config(self):
with tempfile.TemporaryDirectory() as model:
(Path(model) / "config.json").write_text(json.dumps({