ggml_cuda_init: failed to initialize CUDA: (null) on Windows with CUDA 12.9
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Domaine
- ai-infra-agents, backend
Piste de recherche
L’issue concerne un échec de l’initialisation de CUDA sous Windows avec CUDA 12.9. Commencez par examiner les journaux de build et la configuration de CMake (flag GGML_CUDA). Vérifiez la fonction ggml_cuda_init dans le code source de llama.cpp afin de comprendre les vérifications du runtime CUDA. Vérifiez l’installation du toolkit CUDA, la compatibilité du pilote et les variables d’environnement. L’exécution d’un programme de test CUDA simple en dehors de la bibliothèque peut aider à isoler le problème.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
System Information:
- OS: Windows
- GPU: NVIDIA GeForce RTX 5060 Ti
- NVIDIA Driver Version: 577.00
- CUDA Version (from
nvidia-smi): 12.9 - Python Version: 3.12
- Visual Studio: Visual Studio 2019 with "Desktop development with C++" workload
Problem Description:
I am unable to get llama-cpp-python to use my GPU. When I run a script to load a model with n_gpu_layers=-1, I get the error ggml_cuda_init: failed to initialize CUDA: (null), and all layers are
loaded on the CPU.
Troubleshooting Steps Taken:
- Installed llama-cpp-python using the following command in the "x64 Native Tools Command Prompt for VS 2019" with a Python virtual environment activated:
1 set CMAKE_ARGS="-DGGML_CUDA=on" && pip install --upgrade --force-reinstall llama-cpp-python --no-cache-dir - Verified that the command completes successfully, but the resulting installation does not use the GPU.
- Tried using the deprecated LLAMA_CUBLAS flag, which resulted in a build error (as expected).
- Performed a full cleanup of the environment:
- pip uninstall llama-cpp-python
- pip cache purge
- Manually deleted leftover ~* directories from site-packages.
- Reinstalled after the cleanup, but the problem persists.
- Installed PyTorch with CUDA 12.1 support (pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121) before reinstalling llama-cpp-python, but this did not
resolve the issue. - Confirmed that the correct Python interpreter and virtual environment are being used.
- The run_with_llama_cpp.py script being used is:
1 from llama_cpp import Llama
2
3 llm = Llama(
4 model_path="models/mistral-7b-instruct-v0.2.Q4_K_M.gguf",
5 n_gpu_layers=-1,
6 n_ctx=4096,
7 verbose=True
8 )
9
10 output = llm(
11 "AI is going to ",
12 max_tokens=32,
13 stop=["."],
14 echo=True
15 )
16
17 print(output)
Request:
Could you please provide any insights into why the CUDA initialization might be failing, or suggest any further diagnostic steps? I can provide the full verbose build log if needed.
- Langage dominant
- Python
- Étoiles
- 10.6k
- Forks
- 1.5k
- Merge moyen
- 3 h 57 min
- PR mergées (30 j)
- 4
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de abetlen/llama-cpp-python
-
Seven llama_sampler_init_* bindings admit keyword arguments that the ctypes function object silently dropsPeut-être pris @Belal0066 l’a pris il y a 15 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
abetlen/llama-cpp-python#2371 ·
Les mainteneurs répondent en général sous 1 jour
-
uv add llama-cpp-python wheels fails for versions above 0.3.30Peut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
abetlen/llama-cpp-python#2352 · 1 commentaire · 2 réactions ·
Les mainteneurs répondent en général sous 1 jour
-
Docs: consolidate build-from-source and GPU backend guidePeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
abetlen/llama-cpp-python#2314 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
abetlen/llama-cpp-python#2211 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Llama() silently accepts and discards `embedding` kwarg; .embed() then raises confusinglyPeut-être pris @Anai-Guo l’a pris il y a 32 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
abetlen/llama-cpp-python#2210 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de abetlen/llama-cpp-python
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
Vector35/community-plugins#376 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
py-econometrics/pyfixest#1883 ·
Les mainteneurs répondent en général sous 1 jour
-
bad links in rfc5890.htmlOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
ietf-tools/rfc2html#81 ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
mysql/mysql-operator#60 ·
-
Python: Bug: split_plaintext_paragraph / split_markdown_paragraph can return a chunk larger than max_tokensPeut-être pris @xThreeh l’a pris aujourd’hui. Ouvertepython triage
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
microsoft/semantic-kernel#14566 ·
Les mainteneurs répondent en général sous 4 jours