Free | No tracking | Every fact with a source|German and English

Train Your Own LoRA

Teach an image model your style, a character, or a product with your own dataset, AI-Toolkit or OneTrainer, and ComfyUI.

After this guide, you’ll have your own LoRA file. It teaches an image model something new, for example your drawing style, your mascot, or your product. You’ll then use it in ComfyUI. Building the dataset takes one to two hours. Training itself usually takes one to several hours, depending on your graphics card and settings.

What you need

  • A Windows PC with an NVIDIA graphics card. The common training programs are built mainly for NVIDIA (CUDA). What your computer can handle is listed under Computer.
  • Enough storage: base models and checkpoints can quickly take up several dozen GB.
  • ComfyUI, already set up. If not: Install ComfyUI on Windows.
  • 15 to 40 of your own images of what the model should learn.
  • Git and Python. The required version is listed in the guide for each training program.

1. What a LoRA is

LoRA stands for “Low-Rank Adaptation.” The large image model stays unchanged. You train only a small extra file that gets “switched on” during generation. This file is much smaller than the model. You can share it, turn it on and off, and adjust how strongly it affects the output.

Typical use cases:

  • Style: a specific painting or photo style, such as your watercolors.
  • Character: a drawn character or mascot that should always look the same.
  • Product or object: your case, your logo object, your piece of furniture.

More terms like rank, checkpoint, or epoch are explained in the Glossary.

2. Put together the dataset

The dataset matters more for the result than any setting.

  • Amount: For a character or product, 15 to 30 good images are often enough. For a style, use more and more varied images.
  • Quality: sharp, well lit, no watermarks, no text in the image (unless you want it learned too).
  • Variety: different angles, backgrounds, lighting situations, and crops. Ten almost identical photos mainly teach the model the background.
  • Format: The programs resize and crop images themselves. Still, leave out images with very low resolution.

Put all images in their own folder.

Important: Only train with images you have the rights to use. Photos of other people only with their consent. More on this under Legal and Deepfakes, voice, and people.

3. Write captions

Each image needs a text file with the same name, so bild01.jpg and bild01.txt. In it, you describe what is shown.

  • Choose a trigger word that does not exist otherwise, for example mxmaskottchen. It appears in every caption.
  • Describe everything that is allowed to change: background, pose, lighting, clothing. What you don’t describe is more likely to be learned as a fixed part of the trigger word.
  • For a style, describe the content of the image, not the style itself.

Example for a character:

mxmaskottchen, sitting on a wooden table, side view, soft daylight, blurred background

Many training programs can suggest captions automatically. Still read through them and correct them.

4. Choose the tool

As of October 2026, these programs are common on Windows:

  • AI-Toolkit by ostris: Supports many current models, including FLUX.2 (dev and small), Z-Image, and SDXL. It has a web interface for starting and monitoring training. For Windows, there is a manager still marked “experimental” (run_windows.bat). If there are problems, the developer points to an Easy Install script from the community. Docs: github.com/ostris/ai-toolkit.
  • OneTrainer: Graphical interface, supports, according to the project page, among others FLUX.2 (Dev and Small), Z-Image, and SDXL. On Windows, after cloning, run install.bat and then start-ui.bat. Docs: github.com/Nerogar/OneTrainer.
  • Kohya_ss: Proven over years and well documented, especially for SD 1.5 and SDXL. For very new models, check the project page.
  • FluxGym: Very simple interface, but geared toward FLUX.1. For FLUX.2 and Z-Image, it is not a good choice based on what we know.

For getting started, we recommend AI-Toolkit or OneTrainer.

Example: Get AI-Toolkit on Windows and start the manager (Git must be installed):

git clone https://github.com/ostris/ai-toolkit.git
cd ai-toolkit
run_windows.bat

What exactly the manager sets up and how to open the interface is explained in the README. The interface runs in the browser at http://localhost:8675.

5. Choose the base model

The LoRA only works with the model you trained it on. So choose the model you also want to use later for generating images. Overview under Models.

  • FLUX.2 [small] 4B Base: Black Forest Labs recommends the “Base” variants for training and the 4B version for most users. According to BFL, this requires an NVIDIA card with 12 GB VRAM and 32 GB RAM. According to BFL, the 9B version needs about 22 GB VRAM and 64 GB RAM.
  • SDXL: older, but very efficient and with a huge selection of tools and guides.
  • Z-Image: newer model, supported by AI-Toolkit and OneTrainer.

License: FLUX.2 [small] 4B is under Apache 2.0, the 9B version under a non-commercial license - always check the model card before commercial use.

6. The most important settings

Start with your program’s presets for your model. You should understand these three values:

  • Steps: how often the model learns from your images. Too few: the LoRA hardly has any effect. Too many: the LoRA only memorizes your training images.
  • Learning rate: how strongly each step changes the result. Too high makes training unstable, too low makes it very slow. Change it only in small increments.
  • Rank: how much “space” the LoRA has. A higher rank can store more detail, but the file gets larger and training is more likely to memorize. For a character or product, a small to medium value is usually enough.

Have the program save checkpoints and generate sample images along the way. Most programs offer this. That way you can see when the LoRA is good and choose the best version instead of the last one.

7. Use the LoRA in ComfyUI

  1. Copy the finished .safetensors file to ComfyUI\models\loras.
  2. Restart ComfyUI or reload the model list.
  3. Add a LoRA loader between the model loader and the sampler. Your first image with ComfyUI shows what a basic workflow looks like.
  4. Select your LoRA and set the strength to 1.0 to start.
  5. Put the trigger word in the prompt.

If the LoRA is too strong, lower the strength step by step.

Tip: Test with prompts that do not appear in your captions, such as “mxmaskottchen on the beach at night.” Only then can you tell whether the LoRA is flexible.

8. Common errors

  • Overfitting: Every image looks like a training image, often with the same background. Fix: use an earlier checkpoint, fewer steps, more varied images.
  • Underfitting: The character is barely recognizable. Fix: more steps or better, clearer images.
  • Wrong base model: An SDXL LoRA does not work with FLUX.2 and vice versa.
  • Sloppy captions: Unwanted things, like a specific mug in every photo, get baked into the LoRA.

If something doesn’t work

  • Not enough memory (Out of Memory): Use a smaller model (for example small 4B instead of 9B), a lower training resolution, or your program’s memory-saving options.
  • Installation fails: Check the Python version required by the program and your NVIDIA driver. For AI-Toolkit, the Easy Install script linked in the README often helps.
  • Model cannot be downloaded: Some models on Hugging Face require you to log in and agree to the license.
  • More help can be found in the Forum.

What’s next

As of: Oct 22, 2026