lshqqytiger / stable-diffusion-webui-amdgpu

Stable Diffusion web UI
GNU Affero General Public License v3.0
1.69k stars 178 forks source link

[Bug]: LINUX Mint - ModuleNotFoundError: No module named 'torch_directml' #231

Closed andrio1988 closed 4 months ago

andrio1988 commented 11 months ago

Is there an existing issue for this?

What happened?

Linux gives the following error:

Using TCMalloc: libtcmalloc_minimal.so.4 fatal: Имена не найдены, не могу ничего описать. Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] Version: 1.5.1 Commit hash: b180d1df30125ed606f94a779536f2dfb8aca74a Launching Web UI with arguments: no module 'xformers'. Processing without... no module 'xformers'. Processing without... No module 'xformers'. Proceeding without it. Traceback (most recent call last): File "/home/andrey/SD/stable-diffusion-webui-directml/launch.py", line 39, in main() File "/home/andrey/SD/stable-diffusion-webui-directml/launch.py", line 35, in main start() File "/home/andrey/SD/stable-diffusion-webui-directml/modules/launch_utils.py", line 443, in start import webui File "/home/andrey/SD/stable-diffusion-webui-directml/webui.py", line 54, in from modules.call_queue import wrap_gradio_gpu_call, wrap_queued_call, queue_lock # noqa: F401 File "/home/andrey/SD/stable-diffusion-webui-directml/modules/call_queue.py", line 6, in from modules import shared, progress, errors File "/home/andrey/SD/stable-diffusion-webui-directml/modules/shared.py", line 72, in directml_init() File "/home/andrey/SD/stable-diffusion-webui-directml/modules/dml/init.py", line 38, in directml_init from modules.dml.backend import DirectML # pylint: disable=ungrouped-imports File "/home/andrey/SD/stable-diffusion-webui-directml/modules/dml/backend.py", line 4, in import torch_directml # pylint: disable=import-error ModuleNotFoundError: No module named 'torch_directml'

Reinstalled several times - the result is the same. On Windows, everything starts normally.

Steps to reproduce the problem

  1. git clone https://github.com/lshqqytiger/stable-diffusion-webui-directml

  2. Run webui.sh

What should have happened?

Nothing starts, I don't know what the problem is. In Windows, everything is installed normally.

Version or Commit where the problem happens

1.5.1

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

No response

What device are you running WebUI on?

No response

Cross attention optimization

Automatic

What browsers do you use to access the UI ?

No response

Command Line Arguments

No

List of extensions

No

Console logs

Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on andrey user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Using TCMalloc: libtcmalloc_minimal.so.4
fatal: Имена не найдены, не могу ничего описать.
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
Version: 1.5.1
Commit hash: b180d1df30125ed606f94a779536f2dfb8aca74a
Installing torch and torchvision
Looking in indexes: https://download.pytorch.org/whl/rocm5.4.2
Collecting torch==2.0.1+rocm5.4.2
  Using cached https://download.pytorch.org/whl/rocm5.4.2/torch-2.0.1%2Brocm5.4.2-cp310-cp310-linux_x86_64.whl (1536.4 MB)
Collecting torchvision==0.15.2+rocm5.4.2
  Using cached https://download.pytorch.org/whl/rocm5.4.2/torchvision-0.15.2%2Brocm5.4.2-cp310-cp310-linux_x86_64.whl (62.4 MB)
Collecting networkx
  Using cached https://download.pytorch.org/whl/networkx-3.0-py3-none-any.whl (2.0 MB)
Collecting jinja2
  Using cached https://download.pytorch.org/whl/Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting sympy
  Using cached https://download.pytorch.org/whl/sympy-1.11.1-py3-none-any.whl (6.5 MB)
Collecting filelock
  Using cached https://download.pytorch.org/whl/filelock-3.9.0-py3-none-any.whl (9.7 kB)
