CUDA wheel installs, but GPU is never used on Windows 11 (Python 3.11, CUDA 12.1, torch finds GPU)
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 45/100
Rechercherichtung
Das Issue betrifft einen stillen Fallback auf CPU unter Windows mit CUDA 12.1. Beginne mit der Untersuchung der llama_cpp Python-Bindings, insbesondere der Logik zur Zuweisung von GPU-Layern und des Windows-spezifischen DLL-Ladens. Überprüfe die Build-Konfiguration für das cu121-Wheel und suche nach Umgebungsvariablen oder Laufzeitprüfungen, die die GPU-Nutzung deaktivieren könnten. Überprüfe die Logs beim Laden des Modells, um festzustellen, ob GPU-Layer angefordert, aber ignoriert werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
On Windows 11, with Python 3.11 and a CUDA 12.1-compatible NVIDIA GPU, I can successfully install llama-cpp-python via pip from the cu121 wheel, but no matter what, all model layers are always assigned to CPU only.
torch works and finds the GPU (torch.cuda.is_available() == True).
All paths and DLLs appear correct.
No errors, just silent fallback to CPU for every layer, even with n_gpu_layers set. Tried -1 and 32
I have confirmed this across multiple clean venvs and installs.
System Info
OS: Windows 11 Pro
GPU: NVIDIA RTX 4060 Ti, 16 GB VRAM
NVIDIA Driver Version: NVIDIA-SMI, 581.57
CUDA Toolkit Version: 12.1 (from PATH and NVIDIA tools)
Python Version: 3.11.x
llama-cpp-python Version: 0.3.16 (from pip show llama-cpp-python)
Installation Command:
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121
Model Used: Mistral 7B Q5_K GGUF (4.7GB)
What I Tried
Fresh venv (python -m venv envgpu311)
Confirmed correct Python version: where python → E:\envgpu311\Scripts\python.exe
pip list shows torch 2.5.1+cu121, llama-cpp-python 0.3.16
System PATH contains correct CUDA 12.1 bin directory
cudart64_121.dll is present in CUDA bin
Test script:
from llama_cpp import Llama
llm = Llama(model_path="E:/Python/Models/Mistral/lucian_model.gguf", n_ctx=512, n_gpu_layers=32, verbose=True)
print(llm("Hello, world!"))
Logs never mention CUDA or GPU, only assigned to device CPU for every layer.
torch tests pass:
import torch
print(torch.version) # 2.5.1+cu121
print(torch.cuda.is_available()) # True
Tried uninstalling all other venvs, cleaning PATH, and purging pip cache.
Also tried n_gpu_layers=-1 and 32 as stated above
What Happens
Model loads, runs, and produces output—but all layers go to CPU, no GPU assignment or CUDA logs, and performance matches CPU.
What I Expected
Layers assigned to GPU, CUDA logs in output, and at least some portion of the model running on GPU
Other Details
No error messages, just silent fallback to CPU.
Issue persists across all wheels and source builds tested.
pip show llama-cpp-python:
Name: llama_cpp_python
Version: 0.3.16
Location: E:\envgpu311\Lib\site-packages
Requires: diskcache, jinja2, numpy, typing-extensions
torch and other CUDA tools/apps detect GPU fine.
Latest NVIDIA driver installed 10/15/2025
- Vorherrschende Sprache
- Python
- Sterne
- 10.7k
- Forks
- 1.5k
- Ø Merge
- 1 Std. 40 Min.
- Gemergte PRs (30 T.)
- 5
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus abetlen/llama-cpp-python
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
abetlen/llama-cpp-python#2424 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Seven llama_sampler_init_* bindings admit keyword arguments that the ctypes function object silently dropsEvtl. vergeben @Belal0066 hat das vor 59 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
abetlen/llama-cpp-python#2371 ·
Maintainer antworten meist innerhalb von 1 Tag
-
uv add llama-cpp-python wheels fails for versions above 0.3.30Evtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
abetlen/llama-cpp-python#2352 · 1 Kommentar · 3 Reaktionen ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
abetlen/llama-cpp-python#2314 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Llama.embed() calls LlamaBatch.add_sequence with old 3-arg signature; missing logits_arrayEvtl. wieder frei @lxcxjxhx hat das vor 136 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
abetlen/llama-cpp-python#2211 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in abetlen/llama-cpp-python
Ähnliche Issues
-
Bug IronPython Python 3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
pyrevitlabs/pyRevit#4184 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 74/100
jqueryscript/awesome-claude-code#1009 ·
-
tests
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
[Plugin] 群聊记忆 · 人格养成Offen
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 74/100