Mastering Stable Diffusion Web UI Part 1

Mastering Stable Diffusion Web UI Part 1

Let's talk about something you need to know before getting to use SD WebUI to generate images.

Basic Knowledges

Prompt

Prompt is a text instruction that you give to the Stable Diffusion AI image generator to tell it what kind of image you want it to create. The more specific and detailed your prompt is, the better the AI will be able to understand your vision and generate an image that matches it.

A photorealistic portrait of a woman with flowing red hair, standing in a field of wildflowers under a starry night sky.

Negative Prompt

Negative prompt is a specific type of prompt used to tell the AI image generator what you don't want to see in the generated image. It functions like a filter, guiding the AI away from certain features or styles.

blurry, bad anatomy, text, low quality

Checkpoint

It's a pre-trained Stable Diffusion weights, also known as models or checkpoint files, that are models designed for generating specific styles of images. To make it simple, it's like a pre-trained "brain" for the image generator, packed with the knowledge it has learned from its training data.

Here is how it impacts your image creation:

  • Different checkpoints specialize in different things. Some excel at photorealism, while others shine in specific styles or subjects. This depends on the data they were trained on.
  • Quality and consistency vary. Generally, the larger and more advanced the checkpoint, the better the results.
  • Subjects and abilities differ. Some checkpoints can handle a broad range of prompts, while others might be focused on specific themes like landscapes or portraits.

There are some popular models include: Stable diffusion v1.5, SDXL, Realistic Vision, Anything V5, Deliberate V2, Waifu Diffusion V1.4

Normally the size of stable diffusion models ranges from 2 - 8 GB.

Lora

Lora stands for Low-Rank Adaptation. It offers a unique way to fine-tune and customize Stable Diffusion models, addressing some of their limitations. LoRA models are incredibly small, typically ranging from 1MB to 200MB, compared to the several gigabytes of full Stable Diffusion checkpoints. So it is very attractive to individuals as it offers a good trade-off between file size and training power.

Benefits of LoRA:

  • Smaller file size: Easier to manage and share compared to full checkpoints.
  • Targeted adjustments: Fine-tune specific aspects of the AI's output without affecting everything.
  • Wider variety of results: Create custom styles and concepts beyond what's available in general checkpoints.

Embedding

Stable Diffusion embeddings, or textual inversions, are small files containing additional concepts that can be added to a base model without modifying the model itself. They are used to inject new styles or objects into a model to enhance the quality, details, and colors of images, and they play a significant role in expanding the capabilities of models in image generation and manipulation.

Benefits of embeddings:

  • Fine-tune your images: Add specific details, styles, or moods that wouldn't be possible with just a text prompt.
  • Expand your creative reach: Create novel concepts or capture unique artistic approaches beyond the reach of standard checkpoints.
  • Personalize your workflow: Build a library of custom embeddings to inject your own aesthetic or favorite subjects into any image.
  • Lightweight and flexible: Embeddings are small and easy to share, making collaboration and experimentation simple.

Folder Location

Checkpoint default location

  • On Windows: Usually found in C:\Users\YourUserName\path\sd.webui\webui\models\Stable-diffusion
  • On macOS: Typically in /Users/YourUserName/path/sd.webui/webui/models/Stable-diffusion

Lora default location

  • On Windows: Usually found in C:\Users\YourUserName\path\sd.webui\webui\models\Lora
  • On macOS: Typically in /Users/YourUserName/path/sd.webui/webui/models/Lora

Embedding default location

  • On Windows: Usually found in C:\Users\YourUserName\path\sd.webui\webui\embeddings
  • On macOS: Typically in /Users/YourUserName/path/sd.webui/webui/models/embeddings

SD Web UI command line arguments

Typically, no arguments will be included when starting Stable Diffusion WebUI by default. You can add arguments by editing this file: /path/sd.webui/webui/webui-user.bat

@echo off

set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS= --xformers --listen

call webui.bat
  • --xformers will greatly improve memory consumption and speed. Nvidia GPUs only.
  • --listen allows you to access SD WebUI through the intranet rather than accessing it through localhost.

Please refer to this link for more information about SD WebUI arguments.

That's all for today. In the next article, I will explain how to use txt2img and img2img.