Go to file
bmaltais 6357ce868b Update python verstion to 3.11 2025-06-16 07:10:02 -04:00
.cache Docker: empty directories for docker volumes 2023-06-12 17:02:19 +03:00
.github Bump crate-ci/typos from 1.31.2 to 1.32.0 2025-06-01 05:40:31 +00:00
.vscode Restructure files 2024-04-03 19:36:02 -04:00
assets Update style 2025-05-26 08:50:23 -04:00
config_files/accelerate Remove torch 1 support from code 2023-10-04 19:00:12 -04:00
dataset refactor: build `dataset` directory structure 2024-03-15 12:44:48 +08:00
docs docs: extract pip/uv installation guides to OS-specific markdown files and update main README 2025-06-15 23:16:52 +02:00
examples v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
kohya_gui Fix: Default config file dialog to repo root 2025-06-01 17:54:27 +00:00
localizations Bump crate-ci/typos from 1.18.2 to 1.19.0 (#2189) 2024-04-01 11:20:45 -04:00
models Add support for user managed path config 2024-03-16 20:58:22 -04:00
presets v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
sd-scripts@61eda76278 Update sd-scripts 2025-06-05 14:29:02 -04:00
setup fix(validate_requirements): correct typo 2025-06-02 19:39:03 +08:00
test Add pytorch_optimizer.CAME to optimizer list. 2025-03-30 14:44:24 -04:00
tools Cleanup files 2025-05-27 08:47:38 -04:00
.augmentignore Dev pure (#2039) 2024-03-09 09:30:20 -05:00
.dockerignore v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
.env chore(docker): Configure TensorBoard port through .env file (#2397) 2024-04-26 19:43:37 -04:00
.gitattributes Address issue 188 2023-04-15 08:52:23 -04:00
.gitignore v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
.gitmodules Dev pure (#2039) 2024-03-09 09:30:20 -05:00
.hadolint.yml chore(docker): rewrite Dockerfile 2024-02-18 09:58:59 +08:00
.python-version Update python verstion to 3.11 2025-06-16 07:10:02 -04:00
.release Update release number 2025-06-15 10:23:04 -04:00
Dockerfile build(docker): upgrade to CUDA 12.8 and Debian 12 2025-05-27 00:19:05 +08:00
LICENSE.md Add support for new arguments: 2023-01-15 11:05:22 -05:00
README.md docs: extract pip/uv installation guides to OS-specific markdown files and update main README 2025-06-15 23:16:52 +02:00
SECURITY.md Update SECURITY.md 2024-04-11 09:02:21 -04:00
_typos.toml v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
config example.toml v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
docker-compose.yaml v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
gui-uv.bat Update how uv is installed on windows 2025-05-25 19:16:58 -04:00
gui-uv.sh Add message when --quiet is used 2025-05-26 18:39:36 -04:00
gui.bat Merge branch 'master' into dev 2025-03-28 11:20:53 -04:00
gui.ps1 v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
gui.sh Update IPEX and ROCm 2025-06-13 20:17:05 +03:00
kohya_gui.py v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
pyproject.toml Update release number 2025-06-15 10:23:04 -04:00
requirements.txt Fix requirements issues 2025-05-26 21:33:06 -04:00
requirements_ipex_xpu.txt Update IPEX and ROCm 2025-06-13 20:17:05 +03:00
requirements_linux.txt Fix requirements issues 2025-05-26 21:33:06 -04:00
requirements_linux_ipex.txt Cleanup 2025-06-13 20:31:42 +03:00
requirements_linux_rocm.txt Update IPEX and ROCm 2025-06-13 20:17:05 +03:00
requirements_macos_amd64.txt v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
requirements_macos_arm64.txt Apple Silicone Support (This time not on Master) (#3174) 2025-04-19 10:22:53 -04:00
requirements_pytorch_windows.txt Update requirements file for 50X0 support 2025-05-26 07:11:25 -04:00
requirements_runpod.txt v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
requirements_windows.txt Update requirements file for 50X0 support 2025-05-26 07:11:25 -04:00
setup-3.10.bat v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
setup-runpod.sh Improve setup. Add --headless option 2024-03-12 20:31:22 -04:00
setup.bat make sure setuptools are available in the venv (#2437) 2024-05-03 09:17:37 -04:00
setup.ps1 Improve setup. Add --headless option 2024-03-12 20:31:22 -04:00
setup.sh Cleanup 2025-06-13 20:31:42 +03:00
uv.lock Update python verstion to 3.11 2025-06-16 07:10:02 -04:00

README.md

Kohya's GUI

GitHub stars GitHub forks License GitHub issues

This is a GUI and CLI for training diffusion models.

This project provides a user-friendly Gradio-based Graphical User Interface (GUI) for Kohya's Stable Diffusion training scripts. Stable Diffusion training empowers users to customize image generation models by fine-tuning existing models, creating unique artistic styles, and training specialized models like LoRA (Low-Rank Adaptation).

Key features of this GUI include:

  • Easy-to-use interface for setting a wide range of training parameters.
  • Automatic generation of the command-line interface (CLI) commands required to run the training scripts.
  • Support for various training methods, including LoRA, Dreambooth, fine-tuning, and SDXL training.

Support for Linux and macOS is also available. While Linux support is actively maintained through community contributions, macOS compatibility may vary.

Table of Contents

Installation Options

You can run kohya_ss either locally on your machine or via cloud-based solutions like Colab or Runpod.

  • If you have a GPU-equipped PC and want full control: install it locally using uv or pip.
  • If your system doesnt meet requirements or you prefer a browser-based setup: use Colab or a paid GPU provider like Runpod or Novita.
  • If you are a developer or DevOps user, Docker is also supported.

Local Installation Overview

You can install kohya_ss locally using either the uv or pip method. Choose one depending on your platform and preferences:

Platform Recommended Method Instructions
Linux uv uv_linux.md
Linux or Mac pip pip_linux.md
Windows uv uv_windows.md
Windows pip pip_windows.md

uv vs pip What's the Difference?

  • uv is faster and isolates dependencies more cleanly, ideal if you want minimal setup hassle.
  • pip is more traditional, easier to debug if issues arise, and works better with some IDEs or Python tooling.
  • If unsure: try uv. If it doesn't work for you, fall back to pip.

Cloud Installation Overview

🦒 Colab

For browser-based training without local setup, use this Colab notebook:
https://github.com/camenduru/kohya_ss-colab

  • No installation required
  • Free to use (GPU availability may vary)
  • Maintained by camenduru, not the original author
Colab Info
Open In Colab kohya_ss_gui_colab

💡 If you encounter issues, please report them on camendurus repo.

Special thanks
I would like to express my gratitude to camenduru for their valuable contribution.

Runpod, Novita, Docker

These options are for users running training on hosted GPU infrastructure or containers.

  • Runpod setup Ready-made GPU background training via templates.
  • Novita setup Similar to Runpod, but integrated into the Novita UI.
  • Docker setup For developers/sysadmins using containerized environments.

Custom Path Defaults

The repository now provides a default configuration file named config.toml. This file is a template that you can customize to suit your needs.

To use the default configuration file, follow these steps:

  1. Copy the config example.toml file from the root directory of the repository to config.toml.
  2. Open the config.toml file in a text editor.
  3. Modify the paths and settings as per your requirements.

This approach allows you to easily adjust the configuration to suit your specific needs to open the desired default folders for each type of folder/file input supported in the GUI.

You can specify the path to your config.toml (or any other name you like) when running the GUI. For instance: ./gui.bat --config c:\my_config.toml

LoRA

To train a LoRA, you can currently use the train_network.py code. You can create a LoRA network by using the all-in-one GUI.

Once you have created the LoRA network, you can generate images using auto1111 by installing this extension.

For more detailed information on LoRA training options and advanced configurations, please refer to our LoRA documentation:

Sample image generation during training

A prompt file might look like this, for example:

# prompt 1
masterpiece, best quality, (1girl), in white shirts, upper body, looking at viewer, simple background --n low quality, worst quality, bad anatomy, bad composition, poor, low effort --w 768 --h 768 --d 1 --l 7.5 --s 28

# prompt 2
masterpiece, best quality, 1boy, in business suit, standing at street, looking back --n (low quality, worst quality), bad anatomy, bad composition, poor, low effort --w 576 --h 832 --d 2 --l 5.5 --s 40

Lines beginning with # are comments. You can specify options for the generated image with options like --n after the prompt. The following options can be used:

  • --n: Negative prompt up to the next option.
  • --w: Specifies the width of the generated image.
  • --h: Specifies the height of the generated image.
  • --d: Specifies the seed of the generated image.
  • --l: Specifies the CFG scale of the generated image.
  • --s: Specifies the number of steps in the generation.

The prompt weighting such as ( ) and [ ] is working.

Troubleshooting

If you encounter any issues, refer to the troubleshooting steps below.

Page File Limit

If you encounter an X error related to the page file, you may need to increase the page file size limit in Windows.

No module called tkinter

If you encounter an error indicating that the module tkinter is not found, try reinstalling Python 3.10 on your system.

LORA Training on TESLA V100 - GPU Utilization Issue

See Troubleshooting LORA Training on TESLA V100 for details.

SDXL training

For detailed guidance on SDXL training, please refer to the official sd-scripts documentation and relevant sections in our LoRA Training Guide.

Masked loss

The masked loss is supported in each training script. To enable the masked loss, specify the --masked_loss option.

[!WARNING] The feature is not fully tested, so there may be bugs. If you find any issues, please open an Issue.

ControlNet dataset is used to specify the mask. The mask images should be the RGB images. The pixel value 255 in R channel is treated as the mask (the loss is calculated only for the pixels with the mask), and 0 is treated as the non-mask. The pixel values 0-255 are converted to 0-1 (i.e., the pixel value 128 is treated as the half weight of the loss). See details for the dataset specification in the LLLite documentation.

Guides

The following are guides extracted from issues discussions

Using Accelerate Lora Tab to Select GPU ID

Starting Accelerate in GUI

  • Open the kohya GUI on your desired port.
  • Open the Accelerate launch tab
  • Ensure the Multi-GPU checkbox is unchecked.
  • Set GPU IDs to the desired GPU (like 1).

Running Multiple Instances (linux)

  • For tracking multiple processes, use separate kohya GUI instances on different ports (e.g., 7860, 7861).
  • Start instances using nohup ./gui.sh --listen 0.0.0.0 --server_port <port> --headless > log.log 2>&1 &.

Monitoring Processes

  • Open each GUI in a separate browser tab.
  • For terminal access, use SSH and tools like tmux or screen.

For more details, visit the GitHub issue.

Interesting Forks

To finetune HunyuanDiT models or create LoRAs, visit this fork

Contributing

Contributions are welcome! If you'd like to contribute to this project, please consider the following:

  • For bug reports or feature requests, please open an issue on the GitHub Issues page.
  • If you'd like to submit code changes, please open a pull request. Ensure your changes are well-tested and follow the existing code style.
  • For security-related concerns, please refer to our SECURITY.md file.

License

This project is licensed under the Apache License 2.0. See the LICENSE.md file for details.

Change History

v25.0.3

  • Upgrade Gradio, diffusers and huggingface-hub to latest release to fix issue with ASGI.
  • Add a new method to setup and run the GUI. You will find two new script for both Windows (gui-uv.bat) and Linux (gui-uv.sh). With those scripts there is no need to run setup.bat or setup.sh anymore.

v25.0.2

  • Force gradio to 5.14.0 or greater so it is updated.

v25.0.1

  • Fix issue with requirements version causing huggingface download issues

v25.0.0

  • Major update: Introduced support for flux.1 and sd3, moving the GUI to align with more recent script functionalities.
  • Users preferring the pre-flux.1/sd3 version can check out tag v24.1.7.
    git checkout v24.1.7
    
  • For details on new flux.1 and sd3 parameters, refer to the sd-scripts README.