Here is how to train your own Stable Diffusion LoRAs locally, for SDXL and its popular finetunes like Illustrious and Pony using the Kohya GUI, or the much simpler DaSiWa TrainFlow.
On the updates: Back when I first wrote this guide, training a LoRA meant Stable Diffusion 1.5 or the first versions of SDXL, the Kohya GUI, and quite a bit of fiddling with folder names. A lot has changed since then. Nowadays I train my LoRAs on an RTX 3090, with tools that make the whole process a lot less painful, as you can see in my Anima & Krea 2 LoRA training guides.
Training a LoRA for a newer model like Krea 2, Anima or Flux instead? Start with my general LoRA training guide, which covers every model and trainer I use.
Which LoRA Trainer Should You Use For SDXL? (Quick Answer)
- SDXL, Pony, Illustrious and NoobAI: the Kohya GUI if you want every setting at hand, or DaSiWa TrainFlow if you want it simpler. OneTrainer is another reliable and quite popular option here.
- Stable Diffusion 1.5 (mostly legacy applications): the Kohya GUI still handles it just fine, although very few new LoRAs are made for it these days.
- Anything newer (Krea 2, Anima, Flux, Qwen Image): see my general LoRA training guide, which compares the trainers for each model.
Can you train a LoRA directly in Automatic1111 or ComfyUI? The base Automatic1111 WebUI can’t train LoRAs on its own, as its Train tab only covers embeddings and hypernetworks. ComfyUI does have a built-in Train LoRA node now, but a dedicated trainer is still the easier and more predictable way to go.
And what about training on a CPU? In practice, no, and if you could, it would be extremely inefficient. All of the trainers mentioned here are made for NVIDIA GPUs, and only some of them offer experimental support for AMD cards, mostly on Linux.
What Is a LoRA Model, Exactly?
A LoRA (Low-Rank Adaptation) is a small add-on file, usually anywhere from a few to a few hundred megabytes, that you load alongside the checkpoint it was trained for. In this guide that means SDXL. A LoRA trained here will work with SDXL-based checkpoints like Illustrious, Pony or NoobAI, but not with SD 1.5, or with newer models like Anima or Krea 2. I explain how this works across model families in my general LoRA training guide.
You might also like: How to Use LoRA Models with Stable Diffusion WebUI – Quick Tutorial
How Many Images Do You Need To Train a LoRA?
In most cases 20-50 good images are enough for a character or style LoRA. Larger datasets are mostly needed for complex concepts, or for characters you want to show in many different poses, outfits and settings.
What matters more than the exact number is how consistent and sharp your images are. I keep the rules I follow when picking training images in my general LoRA training guide, as they apply to every model.
Do You Have To Crop Your Images To 512×512 or 1024×1024 Manually?
No. The Kohya GUI can sort your images into a few size groups (buckets) on its own, instead of forcing all of them into one square. This is the “Enable buckets” option, which in the latest versions of Kohya is turned on by default.
What you do need to watch is that your images aren’t too small. SDXL, Pony and Illustrious were trained at around 1024×1024 pixels, so use images at least that big, or with a similar pixel count in other aspect ratios. The 512×512 rule would only apply to SD 1.5.
Captioning Your Images – Tags or Natural Language?
Every training image needs a matching .txt file with the same name, that describes what’s in the picture. What these captions should look like depends on how the base model was trained:
- Illustrious, Pony and NoobAI were trained on Danbooru tags, so tag-style captions are the way to go. Here is how these tags work: Booru-Style Tagging, and How To Use It With SDXL Anime Model Prompts.
- Base SDXL and realistic SDXL checkpoints work well with short natural language descriptions.
You don’t have to write them all by hand. The Kohya GUI can caption your images for you with the WD EVA02 tagger or BLIP, as shown in Step 2 below. Whatever you use, go through the results and fix the obvious mistakes by hand.
Auto-captioning can be good as a starting point, but botched image captions can easily make you waste hours of pointless training.

