Nodes/Comfyui_PDuse/PD aitookit training redux
ComfyUI Node

PD aitookit training redux

Separate your labeled and unlabeled training images

By 7BEII·Created 2 years ago·Updated 15 days ago· 53
PD aitookit training redux
    • message
    source_folder
    paired_folder_namepaired_files
    unpaired_folder_nameunpaired_files
    image_extensions.png,.jpg,.jpeg,.webp
    text_extension.txt

    PD aitookit training redux (PD_AitoolkitTrainingRedux) sorts a training dataset folder into two piles: images that have a matching caption file, and images that don't. That's it, and for dataset work it's surprisingly handy. It's named after ai-toolkit because that's the training pipeline the author was prepping data for, but it'll tidy a folder for any LoRA or fine-tune trainer that expects image+caption pairs.

    Why this matters

    Dataset curation beats every training knob you can turn - that's one of the few things that survived the SDXL-to-Flux trainer changes intact. A folder that's half-labeled, half-not will silently train garbage captions on the unlabeled half, or just error out when the trainer expects a .txt for every image. Running this node before you start is the "check your work before you spend hours training" step.

    How it works

    It scans source_folder, and for each image it checks whether a same-named text file exists (matching text_extension, default .txt). Pairs get copied to paired_folder_name (default paired_files); images or text files without a partner go to unpaired_folder_name (default unpaired_files). Source files stay put - it copies, it doesn't move - so nothing is destroyed if you misconfigure it. It outputs a message string summarizing what got sorted, which doubles as a sanity report. image_extensions (default .png,.jpg,.jpeg,.webp) sets what counts as an image.

    The inputs that matter

    • source_folder - where your dataset lives. Required, typed by hand.
    • paired_folder_name / unpaired_folder_name - the two output subfolders it creates inside the source.
    • image_extensions / text_extension - the file-type rules. Defaults are right for the standard image.png + image.txt convention.

    Installing

    Part of the 7BEII/Comfyui_PDuse pack. ComfyUI Manager → search "Comfyui_PDuse" → install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/7BEII/Comfyui_PDuse
    cd Comfyui_PDuse
    pip install -r requirements.txt
    

    Restart after. No models; the pack's dependencies (Pillow, numpy, opencv-python, etc.) are all this node needs.

    Gotchas

    Two things to know before you run it. First, matching is by exact filename - 1_R.png pairs with 1_R.txt, and 1_T.png without a 1_T.txt lands in unpaired. If your captions use a different naming scheme, this node won't magically reconcile it. Second, it copies rather than moves, which is safe but means a big dataset gets doubled while you sort - run it on a copy or accept the disk cost. And the message output is a plain string, so wire it into a text preview or Show Text node if you want to read the report; it's an output node, so nothing downstream depends on it.

    CategoryPDuse/File

    Inputs (5)

    NameTypeDefaultDescription
    source_folderSTRING
    paired_folder_nameSTRINGpaired_files
    unpaired_folder_nameSTRINGunpaired_files
    image_extensionsoptSTRING.png,.jpg,.jpeg,.webp
    text_extensionoptSTRING.txt

    Outputs (1)

    NameTypeDescription
    messageSTRING