Stable diffusion webui Error

2024. 7. 29. 10:03·ML & DL/Computer vision

오늘은 stable diffusion webui를 이용하다가 발생한 오류 해결방법을 정리해보려고 한다.

아무것도 모른 채로 stable diffusion webui를 설치한 다음, 내 이미지로 학습시키기 위해 뒤적거리다가 `Dreambooth`라는 것을 발견했는데, 이 `Dreambooth`를 설치하면서 2가지 오류가 발생했고 그에 대한 해결책이다.

 

1. AssertionError: extension access disabled because of command line flags 

이 오류는 web ui에서 extension 창에 들어가서 dreambooth를 검색한 다음 install 버튼을 누르고 생긴 오류로, dreambooth의 설치 자체가 안 되는 오류였다. 

(나중에도 계속 발생했는데, 모두 --share이나 --listen 옵션을 키고 extension을 설치하려할 때 마다 발생하는 오류였다. 즉 저 두 옵션을 빼고 설치하고 다시 실행하면 된다. --listen 옵션을 키는 이유는 ollama에서 사용하기 위해서 썼었음)

해결방법은 webui 실행시 `--share` 혹은 `--listen` arguments를 제외하고 실행 후 다시 설치해 보면 정상적으로 설치된다.

 

Error during install · Issue #670 · d8ahazard/sd_dreambooth_extension

I'm encountering an error while installing from the setting tab, and cmd prompt gave the following error: assert not shared.cmd_opts.disable_extension_access, "extension access disabled because of ...

github.com

2. CUDA Setup failed despite GPU being available

이 오류는 dreambooth를 설치한 이후, webui를 재시작하려는데 시작이 안되는 오류였다.

/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/bitsandbytes/cuda_setup/main.py:183: UserWarning: /home/bch/miniconda3/envs/stable_diffusion did not contain ['libcudart.so', 'libcudart.so.11.0', 'libcudart.so.12.0', 'libcudart.so.12.1', 'libcudart.so.12.2'] as expected! Searching further paths...
  warn(msg)
