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
- Run
webui-user.bat
from Windows Explorer as normal, non-administrator, user.
Automatic1111 Installation on Linux
Install the dependencies:
# Debian-based:
sudo apt install wget git python3 python3-venv
# Red Hat-based:
sudo dnf install wget git python3
# Arch-based:
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)
Run webui.sh
, check 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:
@echo off
set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=--xformers --no-half-vae
git pull
call webui.bat
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
Launch the 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.
Image Sizes
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
Sample Images
Below images have been generated using the txt2img base model, these were not run through img2img using the refiner model.
If you'd like to support our site please consider buying us a Ko-fi, grab a product or subscribe. Need a faster GPU, get access to fastest GPUs for less than $1 per hour with RunPod.io
Hi!
I tried to follow the steps in the tutorial above, but after having installed Python, Git, Automatic1111 and the two SDXL models, I gave webui-user.bat a spin but it immediately notes: “Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.”
Can you help me out?
Have a look at this: https://sebhastian.com/python-was-not-found-run-without-arguments/
It’s probably because during the Python install you didn’t choose the “Add Python.exe to path”.
Harmeet, you are a life saver! This was indeed the issue. Maybe you could add this to the tutorial for total noobs like myself. I have no experience whatsoever with coding, I hardly know what Python is (something with a Monty?), or Git (something with a hub?) and even running that one command caused me issues (I can open a command window from a folder? Whaaat?!) so I blindly followed your steps. And it got me there too, except for that pesky box I forgot to tick during the Python install.
Anyway, thanks a lot, Harmeet! Curious to start experimenting with this awesome bit of tech!
Glad to read you were able to fix the issue. I have added the remark about this important tip to the blog, thanks for your suggestion
hey, can you please help,I have instal git and phyton, but when I run webui user i get this >
Cloning Stable Diffusion into C:\stable-diffusion-webui-master\repositories\stable-diffusion-stability-ai…
Cloning into ‘C:\stable-diffusion-webui-master\repositories\stable-diffusion-stability-ai’…
fatal: bad boolean config value ‘“false”’ for ‘http.sslverify’
Traceback (most recent call last):
File “c:\stable-diffusion-webui-master\launch.py”, line 39, in
main()
File “c:\stable-diffusion-webui-master\launch.py”, line 30, in main
prepare_environment()
File “c:\stable-diffusion-webui-master\modules\launch_utils.py”, line 345, in prepare_environment
git_clone(stable_diffusion_repo, repo_dir(‘stable-diffusion-stability-ai’), “Stable Diffusion”, stable_diffusion_commit_hash)
File “c:\stable-diffusion-webui-master\modules\launch_utils.py”, line 159, in git_clone
run(f'”{git}” clone “{url}” “{dir}”‘, f”Cloning {name} into {dir}…”, f”Couldn’t clone {name}”, live=True)
File “c:\stable-diffusion-webui-master\modules\launch_utils.py”, line 113, in run
raise RuntimeError(“\n”.join(error_bits))
RuntimeError: Couldn’t clone Stable Diffusion.
Command: “git” clone “https://github.com/Stability-AI/stablediffusion.git” “C:\stable-diffusion-webui-master\repositories\stable-diffusion-stability-ai”
Error code: 128
Press any key to continue . . .
Delete the entire directory that was created and start again. This is what some of the people have done when they got this error. It could be caused due to the permissions on the folder or how you ran the command line. You can try launching the command line in Administrative mode and then run the GIT Clone command, it might help
What am I supposed to do with the SDXL models it says to download? I can run git clone and webui-user.bat but these instructions, unless I am missing it, don’t say what to do with those model files.
place the model file in the Models\stable-diffusion folder