stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: xformers fails to import while module fails to be detected after force reinstall download

Open trickyquietsoft opened this issue 1 year ago • 6 comments

Checklist

  • [ ] The issue exists after disabling all extensions
  • [X] The issue exists on a clean installation of webui
  • [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • [X] The issue exists in the current version of the webui
  • [ ] The issue has not been reported before recently
  • [ ] The issue has been reported before but has not been fixed yet

What happened?

User did a clean install on my Pop_OS machine after fully updating it. After a fresh install User added xformers to my starting arguments. Xformers module failed to be detected. User applied starting arguments to reinstall xfomers.

This gererated the following unusual text code: Launching Web UI with arguments: /home/user/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/timm/models/layers/init.py:48: FutureWarning: Importing from timm.models.layers is deprecated, please import via timm.layers warnings.warn(f"Importing from {name} is deprecated, please import via timm.layers", FutureWarning) no module 'xformers'. Processing without... no module 'xformers'. Processing without... No module 'xformers'. Proceeding without it. Loading weights [6ce0161689] from /home/user/Programs/A1111 WebUI/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors Running on local URL: http://127.0.0.1:7860

There is a second outcome the prints errors in the program code but I cannot reproduce currently

Steps to reproduce the problem

1)User does a clean install on my Pop_OS machine after fully updating it. 2)After a fresh install User adds xformers to my starting arguments. 3)User applies starting arguments to reinstall xfomers.

What should have happened?

WebUI should detect and load xformers module

What browsers do you use to access the UI ?

Mozilla Firefox

Sysinfo

sysinfo-2024-12-09-03-30.json

Console logs

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye), Fedora 34+ and openSUSE Leap 15.4 or newer.
################################################################

################################################################
Running on User user
################################################################

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

