Nodes/ComfyUI-KikoTools/LoRA Folder Batch
ComfyUI Node

LoRA Folder Batch

Test Every LoRA Epoch Without Rebuilding Your Graph

By ComfyAssetsΒ·Created about a year agoΒ·Updated 2 months agoΒ· 19
LoRA Folder Batch
    • lora_params
    • lora_list
    • lora_count
    β—„folder_path.β–Ί
    β—„strength1.0β–Ί
    β—„batch_modesequentialβ–Ί
    β—„include_patternβ–Ί
    β—„exclude_patternβ–Ί
    β—„max_loras50β–Ί
    β—„auto_batchdisabledβ–Ί
    β—„batch_size25β–Ί
    β—„batch_index0β–Ί
    β—„sort_ordernaturalβ–Ί

    Every LoRA training run ends the same way: twenty checkpoint files from twenty epochs, and the best one is never the last one. LoRA Folder Batch is built for exactly that moment. Point it at a folder of .safetensors LoRAs, tell it the strengths you want to test, and it generates a batch of LoRA-parameter sets you can sweep through - epoch by epoch, strength by strength - without hand-plugging each file into a LoRA loader.

    How it works

    It scans a folder for .safetensors files (relative to your models/loras directory, or an absolute path), then applies filters and sorts before generating params. The natural-sorting detail is the one that shows someone actually trained models: it sorts by epoch number, so epoch_004 comes before epoch_020 - alphabetical sort would put epoch_020 first and your sweep would be garbage. You can also sort alphabetically, newest, or oldest.

    Strengths are a flexible string: "1.0" for a single value, "0.5,0.75,1.0" for a list, or "0.5...1.0+0.1" for a range sweep. batch_mode controls the combinatorics: sequential pairs each LoRA with one strength, combinatorial tries every strength on every LoRA (that's the exhaustive sweep, and it multiplies your run count fast). Regex include_pattern / exclude_pattern fields let you slice the folder down to, say, the character LoRAs and skip the style ones.

    Inputs and outputs

    The ones that matter:

    • folder_path - relative to models/loras (default .), or absolute.
    • strength - single value, comma list, or start...end+step range.
    • batch_mode - sequential or combinatorial.
    • max_loras - cap, default 50, to stop a giant folder from flooding your UI.
    • auto_batch / batch_size / batch_index - for chunking huge sets into groups of 25 (default) so the UI doesn't choke.

    Outputs: lora_params (the batch, meant for the pack's Flux Sampler Params), lora_list (a readable list), and lora_count (how many made it through).

    Where it fits

    This is the "find the best epoch" tool, and the training lore backs it up: intermediate epochs are routinely better than the final one, so testing all of them is not optional paranoia. It's also the strength-sweep workhorse - you'll often find a LoRA that "doesn't work" just wants 0.4 instead of 1.0. It's part of the pack's xyz-helpers family (descended from cubiq's ComfyUI_essentials), so it's designed to feed the pack's parameter-testing plumbing, not a stock LoRA loader.

    Installing it

    ComfyUI Manager β†’ "ComfyUI-KikoTools" β†’ Install β†’ restart, under ComfyAssets β†’ xyz-helpers. Manual:

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

    Restart ComfyUI.

    Gotchas

    Watch the run-count explosion: combinatorial mode across 20 epochs Γ— 3 strengths is 60 generations - plan accordingly or use the max_loras / batch_index chunking to eat it in pieces. If you also have the original ComfyUI_essentials installed, the shared lineage can surface duplicate node names; ComfyUI Manager usually flags it. And remember the folder path is relative to models/loras by default - put your training output there (or give an absolute path), or the scan comes back empty.

    Category🫢 ComfyAssets/🧰 xyz-helpers

    Inputs (10)

    NameTypeDefaultDescription
    folder_pathSTRING.Folder path relative to models/loras (or absolute path)
    strengthSTRING1.0Strength values (e.g., '1.0' or '0.5,0.75,1.0' or '0.5...1.0+0.1')
    batch_modeCOMBOsequentialSequential: one strength per LoRA, Combinatorial: all strengths for each LoRA
    include_patternoptSTRINGRegex pattern to include files (empty = all)
    exclude_patternoptSTRINGRegex pattern to exclude files (e.g., 'test|backup')
    max_lorasoptINT501–500Maximum number of LoRAs to process (to prevent UI disconnection)
    auto_batchoptCOMBOdisabledAuto-batch large sets into chunks of 25 LoRAs
    batch_sizeoptINT255–100Number of LoRAs per batch when auto-batching
    batch_indexoptINT00–100Which batch to output (0-based index)
    sort_orderoptCOMBOnaturalHow to sort the LoRA files

    Outputs (3)

    NameTypeDescription
    lora_paramsLORA_PARAMSβ€”
    lora_listSTRINGβ€”
    lora_countINTβ€”