What should you describe in your captions, and do you need a trigger word? In short, describe what you want to be able to change with your prompts. I go through both questions, with examples for character, style and concept LoRAs, in the captioning section of my general LoRA training guide. In the Kohya GUI, your trigger word goes into the image folder’s name and the captioning prefix, as shown in steps 1 and 2 below.
Downloading The Kohya GUI With Dependencies
The Kohya GUI (kohya_ss) is a free, Gradio-based interface for Kohya’s sd-scripts, which lets you train LoRA models and full checkpoints without typing any training commands yourself. It’s still one of the most complete LoRA trainers out there, and it’s what I used to train my SDXL LoRAs back when I was using an RTX 2070 SUPER.
Before installing it, you’ll need these on your system:
- Python 3.11.9. Very important: during the installation, tick the box that adds Python to PATH.
- Git for Windows.
- CUDA Toolkit 12.8.
- Optionally, the Visual C++ Redistributable.
How To Install The Kohya GUI
The installation got a lot simpler over the years. There’s no setup script to run as administrator and no configuration questions to answer anymore. Open PowerShell in the folder where you want the Kohya GUI to live, and run these commands:
git clone --recursive https://github.com/bmaltais/kohya_ss.git
cd kohya_ss
.\gui-uv.bat
The –recursive part downloads the sd-scripts training backend the GUI relies on. On the first launch, gui-uv.bat will offer to install uv, a fast Python package manager, so press Y. It will then download everything it needs, which can take quite a while depending on your connection speed, and by default serve the GUI at 127.0.0.1:7860. Open that address in your browser, and you will see the tool interface.
To start the GUI later, just run gui-uv.bat again. To update it, run git pull in the same folder first.
How To Train an SDXL LoRA In the Kohya GUI in 4 Steps
All of the training happens in the LoRA tab, on the Training sub-tab. Make sure you’re there, and not in the Dreambooth tab, which trains full checkpoints instead.
Step 1: Prepare Your Training Folders
Kohya expects your files in a specific folder structure: an img folder with your training images, a model folder where the finished LoRA files will be saved, and a log folder for the training logs.
Inside the img folder there’s one more subfolder with your actual training images, and when using Kohya, its name is very important. The number at the start of the name sets how many times each image is repeated per epoch, and the rest is your trigger word and, optionally, a class word. For example, 10_mycharacter means 10 repeats per image. Don’t leave out the underscore.

You don’t have to set any of this up by hand. Open the Dataset Preparation section, then Dreambooth/LoRA Folder preparation. Enter your trigger word as the Instance prompt and a general class like “woman” or “style” as the Class prompt, select your training images folder, set the number of repeats and the destination folder, and click Prepare training data. Then click Copy info to respective fields, and Kohya will fill in all the folder paths for you.
How many repeats should you use? Kohya multiplies the number of images by the repeats and the number of epochs (and divides it by the batch size) to get the total number of training steps. For a first character LoRA, somewhere around 1500-3000 total steps is a reasonable target, and you can always pick an earlier saved checkpoint if it turns out to be too much.
Step 2: Caption Your Images
Kohya’s captioning tools live under Utilities, Captioning. For anime-style models like Illustrious, Pony or NoobAI, open WD14 Captioning and pick wd-eva02-large-tagger-v3 from the Repo ID list. For realistic images, BLIP Captioning can help you write short natural language descriptions instead.
Type your trigger word into the “Prefix to add to WD14 caption” field (or the BLIP one), so it’s added to the start of every caption. Then select your image folder and click Caption images. When the tagger is done, you’ll see a confirmation in the terminal window.
Afterwards, open a few of the .txt files and fix whatever the tagger got wrong. This is especially important for things it can’t recognize, like original characters, real people or unusual objects.

