How to run Stable Diffusion locally on your computer
Created on August 27, 2024 by Dawid Wasowski Updated on Oct 4, 2024 https://dav.one/how-to-run-stable-diffusion-locally/
Hardware requirements
The minimum requirement is a computer with a graphics card that has at least 6GB
VRAM. It is possible
to work on 4GB with some tweaks, but in my opinion, it’s not worth trying. The
perfect scenario is to have a top-tier graphics card like
Nvidia RTX4090.
I recommend reading the article about
the ways and costs of generating graphics
before you start.
Installers
Some of popular User Interfaces (UIs) have their own installers. Even if that’s
just a simple script that downloads and configures everything for you, it’s
still an installer. It’s better than forcing users to execute commands manually
in the terminal.
This is the list of popular UIs with installers:
You need to read the documentation of each installer to know how to use it. Some
of them has significantly better performance than others. Some of them supports
FLUX, some not yet. Each of them has different
features, so you need to choose the one that suits your needs.
Cons:
- You may encounter problems with installation and running. Be prepared to spend
some time on manual configuration and fixing errors.
- You may need to learn how to use
Symbolic Links to share models
between UIs.
Stability Matrix
Stability Matrix is a
Multi-Platform Package Manager for Stable Diffusion. Supports Windows, Linux and
MacOS. You can use it to download and run
UIs locally without
unnecessary configuration.
Pros:
- Easy to use.
- You don’t need to install requirements manually.
- You can have multiple UIs installed at the same time and share models between
them.
- Has model browser that allows you to download models directly.
LynxHub
LynxHub is another Multi-Platform
Package Manager for Stable Diffusion. Released for public in August 2024.
Basically it does the same thing as
Stability Matrix. Has a
bit different features and UI.
Comment from the author
about the differences between them. Personally, I didn’t have a chance to do
large tests of LynxHub yet.
Pros:
- Easy to use.
- Nice looking User Interface.
Pinokio
Pinokio - is “a browser that lets you install, run,
and programmatically control ANY application, automatically”. Pinokio is not
focused on Stable Diffusion, but you can use it to run popular UIs. Community
feedback is positive. However, due to the issues mentioned below, I have not
tested it good enough yet.
Cons:
- Terrible App installer. You need to specify the path to install the app
manually. And if that path already exists, you will need to delete it first.
- Has issues with App State Management. You can clearly see that when you change
settings.
- Terrible UI/UX.
Docker
Docker is a platform that enables developers to
automate the deployment of applications inside lightweight, portable containers.
In easy words - you download an file that contains everything you need to run
Stable Diffusion and you launch it. Anyway, it’s a bit more complicated than
previous methods, because you will need to:
- Install and configure Docker.
- Select and download proper image from Docker Hub.
Each image has different features and requirements. So you will need to spend
some time on searching.
- Configure Container. For this part you will need to read the documentation of
the image you downloaded. In most cases you will need to set up just a few
environment variables.
Pros:
- You can switch between different Docker images.
- It’s secure. Things are isolated from your system. Even if you will run a
Pickle Tensor
model, it won’t harm your computer.
Cons:
- Sharing models between Docker images is harder. You will need to
configure it.
There are tons of Docker images created by the community. You need to find the
one that suits your needs. Check
Docker Hub and
GitHub.
Personally, I recommend using AI-Dock images. They
are well maintained and they give you a cool feature to use
Provisioning Scripts
to “perform certain actions when starting a container, such as creating
directories and downloading files”.