Skip to main content
Stable Diffusion 1.x and 2.x are the foundational image generation models supported by sd-scripts. Both share the same UNet + VAE + CLIP pipeline architecture but differ in resolution targets and text encoder configuration.

Architecture

SD 1.x and 2.x use the classic latent diffusion architecture:
  • UNet — the denoising backbone that operates on compressed latent representations.
  • VAE — encodes images into latent space and decodes latents back to pixel space.
  • CLIP text encoder — conditions generation on text prompts.
    • SD 1.x uses OpenAI CLIP ViT-L/14.
    • SD 2.x uses OpenCLIP ViT-H/14 with a 1024-dimensional embedding.

Supported versions

SD 2.x models require --v2 and, for v-prediction checkpoints, --v_parameterization. Omitting these flags when training against a v2 checkpoint produces incorrect results.

Available training methods

LoRA training

Use train_network.py with --network_module=networks.lora:
A LoRA rank of 16–32 (--network_dim) is a good starting point for most subjects. Lower ranks (4–8) reduce file size at the cost of expressiveness; higher ranks (64+) can overfit with small datasets.

SD 2.x flags

When training against an SD 2.x checkpoint you must add the following flags:
Not all SD 2.x checkpoints use v-parameterization. Check the model card before adding --v_parameterization. Applying it to an epsilon-prediction checkpoint degrades quality.

Textual Inversion

Textual Inversion trains new token embeddings without modifying the model weights. Use train_textual_inversion.py:

Key training parameters