Stable Diffusion (Basics)p.1

Wassimgouia
4 min readAug 11, 2023

--

What’s Stable Diffusion

Stable diffusion is an Open-source model that generates images from natural language descriptions. It works by progressively refining an initial random noise vector until it matches the desired output image, using a process called diffusion models. The goal of Stable Diffusion is to produce high-quality images that accurately represent the textual description given as input. Think of it like a generative art tool that takes words as input and produces beautiful, unique images as output!

The different Versions Of Stable Diffusion

  1. Stable Diffusion v1:

Pros:

  • Relatively lightweight, with fewer parameters compared to later versions.
  • Easier to train and deploy due to its simpler architecture.
  • Still achieves competitive results on many NLP tasks.

Cons:

  • Less powerful than newer versions, particularly in terms of generating diverse and coherent text.
  • May struggle with very long sequences or complex tasks.
  1. Stable Diffusion v2:

Pros:

  • Significantly improves upon v1 in terms of text diversity and coherence.
  • Incorporates attention mechanisms for better contextual understanding.
  • Supports multiple output modes, including autoregressive and non-autoregressive decoding.

Cons:

  • Has more parameters and requires more computation compared to v1, making it slower to train and evaluate.
  • May suffer from overfitting if not properly regularized.

3. Stable Diffusion XL:

Pros:

  • Combines the best aspects of v1 and v2, offering both high performance and efficiency.
  • Achieves state-of-the-art results on many NLP tasks while being relatively lightweight.
  • Supports multi-task learning and transfer learning.

Cons:

  • Was specifically designed for the GLUE benchmark, so its performance might vary on other datasets.
  • Requires careful hyperparameter tuning for optimal results(like the resolution that I will cover in another video)

How can you use it?

There to ways, you can use Stable Diffusion either locally or online both for free! here’s how :

online:

there are 2 possibilities in which you can use stable diffusion for free online

the first one is: https://stablediffusionweb.com/

in this web version of stable diffusion you can generate images using prompting and it even offers a prompt generator but it has some limitations like the parameters are not as complete as it is locally or you have to wait in the queue to get your generated AI art

the second one is: https://stability.ai/stablediffusion

compared to stablediffusiononline stability ai(Dream Studio) is so much better quality and also you don’t have to wait in the queue for long but unfortunately it’s not totally free you need to buy credits so you can generate the prompts.

It’s fantastic that you can try stable diffusion now for absolutely no cost at all and especially you don’t need computational power to run the prompts and get the results you want, but is that the case do we really get the results we want? unfortunately, it is not promising quality or it charges you money.

That’s why I recommend using your computer(especially if you have a powerful GPU)

Locally: https://github.com/AUTOMATIC1111/stable-diffusion-webui

This is the official repository of the stable diffusion open-source project it shows how to download it but I will show you how in a simpler way

how to download it(Latest Stable Diffusion Version2):

1- first of all Create an empty folder in a directory of your choice(preferably on your Desktop home screen)

Here in my case, I've named it SD

2- Second after creating the folder click in the directory and type cmd to open the command prompt

this opens up a command prompt and here is where the work starts

3- now install Python and git

for Windows:

to install Python you can click on the link below

https://www.python.org/downloads/release/python-3106/

afterward, you install Git by clicking on this link:

https://git-scm.com/download/win

make sure when installing Git you select the “Use Git from the Windows Command Prompt” option. This will allow you to use all Git commands through your terminal (CMD, PowerShell, Anaconda) rather than having to use Git’s personal terminal, Git Bash

afterward, all you have to do is run this command in your cmd:

git clone <https://github.com/AUTOMATIC1111/stable-diffusion-webui.git>

after the process is finished go back to your folder and click in

“webui-user.bat” file will automatically open a cmd window and all you have to do is wait for it to install all the dependencies.

after the installation is complete a Local URL will appear and all you have to do is “CTRL + left click” and enjoy the power of Stable Diffusion

for Linux:

First of all, Install the dependencies :

# Debian-based:
sudo apt install wget git python3 python3-venv
# Red Hat-based:
sudo dnf install wget git python3
# Arch-based:
sudo pacman -S wget git python3

Second:

  1. Navigate to the directory you would like the WebUI to be installed and execute the following command:
bash <(wget -qO- <https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh>)

check the files with the ls command :

ls

now all you have to do is run webui.sh

and Check webui-user.sh for options.

Comment Below What you want to see next in a blog post:

1-the Ai models and how to download them

2-how to set up SDXL

3-Stable diffusion prompting

--

--