Note: Make sure you don’t have images in different formats that share the same filename (for example image1.jpg and image1.png) in your folder. They would both end up sharing a single caption file, which can mess up your training.
Step 3: Choose Your Base Model & Training Settings
In the Model section, select the SDXL checkpoint you want to train on in “Pretrained model name or path”. When you pick a local file, tick the SDXL checkbox that appears below it, so Kohya knows what kind of model it’s dealing with. Then type the name of your LoRA into “Trained Model output name”.
Which checkpoint should you pick? This depends on what you’re training. For an anime character, use an anime model like Illustrious or NoobAI. For a LoRA of your own face, use a realistic SDXL checkpoint or the base SDXL model. If you’re not sure, Illustrious XL v0.1 is a safe pick for anime-style LoRAs, as it was released specifically as a base for LoRA training.
Next, open Parameters. The Presets dropdown now has a few ready-made SDXL starting points, like “SDXL – LoRA adafactor v1.0”. Keep in mind that these assume a fairly powerful GPU. That one, for instance, uses a batch size of 5, a network rank of 128 and bf16 precision, so on an 8GB card you’ll want to lower the batch size to 1, and on GTX 10 or RTX 20-series cards switch the precision to fp16.
Whether you use a preset or not, check these settings in the Basic section:
- Max resolution: set it to 1024,1024 for SDXL. The default 512,512 is meant for SD 1.5.
- Enable buckets: leave it checked, so you can train on images of different sizes and aspect ratios.
- Network Rank (Dimension) and Network Alpha: 32 for both is a good place to start. Go higher only for complex, detailed styles.
- Cache latents: leave it on. It saves both time and VRAM.
- Save every N epochs: set it to 1, so you get a LoRA checkpoint after every epoch to compare at the end.

Once everything is set, save your settings using the Configuration section at the very top. This way you can load them back for your next LoRA instead of setting everything from scratch.
For a full breakdown of every setting in the Kohya GUI, check out my Kohya LoRA training settings guide.

Step 4: Start The Training
In the Folders section, check that “Output directory for trained model” and “Logging directory” point to your model and log folders. Also make sure that the Image folder in the Model section points to the img folder itself, not to the numbered subfolder inside it. The Regularisation directory can stay empty.
Now click Start training. The training progress, including the total number of steps, the current speed and the estimated time left, shows up in the terminal window where you launched the GUI, not in your browser. How long it takes depends on your GPU, the training resolution and the total number of steps.
When it’s done, you’ll find your LoRA files in the model folder, ready to use with ComfyUI, Forge or any other Stable Diffusion software that supports LoRAs.
An Easier Alternative – DaSiWa TrainFlow
If the Kohya GUI feels like too much, DaSiWa TrainFlow is what I use for most of my LoRAs these days. It’s a portable trainer for Windows and Linux, inspired by the original Anima TrainFlow, that runs the same sd-scripts training code behind a much simpler interface. It supports SDXL, Pony and Illustrious, as well as Anima and Krea 2. I used it for my Krea 2 LoRA, trained on my own drawings.
Getting it running takes just a few clicks: run TrainFlow_Runtime_Tool.exe, click Verify Runtime and Install Requirements, then start TrainFlow.exe. From there, you pick a model profile, point it to your model and dataset, and either set the training options yourself or let Auto Calc pick them based on your dataset size and your GPU’s VRAM. It also has the WD EVA02 tagger built in, shows live sample images during training, and can resume an interrupted run.
How Much VRAM Do You Need For LoRA Training?
For SDXL-based models and SD 1.5, here is what you can expect. The numbers for newer models like Krea 2, Anima and Flux are in my general LoRA training guide.
| Model | VRAM | Notes |
|---|---|---|
| SDXL, Pony, Illustrious | 8GB minimum | In my experience pretty tricky on 8GB, and very challenging below that. |
| SD 1.5 | Under 8GB | Quick to train even on older GPUs. |
So, can you train an SDXL LoRA on an 8GB GPU? Yes, with some effort. Turn on gradient checkpointing, cache the latents, keep the batch size at 1, and keep an eye on your VRAM use in the Windows Task Manager.

