Stable Diffusion WebUI Installation¶
In this article
Stable Diffusion WebUI (formerly Automatic1111) is a graphical interface for working with Stable Diffusion models, which generate images from text descriptions (prompts). Instead of a command line, Stable Diffusion WebUI provides an intuitive interface with buttons, input fields, and settings, simplifying the image generation process. It allows you to easily change parameters, save and load images, and makes Stable Diffusion accessible to a wide audience, even those unfamiliar with command lines.
Installing Stable Diffusion WebUI on a Ubuntu Server¶
Attention
Stable Diffusion WebUI works with acceptable performance only on vGPU/GPU servers with Nvidia graphics cards with tensor cores starting from A4000 and above. Make sure you have pre-installed Nvidia drivers and CUDA.
-
Log in to the server via ssh or other methods as root.
-
Install dependencies:
-
Create the
sd
user: -
Switch to the user's home directory and switch to it:
-
Download the installation script:
-
Install the web interface:
-
Add parameters for launch:
- To launch with a graphical interface accessible by the server's IP address:
echo 'export COMMANDLINE_ARGS="--autolaunch --no-half-vae --xformers --medvram-sdxl --opt-sdp-attention --listen"' >> /home/sd/stable-diffusion-webui/webui-user.sh
- To launch without a graphical interface with OpenWebUI:
echo 'export COMMANDLINE_ARGS="--autolaunch --no-half-vae --xformers --medvram-sdxl --opt-sdp-attention --nowebui --api --api-auth username:password"' >> /home/sd/stable-diffusion-webui/webui-user.sh
where
username:password
is the username and password for accessing the API.Note
You may not need to specify the
--api-auth username:password
parameter if no one else will access this API on the server. -
Download the SDXL model:
-
Create a systemd service for automatic startup:
-
Start the service:
Note
You can manage the Stable Diffusion WebUI service using the commands
sudo service start sdwebui
andsudo service stop sdwebui
. -
Check the service status:
Using the Stable Diffusion WebUI Graphical Interface¶
To access the graphical interface, use the address http://<YOUR_SERVER_IP>:7861
.
In the interface, set the following parameters for image generation:
- Stable Diffusion checkpoint:
sd_xl_base_1.0.safetensors
; - Width:
1024
; - Height:
1024
; - Sampling steps: from
30
to50
.
Note
Generated images are saved in the ~/stable-diffusion-webui/outputs/txt2img-images
directory, sorted by creation date.
Using Stable Diffusion WebUI in an AI Chatbot¶
Setting up Image Generation in an AI Chatbot¶
To enable image generation in an AI chatbot (OpenWebUI), follow these steps:
- Log in to the AI chatbot as an administrator;
- Go to the menu Admin Name >> Admin Panel >> Settings >> Images;
- Enter the value
http://0.0.0.0:7861
in the AUTOMATIC1111 Base URL field, and in the AUTOMATIC1111 Api Auth String field, enter the previously setusername:password
; - After this, set the Image Generation (Experimental) option to
On
; - Change the Set Image Size parameter to
1024x1024
and set the Set Steps value to between30
and50
; - Save the changes by clicking the
Savebutton.
Instructions for Generating Images in an AI Chatbot¶
To generate images, follow these steps:
- Select any model and in the chatbot's input field, send the command
Repeat this back: <you prompt for image generation>
; - In the chatbot's response, click the Generate Image icon;
- Wait for the result for 20 to 50 seconds, depending on your server's load.
Attention
To generate a new image, repeat steps 1-4. Clicking the Regenerate icon will replace the displayed image with a new one, without saving the old one.
Note
All generated images are saved on the server in the directory in the directory /var/lib/docker/volumes/open-webui/_data/cache/image/generations/
.
Adding Other Models to Stable Diffusion OpenWebUI¶
You can add any supported models in .safetensors
and LORA format yourself. To do this, you need to log in to your server via SSH, switch to the SD user with the command
and download the models using the commands provided below.
Attention
After installing models, be sure to restart Stable Diffusion WebUI with the command sudo systemctl restart sdwebui
.
We recommend using the following models:
- UI Icons: A model for drawing icons in monochrome format.
wget -O ~/stable-diffusion-webui/models/uiIcons_v10.safetensors https://civitai.com/api/download/models/367044
Required settings:
- Stable Diffusion checkpoint: `uiIcons_v10.safetensors`;
- Width: `256`;
- Height: `256`;
- Sampling steps: `30`.
- Deliberate v6: A fast model based on SD 1.5 that can be used for both image generation and inpainting, or with ControlNet for style transfer or sketch-based image generation in image2image mode.
wget https://huggingface.co/XpucT/Deliberate/resolve/main/Deliberate_v6.safetensors -O ~/stable-diffusion-webui/models/Deliberate_v6.safetensors
Required settings:
- Stable Diffusion checkpoint: `Deliberate_v6.safetensors`;
- Width: `512`;
- Height: `512`;
- Sampling steps: `30` to `50`.