Open sanromd opened 1 year ago
expected behavior
you need the arg --xformers
to enable xformers
the message "No module 'xformers'. Proceeding without it." is not from us (webui) irrc from stability repo
also I recommend you start from the beginning as probably accidentally install stuff that you shouldn't don't install stuff manually, Just run the script for your platform
Thanks, @w-e-w
I tried running launch.py
with the options --xformers
and --force-enable-xformers
. I also tested --reinstall-xformers
. None of these options fixed the problem. If I try to force loading xformers I get the following error:
No module 'xformers'. Proceeding without it.
*** Cannot import xformers
Traceback (most recent call last):
File "$PATH_TO_AUTOMATIC!111/modules/sd_hijack_optimizations.py", line 156, in <module>
import xformers.ops
ModuleNotFoundError: import of xformers halted; None in sys.modules
However, xformers
is installed in the environment
@w-e-w see bug report. This issue persists across platforms/users https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/5993
ah Linux, not too familiar webui on linux
It is strange because I can find xformers.ops
in the env's site-packages. Below is the output of my sys.modules
The error originates in lines 154:160 of _/modules/sd_hijackoptimizations.py
(note: I must load xformers.ops first, otherwise sys.modules cannot see the package)
python -c "import xformers.ops, sys; print(sys.modules['xformers.ops'])" | grep xformers
<module 'xformers.ops' from '$PYTHON_ROOT/envs/diffusers/lib/python3.10/site-packages/xformers/ops/__init__.py'>
@w-e-w, @liuzimo proposed a solution in https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/6594#discussioncomment-5216054. I tested it; it works.
Solution: modify modules/import_hook.py
import sys
# solution to load xformers by @liuzimo https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/6594#discussioncomment-5216054
# sd_hijack will fail to load xformers because sys.modules cannot find i. This solution solves the problem.
if "--xformers" not in "".join(sys.argv):
import xformers
sys.modules["xformers"] = xformers
Is there an existing issue for this?
What happened?
I am running webUI from the command line inside an environment with all prerequisites installed, i.e.,
pip install -r requirements.txt; python launch.py
. During ststartup, the script complains thatxfomers
cannot be found. However, the module is installed.Steps to reproduce the problem
pip install -r requirements.txt
)python launch.py
)What should have happened?
The script should load without issues since all modules are available in the environment. I can load
xformers
from a jupyter notebook using the diffusers pipeline.Version or Commit where the problem happens
Master
What Python version are you running on ?
Python 3.10.x
What platforms do you use to access the UI ?
Linux
What device are you running WebUI on?
Nvidia GPUs (RTX 20 above)
Cross attention optimization
xformers
What browsers do you use to access the UI ?
Microsoft Edge
Command Line Arguments
List of extensions
No
Console logs