Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

AttributeError: function 'llama_get_kv_self' not found. Did you mean: 'llama_get_model'? after compiling llama-cpp-python on Windows

未關閉
#2,074 3 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
45/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
c, python

研究方向

錯誤發生在 llama_cpp.py 第 1408 行,其中 ctypes 函式裝飾器嘗試從已編譯的函式庫載入 'llama_get_kv_self'。檢查底層 llama.cpp 函式庫的版本及其匯出的符號,尤其是在 Windows 上進行啟用 CUDA 的建置之後。將 _ctypes_extensions.py 中的繫結與實際的 DLL 進行比較。修正可能需要更新繫結,或確保使用正確的 llama.cpp commit。

由索引模型根據 Issue 內容生成。

描述

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new bug or useful enhancement to share.

Expected Behavior

Hello, basically I am trying to compile and install llama-cpp-python with cuda on Windows 11 following this https://github.com/abetlen/llama-cpp-python/issues/1963 guide. It installs perfectly fine, but I am running into the issue mentioned in the header.

Current Behavior

when importing Llama in a python script, I get the following error:
AttributeError: function 'llama_get_kv_self' not found. Did you mean: 'llama_get_model'?
it is thrown when calling
import llama_cpp

Environment and Context

I am using Windows 11 using a Ryzen 5700x and an RTX 4070. I am trying to install llama-cpp-python into a venv based on Python 3.11.9 and have also tried it with Python 3.13.xx. Also tested straight into python without venv.

Failure Information (for bugs)

Traceback (most recent call last):
File ".\testLlamaCpp.py", line 1, in
import llama_cpp
File "..venv\Lib\site-packages\llama_cpp_init_.py", line 1, in
from .llama_cpp import *
File "..venv\Lib\site-packages\llama_cpp\llama_cpp.py", line 1408, in
@ctypes_function(
^^^^^^^^^^^^^^^^
File "..venv\Lib\site-packages\llama_cpp_ctypes_extensions.py", line 113, in decorator
func = getattr(lib, name)
^^^^^^^^^^^^^^^^^^
File "\AppData\Local\Programs\Python\Python311\Lib\ctypes_init_.py", line 389, in getattr
func = self.getitem(name)
^^^^^^^^^^^^^^^^^^^^^^
File "
\AppData\Local\Programs\Python\Python311\Lib\ctypes_init_.py", line 394, in getitem
func = self._FuncPtr((name_or_ordinal, self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: function 'llama_get_kv_self' not found. Did you mean: 'llama_get_model'?

Steps to Reproduce

Compile llama-cpp-python on windows using the guide mentioned.
import llama_cpp

主要語言
Python
星號
10.6k
分支
1.5k
平均合併
3 小時 57 分鐘
30 天內合併 PR
4

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

abetlen/llama-cpp-python 的其他 Issue

查看 abetlen/llama-cpp-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。