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

[Bug]: xFormers can't load C++/CUDA extensions. xFormers was built for:

Open mockinbirdy opened this issue 1 year ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

Never encountered that problem before the update. Obviously did not change/update anything else. Forcefully reinstalling xformers/torch+xformers as it's been recommended in similar threads does not solve the problem.

Launching Web UI with arguments: --xformers --opt-channelslast
WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
PyTorch 2.0.0+cu118 with CUDA 1108 (you have 1.13.1+cu117)
Python  3.10.10 (you have 3.10.6)

Solution?

Steps to reproduce the problem

  1. Clean installation
  2. Run it
  3. See the bug

What should have happened?

It should run as intended

Commit where the problem happens

probably the latest, hash is unknown due to the error

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Windows

What device are you running WebUI on?

Nvidia GPUs (RTX 20 above)

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

none

List of extensions

none

Console logs

-

Additional information

No response

mockinbirdy avatar Jun 24 '23 01:06 mockinbirdy

I managed to get my latest commit but the error is still here. It says the right version of xformers was installed however it still does not work and shows me the warning.

venv "C:\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 
Version: v1.2.1
Commit hash: 89f9faa63388756314e8a1d96cf86bf5e0663045
Installing xformers
Collecting xformers==0.0.17
Using cached xformers-0.0.17-cp310-cp310-win_amd64.whl (112.6 MB)
Installing collected packages: xformers
Successfully installed xformers-0.0.17

[notice] A new release of pip available: 22.2.1 -> 23.1.2
[notice] To update, run: C:\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip
Installing requirements
Launching Web UI with arguments:--xformers

WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
PyTorch 2.0.0+cu118 with CUDA 1108 (you have 1.13.1+cu117)
Python 3.10.10 (you have 3.10.6)
Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)
Memory-efficient attention, SwiGLU, sparse and more won't be available.
Set XFORMERS_MORE_DETAILS=1 for more details

mockinbirdy avatar Jun 24 '23 02:06 mockinbirdy

use --reinstall-torch and --reinstall-xformers or just deleter the venv so every thing is reinstalled

w-e-w avatar Jun 24 '23 04:06 w-e-w

It does not solve the problem. I already tried all the solutions discussed in this repository. I reinstalled torch, xformers, deleted venv several times. Moreover, I changed nothing in my system but here I am, facing this error after the reinstall.

mockinbirdy avatar Jun 24 '23 14:06 mockinbirdy

What should be fixed The script should not force the installation of xformers 0.17 for systems with torch 1.3, it should automatically download xformers 0.16 which is compatible with torch 1.13. Otherwise, it breaks things. Now you can force-install xformers 0.16 by adding arguments in webui.bat but ideally the right xformers version has to be chosen automatically.

mockinbirdy avatar Jun 29 '23 15:06 mockinbirdy

Did you get this issue fixed? I'm having the same problem.

EndZz- avatar Aug 22 '23 02:08 EndZz-

Hi! I had the same problem, I solved it with this issue https://github.com/facebookresearch/xformers/issues/664#issuecomment-1459986536

RuthSalvador avatar Aug 23 '23 06:08 RuthSalvador

What should be fixed The script should not force the installation of xformers 0.17 for systems with torch 1.3, it should automatically download xformers 0.16 which is compatible with torch 1.13. Otherwise, it breaks things. Now you can force-install xformers 0.16 by adding arguments in webui.bat but ideally the right xformers version has to be chosen automatically.

What arguments do I add to force install a version cause the other solution didn't work for me. I have pytorch version 2.0.1+cu118 which is also incompatible cause it's too high.

SavageKuza avatar Aug 24 '23 05:08 SavageKuza

What should be fixed The script should not force the installation of xformers 0.17 for systems with torch 1.3, it should automatically download xformers 0.16 which is compatible with torch 1.13. Otherwise, it breaks things. Now you can force-install xformers 0.16 by adding arguments in webui.bat but ideally the right xformers version has to be chosen automatically.

What arguments do I add to force install a version cause the other solution didn't work for me. I have pytorch version 2.0.1+cu118 which is also incompatible cause it's too high.

Hi, try this. Add set XFORMERS_PACKAGE=xformers==0.0.16 (change the version as you like) and set COMMANDLINE_ARGS=--xformers --reinstall-xformers to webui-user.bat. Don't forget to remove --reinstall-xformers afterwards or it'll reinstall it every time.

Or if you are reinstalling it from scratch, try to add set TORCH_COMMAND=pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117 set XFORMERS_PACKAGE=xformers==0.0.16 (change the versions as you like) to webui-user.bat before the first run of this bat. It will force-install the versions of torch and xformers you specified.

P.S. You can also add --skip-version-check to the bat file later on so it won't check it every time.

mockinbirdy avatar Aug 24 '23 13:08 mockinbirdy

WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for: PyTorch 2.0..0+cu118 with CUDA 1108 (you have 1.13.1+cu117) 遇到这个问题我的解决方法是: (you have 1.13.1+cu117)这是你的系统内的版本, 重新安装 xFormers 可以按照以下步骤进行: 首先,打开命令行界面。 使用以下命令卸载当前已安装的 xFormers(如果已安装): x:\xxx\xxx\python(你的SD目录内的python文件夹),在上面键入CMD 然后在控制台输入以下命令 pip uninstall xformers 完成后打开启动器(我是秋叶的绘世) 高级选项 点进去后跟一键启动并排 有个环境维护,配置pyTorch点开,选择版本,与你的(you have 1.13.1+cu117)这一项版本一致的选择完点击安装即可解决.

ilovefree999 avatar Aug 27 '23 06:08 ilovefree999

WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for: PyTorch 2.0..0+cu118 with CUDA 1108 (you have 1.13.1+cu117) 遇到这个问题我的解决方法是: (you have 1.13.1+cu117)这是你的系统内的版本, 重新安装 xFormers 可以按照以下步骤进行: 首先,打开命令行界面。 使用以下命令卸载当前已安装的 xFormers(如果已安装): x:\xxx\xxx\python(你的SD目录内的python文件夹),在上面键入CMD 然后在控制台输入以下命令 pip uninstall xformers 完成后打开启动器(我是秋叶的绘世) 高级选项 点进去后跟一键启动并排 有个环境维护,配置pyTorch点开,选择版本,与你的(you have 1.13.1+cu117)这一项版本一致的选择完点击安装即可解决.

Use PyTorch 2.0..0+cu118 使用PyTorch 2.0..0+cu118版本 Change Mockin's Arg into set TORCH_COMMAND=pip install torch==2.0.0+cu118

OOPSgary avatar Aug 30 '23 02:08 OOPSgary