text-generation-webui icon indicating copy to clipboard operation
text-generation-webui copied to clipboard

🔴 xformers not found! Please install it before trying to use it.

Open IronWolve opened this issue 1 year ago • 27 comments

Describe the bug

Did both pip install xformers, and xformers in /text-generation-webui directory. Evan ran the installer again.

https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Xformers

Is there an existing issue for this?

  • [X] I have searched the existing issues

Reproduction

xformers missing

Screenshot

No response

Logs

🔴 xformers not found! Please install it before trying to use it.
Loading the extension "api"... Ok.
Loading the extension "sd_api_pictures"... Ok.
Loading the extension "gallery"... Ok.
Loading the extension "send_pictures"... Starting KoboldAI compatible api at http://127.0.0.1:5000/api
Ok.

System Info

AMD 5950x, Nvidia 4090, Win11

IronWolve avatar Apr 15 '23 23:04 IronWolve

yes but did you install it inside conda or the correct venv?

Ph0rk0z avatar Apr 16 '23 01:04 Ph0rk0z

Should be the correct one, I ran microconda first. I'm using the windows installer.

pip shows it installed.

xformers 0.0.18

IronWolve avatar Apr 16 '23 04:04 IronWolve

maybe this check fails on windows

try:
        import xformers.ops
    except Exception:
        print("🔴 xformers not found! Please install it before trying to use it.", file=sys.stderr)

Ph0rk0z avatar Apr 16 '23 11:04 Ph0rk0z

Same situation, why?

Gitbreast avatar Apr 16 '23 12:04 Gitbreast

Open up a python .. write import xformers.ops, what does it say?

Ph0rk0z avatar Apr 16 '23 12:04 Ph0rk0z

image @Ph0rk0z I got this, means I need to upgrade something?

Gitbreast avatar Apr 16 '23 14:04 Gitbreast

Yea, you have CPU pytorch.

Ph0rk0z avatar Apr 16 '23 16:04 Ph0rk0z

I have the same problem. My notifications are like this. Screenshot 2023-04-17 134612 but when i open the WebUI , I still get error that not found

Screenshot 2023-04-17 134856

Ketorami avatar Apr 17 '23 06:04 Ketorami

Triton doesn't work on windows I think.

Ph0rk0z avatar Apr 17 '23 11:04 Ph0rk0z

Yea, you have CPU pytorch.

So I need to install a PyTorch for GPU and upgrade Python?

Gitbreast avatar Apr 17 '23 11:04 Gitbreast

You can install PyTorch form this repo https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/8691#discussion-4972715

Ketorami avatar Apr 17 '23 12:04 Ketorami

Basically.. you need a cuda pytorch to do GPU inference.

Ph0rk0z avatar Apr 17 '23 12:04 Ph0rk0z

the xformers library def needs to be installed in the env, which is managed by mamba. I was able to get it working with these steps, hopefully it helps:

  1. run micromamba-cmd.bat, this will open a terminal, in the text-generation-webui's env activated already.
  2. run pip install xformers
  3. close that terminal, and close, then restart webui start-webui.bat

EnviralDesign avatar Apr 18 '23 15:04 EnviralDesign

the xformers library def needs to be installed in the env, which is managed by mamba. I was able to get it working with these steps, hopefully it helps:

  1. run micromamba-cmd.bat, this will open a terminal, in the text-generation-webui's env activated already.
  2. run pip install xformers
  3. close that terminal, and close, then restart webui start-webui.bat

Can you elaborate? Where is "text-generation-webui's env"? in oobabooga-windows\installer_files? And how i run micromamba-cmd.bat?

Ketorami avatar Apr 18 '23 16:04 Ketorami

The env and the mamba stuff is here: image

I'm on windows, so for me the micromamba-cmd.bat is located here. I was able to double click and it opened up ready to use. image

EnviralDesign avatar Apr 18 '23 16:04 EnviralDesign

Screenshot 2023-04-18 233412 Sad TT

Ketorami avatar Apr 18 '23 16:04 Ketorami

that's weird! I'm not sure. fyi for context I used the one click installer to set everything up, not sure if it would behave differently if you installed it another way or manually.

EnviralDesign avatar Apr 18 '23 16:04 EnviralDesign

I used the new installer zip, did a fresh install in a directory with no spaces. That worked for me.