Collecting typing-extensions
  Using cached https://download.pytorch.org/whl/typing_extensions-4.4.0-py3-none-any.whl (26 kB)
Collecting pytorch-triton-rocm<2.1,>=2.0.0
  Using cached https://download.pytorch.org/whl/pytorch_triton_rocm-2.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (78.4 MB)
Collecting numpy
  Using cached https://download.pytorch.org/whl/numpy-1.24.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)
Collecting pillow!=8.3.*,>=5.3.0
  Using cached https://download.pytorch.org/whl/Pillow-9.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB)
Collecting requests
  Using cached https://download.pytorch.org/whl/requests-2.28.1-py3-none-any.whl (62 kB)
Collecting lit
  Using cached https://download.pytorch.org/whl/lit-15.0.7.tar.gz (132 kB)
  Preparing metadata (setup.py) ... done
Collecting cmake
  Using cached https://download.pytorch.org/whl/cmake-3.25.0-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.7 MB)
Collecting MarkupSafe>=2.0
  Using cached https://download.pytorch.org/whl/MarkupSafe-2.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached https://download.pytorch.org/whl/urllib3-1.26.13-py2.py3-none-any.whl (140 kB)
Collecting idna<4,>=2.5
  Using cached https://download.pytorch.org/whl/idna-3.4-py3-none-any.whl (61 kB)
Collecting certifi>=2017.4.17
  Using cached https://download.pytorch.org/whl/certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting charset-normalizer<3,>=2
  Using cached https://download.pytorch.org/whl/charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting mpmath>=0.19
  Using cached https://download.pytorch.org/whl/mpmath-1.2.1-py3-none-any.whl (532 kB)
Using legacy 'setup.py install' for lit, since package 'wheel' is not installed.
Installing collected packages: mpmath, lit, cmake, urllib3, typing-extensions, sympy, pillow, numpy, networkx, MarkupSafe, idna, filelock, charset-normalizer, certifi, requests, jinja2, pytorch-triton-rocm, torch, torchvision
  Running setup.py install for lit ... done
