stable-diffusion
stable-diffusion copied to clipboard
CUDA driver initialization failed, you might not have a CUDA gpu.
Hi, I'm new to all of this so please bear with me.
When I run nvidia-smi in conda to see if cuda is installed, I get back:
NVIDIA-SMI 426.78 Driver Version: 426.78 CUDA Version: 10.1
However I keep receiving the,
RuntimeError: CUDA driver initialization failed, you might not have a CUDA gpu.
whenever I try to run Diffusion.
I was thinking that since the environment was downloading the cudatoolkit version 11.3 (or something) that maybe my version of cuda isn't sufficient enough. Like I said, no idea what I am talking about so hopefully someone much smarter will be able to glean something from this :-)
UPDATE
I checked the cuda toolkit version with the nvcc -V command and it says:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Mar_21_19:24:09_Pacific_Daylight_Time_2021
Cuda compilation tools, release 11.3, V11.3.58
Build cuda_11.3.r11.3/compiler.29745058_0
So I am not sure why it still says I might not have a cuda GPU.
What happens if you run:
import torch
print(torch.cuda.is_available())
print(torch.__version__)
Same issue here, everything including torch check is here:
File "scripts/txt2img.py", line 346, in <module>
main()
File "scripts/txt2img.py", line 242, in main
model = load_model_from_config(config, f"{opt.ckpt}")
File "scripts/txt2img.py", line 65, in load_model_from_config
model.cuda()
File "/home/centos/miniconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/core/mixins/device_dtype_mixin.py", line 127, in cuda
return super().cuda(device=device)
File "/home/centos/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 688, in cuda
return self._apply(lambda t: t.cuda(device))
File "/home/centos/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply
module._apply(fn)
File "/home/centos/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply
module._apply(fn)
File "/home/centos/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply
module._apply(fn)
[Previous line repeated 1 more time]
File "/home/centos/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 601, in _apply
param_applied = fn(param)
File "/home/centos/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 688, in <lambda>
return self._apply(lambda t: t.cuda(device))
File "/home/centos/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/cuda/__init__.py", line 216, in _lazy_init
torch._C._cuda_init()
RuntimeError: CUDA driver initialization failed, you might not have a CUDA gpu.
(ldm) [centos@ip-20-0-4-157 stable-diffusion]$ nvidia-smi
Mon Sep 5 20:06:40 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.33.01 Driver Version: 440.33.01 CUDA Version: 10.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla T4 Off | 00000000:00:1E.0 Off | 0 |
| N/A 48C P0 27W / 70W | 1468MiB / 15109MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 22218 C ...ntos/miniconda3/envs/my_env/bin/python3 1457MiB |
+-----------------------------------------------------------------------------+
(ldm) [centos@ip-20-0-4-157 stable-diffusion]$ python
Python 3.8.5 (default, Sep 4 2020, 07:30:14)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.cuda.is_available())
/home/centos/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/cuda/__init__.py:82: UserWarning: CUDA initialization: CUDA driver initialization failed, you might not have a CUDA gpu. (Triggered internally at /opt/conda/conda-bld/pytorch_1646755903507/work/c10/cuda/CUDAFunctions.cpp:112.)
return torch._C._cuda_getDeviceCount() > 0
False
>>> print(torch.__version__)
1.11.0
>>>```
Found the solution, works for me: `conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
Found the solution, works for me: `conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
it works!
I'm getting the following error after installing the said cuda toolkit:
cannot import name 'PILLOW_VERSION' from 'PIL'
Please help.
I'm getting the following error after installing the said cuda toolkit:
cannot import name 'PILLOW_VERSION' from 'PIL'
Please help.
me too
I'm getting the following error after installing the said cuda toolkit:
cannot import name 'PILLOW_VERSION' from 'PIL'
Please help.
me too
getting the same error
this is what I did to solve it
pip install "pillow<7"
Found the solution, works for me: `conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
it works! Hi, Have you gotten it working? I am having the same issue but unsure what to do with it?
Thanks!