How to Install Stable Diffusion on Windows

Updated
How to Install Stable Diffusion on Windows
Unlock your creativity on Windows with Stable Diffusion. Install and harness the power of this remarkable tool to effortlessly generate stunning images. Explore installation and usage instructions now!

1. Introduction

Today we are going to look at how you can both install and use Stable Diffusion. With Stable Diffusion, you can type in some text, and then using AI, you can generate an image based on that text, and the results are actually really stunning. There are many different companies pushing out technology like this, but the reason I like Stable Diffusion so much is, first off, the code is public and also free to use. You can install it on your computer as long as you have a decent graphics card, and you also get full rights to all of the images that are generated. Let's check this out.

2. Preparing Your PC for Stable Diffusion

First, we want to make sure that your PC is even capable of running Stable Diffusion, and you'll want to make sure that you have a discrete GPU (graphics card).

  • On Windows, press Control + Shift + Escape to open Task Manager.
  • Click on "Performance" on the left-hand side.

Now look if you have the following requirements:

  • At least a dedicated graphics card like NVIDIA.
  • At least 4 GB of dedicated GPU memory.
  • At least 10 GB of free hard drive space.

If you meet these requirements, you're ready to move on to the installation process.

Stable Diffusion in the Cloud⚡️Run Automatic1111 in your browser in under 90 seconds
20% bonus on first deposit

3. Installing the Pre-Requisites: Git and Python

To use Stable Diffusion, you need to get two different pre-requisites. The first one is called Git. Click on the provided link to download Git.

Step 1: Download Git

  • Click on the provided link to download Git. install-use-stable-diffusion-for-windows-stunning-images-download-git.png
  • Once the download is complete, run the installation file with the default settings.

Git is used for source control management, but in this case, we're simply using it to download Stable Diffusion and keep it up to date.

Step 2: Download Python

The second pre-requisite is Python. Click on the provided link to download Python. Make sure to select version 10.6, which is the current version that works with Stable Diffusion.

  • Click on the provided link to download Python. install-use-stable-diffusion-for-windows-stunning-images-download python for stable diffusion.png

  • During the installation process, check the box to add python.exe to the system's PATH, which will make it easier to run the Python scripts.

4. Installing Stable Diffusion with WebUI

Now that we have all the pre-requisites, we're ready to install Stable Diffusion. We will install a fork called WebUI, which is the most popular fork and provides a graphical interface for easier interaction.

  • Open File Explorer (press Windows key + E)

  • Navigate to the location where you want to install Stable Diffusion.

  • Create a new folder and name it "stable-diffusion" install-use-stable-diffusion-for-windows-stunning-images-download-create stable diffusion folder.png

  • Open the folder and click on the address bar. Type "CMD" to open the command prompt. install-use-stable-diffusion-for-windows-stunning-images-download-enter cmd in navbar.png

  • We will use Git to clone the Stable Diffusion files.

  • Enter the command git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui in the command prompt and press Enter. install-use-stable-diffusion-for-windows-stunning-images-download-git clone stable diffusion.png

  • This will download the Stable Diffusion files from the GitHub repository.

Stable Diffusion in the Cloud⚡️Run Automatic1111 in your browser in under 90 seconds

5. Download Stable Diffusion Base Model

6. Launching Stable Diffusion Web UI

To launch the Stable Diffusion Web UI:

  • Navigate to the stable-diffusion-webui folder: install-use-stable-diffusion-for-windows-stunning-images-download-open stable diffusion.png
  • Double Click on web-user.bat, this will open the command prompt and will install all the necessary packages. This can take a while. install-use-stable-diffusion-for-windows-stunning-images-download-web ui bat.png
  • After completing the installation and updates, a local link will be displayed in the command prompt: install-use-stable-diffusion-for-windows-stunning-images-download-web ui localhost url.png
  • Use Ctrl + C to copy the URL beginning with http and then paste it into your web browser.
  • Congratulations! You have successfully installed Stable Diffusion. install-use-stable-diffusion-for-windows-stunning-images-download-web ui bat stable diffusion opened start local host.png
  • At the top left corner, you have the option to choose your base model, create your input prompt, and begin generating AI images.
Stable Diffusion in the Cloud⚡️Run Automatic1111 in your browser in under 90 seconds

7. Additional Settings

By default, your version of Stable Diffusion will not receive automatic updates. Considering the rapid pace of advancements, it is highly probable that you will need to update your version at some stage in order to access the most up-to-date and impressive features. This can be achieved by adding the line git pull to the top of the webui-user.bat file.

Additionally you can speed up stable diffusion with some additional settings. If you have less than 8 GB VRAM on GPU, it is a good idea to turn on the --medvram option to save memory to generate more images at a time.

To enable these settings, right-click on the file webui-user.bat and select Edit. (You may need to select “Show More Options” first if you use Windows 11).

  • When opened add git pull to the top of the document. This will automatically update to the newest version when starting Stable Diffusion.
  • Update COMMANDLINE_ARGS to the following: set COMMANDLINE_ARGS= --xformers --medvram
  • Save, Close and Double Click the file to start Stable Diffusion with these new settings.

how-to-install-stable-diffusion-on-windows-additional settings lowvram medvram xformers.png

Do you get out-of-memory errors?

  • Consider changing the --medvram settings to --lowvram.
  • Additionally, Add a new line in the webui-user.bat file named set PYTORCH_CUDA_ALLOC_CONF.
  • Set the value to garbage_collection_threshold:0.6,max_split_size_mb:128

how-to-install-stable-diffusion-on-windows-settings-lowvram medvram threshold mb 128.png

8. Conclusion

In this blog post, we covered the installation and usage of Stable Diffusion for stunning image generation. We discussed both the web version and the installation process on your PC using the WebUI fork. Stable Diffusion provides a powerful tool for generating images based on text prompts, and by installing it locally, you gain more control over the parameters and output. Have fun exploring the creative possibilities with Stable Diffusion!

Frequently Asked Questions

Stable Diffusion is a tool that uses AI to generate stunning images based on text prompts. Installing it on your Windows PC allows you to have more control over parameters and output, and it's especially beneficial if you want to create hyper-realistic images. The installation process is outlined in this guide.

Before installing Stable Diffusion, make sure your PC meets the following requirements:

  • A dedicated graphics card (e.g., NVIDIA) with at least 4 GB of dedicated GPU memory.
  • At least 10 GB of free hard drive space.