Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ def _detect_gpu_backend() -> str:
if lib_ok and icd_ok:
return "vulkan"

# ── Apple Metal (macOS) ───────────────────────────────────────────────────
# Metal is available on all Apple Silicon (M1+) and most modern Intel Macs.
# node-llama-cpp supports Metal natively — just needs NODE_LLAMA_CPP_GPU=metal.
if sys.platform == "darwin":
metal_framework = Path("/System/Library/Frameworks/Metal.framework")
if metal_framework.exists():
return "metal"

# ── CPU fallback ──────────────────────────────────────────────────────────
# "false" tells node-llama-cpp: use CPU only, do NOT attempt to build any
# GPU backend from source. This avoids the CMake Vulkan errors entirely.
Expand Down
9 changes: 9 additions & 0 deletions helpers/qmd_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import json
import math
import os
import sys
import subprocess
import threading
from pathlib import Path
Expand Down Expand Up @@ -180,6 +181,14 @@ def _detect_gpu_backend() -> str:
if lib_ok and icd_ok:
return "vulkan"

# ── Apple Metal (macOS) ───────────────────────────────────────────────────
# Metal is available on all Apple Silicon (M1+) and most modern Intel Macs.
# node-llama-cpp supports Metal natively — just needs NODE_LLAMA_CPP_GPU=metal.
if sys.platform == "darwin":
metal_framework = Path("/System/Library/Frameworks/Metal.framework")
if metal_framework.exists():
return "metal"

# ── CPU fallback ──────────────────────────────────────────────────────────
return "false"

Expand Down