To install and run default Stable Diffusion locally, you require a GPU-equipped machine.
But not a lot of consumer Computers have GPUs.
In this article, we will see how to install and run Stable Diffusion locally without a GPU.
Note that since Stable Diffusion is going to use the CPU to generate images, the speed is much slower than if you have a GPU.
If this is a good enough trade-off for you, then read on.
Table of Contents
Before you follow the steps in this article to get Stable Diffusion working on a CPU-only computer, make sure to check if the below requirements are met.
- A computer running Linux, Windows or Mac.
- Prior knowledge of running commands in a Command line program, like Powershell on Windows, or Terminal on Ubuntu / Linux.
- Python 3.8 or higher is installed.
If all is good so far, then let’s go look at those steps.
Install Stable Diffusion locally without a GPU on CPU-only machines
Get the code
Very first thing you need to do is get the code for this. Open the command line program on your computer and run the below command
git clone [email protected]:bes-dev/stable_diffusion.openvino.git
If you don’t have git installed, you could directly download the archive from github and open the archive.
Next, from the command line program, change into the opened archive or the cloned git repo from the above setep.
Next, run the below command to install Stable Diffusion and other modules necessary for it
pip install -r requirements.txt
If you see no errors, then you have stable diffusion installed now
Running Stable Diffusion locally without a GPU
There are two ways to use this
In your command line program, make sure you are still in the downloaded code folder.
Run below command to generate an image from a prompt:
python demo.py --prompt "A market scene from the Roman era, oil painting"
Browser based GUI
from the command line program, run this command
streamlit run demo_web.py
This will open a GUI App in your browser where you can enter your prompts and generate images.