Nodes/ComfyUI Flux Trainer/TrainDatasetGeneralConfig
ComfyUI Node

TrainDatasetGeneralConfig

The dataset-wide settings for a FluxTrainer run

By kijai·Created 2 years ago·Updated about a year ago· 1,157
TrainDatasetGeneralConfig
    • dataset_general
    color_augfalse
    flip_augfalse
    shuffle_captionfalse
    caption_dropout_rate0.00
    alpha_maskfalse
    reset_on_queuefalse
    caption_extension.txt

    Think of this as the settings that apply to your whole dataset, before you tell FluxTrainer about any specific folder. TrainDatasetAdd handles the per-folder stuff - where the images are, what resolution, how many repeats. This node handles the choices that ride on top of all of them: augmentation, how captions are read and shuffled, whether to use an alpha mask. You wire it in first, and its output becomes the base that TrainDatasetAdd extends.

    It's a small node with quiet defaults, and for most first runs you can leave almost everything alone. But two or three of these switches genuinely change how your LoRA turns out, so it's worth knowing what they do rather than treating it as a black box you drag in because the example workflow had one.

    How it works

    It emits a dataset_general JSON blob - the global half of the dataset config. That flows into TrainDatasetAdd, which appends the actual image folders as subsets. Splitting it this way means every folder you add inherits the same augmentation and caption rules without you re-setting them each time. One place for the dataset-wide policy, many folders under it.

    The inputs that matter

    Most of these are booleans that default to off, and for a first character or style LoRA that's usually correct. The ones worth a thought:

    • shuffle_caption - randomizes the order of comma-separated tags each time an image is seen. Useful for tag-style captioning (it stops the model over-associating with tag position); pointless and mildly harmful for natural-language captions where word order carries meaning.
    • caption_dropout_rate - randomly drops captions entirely for some fraction of steps (0 to 1). A small amount can help the model learn the concept without leaning too hard on the trigger word. Leave at 0 unless you know you want it.
    • flip_aug - horizontally mirrors images to fake a bigger dataset. Fine for many subjects, a trap for anything with handedness or asymmetry - text, logos, a scar on one cheek, a specific parting in hair. It'll happily teach your LoRA that the feature can be on either side.
    • color_aug - jitters colors for variety. Similar deal: harmless for some datasets, actively wrong if color is the concept.
    • alpha_mask - uses the image's alpha channel as a loss mask. Niche; leave off unless you specifically prepared masked images.

    The optional inputs are reset_on_queue (clears cached dataset state between queued runs) and caption_extension (defaults to .txt - change it only if your caption files use a different extension). Output is dataset_general (JSON).

    Installing ComfyUI-FluxTrainer

    ComfyUI Manager: search "ComfyUI Flux Trainer", install, restart. Or clone it:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kijai/ComfyUI-FluxTrainer
    cd ComfyUI-FluxTrainer
    pip install -r requirements.txt
    

    Restart ComfyUI. Torch 2.4.0 or newer recommended; the example workflow uses ComfyUI-KJNodes.

    Common issues

    The mistakes here are conceptual, not crashes - this node rarely errors, it just quietly shapes your data.

    The big one is flip_aug on the wrong dataset. People flip augmentation on to stretch a thin dataset, then wonder why their character's asymmetric features drift side to side. If any detail is supposed to stay on one side, leave flipping off and gather more real images instead.

    The second is mismatching shuffle_caption to your caption style. If you wrote natural-language captions (the norm for Flux, whose T5 encoder reads sentences), shuffling the words is counterproductive. Shuffling is a tag-caption habit from the Danbooru-tagged anime lineage. Match the switch to how you actually captioned.

    Everything else is safe to leave at defaults for your first run. Get a clean result, then start experimenting with dropout and augmentation - changing five things at once means you learn nothing when the LoRA comes out different.

    CategoryFluxTrainer

    Inputs (7)

    NameTypeDefaultDescription
    color_augBOOLEANfalseenable weak color augmentation
    flip_augBOOLEANfalseenable horizontal flip augmentation
    shuffle_captionBOOLEANfalseshuffle caption
    caption_dropout_rateFLOAT0.000–1tag dropout rate
    alpha_maskBOOLEANfalseuse alpha channel as mask for training
    reset_on_queueoptBOOLEANfalseForce refresh of everything for cleaner queueing
    caption_extensionoptSTRING.txtextension for caption files

    Outputs (1)

    NameTypeDescription
    dataset_generalJSON