feat: Update vendored llama.cpp to include ModernBERT support
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 功能
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
研究方向
此 issue 要求將 vendored llama.cpp 子模組更新到 2025 年 12 月 22 日之後的某個 commit,然後更新 llama_cpp/llama_cpp.py 中的 Python ctypes binding,使其符合變更後的 C API(例如,llama_get_kv_self 已不存在)。此外,也需要修正 CMakeLists.txt,尤其是 LLAVA_BUILD 相關的部分。請先檢查目前的 vendor/llama.cpp 子模組和 binding 程式碼,接著檢查目標 commit 中 llama.cpp C API 的變更。使用 -DLLAVA_BUILD=OFF 進行建置是一種 workaround,但 binding 必須完全相容。當函式庫能夠無錯誤地載入 ModernBERT GGUF 模型時,即可視為完成。
由索引模型根據 Issue 內容生成。
描述
Context
The current release (v0.3.16, Aug 15 2025) vendors llama.cpp at commit 4227c9b (Aug 14, 2025). ModernBERT architecture support was added to llama.cpp on Dec 22, 2025 in PR ggml-org/llama.cpp#15641 (src/models/modern-bert.cpp). The vendor submodule hasn't been updated in ~7 months.
Problem
Loading a ModernBERT GGUF model fails with:
llama_model_load: error loading model: error loading model architecture: unknown model architecture: 'modernbert'
The binary only knows: bert, falcon, gemma, gpt2, llama, mamba, qwen, rwkv, stablelm — no modernbert.
Attempted fix
We tried updating the vendor submodule to llama.cpp b8373 (Mar 16, 2026) and building from source. Results:
- CMake fails with
LLAVA_BUILD=ON(default) —vendor/llama.cpp/tools/mtmd/CMakeLists.txt:37has aset_target_propertieserror incompatible with the binding's CMakeLists.txt - CMake succeeds with
-DLLAVA_BUILD=OFF— builds and installs fine - Runtime ABI mismatch — the Python bindings call
llama_get_kv_selfwhich no longer exists in b8373 (symbol not found). The C API has diverged significantly in 7 months.
So it's not just a submodule bump — the Python ctypes bindings need updates to match the current llama.cpp C API.
Why it matters
Several recent high-quality embedding models use ModernBERT architecture:
- granite-embedding-small-english-r2 (IBM, 47M params, 384d, BEIR NDCG@10 50.9, Apache 2.0)
- modernbert-embed-base (Nomic, 149M params, Apache 2.0)
- gte-modernbert-base (Alibaba, 149M params)
These models can't be used with llama-cpp-python until the binding is updated.
Request
Update the Python ctypes bindings and CMakeLists.txt to be compatible with a recent llama.cpp build that includes ModernBERT support (post Dec 22, 2025).
- 主要語言
- Python
- 星號
- 10.7k
- 分支
- 1.5k
- 平均合併
- 1 小時 40 分鐘
- 30 天內合併 PR
- 5
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
abetlen/llama-cpp-python 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
abetlen/llama-cpp-python#2424 ·
維護者通常 1 天內回覆
-
Seven llama_sampler_init_* bindings admit keyword arguments that the ctypes function object silently drops可能已有人在做 @Belal0066 於 59 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 88/100
abetlen/llama-cpp-python#2371 ·
維護者通常 1 天內回覆
-
uv add llama-cpp-python wheels fails for versions above 0.3.30可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 65/100
abetlen/llama-cpp-python#2352 · 1 則留言 · 3 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
abetlen/llama-cpp-python#2314 ·
維護者通常 1 天內回覆
-
Llama.embed() calls LlamaBatch.add_sequence with old 3-arg signature; missing logits_array可能重新可做 @lxcxjxhx 於 136 天前認領,目前沒有進行中的 PR。 未關閉
難度 2/5 1-3 小時 新手友好度 65/100
abetlen/llama-cpp-python#2211 · 2 則留言 ·
維護者通常 1 天內回覆
查看 abetlen/llama-cpp-python 的全部 Issue
相似的 Issue
-
Bug IronPython Python 3
難度 2/5 1-3 小時 新手友好度 72/100
pyrevitlabs/pyRevit#4184 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 74/100
jqueryscript/awesome-claude-code#1009 ·
-
tests
難度 2/5 1-3 小時 新手友好度 66/100
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 74/100