Stable Diffusion is a powerful tool for generating high-quality images from text prompts. In this article, we will walk through the steps to install Stable Diffusion locally on your machine, allowing you to harness its capabilities without relying on cloud services.
Before you begin, make sure you have the following:
First, you need to clone the Stable Diffusion repository from GitHub. Open your command line and run:
git clone https://github.com/CompVis/stable-diffusion
Once the repository is cloned, navigate to the Stable Diffusion directory:
cd stable-diffusion
It’s advisable to create a virtual environment to manage dependencies:
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
Now that you have activated the virtual environment, install the necessary packages:
pip install -r requirements.txt
Stable Diffusion requires pre-trained model weights. You can download these from the official Hugging Face repository.
After downloading, place the weights in the appropriate directory as specified in the README of the repository.
Now, you're ready to generate images! You can use the command below to run the model:
python scripts/txt2img.py --prompt "A fantasy landscape" --plms
To create different images, modify the --prompt argument with your desired text. Here are some examples:
--prompt "A futuristic city skyline at sunset"
--prompt "A serene forest with a river running through it"
--prompt "A cyberpunk character in a neon-lit alley"
If you encounter any issues during installation or execution, consider the following:
"With the power of Stable Diffusion, the only limit is your imagination!" - AI Enthusiast
Now you have a local installation of Stable Diffusion! Experiment with various prompts and settings to create stunning images tailored to your preferences.