Nodes/Comfyui_PDuse/PD:aitookitTraining v1
ComfyUI Node

PD:aitookitTraining v1

PD:aitookitTraining v1 — sort your training folder into R/T buckets by filename keyword

By 7BEII·Created 2 years ago·Updated 15 days ago· 53
PD:aitookitTraining v1
    • message
    input_path
    output_path
    training_folderaitookit_training
    folder_1aitookit_R
    word_1R
    folder_2aitookit_T
    word_2T

    The name says "Training," but make no mistake: this node does no training. It's a file organizer aimed at the AI Toolkit style of dataset prep, where your raw exports are a pile of mixed _R and _T files (and captions) that need to be split into clean folders before a trainer will eat them. PD:aitookitTraining v1 reads a source folder, checks each filename for a keyword, and copies the files into one of two target buckets.

    This is the kind of job you'd normally do with a shell one-liner or by hand-selecting in Explorer. Doing it as a node is nice because it's repeatable and inspectable - run it, read the message output, and re-run after fixing your naming without writing a script.

    How it works

    The logic is a two-bucket classifier built on keyword presence in the filename. You define two words and two folder names:

    • Files whose name contains word_1 (default R) get copied to folder_1 (default aitookit_R).
    • Files whose name contains word_2 (default T) get copied to folder_2 (default aitookit_T).

    Everything lands under a training_folder (default aitookit_training), which is created automatically - inside output_path if you gave one, otherwise inside the source folder. The important detail: it copies, it doesn't move. The source stays untouched, which is the safe default for dataset work (get it wrong and you haven't destroyed anything).

    The inputs that matter

    • input_path (STRING) - source folder, required.
    • output_path (STRING, default empty) - where the training_folder goes; empty means "inside input_path."
    • training_folder (STRING, default aitookit_training) - the container for both buckets.
    • folder_1 / word_1 (aitookit_R / R) - bucket one and its keyword.
    • folder_2 / word_2 (aitookit_T / T) - bucket two and its keyword.

    One output: message (STRING) - a run report (success/error counts, paths). It's a string, so wire it to a text display or just read it in the widget.

    How to actually use it

    If you have the standard 1_R.png + 1_R.txt / 2_T.png layout from an AI Toolkit-style export, set word_1=R, word_2=T and you'll end up with aitookit_R/ holding every R-tagged image and caption, and aitookit_T/ holding the T side. That's precisely the split a trainer's "paired vs. variant" handling wants. The README's related "aitookit training redux" node is the smarter sibling (it pairs images with their .txt and separates paired from unpaired); this node is the simpler keyword sorter.

    Gotchas

    Keyword matching is a plain substring check - a filename containing "R" anywhere (like starter.png) will get bucketed into the R folder even if it's not an R variant. If your names are ambiguous, rename first or pick longer keywords. And because it copies, a huge dataset means doubled disk usage; that's the price of safety. Finally, every path is a hand-typed text box - no folder pickers in this pack - so a typo just produces a "folder doesn't exist" message rather than silently failing.

    Install

    ComfyUI Manager: search PDuse (repo 7BEII/Comfyui_PDuse), install, restart. Or:

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

    Restart and it shows as PD:aitookitTraining v1 under PandyTool/File. A small, safe, repeatable way to impose order on a messy training folder.

    CategoryPandyTool/File

    Inputs (7)

    NameTypeDefaultDescription
    input_pathSTRING
    output_pathSTRING
    training_folderSTRINGaitookit_training
    folder_1STRINGaitookit_R
    word_1STRINGR
    folder_2STRINGaitookit_T
    word_2STRINGT

    Outputs (1)

    NameTypeDescription
    messageSTRING