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

Fix GPU detection on unified-memory chips; wire HF_TOKEN into downloader

ideaclawa920336cae27
diff --git a/c/resource_plan.py b/c/resource_plan.py
index 4a1014a7..c879cee3 100644
--- a/c/resource_plan.py
+++ b/c/resource_plan.py
@@ -157,9 +157,22 @@ def discover_gpus():
if len(fields) != 4:
continue
try:
- index, total, free = int(fields[0]), int(fields[2]), int(fields[3])
+ index = int(fields[0])
except ValueError:
continue
+ # Unified-memory chips (e.g. NVIDIA GB10 Grace Blackwell) have no
+ # discrete VRAM pool, so nvidia-smi reports memory.total/memory.free
+ # as "[N/A]" rather than a number. Fall back to system RAM figures
+ # in that case instead of silently dropping the GPU from discovery.
+ try:
+ total, free = int(fields[2]), int(fields[3])
+ except ValueError:
+ try:
+ meminfo = Path("/proc/meminfo").read_text()
+ total = int(re.search(r"MemTotal:\s+(\d+)", meminfo).group(1)) // 1024
+ free = memory_available() // (1024 * 1024)
+ except (OSError, AttributeError):
+ total = free = 0
devices.append({"index": index, "name": fields[1],
"total_bytes": total * 1024 * 1024,
"free_bytes": free * 1024 * 1024})
diff --git a/c/tools/convert_fp8_to_int4.py b/c/tools/convert_fp8_to_int4.py
index 447654d0..e9a27774 100644
--- a/c/tools/convert_fp8_to_int4.py
+++ b/c/tools/convert_fp8_to_int4.py
@@ -663,8 +663,9 @@ def main():
s0, s1 = segs[t]
while done[t] < s1 - s0 and not stopfail:
pos = s0 + done[t]
- req = urllib.request.Request(url, headers={"User-Agent": "colibri-convert",
- "Range": f"bytes={pos}-{s1-1}"})
+ _hdrs = {"User-Agent": "colibri-convert", "Range": f"bytes={pos}-{s1-1}"}
+ if os.environ.get("HF_TOKEN"): _hdrs["Authorization"] = f"Bearer {os.environ['HF_TOKEN']}"
+ req = urllib.request.Request(url, headers=_hdrs)
try:
with urllib.request.urlopen(req, timeout=8) as r:
if r.status != 206: # Range ignorato: multi-stream impossibile
@@ -727,6 +728,7 @@ def main():
have0 = have
req = urllib.request.Request(url, headers={"User-Agent": "colibri-convert"})
if have: req.add_header("Range", f"bytes={have}-")
+ if os.environ.get("HF_TOKEN"): req.add_header("Authorization", f"Bearer {os.environ['HF_TOKEN']}")
try:
with urllib.request.urlopen(req, timeout=8) as r:
if have and r.status == 200: # server ha ignorato il Range: riparti pulito