The following directories listed in your path were found to be non-existent: {PosixPath('tmp/restart')}
CUDA_SETUP: WARNING! libcudart.so not found in any environmental path. Searching in backup paths...
The following directories listed in your path were found to be non-existent: {PosixPath('/usr/local/cuda/lib64')}
DEBUG: Possible options found for libcudart.so: set()
CUDA SETUP: PyTorch settings found: CUDA_VERSION=121, Highest Compute Capability: 7.5.
CUDA SETUP: To manually override the PyTorch CUDA version please see:https://github.com/TimDettmers/bitsandbytes/blob/main/how_to_use_nonpytorch_cuda.md
CUDA SETUP: Loading binary /home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cuda121.so...
libcusparse.so.12: cannot open shared object file: No such file or directory
CUDA SETUP: Problem: The main issue seems to be that the main CUDA runtime library was not detected.
CUDA SETUP: Solution 1: To solve the issue the libcudart.so location needs to be added to the LD_LIBRARY_PATH variable
CUDA SETUP: Solution 1a): Find the cuda runtime library via: find / -name libcudart.so 2>/dev/null
CUDA SETUP: Solution 1b): Once the library is found add it to the LD_LIBRARY_PATH: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:FOUND_PATH_FROM_1a
CUDA SETUP: Solution 1c): For a permanent solution add the export from 1b into your .bashrc file, located at ~/.bashrc
CUDA SETUP: Solution 2: If no library was found in step 1a) you need to install CUDA.
CUDA SETUP: Solution 2a): Download CUDA install script: wget https://raw.githubusercontent.com/TimDettmers/bitsandbytes/main/cuda_install.sh
CUDA SETUP: Solution 2b): Install desired CUDA version to desired location. The syntax is bash cuda_install.sh CUDA_VERSION PATH_TO_INSTALL_INTO.
CUDA SETUP: Solution 2b): For example, "bash cuda_install.sh 113 ~/local/" will download CUDA 11.3 and install into the folder ~/local
Traceback (most recent call last):
  File "/home/bch/Project/stable-diffusion-webui/launch.py", line 48, in <module>
    main()
  File "/home/bch/Project/stable-diffusion-webui/launch.py", line 44, in main
    start()
  File "/home/bch/Project/stable-diffusion-webui/modules/launch_utils.py", line 465, in start
    import webui
  File "/home/bch/Project/stable-diffusion-webui/webui.py", line 13, in <module>
    initialize.imports()
  File "/home/bch/Project/stable-diffusion-webui/modules/initialize.py", line 26, in imports
    from modules import paths, timer, import_hook, errors  # noqa: F401
  File "/home/bch/Project/stable-diffusion-webui/modules/paths.py", line 60, in <module>
    import sgm  # noqa: F401
  File "/home/bch/Project/stable-diffusion-webui/repositories/generative-models/sgm/__init__.py", line 1, in <module>
    from .models import AutoencodingEngine, DiffusionEngine
  File "/home/bch/Project/stable-diffusion-webui/repositories/generative-models/sgm/models/__init__.py", line 1, in <module>
    from .autoencoder import AutoencodingEngine
  File "/home/bch/Project/stable-diffusion-webui/repositories/generative-models/sgm/models/autoencoder.py", line 12, in <module>
    from ..modules.diffusionmodules.model import Decoder, Encoder
  File "/home/bch/Project/stable-diffusion-webui/repositories/generative-models/sgm/modules/__init__.py", line 1, in <module>
    from .encoders.modules import GeneralConditioner
  File "/home/bch/Project/stable-diffusion-webui/repositories/generative-models/sgm/modules/encoders/modules.py", line 5, in <module>
    import kornia
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/kornia/__init__.py", line 11, in <module>
    from . import augmentation, color, contrib, core, enhance, feature, io, losses, metrics, morphology, tracking, utils, x
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/kornia/x/__init__.py", line 2, in <module>
    from .trainer import Trainer
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/kornia/x/trainer.py", line 11, in <module>
    from accelerate import Accelerator
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/accelerate/__init__.py", line 3, in <module>
    from .accelerator import Accelerator
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/accelerate/accelerator.py", line 35, in <module>
    from .checkpointing import load_accelerator_state, load_custom_state, save_accelerator_state, save_custom_state
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/accelerate/checkpointing.py", line 24, in <module>
    from .utils import (
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/accelerate/utils/__init__.py", line 131, in <module>
    from .bnb import has_4bit_bnb_layers, load_and_quantize_model
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/accelerate/utils/bnb.py", line 42, in <module>
    import bitsandbytes as bnb
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/bitsandbytes/__init__.py", line 6, in <module>
    from . import cuda_setup, research, utils
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/bitsandbytes/research/__init__.py", line 2, in <module>
    from .autograd._functions import (
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/bitsandbytes/research/autograd/_functions.py", line 8, in <module>
    from bitsandbytes.autograd._functions import GlobalOutlierPooler, MatmulLtState
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/bitsandbytes/autograd/__init__.py", line 1, in <module>
    from ._functions import get_inverse_transform_indices, undo_layout
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/bitsandbytes/autograd/_functions.py", line 10, in <module>
    import bitsandbytes.functional as F
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/bitsandbytes/functional.py", line 17, in <module>
    from .cextension import COMPILED_WITH_CUDA, lib
  File "/home/bch/Project/stable-diffusion-webui/venv/lib/python3.10/site-packages/bitsandbytes/cextension.py", line 17, in <module>
    raise RuntimeError('''
RuntimeError: 
        CUDA Setup failed despite GPU being available. Please run the following command to get more information:

        python -m bitsandbytes

        Inspect the output of the command and see if you can locate CUDA libraries. You might need to add them
        to your LD_LIBRARY_PATH. If you suspect a bug, please take the information from python -m bitsandbytes
        and open an issue at: https://github.com/TimDettmers/bitsandbytes/issues

뭐 위와 같은 오류들이 떳었는데, 요약하면 `CUDA Setup failed despite GPU being available`가 발생했고 `bindsandbytes`라는 것 때문에 발생한 것 같았다.

이 오류는 찾아보니 window유저들은 뭐 다른 버전의 bindsandbytes를 설치해라 이런 해결책도 있었는데, 나는 다른 버전을 설치해도 계속 오류가 발생했고, 나는 Ubuntu 22.04를 이용 중이었다.

아무튼 해결책은 이유는 모르지만 아래 커맨드를 통해 해결했다. torch와 torchvision을 재설치하니 거짓말처럼 멀쩡해지고 dreambooth도 사용가능해졌다! 

https://www.reddit.com/r/StableDiffusion/comments/16tny9z/comment/k2g322e/?utm_source=share&utm_medium=web2x&context=3

cd stable-diffusion-webui                 # move to cloned repository
 
.venv/bin/activate                        # activate env

pip uninstall torchvision torch

pip install torchvision torch

 

 

 

 

 

728x90

'ML & DL > Computer vision' 카테고리의 다른 글

ViT: Vision Transformer  (0) 2024.02.26
Transformer  (0) 2024.02.24
Computer vision Metric  (0) 2024.02.23
FCN: Fully Convolutional Network  (0) 2024.02.02
Semantic segmentation 방식  (0) 2024.02.02
'ML & DL/Computer vision' 카테고리의 다른 글
  • ViT: Vision Transformer
  • Transformer
  • Computer vision Metric
  • FCN: Fully Convolutional Network
창빵맨
창빵맨
  • 창빵맨
    Let's be Developers
    창빵맨
    로그인/로그아웃
  • 전체
    오늘
    어제
    • 분류 전체보기 (472)
      • 알쓸신잡 (80)
      • ML & DL (85)
        • Computer v.. (22)
        • NLP (22)
        • 파이썬 머신러닝 완.. (3)
        • 개념정리 (38)
      • 리눅스 (21)
      • 프로젝트 (29)
        • 산불 발생 예측 (6)
        • 음성비서 (12)
        • pdf 병합 프로그.. (0)
        • 수위 예측 (5)
        • 가짜 뉴스 분류 (5)
        • 전력사용량 예측 (1)
      • 코딩테스트 (217)
        • 프로그래머스[Pyt.. (17)
        • 프로그래머스[Fai.. (3)
        • 백준[Python] (160)
        • 이것이취업을위한코딩.. (18)
        • 파이썬 알고리즘 (19)
      • 데이터분석실습 (25)
        • 데이터 과학 기반의.. (18)
        • 헬로 데이터 과학 (7)
      • 메모장 (0)
      • 잡담 (4)
  • Blog

    • 🏠 Home

    ✏️글쓰기
    💻 관리

    Personal

    GITHUB
    Instagram
  • 공지사항

  • 인기 글

  • 태그

    이것이취업을위한코딩테스트다
    나동빈
    파이썬
    이코테
    dp
    백준
    DFS
    BFS
    이분탐색
    그리디
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
상단으로

티스토리툴바