Nodes/LoRA Optimizer/LoRA Combination Generator
ComfyUI Node

LoRA Combination Generator

Not for merging, it's for building an AutoTuner dataset

By ethanfel·Created 5 months ago·Updated 23 days ago· 135
LoRA Combination Generator
    • lora_stack
    • combo_info
    shuffle_order0
    strength1.00
    combo_size2_and_3
    folder_filter
    rerun_modefalse
    rerun_sourceshuffle

    Read the node description carefully and don't confuse this with a normal "combine my LoRAs" tool - that's LoRA Stack. This node generates LoRA combinations systematically, one at a time, across every 2-way and/or 3-way pairing in your LoRA folder, for the purpose of collecting AutoTuner scoring data. It's infrastructure for the pack's Community Cache and record_dataset feature, not something you'd reach for to build a specific merge.

    What it is and why you'd use it

    If you want the AutoTuner's community-backed k-NN estimator (the LoRA Merge Estimator node) to be useful for a broad range of LoRA combinations, someone has to have actually run the sweep on those combinations first and recorded the results. This node is how that happens systematically instead of by hand: point it at a LoRA folder, and it cycles through combinations in a deterministic shuffle order, feeding each one out as a lora_stack you can pipe straight into AutoTuner with record_dataset and community_cache enabled. It tracks which combos it's already processed in a persistent combo_progress.json, so a long collection run spanning many separate queue executions - which is realistic, since testing hundreds of combos takes real wall-clock time - can be resumed rather than restarted.

    This is squarely a contributor/power-user tool. If you're not building or backfilling a dataset for the community cache, you almost certainly want LoRA Stack (Dynamic) instead.

    How it works

    Each execution emits one combination. combo_size controls whether it generates pairs, triples, or both; shuffle_order is a seed for the deterministic ordering, so re-running with the same seed reproduces the same sequence rather than a fresh random walk. folder_filter restricts the pool of LoRAs it draws from - useful if you only want to generate combos within one style family (zit/,zib/) rather than across your entire, possibly unrelated, LoRA collection.

    The inputs and outputs that matter

    • shuffle_order (default 0) - the deterministic shuffle seed. Same value reproduces the same sequence of combos.
    • strength (default 1.0) - applied uniformly to every LoRA in each generated combo.
    • combo_size (default 2_and_3) - 2, 3, or both.
    • folder_filter (default empty, meaning all LoRAs) - comma-separated path prefixes to restrict which LoRAs get combined.
    • rerun_mode / rerun_source - the README flags rerun_mode as a temporary tool for backfilling per-prefix decisions into a separate progress file, meant to be used once and then disabled - not a setting to leave on permanently.

    Outputs: lora_stack - one combination per execution, ready for AutoTuner. combo_info - a STRING describing which combo this particular run produced, useful for logging alongside whatever dataset you're building.

    How to install it

    ComfyUI Manager: search "LoRA Optimizer", install, restart. Manually:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/ethanfel/ComfyUI-LoRA-Optimizer.git
    

    Restart - nodes appear under loaders. No extra downloads for the node itself; it works against your existing LoRA folder.

    Common issues & troubleshooting

    You just wanted to merge two or three specific LoRAs. You're in the wrong node - this generates combinations across your whole (filtered) LoRA folder for dataset purposes, not a single deliberate merge. Use LoRA Stack (Dynamic) for a specific, intentional combination.

    Progress seems to reset unexpectedly. Progress is tracked in combo_progress.json; if you're running this across different machines or ComfyUI installs, that file needs to travel with you, or the generator will start over rather than resume.

    Left rerun_mode enabled long-term. The README calls this out as a temporary backfill mechanism writing to a separate progress file - leaving it on indefinitely isn't the intended use and can leave you with a confusing side file (combo_progress_rerun.json) alongside your main progress. Turn it off once the backfill you needed is done, and delete the side file as the README suggests.

    CategoryLoRA Optimizer

    Inputs (6)

    NameTypeDefaultDescription
    shuffle_orderINT00–2147483647Seed for shuffle order. Same value = same deterministic sequence.
    strengthFLOAT1.00-10–10Default strength applied to all LoRAs in each combination.
    combo_sizeCOMBO2_and_3Generate pairs (2), triples (3), or both (2_and_3).
    folder_filterSTRINGComma-separated prefixes to filter LoRAs (e.g. 'zit/,zib/' or 'sdxl/'). Empty = all LoRAs.
    rerun_modeBOOLEANfalseTEMPORARY: re-run all combos into a separate progress file (combo_progress_rerun.json). Use once to backfill per-prefix decisions, then disable and delete the side file.
    rerun_sourceCOMBOshuffleOnly meaningful when rerun_mode=True. 'shuffle' iterates all combos in shuffle order. 'original_progress' restricts iteration to combos present in the original combo_progress.json (replay exactly what was previously processed).

    Outputs (2)

    NameTypeDescription
    lora_stackLORA_STACK
    combo_infoSTRING