- How-to
- Kohya
- Civitai
- Dataset packaging
Kohya Folder Names & Civitai Zip Layout for LoRA Datasets
Pack image+.txt pairs for Kohya (10_ohwx woman under the parent train_data_dir) or a flat Civitai zip. Avoid No data found and nested junk folders.
You already have paired images and captions—or a LoRA Dataset export—and still stall at the last mile: Kohya GUI wants a weird folder name, Civitai rejects your zip, or the trainer logs “No data found.” This guide owns that packaging contract. It covers folder naming, where to point train_data_dir, caption sidecars, Kohya’s TOML mode, and the flat zip Civitai’s on-site trainer expects. If you are still building the pairs from one reference, start with creating a LoRA dataset from one image; this post picks up at export.
What this guide covers (and what it does not)
Scope here is filesystem layout, caption sidecars, zip root, and the two Kohya loading modes (subdirectory naming vs dataset TOML). Out of scope: learning rate, network dim, epoch choice, caption wording, and image count. You will leave with:
- A correct Kohya DreamBooth-style tree and the parent vs image-folder rule.
- A Civitai zip that keeps captions paired at the archive root.
- A short checklist to go from one export to either trainer without rewriting captions.
For caption content and trigger placement, use the captioning guide. For how repeats interact with image count and steps, see how many images to train a LoRA.
The two packaging contracts (Kohya vs Civitai)
Same captioned pairs can feed both trainers. You rearrange folders or zip contents; you do not re-caption. Caption style (natural language vs tags) still follows the base model—see Flux vs SDXL LoRA training—but the packaging steps below are shared.
| Concern | Classic Kohya (subdir naming) | Civitai on-site zip |
|---|---|---|
| Repeats in folder name? | Yes (N_…) | No — set in trainer UI |
| Parent vs image folder | Point train_data_dir at parent of N_… | Do not wrap a parent folder in the zip |
| Captions | Same-stem .txt or .caption beside images | Same-stem .txt only |
| Nesting | Images live inside each N_… folder | Prefer flat pairs at zip root |
Kohya DreamBooth-style folder naming
Anatomy of 10_ohwx woman
In classic DreamBooth-style loading, Kohya scans child folders of train_data_dir and parses each name on the first underscore. The leading integer becomes num_repeats; everything after becomes class_tokens (spaces allowed). Examples from the GUI docs include 30_cat and 40_black mamba. Folders whose names do not start with an integer repeat are ignored (sd-scripts logs a warning).
10_ohwx woman→ 10 repeats, class tokensohwx woman30_cat→ 30 repeats, class tokenscat
Do not invent a magic repeat
N from the steps formula on how many images a LoRA needs, not from a one-size-fits-all folder name meme.Parent folder vs image folder (the #1 Kohya mistake)
Point train_data_dir at the parent of the N_… folders, not at the folder that literally contains the PNGs. Kohya looks for named children under that path. Aiming one level too deep is the usual cause of No data found. Please verify arguments.
train_data/ ← point train_data_dir HERE
└── 10_ohwx woman/ ← repeats_trigger class
├── 001.png
├── 001.txt
├── 002.png
└── 002.txtWrong: setting train_data_dir to train_data/10_ohwx woman. Also wrong: dumping images loose in train_data/ with no N_name child—those files are not discovered in DreamBooth-style mode.
Multi-concept layouts follow the same parent rule. From the kohya_ss folder docs you can have images/30_cat and images/30_dog, plus optional regularization siblings such as regularization/1_cat. This post’s hero case is one character concept.
Caption sidecars (.txt / .caption)
Put a caption file beside each image with the same basename: 001.png pairs with 001.txt. When a .txt or .caption exists, its contents take precedence over the folder’s class tokens for that image. Folder class_tokens are only the fallback when no caption file exists. Put the trigger in the caption (see the captioning guide); do not assume the folder name alone teaches the trigger when sidecars are present.
Match caption_extension
.caption. GUIs and Civitai commonly use .txt. Set caption_extension to match your files—usually .txt.Kohya TOML / --dataset_config mode (folder names ignored)
With an explicit dataset config, image_dir must contain images directly. Naming a folder 5_cat does not apply repeats or class tokens in this mode—set num_repeats and class_tokens explicitly. class_tokens are used only when a caption file is missing; missing both caption and class tokens errors out.
[general]
caption_extension = ".txt"
keep_tokens = 1
[[datasets]]
resolution = 1024
batch_size = 1
[[datasets.subsets]]
image_dir = "/path/to/ohwx_woman_images"
class_tokens = "ohwx woman"
num_repeats = 10Do not mix mental models
N_name children under a parent, or flat image_dir with repeats in the config.Packing for Civitai’s on-site LoRA trainer
Filename pairing
Civitai accepts a .zip of images only, or images plus matching caption .txt files. Pairing is same basename (1.jpg + 1.txt). Caption extension is .txt only. Guidelines list .png, .jpg, and .jpeg; the education page also lists .webp. Prefer lowercase extensions. Community reports of uppercase extensions or sequential mis-numbering (01.jpg with 02.txt) breaking caption detection are common enough to avoid.
| Image | Caption | Valid? |
|---|---|---|
| 001.png | 001.txt | Yes |
| hero.jpg | hero.txt | Yes |
| 01.jpg | 02.txt | No — stems must match |
| shot.PNG | shot.txt | Risky — prefer lowercase .png |
Zip the files, not the parent folder
Select the image/caption pairs; do not include the parent folder when preparing the zip. Desired layout inside the archive:
dataset.zip
├── 001.png
├── 001.txt
├── 002.png
└── 002.txtBad layout (common failure):
dataset.zip
└── my_lora_dataset/
├── 001.png
└── 001.txtAlso unnecessary for the on-site trainer: wrapping pairs in 10_ohwx woman/. Repeats are configured in the Civitai trainer UI, not via Kohya folder names.
OS tip
Optional: images without captions
Civitai accepts image-only zips and can auto-label (tag vs natural language). Prefer shipping captions from LoRA Dataset so the trigger stays consistent. Match sentence vs tag style to your base model using the captioning guide.
From LoRA Dataset export → Kohya or Civitai
- 01
Confirm every image has a same-stem .txt
Or decide captionless only if you will rely on Civitai auto-label. Matching stems matter more than fancy filenames. - 02
Kohya path: nest under repeats_trigger class
Create parenttrain_data/, child{repeats}_{trigger class}/, move pairs inside, point the GUI /train_data_dirat the parent, then verify the steps preview or image count in the logs. - 03
Civitai path: zip only the loose pairs
Select the files (not the folder), zip, upload, and confirm captions appear under each thumbnail before you submit. - 04
Quick preflight
No nested junk folders, lowercase extensions, UTF-8 captions, and no leftoverCopy of …files.
Doing this with LoRA Dataset
LoRA Dataset exports paired image + .txt captions from one reference (free with your own Gemini API key). After download, nest the pairs under a {repeats}_{trigger class} folder for Kohya, or zip the flat pairs for Civitai. No re-captioning is required if the trigger is already in the sidecars.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| No data found. Please verify arguments | train_data_dir points at the image folder, not the parent of N_… | Point one level up; ensure the child folder name starts with integer + _ |
| Kohya ignores some folders | Folder name lacks a leading repeats integer | Rename to the 10_ohwx woman pattern |
| Captions ignored / only class token used | Missing sidecars or wrong caption_extension | Add matching .txt files; set caption_extension |
| Civitai sees images but blank captions | Basename mismatch, nested zip, or wrong caption extension | Flatten the zip; match stems; use lowercase .txt |
| Civitai could not find any valid files | Empty or wrong zip contents | Re-zip selected pairs at the archive root |
If packaging looks correct but likeness still wanders at generation time, the problem is probably the dataset or training settings—see fixing identity drift.
Frequently asked questions
What does 10_ohwx woman mean in Kohya?
In DreamBooth-style subdirectory loading, Kohya splits the folder name on the first underscore. 10 becomes num_repeats (each image is seen 10 times per epoch in that subset). ohwx woman becomes class_tokens—the fallback caption when an image has no sidecar. Spaces after the underscore are fine.
Why does Kohya say “No data found” even though my images are right there?
With classic folder loading, train_data_dir must be the parent of folders named like 10_ohwx woman, not the folder that directly contains the PNGs. Kohya scans children of train_data_dir for repeats_name directories. Pointing one level too deep is the usual cause.
If every image has a .txt caption, does the folder name still matter?
The leading repeats number still matters for how often each image is trained. The text after the underscore is only a fallback: when a matching .txt or .caption exists, that file’s contents are used instead of the folder’s class tokens. Put your trigger in the captions.
Do I need the 10_ohwx woman folder inside my Civitai zip?
No. Civitai’s guidelines ask for image/caption pairs (or images alone) selected into a zip without wrapping a parent folder. Repeats are set in the on-site trainer UI, not via Kohya-style folder names.
Which is correct for Civitai: zip the folder, or zip the files inside it?
Zip the files (the pairs) so they sit at the archive root. Official docs warn that including the parent folder prevents correct parsing.
Can I use the same export for Kohya and Civitai?
Yes. Keep one flat set of image + .txt pairs from LoRA Dataset. For Kohya, nest that set under {repeats}_{trigger class} inside a parent you point at. For Civitai, zip the flat pairs. No need to rewrite captions.
What if I use a Kohya dataset TOML instead of named folders?
Then folder names like 10_ohwx woman are ignored. Point image_dir at the directory that directly contains images, and set num_repeats and class_tokens in the TOML. Captions still come from sidecars when present.
Sources and further reading
- bmaltais/kohya_ss: image folder structure
- kohya-ss/sd-scripts: DreamBooth subdirectory parsing (config_util.py)
- kohya-ss/sd-scripts: dataset config README (TOML mode)
- kohya-ss/sd-scripts#78: train_data_dir must be parent of N_name folders
- bmaltais/kohya_ss#3374: No data found — parent of image folders
- Civitai: Dataset and Training Guidelines
- Civitai education: Using the on-site LoRA trainer