Watch the video:
00:00 - Explanation
00:54 - Features of Stable Diffusion WebUI
01:27 - Windows install steps
01:50 - Installing Stable Diffusion WebUI under WSL (Best)
02:56 - Downloading Stable Diffusion model
03:45 - Downloading ESRGAN (Upscaling addon)
05:03 - Starting Stable Diffusion WebUI
05:38 - Feature - Inpainting/Outpainting
05:47 - Feature - Prompt Matrix
06:06 - Feature - Stable Diffusion Upscaling
06:32 - Feature - Attention
06:54 - Feature - Textural Inversion
07:49 - Variations, Sampling method
07:58 - Feature - Negative prompt
08:19 - Feature - Prompt Interrogator (image2prompt)
08:34 - Feature - Highres. fix
09:25 - Fix possible CUDA/CUDNN error
12:14 - Generating images in Stable Diffusion WebUI
12:42 - Negative prompt example
13:19 - Saving images (+Auto-saving)
16:08 - Img2Img from the generated output (Loopback)
17:26 - Inpainting example
18:30 - Batch Img2Img
18:50 - Upscaling & Batch upscaling
20:16 - Reading prompts & info from the image
20:53 - Toggle NSFW/Filter settings
Stable Diffusion WebUI
Stable Diffusion is a free AI model. If you’re paying for anything other than someone else’s hardware to generate images, then you’re likely being cheated for your money. I’ve seen some paid programs accomplish far less but have good marketing.
You do not need to pay for Stable Diffusion, or a UI, or a Web UI.
This guide shows you installing the AUTOMATIC1111 Stable Diffusion WebUI under WSL.
This is one of many versions, but it seems one of the best. Just a quick note: the NSFW filter is OFF by DEFAULT. If you’re looking to test this on stream or something like that, you may want to enable it on the Settings page before generating images - Just in case.
Why this project above others?
Check the following page to read about what it can do, as well as see examples: Features Wiki Page.
About my install
You can install this on Windows by following the official guide, but I choose to run it under WSL. It’s a little easier, at least for me.
I’m using Ubuntu 22.04 in WSL 2.
If you haven’t already got Windows WSL setup and installed, check my guide for Installing and Using Ubuntu in WSL.
Installation
The official WSL installation steps are a little hidden. They are here on the Wiki.
Remember to check to see if these commands are up-to-date before running them, as this guide likely won’t be updated anywhere near as often.
|
|
Downloading the Stable Diffusion model
Checking the dependencies page, download the official Stable Diffusion model to get started – You can swap this out later or use more than one!
There is an official HuggingFace link, as well as a direct download link and a torrent.
Importing the Stable Diffusion model
Run cd ~/stable-diffusion-webui
(assuming you didn’t get cd before installing, replace ~/
with the correct folder location).
Now run explorer.exe .
to open a Windows Explorer instance in this WSL location - You can edit Ubuntu WSL files DIRECTLY within Windows, and it’s great! Keep this command in mind, as we’ll use it later. You’re free to use it in your own projects if you didn’t know about this too.
Open the models
folder, and simply drag the model into here. It’s a few GB, so it will take some time to copy. You can also import other models here and swap between them in the Stable Diffusion WebUI later.
Downloading ESRGAN (for Upscaling)
The Stable Diffusion WebUI can use ESRGAN models for upscaling but can NOT use RealESRGAN models, and you will receive an error if they can not be loaded. Download a ton of .pth
files from the Model Database, or elsewhere on the internet.
ESRGAN models are essentially models trained for upscaling images but on different datasets. You’ll have upscale trained in cartoons, manga, photos, drawings, pixel art, and more. Find the models you’ll want to use, import them all, and you can swap between them later when upscaling images.
Most of the compatible models are listed under 1. ESRGAN ('old Architecture') Models
.
You can also download collections under 2. Model Collections
, but just know that some may not be compatible and will spam the console with errors on launch. You can use these errors to just find the names and delete them from your ESRGAN folder later.
Importing ESRGAN models
Using explorer.exe .
in the ~/stable-duffusion-webui/ESRGAN
folder, simply just drag and drop all your upscaling pth
files here.
Launching Stable Diffusion WebUI in WSL
Simply run cd ~/stable-diffusion-webui && ./webui.sh
to change to the correct folder and run the Stable Diffusion Web UI.
If this is your first launch, there will be a couple GB downloaded to your PC. Like anything AI-related, there are many downloads and large models and files. This is unfortunate but definitely worth it for the quality of this FREE OPEN-SOURCE PROJECT.
Now is the best time to check the Features Wiki Page to learn more about what the software is capable of, at least for now. The software is ever-changing and will receive updates for some time to come.
Fixing CUDA errors
If you start it the first time and see Could not load library libcudnn_cnn_infer.sp.8. Error: libcuda.so: cannot open shared object file: No such file or directory
then you just need to make sure of a few things:
- Make sure you have the latest Nvidia drivers installed on your host system (Windows - NOT WSL!)
- Make sure you have installed the NVIDIA CUDA drivers (NOT the Graphics drivers) in WSL
- Make sure that libcuda is in your PATH - It’s likely this.
Checking libcuda is in your PATH
Simply run: sudo find /usr/ -name 'libcuda.so'
, and you’ll see where it is. If you can’t find it, you likely have not installed the NVIDIA CUDA drivers. Check the next section, then return here.
You should see something like: /usr/local/cuda-11.7/targets/x86_64-linux/lib/stubs/libcuda.so
.
Yours may not be cuda-11.7
, so just make sure to update it in the following commands you will be running:
The first command should match the folder above, starting with /usr/local
. The second command should match the folder above, beginning with /usr/lib
|
|
Now you should be able to run ./webui.sh
, and use the program properly.
Installing the NVIDIA CUDA drivers
See the Official Ubuntu guide here.
Commands from the guide are as follows.
|
|
(OPTIONAL) You can verify that everything is working with:
|
|
Where to from here?
The video covers setting up auto-save and other features. This was more just for easy command reference and quick-start for installing Stable Diffusion Web UI.