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 绑定,使其匹配变更后的 C API(例如,llama_get_kv_self 已不存在)。此外,还需要修复 CMakeLists.txt,尤其是 LLAVA_BUILD 相关的部分。首先检查当前的 vendor/llama.cpp 子模块和绑定代码,然后检查目标 commit 中 llama.cpp C API 的变更。使用 -DLLAVA_BUILD=OFF 进行构建是一种 workaround,但绑定必须完全兼容。当库能够无错误地加载 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