Difference between revisions of "Stable Diffusion"

From Interaction Station Wiki
Jump to navigation Jump to search
m
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Generating images from a sentence using Stable Diffusion (sd) ==
+
== Generating images from a sentence using Stable Diffusion ==
  
Stable Diffusion is an AI algorithm developed by [https://github.com/CompVis/stable-diffusion CompVis] and sponsored primarily by [https://stability.ai/ Stability AI], a startup that aims to be the driving-force behind the open-source AI revolution. The algorithm itself builds on ideas from [https://openai.com/dall-e-2/ Open AI’s DALL-E 2], [https://imagen.research.google/ Google’s Imagen] and other image generation models, with some extra optimizations.
+
Stable Diffusion is an AI algorithm developed by [https://github.com/CompVis/stable-diffusion CompVis] and sponsored primarily by [https://stability.ai/ Stability AI], a startup that aims to be the driving-force behind the open-source AI. The algorithm itself builds on ideas from [https://openai.com/dall-e-2/ Open AI’s DALL-E 2], [https://imagen.research.google/ Google’s Imagen] and other image generation models, with some extra optimizations.
  
=== Parameters ===
+
=== Running Stable Diffusion ===
<code>--prompt</code> <code>"a painting of a fantasy landscape"</code>: Sentence (prompt) to generate an image off, between double quotes<br>
+
At the time of writing, Stable Diffusion (SD) is only installed on the PCs in classroom WH02.110. So find yourself a PC and [[Ubuntu | login to Ubuntu]]. After you've logged in, open the [[Terminal | terminal]] and enter the following commands to start up SD.</br></br>
<code>--outdir</code> <code>outputs/txt2img-samples</code>: Directory (folder) to save the generated image to<br>
+
 
<code>--skip_grid</code>: Generate single images instead of multiple images in a grid<br>
+
1: Navigate to the SD folder
<code>--skip_save</code>: Do not save images<br>
+
cd ~/MachineLearning/stable-diffusion-webui
<code>--ddim_steps</code> <code>50</code>: Steps for image processing, higher means more detail. Worse results past 250<br>
+
 
<code>--fixed_code</code><br>
+
2: Activate the environment
<code>--ddim_eta</code><br>
+
conda activate stable-diffusion
<code>--n_iter</code><br>
+
 
<code>--H</code><br>
+
3: Start SD
<code>--W</code><br>
+
python launch.py --opt-split-attention --medvram --disable-safe-unpickle
<code>--C</code><br>
+
 
<code>--f</code><br>
+
The moment you run the final command, some output will appear within the terminal. At a certain point you will see <code>Running on local URL: http://127.0.0.1:7860</code>. If you open any browser and navigate to this link (or just click the link in the terminal while holding the <code>ctrl</code> key), you will be greeted by the SD interface. Keep in mind that this is a local URL, meaning that you can only visit this website on the PC which is running the SD command you typed in at step 3.
<code>--n_samples</code> <code>5</code>: How many images to generate for each given prompt<br>
 
<code>--n_rows</code> <code>5</code>: Rows in the grid<br>
 
<code>--scale</code><br>
 
<code>--from-file</code><br>
 
<code>--seed</code><br>
 
<code>--small_batch</code>: Reduce time when generate a smaller batch of image<br>
 
<code>--precision</code>
 
  
 
=== Image sizes ===
 
=== Image sizes ===
Line 37: Line 30:
 
Prompt builder: https://promptomania.com/stable-diffusion-prompt-builder/<br>
 
Prompt builder: https://promptomania.com/stable-diffusion-prompt-builder/<br>
 
Img to prompt: https://replicate.com/methexis-inc/img2prompt<br>
 
Img to prompt: https://replicate.com/methexis-inc/img2prompt<br>
Prompt examples: https://lexica.art/
+
Prompt examples: https://lexica.art/<br>
 +
Have I Been Trained: https://haveibeentrained.com/
  
 
== Community ==
 
== Community ==
 
Discord: http://discord.gg/stablediffusion
 
Discord: http://discord.gg/stablediffusion
 +
 +
== Readme with examples ==
 +
http://github.com/AUTOMATIC1111/stable-diffusion-webui-feature-showcase
 +
 +
 +
[[Category:Generative Models]]

Latest revision as of 12:22, 20 January 2023

Generating images from a sentence using Stable Diffusion

Stable Diffusion is an AI algorithm developed by CompVis and sponsored primarily by Stability AI, a startup that aims to be the driving-force behind the open-source AI. The algorithm itself builds on ideas from Open AI’s DALL-E 2, Google’s Imagen and other image generation models, with some extra optimizations.

Running Stable Diffusion

At the time of writing, Stable Diffusion (SD) is only installed on the PCs in classroom WH02.110. So find yourself a PC and login to Ubuntu. After you've logged in, open the terminal and enter the following commands to start up SD.

1: Navigate to the SD folder

cd ~/MachineLearning/stable-diffusion-webui

2: Activate the environment

conda activate stable-diffusion

3: Start SD

python launch.py --opt-split-attention --medvram --disable-safe-unpickle

The moment you run the final command, some output will appear within the terminal. At a certain point you will see Running on local URL: http://127.0.0.1:7860. If you open any browser and navigate to this link (or just click the link in the terminal while holding the ctrl key), you will be greeted by the SD interface. Keep in mind that this is a local URL, meaning that you can only visit this website on the PC which is running the SD command you typed in at step 3.

Image sizes

[1:1] Square: --W 512 --H 512
[16:9] Widescreen: --W 1024 --H 576
[9:16] Mobile first (Instagram stories, Snapchat etc): --W 576 --H 1024
[10:16] Portrait: --W 640 --H 1024

Code

Github: https://github.com/mywdka/stable-diffusion

Tools

Dataset explorer: https://knn5.laion.ai (mirror)
Prompt builder: https://promptomania.com/stable-diffusion-prompt-builder/
Img to prompt: https://replicate.com/methexis-inc/img2prompt
Prompt examples: https://lexica.art/
Have I Been Trained: https://haveibeentrained.com/

Community

Discord: http://discord.gg/stablediffusion

Readme with examples

http://github.com/AUTOMATIC1111/stable-diffusion-webui-feature-showcase