Successfully installed MarkupSafe-2.1.2 certifi-2022.12.7 charset-normalizer-2.1.1 cmake-3.25.0 filelock-3.9.0 idna-3.4 jinja2-3.1.2 lit-15.0.7 mpmath-1.2.1 networkx-3.0 numpy-1.24.1 pillow-9.3.0 pytorch-triton-rocm-2.0.1 requests-2.28.1 sympy-1.11.1 torch-2.0.1+rocm5.4.2 torchvision-0.15.2+rocm5.4.2 typing-extensions-4.4.0 urllib3-1.26.13
Installing gfpgan
Installing clip
Installing open_clip
Cloning Stable Diffusion into /home/andrey/SD/stable-diffusion-webui-directml/repositories/stable-diffusion-stability-ai...
Клонирование в «/home/andrey/SD/stable-diffusion-webui-directml/repositories/stable-diffusion-stability-ai»...
remote: Enumerating objects: 574, done.
remote: Counting objects: 100% (311/311), done.
remote: Compressing objects: 100% (92/92), done.
remote: Total 574 (delta 244), reused 219 (delta 219), pack-reused 263
Получение объектов: 100% (574/574), 73.43 МиБ | 218.00 КиБ/с, готово.
Определение изменений: 100% (276/276), готово.
Cloning Stable Diffusion XL into /home/andrey/SD/stable-diffusion-webui-directml/repositories/generative-models...
Клонирование в «/home/andrey/SD/stable-diffusion-webui-directml/repositories/generative-models»...
remote: Enumerating objects: 504, done.
remote: Counting objects: 100% (325/325), done.
remote: Compressing objects: 100% (168/168), done.
remote: Total 504 (delta 202), reused 207 (delta 148), pack-reused 179
Получение объектов: 100% (504/504), 22.29 МиБ | 211.00 КиБ/с, готово.
Определение изменений: 100% (241/241), готово.
Cloning K-diffusion into /home/andrey/SD/stable-diffusion-webui-directml/repositories/k-diffusion...
Клонирование в «/home/andrey/SD/stable-diffusion-webui-directml/repositories/k-diffusion»...
remote: Enumerating objects: 735, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 735 (delta 4), reused 6 (delta 4), pack-reused 724
Получение объектов: 100% (735/735), 143.84 КиБ | 293.00 КиБ/с, готово.
Определение изменений: 100% (481/481), готово.
Cloning CodeFormer into /home/andrey/SD/stable-diffusion-webui-directml/repositories/CodeFormer...
Клонирование в «/home/andrey/SD/stable-diffusion-webui-directml/repositories/CodeFormer»...
remote: Enumerating objects: 594, done.
remote: Counting objects: 100% (245/245), done.
remote: Compressing objects: 100% (98/98), done.
remote: Total 594 (delta 176), reused 167 (delta 147), pack-reused 349
Получение объектов: 100% (594/594), 17.31 МиБ | 254.00 КиБ/с, готово.
Определение изменений: 100% (287/287), готово.
Cloning BLIP into /home/andrey/SD/stable-diffusion-webui-directml/repositories/BLIP...
Клонирование в «/home/andrey/SD/stable-diffusion-webui-directml/repositories/BLIP»...
remote: Enumerating objects: 277, done.
remote: Counting objects: 100% (165/165), done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 277 (delta 137), reused 136 (delta 135), pack-reused 112
Получение объектов: 100% (277/277), 7.03 МиБ | 376.00 КиБ/с, готово.
Определение изменений: 100% (153/153), готово.
Installing requirements for CodeFormer
Installing requirements
Installing diffusers
Launching Web UI with arguments: 
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Traceback (most recent call last):
  File "/home/andrey/SD/stable-diffusion-webui-directml/launch.py", line 39, in <module>
    main()
  File "/home/andrey/SD/stable-diffusion-webui-directml/launch.py", line 35, in main
    start()
  File "/home/andrey/SD/stable-diffusion-webui-directml/modules/launch_utils.py", line 443, in start
    import webui
  File "/home/andrey/SD/stable-diffusion-webui-directml/webui.py", line 54, in <module>
    from modules.call_queue import wrap_gradio_gpu_call, wrap_queued_call, queue_lock  # noqa: F401
  File "/home/andrey/SD/stable-diffusion-webui-directml/modules/call_queue.py", line 6, in <module>
    from modules import shared, progress, errors
  File "/home/andrey/SD/stable-diffusion-webui-directml/modules/shared.py", line 72, in <module>
    directml_init()
  File "/home/andrey/SD/stable-diffusion-webui-directml/modules/dml/__init__.py", line 38, in directml_init
    from modules.dml.backend import DirectML # pylint: disable=ungrouped-imports
  File "/home/andrey/SD/stable-diffusion-webui-directml/modules/dml/backend.py", line 4, in <module>
    import torch_directml # pylint: disable=import-error
ModuleNotFoundError: No module named 'torch_directml'

Additional information

The other day I tried to install ROM drivers, but I deleted them, as it turned out that my video card is not supported (AMD RX550). My Linux Distribution: Mint 21.2

lshqqytiger commented 11 months ago

DirectML depends on DirectX api. But Linux systems do not have it. You must have Windows or WSL environment to run DirectML. (and there's no available distribution of torch-directml for Linux) Or you can try with ROCm.

txtsd commented 10 months ago

DirectML depends on DirectX api. But Linux systems do not have it. You must have Windows or WSL environment to run DirectML. (and there's no available distribution of torch-directml for Linux) Or you can try with ROCm.

@lshqqytiger How can I try it with ROCm? I'm trying to run this on a Ryzen 2400G on Linux.

lshqqytiger commented 10 months ago

As I know, APUs are not officially supported by ROCm. https://github.com/RadeonOpenCompute/ROCm/issues/2216