abetlen / abetlen/llama-cpp-python

Can't disable CMAKE ARG on Apple: GGML_METAL=OFF

Aperta
#2,050 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
10.6k
Fork
1.4k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

# Expected Behavior

I can disable GGML_METAL and enable GGML_VULKAN.

# Current Behavior

Due to this [line in the CMAKE config](https://github.com/abetlen/llama-cpp-python/blob/main/CMakeLists.txt#L95) I cannot set `GGML_METAL=OFF` as it is forced.

# Environment and Context

I'm trying to build `GGML_VULKAN=ON` with Metal off as I want to use MoltenVK on my Intel MBP with an AMD GPU. I have already successfully don't this directly with llama.cpp.

I am having to resort to cloning the repo and patching the lines by hand, which is not ideal.

* Physical (or virtual) hardware you are using, e.g. for Linux:

2019 Intel MBP

* Operating System, e.g. for Linux:

MacOS 15.5

* SDK version, e.g. for Linux:

```
Python 3.11.9

GNU Make 3.81

Apple clang version 16.0.0 (clang-1600.0.26.4)
Target: x86_64-apple-darwin24.5.0
Thread model: posix
```

# Steps to Reproduce

```
CMAKE_ARGS="-DGGML_METAL=OFF -DGGML_VULKAN=ON \
-DVulkan_INCLUDE_DIR=/Users/brenden/VulkanSDK/1.4.309.0/macOS/include \
-DVulkan_LIBRARY=/Users/brenden/VulkanSDK/1.4.309.0/macOS/lib/libMoltenVK.dylib \
-DOpenMP_ROOT=$(brew --prefix)/opt/libomp \
-DVulkan_GLSLC_EXECUTABLE=$(brew --prefix)/opt/shaderc/bin/glslc \
-DVulkan_GLSLANG_VALIDATOR_EXECUTABLE=$(brew --prefix)/opt/glslang/bin/glslangValidator \
-DOpenMP_C_FLAGS=-fopenmp=lomp \
-DOpenMP_CXX_FLAGS=-fopenmp=lomp \
-DOpenMP_C_LIB_NAMES=libomp \
-DOpenMP_CXX_LIB_NAMES=libomp \
-DOpenMP_libomp_LIBRARY=$(brew --prefix)/opt/libomp/lib/libomp.dylib \
-DOpenMP_CXX_FLAGS=\"-Xpreprocessor -fopenmp $(brew --prefix)/opt/libomp/lib/libomp.dylib -I$(brew --prefix)/opt/libomp/include\" \
-DOpenMP_CXX_LIB_NAMES=libomp \
-DOpenMP_C_FLAGS=\"-Xpreprocessor -fopenmp $(brew --prefix)/opt/libomp/lib/libomp.dylib -I$(brew --prefix)/opt/libomp/include\"" FORCE_CMAKE=1 pip install --no-binary=llama-cpp-python --no-cache-dir -v llama-cpp-python
```
(NOTE: These args are derived from what I used to compile a MoltenVK/Vulkan build of llama.cpp using a version of llama.cpp that is from June 2025.

GGML Metal backend runs when you run the server.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.