abetlen / abetlen/llama-cpp-python

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

オープン
#2,050 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
10.6k
フォーク
1.4k
PR マージ指標
PR 指標を取得中

説明

# 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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。