If you check the wiki and readme on AUTOMATIC1111/stable-diffusion-webui you would be forgiven for thinking that installing this will be easy. It's not! There are loads of prerequisites and potential issues that will confuse the hell out of you unless you are already very familiar with running Python ML packages.
We will install AUTOMATIC1111 into in C:\dev\stable-diffusion-webui
. But most of this probably applies to other stable diffusion installs too.
If you're thinking about using WSL, you probably stop thinking that. It seems like there's a bunch of issues that make this way more complicated than installing directly under Linux would be. I wasted several hours on this. You might have more luck but make sure to read the WSL install docs before you start!
We will install directly under Windows.
Install git (latest version is fine) Install Python 3.10.6 (this exact version, if you have another installed then delete it and also delete any pip or python folders in %appData% then install 3.10.6).
Install VS Build tools: https://aka.ms/vs/17/release/vs_BuildTools.exe There's lots of options, I checked most of them. I assume you need the C/C++ related tools. I ended up with about 10gb download here.
Get it here 2.7gb download. It will warn you that you don't have Visual Studio installed. Unless you do I guess
#3 Install Ninja (optional)
Apparently this will speed up xformers on Windows https://github.com/ninja-build/ninja/releases
Extract ninja.exe to C:/windows
or add it to the PATH.
Find and download GFPGANv1.4.pth
and put it in the base folder.
Download your choice of stable diffusion model and put the .ckpt
and associated .yaml
files in the models/ folder.
I'm using 768-v-ema.ckpt
so I called the config 768-v-ema.yaml
. The ckpt is about 5gb so start downloading now!
Get the config here.
Get the SD 2.0 model here
Open a simple non-admin cmd prompt. Don't use Poweshell
cd dev
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
webui-user.bat
Expect it to fail but it will set up the venv. Didn't fail? wow, lucky you.
Not 100% sure if this is required but it will silence some warnings.
C:\dev\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip
From a non-admin cmd inside C:\dev\stable-diffusion-webui
python -m venv venv
venv\Scripts\activate
You should see the prompt change to:
(venv) C:\dev\stable-diffusion-webui\
pip install cython
pip install pycocotools
pip install sparse_dot_topn
python -m pip install -U pip setuptools
pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu113
(these are supposed to be installed automatically but...)
NOTE: so far any attempt to run with Xformers has totally failed. I did manage to get it to compile using this guide Once I install it, I can launch the web ui but cannot generate any images and each solved cryotic error leads to another cryptic error... so maybe skip this for now. What does xformers do?
Make sure you have VS Build Tools and Cuda installed or this will fail!
SD does run without it though.
These are supposed to be the required steps:
Make sure you are in C:\dev\stable-diffusion-webui
Ensure venv is active
venv\Scripts\activate
cd repositories git clone [email protected]:facebookresearch/xformers.git git submodule update --init --recursive pip install -r requirements.txt pip install -e .
Run webui-user.bat again from a non-admin cmd prompt. You should see various logs until finally this one:
DiffusionWrapper has 865.91 M params.
At this point it froze. I waited about 5 minutes then I pressed the "enter" key and it moved to the next line:
Downloading... 1%...
Again it froze and again after several minutes I pressed enter and it started downloading. It's another 4gb download so go make a coffee or something.
Once the download completes, you should finally see:
Running on local URL: http://127.0.0.1:7860
Congratulations! You have Stable Diffusion 2.0 running on Windows. Enjoy that coffee, you earned it.