Comprehensive Guide to Formalized LoRA Training on Kohya with Stable Diffusion

Navigating the multitude of fields in Kohya can be an intimidating prospect for those new to the intricacies of LoRA training. This guide aims to present a meticulously structured workflow, allowing users to initiate LoRA training in less than 20 minutes—a particularly advantageous starting point for beginners.

To commence, ensure you are operating on a Think Diffusion Turbo machine by launching the TURBO: KOHYA machine. This guide is also applicable to local installations.

Loading Pre-defined Settings

  1. Head to the LoRA tab, located at the top of the interface (not the Dreambooth tab).
  2. Navigate to the Kohya directory.
  3. Create an ‘inputs’ folder within the root Kohya directory.

Download the Quick Start .json file named “ThinkDiffusion_Kohya_Quick_Start.json” to your desktop and upload it to the ‘inputs’ folder.

Uploading Quick Start File

  1. Paste the file path into the designated field (e.g., “../user_data/kohya/inputs/ThinkDiffusion_Kohya_Quick_Start.json”).
  2. Click the ‘Load 💾’ button.

Model Selection

Choose the desired model for training. While the SDXL base model is recommended, for tutorial purposes, we will use the ThinkDiffusion-XL model. If opting for a different model, ensure it is uploaded.

Setting Parameters

With your model selected, configure the settings and parameters for your LoRA training (prompts here).

Creating Folder Structure

  1. Establish a folder called ‘LoRA_Training’ at the root level.
  2. Within this folder, create a ‘My_Images’ subfolder.

Uploading Images

Place 20 to 30 images in the ‘My_Images’ folder, ensuring a variety of subjects and a minimum resolution of 1024 x 1024 for SDXL models.

Dataset Preparation

Navigate to the Tools tab and then the Dataset Preparation tab to configure instance prompts, class prompts, and training images’ path. Set repeats to 1 and the destination training directory to “../user_data/kohya/output.”

Preparing Training Data

Click ‘Prepare Training Data’ to create three new folders in the output directory.

Initiating Training

Click ‘Copy info to folders tab’ and select a model output name. Then, hit ‘start training’ to commence LoRA generation.

Checking Progress

Note that there is no front-end indicator bar on Kohya. Check the progress by accessing the kohya.txt file in the logging folder.

Trying out the Model

After completion, find the finished .safetensors file in “../user_data/kohya/output/model/.” Download and upload it to Auto1111 for further testing.

Testing in Auto1111

Go to the txt2img tab in Auto1111, enter positive and negative prompts, and use the trigger word enclosed in angled brackets to activate LoRA.

Alternative Trigger

Alternatively, select the LoRA sub-tab in txt2Img and click on the LoRA thumbnail to activate it in the positive prompts.

Generating Results

Hit ‘generate’ to observe the results of your newly trained LoRA.

This comprehensive guide enables users to run these workflows on a local SD version, but for those facing installation issues or hardware constraints, trying these workflows on a more potent GPU in the browser using ThinkDiffusion is recommended.

Sparkle Business | Copyright 2024