You might also like: Best GPUs For AI Training & Inference This Year – My Top List
Testing Your LoRA & Picking The Best Checkpoint
With “Save every N epochs” set to 1, Kohya saves a separate LoRA file after every epoch, so you end up with several checkpoints to choose from. Don’t just grab the last one, as with small datasets the later checkpoints can easily turn out overtrained.
The easiest way to compare checkpoints is to load them one by one in ComfyUI and generate the same prompt with the same seed. Try a few different LoRA strengths too, as lowering the strength of a later checkpoint often gives you the same result as an earlier one. In the Kohya GUI, you can also set up sample prompts in the Samples section, and Kohya will generate preview images during training.
Not sure whether a checkpoint is undertrained or overtrained? Here are the signs to look for, and what to do about each.

If you decide to share your LoRA on Civitai or Hugging Face, include the trigger word, the base model it was trained for and a few example images, and, of course, make sure the base model’s licence allows it.
You might also like: 6 Sites Like Civitai – Best Alternatives Available
Common LoRA Training Problems & Fixes
Out of Memory Errors or Very Slow Training
If you’re running out of VRAM, close everything else that uses your GPU (browsers with hardware acceleration are a common culprit), lower the batch size or the training resolution, and turn on the memory-saving options like gradient checkpointing and latent caching. Here are a few more tricks: Hidden VRAM Hogs – How to Free Up GPU Memory (Local AI & Gaming)
If your training suddenly becomes extremely slow instead, check the “Shared GPU memory” graph in the Windows Task Manager. When it starts filling up, your GPU is spilling over into system RAM, which can slow things down many times over. I explain what to do about it in my guide to fixing slow Kohya LoRA training.
The bf16 Mixed Precision Error

If you get the “ValueError: bf16 mixed precision requires PyTorch >= 1.10 and a supported device” error, your GPU doesn’t support the bf16 format. This is the case with GTX 10-series and RTX 20-series cards, like my old RTX 2070 SUPER. In the Kohya GUI, set “Mixed precision” (in the Accelerate launch section) and “Save precision” (in the Model section) to fp16, and start the training again. RTX 30, 40 and 50-series GPUs support bf16 calculations just fine, so it won’t be an issue on them.
Training LoRAs For Newer Models Like Krea 2, Anima & Flux
Newer models need a slightly different approach than SDXL, from the trainer you use to the way you caption your images. I’ve put everything I know about training LoRAs for them in my How To Train LoRA Models Locally – The Complete LoRA Training Guide.
For full walkthroughs of my own runs, see How To Train Anima LoRAs – The Easiest Way (Anima TrainFlow) and How To Train Krea 2 LoRAs – DaSiWa TrainFlow Guide (Tested on RTX 3090).
What About Stable Diffusion 1.5 LoRAs?
You can still train SD 1.5 LoRAs in the Kohya GUI following the exact same steps as above. Just leave the SDXL box unchecked, pick an SD 1.5 checkpoint and set the max resolution to 512,512. They train quickly even on older GPUs with less than 8GB of VRAM. Most new LoRAs are made for newer models these days, but if you’re up for some experiments, the options are there.
If you want a ready-made starting point, here is the settings preset I made for SD 1.5 back when I first wrote this guide: download my SD 1.5 LoRA settings preset (.json). Load it with the Configuration section at the very top of the LoRA tab, then set your own model, folders and output name. It uses rank 128, AdamW8bit with a learning rate of 1e-4, a batch size of 2, fp16 precision and a 512×512 resolution, so it’s meant for SD 1.5 only, not for SDXL.
So, That’s It – You’ve Trained Your Very First LoRA!
In a word, training LoRAs got a lot easier since the Stable Diffusion 1.5 days. Prepare your folders, caption your images carefully, check the handful of settings that matter, and test a few checkpoints before you settle on one. That’s really most of it.
If this guide helped you train your first LoRA, I’d appreciate you sharing it with others who might find it useful too. Thanks for reading, and see you next time!

