SDXL 1.0 (Stable Diffusion XL) has been released earlier this week which means you can run the model on your own computer and generate images using your own GPU. I wanted to document the steps required to run your own model and share some tips to ensure that you are starting on the right foot. If you want to see my specifications of my PC have a read of this post.
What you need
- Your own hardware with at least 16 GB of GPU memory. I have not found the official specs but my GPUs usage is 12 GB (of total 16GB) for a 1024x1024px image.
- Automatic1111 v1.5.0 or higher
- SDXL Models only from their original huggingface page
- SDXL Base model (6.94 GB) for txt2img
- SDXL Refiner model (6.08 GB) for img2img
You will need to move the model file in the sd-webui\models\stable-diffusion directory
Automatic1111 Installation on Windows
- Install Python 3.10.6 (make sure you choose the option “Add Python.exe to path” during the installation)
- Install git.
- Download the stable-diffusion-webui repository, by running the command. Make sure you are in the desired directory where you want to install eg: c:\AI
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
webui-user.batfrom Windows Explorer as normal, non-administrator, user.
Automatic1111 Installation on Linux
Install the dependencies:
sudo apt install wget git python3 python3-venv
# Red Hat-based:
sudo dnf install wget git python3
sudo pacman -S wget git python3
Make sure you are in the desired directory where you want to install eg: \home\AI. Launch command line terminal and execute command:
wget -qO- https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh)
webui-user.sh for options.
Follow these steps and you will be up and running in no time with your SDXL 1.0
Already running SD 1.x or 2.x with Automatic1111
If you are already running Automatic1111 with Stable Diffusion (any 1.x or 2.x version) then all you need to do is run your
webui-user.bat file with added command
git pull. Your file should look like this:
set COMMANDLINE_ARGS=--xformers --no-half-vae
After you run this you can re-edit the file to remove this line or add REM at the start to turn it into a comment which means its not executed. You can also choose to keep it there which means every time you launch the instance of SD, your command line with check the A1111 repo online and update your instance. This will keep you up to date all the time.
Lower GPU Tip
If you have a 8GB or 10GB sized GPU then you might want to run the batch file webui-user.bat with additional arguments like –xformers –no-half-vae which will optimize memory usage and reduce the “CUDA out of memory” errors. Also reducing the image size to 512x512px or 768x768px will help.
Running SDXL 1.0
webui-user.bat file and the command line will execute creating a URL http://127.0.0.1:7860/ which you can open in a browser.
Next you enter the Prompt and any Negative prompt, set the Width and Height to 1024px for best result. Click on Generate and within a few seconds you should have the image produced (time taken depends on the GPU speed). For me SDXL 1.0 was able to generate a new image in <10 seconds.
For best results you should be using 1024x1024px but what if you want to generate tall images or wider images. You can do this as well using SDXL 1.0 however as per their documentation they suggest using the following dimensions:
- 1024 x 1024
- 1152 x 896
- 896 x 1152
- 1216 x 832
- 832 x 1216
- 1344 x 768
- 768 x 1344
- 1536 x 640
- 640 x 1536
The objective is that the total of the dimensions should add up to 2048px. In my experimentation however, I have tried different ratios as well and the results are good, occasionally you will get the elongation or
Below images have been generated using the txt2img base model, these were not run through img2img using the refiner model.