################################################################
Launching launch.py...
################################################################
glibc version is 2.35
Check TCMalloc: libtcmalloc_minimal.so.4
libtcmalloc_minimal.so.4 is linked with libc.so,execute LD_PRELOAD=/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4
Python 3.10.12 (main, Nov  6 2024, 20:22:13) [GCC 11.4.0]
Version: v1.10.1
Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2
Launching Web UI with arguments: 
/home/user/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/timm/models/layers/__init__.py:48: FutureWarning: Importing from timm.models.layers is deprecated, please import via timm.layers
  warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.layers", FutureWarning)
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Loading weights [6ce0161689] from /home/user/Programs/A1111 WebUI/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Creating model from config: /home/user/Programs/A1111 WebUI/stable-diffusion-webui/configs/v1-inference.yaml
Startup time: 6.9s (prepare environment: 1.4s, import torch: 2.1s, import gradio: 0.5s, setup paths: 1.2s, initialize shared: 0.3s, other imports: 0.3s, load scripts: 0.4s, create ui: 0.3s, gradio launch: 0.3s).
/home/user/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py:797: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(
ERROR: ld.so: object '/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Gtk-Message: 21:53:05.723: Failed to load module "canberra-gtk-module"
Gtk-Message: 21:53:05.724: Failed to load module "canberra-gtk-module"
Applying attention optimization: Doggettx... done.
Model loaded in 2.8s (load weights from disk: 0.4s, create model: 0.4s, apply weights to model: 1.8s, calculate empty prompt: 0.1s).

Additional information

There is a second outcome the prints errors in the programs code but I cannot reproduce this currently. I read thru it. xformers is failing to be imported as a library in one of the scripts.

trickyquietsoft avatar Dec 09 '24 03:12 trickyquietsoft

You don't have xformers enabled. Add --xformers to webui-user.sh (and uncomment the line.)

See also: https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Optimizations

missionfloyd avatar Dec 10 '24 03:12 missionfloyd

Sorry here's the proper terminal output.

`

################################################################ Install script for stable-diffusion + Web UI Tested on Debian 11 (Bullseye), Fedora 34+ and openSUSE Leap 15.4 or newer. ################################################################

################################################################ Running on ronnie user ################################################################

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

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

################################################################ Launching launch.py... ################################################################ glibc version is 2.35 Check TCMalloc: libtcmalloc_minimal.so.4 libtcmalloc_minimal.so.4 is linked with libc.so,execute LD_PRELOAD=/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4 Python 3.10.12 (main, Nov 6 2024, 20:22:13) [GCC 11.4.0] Version: v1.10.1 Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2 ControlNet init warning: Unable to install insightface automatically. Please try run pip install insightface manually. Launching Web UI with arguments: --medvram --xformers no module 'xformers'. Processing without... no module 'xformers'. Processing without... No module 'xformers'. Proceeding without it. *** Cannot import xformers Traceback (most recent call last): File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/modules/sd_hijack_optimizations.py", line 160, in import xformers.ops File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/xformers/ops/init.py", line 8, in from .fmha import ( File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/xformers/ops/fmha/init.py", line 10, in from . import attn_bias, cutlass, decoder, flash, small_k, triton, triton_splitk File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/xformers/ops/fmha/triton_splitk.py", line 21, in if TYPE_CHECKING or _has_triton21(): File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/xformers/ops/common.py", line 192, in _has_triton21 if not _has_a_version_of_triton(): File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/xformers/ops/common.py", line 176, in _has_a_version_of_triton import triton # noqa: F401 File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/triton/init.py", line 20, in from .compiler import compile, CompilationError File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/triton/compiler/init.py", line 1, in from .compiler import CompiledKernel, compile, instance_descriptor File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/triton/compiler/compiler.py", line 27, in from .code_generator import ast_to_ttir File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/triton/compiler/code_generator.py", line 8, in from .. import language File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/triton/language/init.py", line 4, in from . import math File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/triton/language/math.py", line 4, in from . import core File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/triton/language/core.py", line 1376, in def minimum(x, y): File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/triton/runtime/jit.py", line 542, in jit return decorator(fn) File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/triton/runtime/jit.py", line 534, in decorator return JITFunction( File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/triton/runtime/jit.py", line 433, in init self.run = self._make_launcher() File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/triton/runtime/jit.py", line 388, in _make_launcher scope = {"version_key": version_key(), File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/triton/runtime/jit.py", line 120, in version_key ptxas = path_to_ptxas()[0] File "/home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/triton/common/backend.py", line 119, in path_to_ptxas raise RuntimeError("Cannot find ptxas") RuntimeError: Cannot find ptxas


[-] ADetailer initialized. version: 24.11.1, num models: 11 CivitAI Browser+: Aria2 RPC started ControlNet preprocessor location: /home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/extensions/sd-webui-controlnet/annotator/downloads 2024-12-10 01:40:06,626 - ControlNet - INFO - ControlNet v1.1.455 Loading weights [42fb9a8ac9] from /home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/models/Stable-diffusion/Pony/Pony_OmegaPonyReal + 0.7(Pony_fennfotoPONY_v4 - Pony_vMIXVectorStylePony_v10_998947).safetensors 2024-12-10 01:40:07,287 - ControlNet - INFO - ControlNet UI callback registered. Creating model from config: /home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/repositories/generative-models/configs/inference/sd_xl_base.yaml /home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py:797: FutureWarning: resume_download is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use force_download=True. warnings.warn( [ERROR]: Config states /home/ronnie/Programs/A1111 WebUI/stable-diffusion-webui/config_states/civitai_subfolders.json, "created_at" does not exist Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). IIB Database file has been successfully backed up to the backup folder. Startup time: 14.0s (prepare environment: 2.5s, import torch: 2.8s, import gradio: 1.1s, setup paths: 1.4s, import ldm: 0.4s, initialize shared: 0.7s, other imports: 0.7s, load scripts: 2.7s, create ui: 1.2s, gradio launch: 0.6s). ERROR: ld.so: object '/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. ERROR: ld.so: object '/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. Gtk-Message: 01:40:09.074: Failed to load module "canberra-gtk-module" Gtk-Message: 01:40:09.077: Failed to load module "canberra-gtk-module" Applying attention optimization: Doggettx... done. Model loaded in 6.1s (load weights from disk: 0.7s, create model: 0.9s, apply weights to model: 3.6s, calculate empty prompt: 0.7s).

`

Oh, fun fact! If I force xformers I dont get to generate anything at all apparently. I'll submit a new form later.

trickyquietsoft avatar Dec 10 '24 06:12 trickyquietsoft

Try --opt-sdp-attention instead.

missionfloyd avatar Dec 11 '24 03:12 missionfloyd

having this problem also. Is xformers just not used anymore? Never installs automatically on setup, any version you install afterwards just updates torch to 2.4.0 and then complains it's incompatible with everything.

NPDX909 avatar Feb 24 '25 06:02 NPDX909

pip install xformers==0.0.27.post1 --index-url https://download.pytorch.org/whl/cu121

NPDX909 avatar Feb 24 '25 22:02 NPDX909

pip install xformers==0.0.27.post1 --index-url https://download.pytorch.org/whl/cu121

i have same issue and this version of xformers not work. i have torch 2.6.0+cu116 and xformers 0.0.29.post2 (older version xformers support only torch 2.4.0) can't fix "no module 'xformers'. Processing without..." bug. and share feature doesn't work too

renega51 avatar Mar 23 '25 19:03 renega51