explaingit

kohya-ss/sd-scripts

7,025PythonAudience · vibe coderComplexity · 4/5Setup · hard

TLDR

A collection of Python scripts for training and fine-tuning AI image generation models like Stable Diffusion, FLUX, and SDXL on your own hardware using techniques like LoRA and DreamBooth.

Mindmap

mindmap
  root((sd-scripts))
    Supported Models
      Stable Diffusion
      SDXL
      FLUX.1
      SD3
    Training Methods
      LoRA
      DreamBooth
      Textual Inversion
    Utilities
      Model conversion
      LoRA merging
      Image tagging
    Setup
      Windows
      Linux WSL2
      CUDA GPU
    Audience
      Image creators
      AI artists
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Train a LoRA file that teaches Stable Diffusion your art style using a small set of your own images, without a full model retrain.

USE CASE 2

Fine-tune FLUX.1 or SDXL with DreamBooth to generate images of a specific person, product, or character.

USE CASE 3

Convert and merge LoRA checkpoint files between model formats, or resize a LoRA to reduce its file size.

Tech stack

PythonPyTorchCUDAWindowsLinux

Getting it running

Difficulty · hard Time to first run · 1day+

Requires a CUDA-capable Nvidia GPU, training large models without one is not practical.

In plain English

sd-scripts is a collection of Python scripts for training and fine-tuning AI image generation models. The primary focus is on Stable Diffusion and its variants, but the project also supports other modern image models including FLUX.1, SDXL, SD3, LUMINA, and HunyuanImage-2.1. The scripts let you take an existing image model and teach it new visual styles, subjects, or concepts using your own image data. The most common use case is LoRA training, a technique that adjusts a small part of the model rather than retraining the entire thing. This makes training feasible on consumer-grade hardware and produces files that can be layered on top of base models without permanently altering them. The project also supports deeper training approaches such as DreamBooth fine-tuning, Textual Inversion (teaching the model a new word that refers to a specific concept), and inpainting model training. Additional utilities cover practical tasks like converting models between different formats, tagging images automatically using a separate AI tagger (WD14), merging multiple LoRA files, and resizing them. Multi-resolution dataset handling lets you train on images of different sizes at once. Installation is available for both Windows and Linux, including WSL2 on Windows. Documentation for most training workflows is provided in both English and Japanese, reflecting the project's roots and the bilingual community around it. The README also describes a setup path for developers who want to use AI coding assistants like Claude within the repository. The project is actively maintained with frequent releases. Recent updates added Intel GPU support, improved fp16 training stability, and extended LoKr and LoHa training techniques to SDXL and the Anima model preview. No license terms are stated in the README excerpt provided.

Copy-paste prompts

Prompt 1
Walk me through setting up sd-scripts on Windows to train a LoRA for Stable Diffusion 1.5 using 20 of my own photos, including dataset folder structure and the training command.
Prompt 2
Show me the sd-scripts command to train a FLUX.1 LoRA with a specific learning rate and save a checkpoint every 500 steps.
Prompt 3
I have a trained LoRA file from sd-scripts. How do I load it in AUTOMATIC1111 or ComfyUI to use it for image generation?
Prompt 4
How do I use the WD14 tagger script in sd-scripts to automatically generate caption text files for my training images?
Open on GitHub → Explain another repo

← kohya-ss on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.