How to Install Stable Diffusion on Windows
Introduction:
Yes, it is possible to install Stable Diffusion on Windows, and here I will show you how to do it step by step. Before starting, it's important to mention that the main challenge for many users can be the hardware. While an NVIDIA RTX 3050 with 4 GB may be sufficient to get started, it is ideal to have an RTX 3060 with 12 GB or even a 3070 for better results and processing times.
In this tutorial, I will guide you through the installation of Stable Diffusion using the most popular method: Automatic1111 Web UI, a user-friendly graphical interface for those who want to experiment with Stable Diffusion locally on their Windows PC.
Prerequisites:
- Windows 10 or higher
- NVIDIA GPU (recommended to leverage CUDA acceleration)
- Updated GPU drivers
Step 1: Install Python and Git
Install Python 3.10.6 (not version 3.12):
- Visit the official Python website and download version 3.10.6.
- During the installation, make sure to select the "Add Python to PATH" option. This will allow you to run Python from the command line without issues.
Install Git:
- Download Git from Git SCM. During the installation, you can accept the default settings.
Clone the Automatic1111 Web UI repository: Once Git is installed, open a PowerShell or CMD window and run the following command to clone the repository:
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
Step 2: Download the Stable Diffusion Model
Stable Diffusion requires a pretrained model to function. You can download this model from trusted platforms like Hugging Face.
Go to Hugging Face and accept the terms to download the model.
Once downloaded, move the
.ckpt
or.safetensors
file to the cloned repository folder:\stable-diffusion-webui\models\Stable-diffusion\
Step 3: Install Dependencies
Within the stable-diffusion-webui
directory, run the following command in PowerShell or CMD to install all necessary dependencies:
webui-user.bat
This script will automatically download and install libraries like torch, xformers, and other dependencies for the graphical interface.
Step 4: Run Stable Diffusion Web UI
Once the installation is complete, you can run Stable Diffusion by starting the script again:
webui-user.bat
This will open a local web interface that you can access from your browser by entering the following address:
http://127.0.0.1:7860
Optional: Improve Performance
To optimize performance, you can enable xformers, a library that improves efficiency on compatible GPUs. Simply add the --xformers
option to the webui-user.bat
file. For example:
set COMMANDLINE_ARGS=--xformers
Step 5: Customization and Usage
Once you are in the web interface, you can start generating images using prompts. Adjust the parameters to your liking to achieve the desired results.
Comments
Post a Comment