tonyzehs avatar Apr 20 '23 18:04 tonyzehs

After installing xformers, I get the Triton not available message, but it will still load a model and the webui. It also says "Replaced attention with xformers_attention" so it seems xformers is working, but it is not any faster in tokens/sec than without --xformers, so I don't think it is completely functional. What is Triton?

Jonseed avatar Apr 20 '23 21:04 Jonseed

After installing xformers, I get the Triton not available message, but it will still load a model and the webui. It also says "Replaced attention with xformers_attention" so it seems xformers is working, but it is not any faster in tokens/sec than without --xformers, so I don't think it is completely functional. What is Triton?

Search Triton in the existing issues on github, I think someone answered it being a Linux specific thing. And yeah, xformers is working for you now.

tonyzehs avatar Apr 20 '23 21:04 tonyzehs

If it is specific to Linux, why is it trying to run Triton on Windows? And if xformers is working, why is the inference speed not any faster than without it? I get about 3 tokens/s with or without it with my 3060 12GB card.

Jonseed avatar Apr 20 '23 21:04 Jonseed

If it is specific to Linux, why is it trying to run Triton on Windows? And if xformers is working, why is the inference speed not any faster than without it? I get about 3 tokens/s with or without it with my 3060 12GB card.

Maybe the base code is the same across platforms, so updating/maintaining is easier for the devs? As for the speed increase, I personally found it to also be minimal, unlike Stable Diffusion. If anything, when running larger models the AI generations seem to spit out things that make less sense. (just limited personal observations, not tested in a controlled environment) here's a thread of people experimenting with it:

https://github.com/oobabooga/text-generation-webui/pull/950

tonyzehs avatar Apr 20 '23 21:04 tonyzehs

It was mentioned xformers may use less memory.

Ph0rk0z avatar Apr 21 '23 11:04 Ph0rk0z

The env and the mamba stuff is here:

I'm using the new installation, that batch script doesn't exist anymore. How would you go about downloading the library now? Thank you!

Stoxis avatar Apr 27 '23 04:04 Stoxis

open oobabooga_windows/cmd_windows.bat. Then run pip install xformers. Then open oobabooga_windows/webui.py, line 146 run_cmd("python server.py --chat --model-menu --model_type llama --xformers") =)

sparky002 avatar Apr 28 '23 18:04 sparky002

I added xfromers into oobabooga_windows/text-generation-webui/requrments.txt and it installed the latest xfromers, but I get a triton error when I use the --xformer parameter. First 4 lines at launch: Gradio HTTP request redirected to localhost :) A matching Triton is not available, some optimizations will not be enabled. Error caught was: No module named 'triton' bin D:\Other_projects\oobabooga\installer_files\env\lib\site-packages\bitsandbytes\libbitsandbytes_cuda117_nocublaslt.dll The speed doesn't change, I tried reinstalling it with the new release, but it's the same.

bkutasi avatar Apr 29 '23 10:04 bkutasi

Yes, just today I tried to reinstall oobabooga with oobabooga_windows.zip and despite that I answered A to install for nvidia GPU, it still installed pytorch for cpu into venv. Used this https://github.com/oobabooga/text-generation-webui/issues/1252#issuecomment-1511211024 from this thread to reinstall it and then installed "pip3 install xformers" - it's now 0.0.19 version by default. Now it's working, even though it's still giving "no triton" error

UPD: yes, it's starting and loading model, but it gives error when trying to generate. Had to use --sdp-attention instead and it's working alright

barleyj21 avatar May 02 '23 17:05 barleyj21

This issue has been closed due to inactivity for 6 weeks. If you believe it is still relevant, please leave a comment below. You can tag a developer in your comment.

github-actions[bot] avatar Sep 01 '23 23:09 github-actions[bot]

the xformers library def needs to be installed in the env, which is managed by mamba. I was able to get it working with these steps, hopefully it helps:

  1. run micromamba-cmd.bat, this will open a terminal, in the text-generation-webui's env activated already.
  2. run pip install xformers
  3. close that terminal, and close, then restart webui start-webui.bat

This broke my installation completely, because it was successful ;-; Well I mean it still works, but it's significantly slower "triton" doesn't exist, and I don't think it's doing what it's supposed to.

MistakingManx avatar Jan 23 '24 04:01 MistakingManx