May 20, 2024
Guide to Running Stable Diffusion Locally
Learn to run Stable Diffusion 3 online and locally to generate detailed images with this easy-to-follow guide.
![Stable Diffusion Locally](https://framerusercontent.com/images/7cuJ2ACUAAbxF9dNTpp5nswG6dc.png)
Stable Diffusion model was released in 2022 by a startup named Stability AI, in collaboration with academic researchers and non-profit organizations.
This open-source deep learning model is designed to generate high-quality, detailed images from text. You can also use it to modify images or add details to low-resolution images.
Stable Diffusion 3 is the latest iteration of the text-to-image AI model developed by Stability AI. It introduces several significant improvements over previous versions, making it a strong competitor to OpenAI's DALL-E 3.
In this guide, we will briefly explain how it works and show you how to run Stable Diffusion locally and online.
How Does Stable Diffusion Work?
Stable Diffusion is a type of deep learning model called a diffusion model. More specifically, it’s a generative model, meaning it’s trained to create new data similar to what it has learned from past data.
Generative modeling is a type of unsupervised learning that automatically discovers and learns patterns in input data. This allows the model to generate new examples that resemble the original data.
The term "diffusion" in Stable Diffusion comes from its mathematical similarity to the concept of diffusion in physics.
While DALL-E 3 is a closed-source commercial product from OpenAI, Stable Diffusion 3 is an open-source model designed to meet or exceed DALL-E 3's performance. Stability AI's human preference evaluations show that SD3 excels in areas such as typography (text rendering) and prompt adherence (following the given context), outperforming DALL-E 3 in these aspects.
How to Run Stable Diffusion Locally
If you want to experiment with Stable Diffusion on your local computer, we’ve got you covered.
Running Stable Diffusion locally lets you experiment with various text inputs to generate images tailored to your needs. You can also fine-tune the model on your data for better results.
Disclaimer: You must have a GPU to run Stable Diffusion on your PC.
Step 1: Install Python & Git
You will need Python 3.10.6 to run Stable Diffusion on your local computer. You can download it from the official Python website. If you have any issues, refer to our How to Install Python tutorial.
To check if the installation was successful, open the command prompt, type python
, and execute the command. This should display the Python version you are using. If you don’t see Python version 3.10.6 or later, ensure you’ve removed all other versions of Python from your PC.
Next, install Git. You can follow the Git Install Tutorial for assistance.
Note: Don’t proceed without Python 3.10.6 or later versions.
Step 2: Create GitHub and Hugging Face Accounts
GitHub is a hosting service for software development. It’s where developers host their code to track and collaborate on projects. If you don’t have a GitHub account, now is a good time to create one. Here, the GitHub & Git Tutorial for Beginners can help.
Hugging Face is an AI community that supports open-source contributions. It hosts various models, including those for natural language processing and computer vision. You’ll need an account to download the latest version of Stable Diffusion.
Step 3: Clone Stable Diffusion Web-UI to Your PC
This step involves downloading the basics of the Stable Diffusion installation to your local PC. It’s helpful to create a folder (e.g., stable-diffusion-demo-project) for this purpose, but it’s not required.
Using Git Bash, navigate to the folder where you want to clone the Stable Diffusion web UI with this command:
Then, run the following command:
If the command executes successfully, you should now have a folder called stable-diffusion-webui.
Step 4: Download the Latest Stable Diffusion Model
Log in to Hugging Face and download a Stable Diffusion model. This may take a few minutes because it’s a relatively large file.
Once downloaded, navigate to the “models” folder inside the stable-diffusion-webui folder. There should be a “stable-diffusion” folder containing a text file titled “Put Stable Diffusion Checkpoints here.”
Move the downloaded Stable Diffusion model to this folder. The path should look like this:
Step 5: Set Up the Web-UI
The next step is to install the tools required to run Stable Diffusion. This process can take about 10 minutes.
Open your command prompt and navigate to the stable-diffusion-webui folder with this command:
Once there, run:
This will create a virtual environment and install all necessary dependencies.
Step 6: Run Stable Diffusion
After the dependencies are installed, a URL will appear in your command prompt:
Copy and paste this into your address bar to run the Stable Diffusion web UI.
How To Run Stable Diffusion Online
If you want to get started with Stable Diffusion online, you can run it using the following tools:
DreamStudio
Stability AI, the team behind Stable Diffusion, have made it easy to test their text-to-image model with an online tool called DreamStudio. This platform provides access to the latest Stable Diffusion models like SD3, allowing you to generate an image in up to 15 seconds.
To use DreamStudio, you need to sign up. New users receive 25 credits (at the time of writing) when they create an account, which lets you generate around 100 images. If you need more, you can purchase extra credits from the account dashboard.
![DreamStudio Generated Dragons](https://framerusercontent.com/images/rpS81zL5PpGxp9obT6iL9gxqRac.png?scale-down-to=1024)
ChatLabs AI
With ChatLabs, you can not only use Stable Diffusion 3 but also compare it with DALL-E 3 using the ChatLabs AI Split View mode. Here’s how:
Go to the ChatLabs website: ChatLabs and log in.
Activate the Pro Subscription, as using text-to-image models requires a subscription.
Choose Split Screen mode on the left panel and select AI Image Generators in the Plugins menu.
If you prefer not to pay, ChatLabs offers free access to many models. For $20/month, you get unlimited access to DALL-E 3, Stable Diffusion 3, and other Pro models like Claude 3 Opus, Gemini 1.5 Pro, and Perplexity. ChatLabs provides access to top AI tools for a fraction of the cost, saving you hundreds.
Watch the video of running and comparing DALL-E 3 and Stable Diffusion 3 using ChatLabs Split Screen:
Hugging Face Stable Diffusion
Hugging Face is an AI community platform known for its open-source contributions. It also offers access to the latest Stable Diffusion models. The downside is that you can’t customize properties as you can in DreamStudio, and it takes more time to generate an image.
Summing Up
In conclusion, running Stable Diffusion locally and online provides flexibility and control over your image generation projects. Whether you use DreamStudio, ChatLabs AI, or Hugging Face for online testing, or set up the model on your local computer, you can use this open-source image generation model. With Stable Diffusion 3, you can create high-quality, detailed images that meet your specific needs, beating other models like DALL-E 3 in key areas. Start exploring the features of SD3 today and take your projects to the next level.