A friendly guide to local AI image gen with Stable Diffusion and Automatic1111

A picture is worth a 1,000 words... or was that a 1,000 TOPS

Installing on Windows

If you're rocking a Windows box, A1111 can be a little hit and miss depending on your hardware. On Windows, the dashboard only natively supports Nvidia hardware. The good news is there are a couple of projects dedicated to getting it running on AMD and Intel-based boxes.

If you've got a Nvidia card, you're in luck as installing A1111 is as simple as downloading the sd.webui.zip file from the Automatic1111 GitHub page and extracting it.

Then, inside the folder, you just need to run the update.bat and run.bat executables, and you'll be generating images in no time at all. Note, you may need to unblock the batch files under file properties before running them.

AMD

For those of you with AMD cards, Windows support is provided by lshqqytiger's Direct-ML-compatible fork of SD WebUI project. The bad news is that the Direct-ML implementation is much, much slower than native ROCm on Linux.

AMD has previously recommended using the ONNX runtime with Microsoft's Olive library. Unfortunately, we didn't have much luck getting this method to work in our testing with a Radeon RX 7900 XT.

If you just want to play around with image generation on AMD/Windows and don't mind waiting a while, here's how you can get it up and running.

Start by downloading and installing the following dependencies:

Next use git to pull down the latest version of A1111 for AMD:

git clone https://github.com/lshqqytiger/stable-diffusion-webui-amdgpu.git && cd stable-diffusion-webui-amdgpu
git submodule update —init —recursive

From there, we want to launch A1111 using the —-use-directml flag.

.\webui.bat —-use-directml

The installer will go to work and after a few minutes you should be greeted by the Web GUI in your browser. Alternatively, you can try out Zluda — a project that aims to let you run unmodified CUDA code on AMD graphics chips — but we'll note that while performance is much better once set up, we did run into some odd behavior.

If you've already launched A1111 using Direct-ML, you'll need to remove the .\venv\ folder first to avoid conflicts during the install.

rm -r .\venv\

Next, you'll need to download and install the latest HIP SDK — version 5.7.1 as of writing — from AMD's website. It's probably worth rebooting at this point for good measure.

Finally, launch A1111 with the —-use-zluda flag and go make a cup of coffee or two — it's gonna be a while.

.\webui.bat —-use-zluda

Once the dashboard is running, don't be surprised if it takes 15 minutes or more to generate your first image. All subsequent images should be quite snappy, but the first one just seems to take forever. We're not the only ones that have run into this issue, so it appears that something is going on behind the scenes.

It's also worth noting that the Zluda project has been on uncertain footing since ever since AMD stopped funding it earlier this year. We also ran into some other odd behavior and freezes when running in this mode. That's not to say things won't improve, just don't be surprised if you run into some junk while testing it out.

And macOS

If you happen to be running on macOS, the installation is similarly straightforward. Before you begin, you'll need to make sure the Homebrew package manager is installed on your system. You can find more information on setting up Homebrew here. Using brew, we'll install a few dependencies and pull A1111 down from GitHub.

brew install cmake protobuf rust python@3.10 git wget
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui

As part of the installation we also need to pull down the Stable Diffusion 1.5 model file and place it under the ~/stable-diffusion-webui/models/stable-diffusion/ folder. We can achieve this using the following wget command.

wget -O models/stable-diffusion/v1-5-pruned-emaonly.ckpt https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt

Finally, can navigate to the stable-diffusion-webui folder and launch the web server.

cd stable-diffusion-webui
./webui.sh

After about a minute or so you should be greeted with the A1111 dashboard.

In the next section, we'll move onto generating images from text or image prompts and touch on using inpainting to target your edits.

More about

TIP US OFF

Send us news


Other stories you might like