hako-mikan / sd-webui-traintrain

LoRA training extention for Stable Diffusion Web-UI
GNU Affero General Public License v3.0
131 stars 4 forks source link

CUDA Setup failed despite GPU being available #7

Closed sandner-art closed 3 months ago

sandner-art commented 5 months ago

After installation, A1111 will not start with these errors. Is it upgrading or downgrading anything cuda or bitsandbytes related? Maybe it interferes with some extension? Do you know a solution to this? I have tried reinstall bitsandbytes, also removing this traintrain extension but no luck. On fresh A1111 install it runs, but shows PermissionError: [Errno 13] Permission denied: when trying to save a setting... The original error:

Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues

binary_path: C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\cuda_setup\libbitsandbytes_cuda116.dll CUDA SETUP: Loading binary C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\cuda_setup\libbitsandbytes_cuda116.dll... Could not find module 'C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\cuda_setup\libbitsandbytes_cuda116.dll' (or one of its dependencies). Try using the full path with constructor syntax. CUDA SETUP: Loading binary C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\cuda_setup\libbitsandbytes_cuda116.dll... Could not find module 'C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\cuda_setup\libbitsandbytes_cuda116.dll' (or one of its dependencies). Try using the full path with constructor syntax. CUDA SETUP: Loading binary C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\cuda_setup\libbitsandbytes_cuda116.dll... Could not find module 'C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\cuda_setup\libbitsandbytes_cuda116.dll' (or one of its dependencies). Try using the full path with constructor syntax. CUDA SETUP: Problem: The main issue seems to be that the main CUDA library was not detected. CUDA SETUP: Solution 1): Your paths are probably not up-to-date. You can update them via: sudo ldconfig. CUDA SETUP: Solution 2): If you do not have sudo rights, you can do the following: CUDA SETUP: Solution 2a): Find the cuda library via: find / -name libcuda.so 2>/dev/null CUDA SETUP: Solution 2b): Once the library is found add it to the LD_LIBRARY_PATH: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:FOUND_PATH_FROM_2a CUDA SETUP: Solution 2c): For a permanent solution add the export from 2b into your .bashrc file, located at ~/.bashrc Traceback (most recent call last): File "C:\SDXL\stable-diffusion-webui\launch.py", line 48, in main() File "C:\SDXL\stable-diffusion-webui\launch.py", line 44, in main start() File "C:\SDXL\stable-diffusion-webui\modules\launch_utils.py", line 465, in start import webui File "C:\SDXL\stable-diffusion-webui\webui.py", line 13, in initialize.imports() File "C:\SDXL\stable-diffusion-webui\modules\initialize.py", line 26, in imports from modules import paths, timer, import_hook, errors # noqa: F401 File "C:\SDXL\stable-diffusion-webui\modules\paths.py", line 60, in import sgm # noqa: F401 File "C:\SDXL\stable-diffusion-webui\repositories\generative-models\sgm__init.py", line 1, in from .models import AutoencodingEngine, DiffusionEngine File "C:\SDXL\stable-diffusion-webui\repositories\generative-models\sgm\models__init.py", line 1, in from .autoencoder import AutoencodingEngine File "C:\SDXL\stable-diffusion-webui\repositories\generative-models\sgm\models\autoencoder.py", line 12, in from ..modules.diffusionmodules.model import Decoder, Encoder File "C:\SDXL\stable-diffusion-webui\repositories\generative-models\sgm\modules\init.py", line 1, in from .encoders.modules import GeneralConditioner File "C:\SDXL\stable-diffusion-webui\repositories\generative-models\sgm\modules\encoders\modules.py", line 5, in import kornia File "C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\kornia\init.py", line 11, in from . import augmentation, color, contrib, core, enhance, feature, io, losses, metrics, morphology, tracking, utils, x File "C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\kornia\x\init.py", line 2, in from .trainer import Trainer File "C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\kornia\x\trainer.py", line 11, in from accelerate import Accelerator File "C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\accelerate\init.py", line 3, in from .accelerator import Accelerator File "C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\accelerate\accelerator.py", line 35, in from .checkpointing import load_accelerator_state, load_custom_state, save_accelerator_state, save_custom_state File "C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\accelerate\checkpointing.py", line 24, in from .utils import ( File "C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\accelerate\utils\init.py", line 131, in from .bnb import has_4bit_bnb_layers, load_and_quantize_model File "C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\accelerate\utils\bnb.py", line 42, in import bitsandbytes as bnb File "C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\init__.py", line 7, in from .autograd._functions import ( File "C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\autograd\init__.py", line 1, in from ._functions import undo_layout, get_inverse_transform_indices File "C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\autograd_functions.py", line 9, in import bitsandbytes.functional as F File "C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\functional.py", line 17, in from .cextension import COMPILED_WITH_CUDA, lib File "C:\SDXL\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\cextension.py", line 22, in raise RuntimeError(''' RuntimeError: CUDA Setup failed despite GPU being available. Inspect the CUDA SETUP outputs above to fix your environment! If you cannot find any issues and suspect a bug, please open an issue with detals about your environment: https://github.com/TimDettmers/bitsandbytes/issues Drücken Sie eine beliebige Taste . . .

hako-mikan commented 5 months ago

This error usually does not occur. Considering it's a permission error, I think the problem is likely due to it being installed on the C drive.

za-wa-n-go commented 4 months ago

In my case, this fixed it.

  1. Enable Virtual Environment.
  2. python -m pip uninstall bitsandbytes
  3. python -m pip install https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.1-py3-none-win_amd64.whl

https://github.com/TimDettmers/bitsandbytes/issues/1059#issuecomment-1950293501

(I use StabilityMatrix.)

Derjyn commented 4 months ago

It's not likely a permissions issue. I watched the install (which also failed for me), and it looks like a virtual environment wasn't referenced on (some?) steps. This resulted in some of my global libraries being screwed up, which is always just a pleasure to deal with.

The versions of various libraries referenced and such would by my guess. 99% of the other extensions and utilities I personally use are just fine, so when there is a particular one that doesn't play nice, I don't blame the other parts of the environment that follows standards and stable version adherence.

At any rate, the fix by @za-wa-n-go worked for me, so hopefully that's the only major issue!

hako-mikan commented 3 months ago

Thanks @za-wa-n-go