-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Xformers
Xformers library is an optional way to speedup your image generation.
There are no binaries for Windows except for one specific configuration, but you can build it yourself.
A guide from an anonymous user, although I think it is for building on Linux:
GUIDES ON HOW TO BUILD XFORMERS also includes how to uncuck yourself from sm86 restriction on voldy's new commit
- go to the webui directory
source ./venv/bin/activate
cd repositories
git clone /~https://github.com/facebookresearch/xformers.git
cd xformers
git submodule update --init --recursive
pip install -r requirements.txt
pip install -e .
-
Install VS Build Tools 2022, you only need
Desktop development with C++
- Install CUDA 11.3 (later versions are not tested), select custom, you only need the following (VS integration is probably unecessary):
- Clone the xFormers repo, create a
venv
and activate it
git clone /~https://github.com/facebookresearch/xformers.git
cd xformers
python -m venv venv
./venv/scripts/activate
- To avoid issues with getting the CPU version, install pyTorch seperately:
pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu113
- Then install the rest of the dependencies:
pip install -r requirements.txt
pip install wheel
-
As CUDA 11.3 is rather old, you need to force enable it to be built on MS Build Tools 2022. Do
$env:NVCC_FLAGS = "-allow-unsupported-compiler"
if onpowershell
, orset NVCC_FLAGS=-allow-unsupported-compiler
if oncmd
-
You can finally build xFormers, note that the build will take a long time (probably 10-20minutes), it may initially complain of some errors but it should still compile correctly.
python setup.py build
python setup.py bdist_wheel
-
In
xformers
directory, navigate to thedist
folder and copy the.whl
file to the base directory ofstable-diffusion-webui
-
In
stable-diffusion-webui
directory, install the.whl
, change the name of the file in the command below if the name is different:
./venv/scripts/activate
pip install xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl
-
Ensure that
xformers
is activated by launchingstable-diffusion-webui
with--force-enable-xformers
If you encounter some error about torch not being built with your cuda version blah blah, then try:
pip install setuptools==49.6.0
-
wait like 30 minutes for everything to build
-
launch with
--force-enable-xformers
commandline argument
This is the Stable Diffusion web UI wiki. Wiki Home
Setup
- Install and run on NVidia GPUs
- Install and run on AMD GPUs
- Install and run on Apple Silicon
- Install and run on Intel Silicon (external wiki page)
- Install and run via container (i.e. Docker)
- Run via online services
Reproducing images / troubleshooting
Usage
- Features
- Command Line Arguments and Settings
- Optimizations
- Custom Filename Name and Subdirectory
- Change model folder location e.g. external disk
- User Interface Customizations
- Guides and Tutorials
Developers