Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの 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 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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 のコミットが使用されていることの確認が必要になる可能性があります。

索引モデルが 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分
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

abetlen/llama-cpp-python のほかの issue

abetlen/llama-cpp-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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