Stable Diffusion is a powerful deep learning model for generating images from text prompts. In this guide, we will walk you through the steps to install and run Stable Diffusion locally on your machine. You'll be able to generate stunning images with just a few commands!
Before you begin the installation process, ensure you have the following prerequisites:
First, create a virtual environment using Conda or Python's built-in venv
module:
conda create -n stable-diffusion python=3.8
Activate the virtual environment:
conda activate stable-diffusion
Clone the official Stable Diffusion repository from GitHub:
git clone https://github.com/CompVis/stable-diffusion
Navigate to the cloned directory:
cd stable-diffusion
Now, install the required Python packages:
pip install -r requirements.txt
You need to download the pre-trained model weights. Visit the official Hugging Face Model Hub and download sd-v1-4.ckpt. Place it in the models/ldm/stable-diffusion-v1 directory.
You can now run Stable Diffusion with the following command:
python scripts/txt2img.py --prompt "a fantasy landscape" --plms
Replace "a fantasy landscape" with your desired prompt to generate different images.
If you encounter any issues during installation or execution, consider the following troubleshooting tips:
Congratulations! You've successfully installed Stable Diffusion on your local machine. You can now generate unique images from text prompts. Experiment with different prompts and settings to explore the full potential of this amazing model!
For more in-depth information, check out the following resources:
“The best way to predict the future is to create it.” - Peter Drucker