ComfyUI Node

Pack H3 RefLoRA

Weld a LoRA and its references into one file you can't mix up

By malcolmamal·Created 21 days ago·Updated 21 days ago· 9
Pack H3 RefLoRA
    • path
    • report
    ◄lora_name▾►
    ◄output_name►
    ◄subfolderMinimaxH3/reflora►
    ◄overwritefalse►
    ◄refmod_1▾►
    ◄refmod_2▾►
    ◄refmod_3▾►
    ◄refmod_4▾►
    ◄refmod_5▾►
    ◄refmod_6▾►
    ◄refmod_7▾►
    ◄refmod_8▾►

    Training a character LoRA is the part everyone writes about. The part that quietly ruins an afternoon is the folder: aneta_v1-000040.safetensors, aneta_v1-000050.safetensors, aneta_v1-000060.safetensors, and three refmod files that were each extracted at a different epoch. Which reference goes with which checkpoint? You think you remember. You don't.

    This node takes a LoRA plus one to eight RefMods and writes them into a single RefLoRA container in models/loras/, with a header that records what went in. One download, one name, no pairing decision later. The author of this pack trains his own H3 subjects, so it's the tool he needed for his own folders - the example graphs in the repo ship with containers built exactly this way.

    The inputs

    lora_name is the LoRA you're packing - picked from models/loras/ like any other loader field. It has to look like a LoRA: the packer checks for *.lora_down.weight tensors and refuses the file if it can't find any. If your LoRA already contains keys starting with ref_, it refuses too, rather than silently colliding with the reference namespace.

    refmod_1 through refmod_8 are the references. At least one is required - packing a LoRA with no references is just copying a file, so the node raises Select at least one RefMod to pack. Pass a v5 RefMod bundle and it gets flattened into its own members, so one bundle slot can contribute several references. Older standalone RefMods (format versions 2 and 4, the bare latent variant) are accepted as inputs.

    output_name is the output stem; leave it empty and you get the LoRA's filename with _reflora appended. subfolder defaults to MinimaxH3/reflora, which is where the example workflows expect to find their containers - change it and you'll need to re-point the loader's file picker. overwrite is off by default, and with it off the node refuses to clobber an existing container rather than replacing the file you spent an hour building.

    What you get back

    Two outputs. path is where the file landed, and report is the same summary the Inspect node prints - reference count, token totals, LoRA tensor count and dim/alpha. The node is an output node, so both show up as text in the UI as well as in the graph.

    Doing it without launching ComfyUI

    Same pack, pack_reflora.py, and it's standard library only - no torch, no safetensors, no virtualenv:

    python pack_reflora.py pack --lora minimaxh3_aneta_v1-000060 \
                                --refmod minimaxh3_aneta_v1_refmod \
                                --out models/loras/MinimaxH3/reflora/minimaxh3_aneta_v1_reflora.safetensors
    
    python pack_reflora.py inspect <reflora>
    python pack_reflora.py verify  <reflora> --lora <source lora>
    python pack_reflora.py unpack  <reflora> --out-dir <dir>
    

    Bare names resolve against models/loras and models/refmods, so you rarely need full paths; set COMFYUI_MODELS_DIR if the pack isn't sitting inside a ComfyUI install. It streams in 1 MiB chunks, so packing a 150 MB LoRA costs about a megabyte of RAM - and because packing is a header rewrite plus a byte copy, there's no dtype round-trip: the weights come out identical to what you started with. verify --lora byte-compares them if you'd rather not take that on faith, which is the right instinct when a tool is rewriting a file you trained.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/malcolmamal/ComfyUI-MiniMaxH3RefLoRA
    

    Restart. No dependencies to install - the pack's own README notes the packer needs nothing at all, not even safetensors, and there's no requirements file in the repo. RefMods you want to pack from the UI need to live under models/refmods/; the pack registers that folder itself, so you don't need another pack installed for the dropdown to populate.

    The one trap worth memorising

    If you also run ComfyUI-MiniMaxH3Mod, do not re-save a RefLoRA with its Bundle Save node. That code path writes only the ref_i tensors, which drops the entire weight half of your container with no error message and no warning - you'll get a file that loads and simply doesn't apply any LoRA. Use this node, or pack_reflora.py, for anything that rewrites a container. The loader warns when a container's declared LoRA tensor count no longer matches what's in the file, and Inspect with verify_bytes turned on will tell you outright, but the cheaper move is not doing it in the first place. Fix Config in that other pack is safe - it copies every tensor through - so it's specifically the bundle saver to avoid.

    CategoryMiniMax-H3/reflora

    Inputs (12)

    NameTypeDefaultDescription
    lora_nameCOMBOThe LoRA to pack.
    output_nameSTRINGOutput stem. Empty = the LoRA's name with '_reflora' appended.
    subfolderSTRINGMinimaxH3/refloraDestination inside models/loras/.
    overwriteBOOLEANfalse—
    refmod_1COMBOReference 1, or (none). A RefMod bundle is flattened into its own members.
    refmod_2COMBOReference 2, or (none). A RefMod bundle is flattened into its own members.
    refmod_3COMBOReference 3, or (none). A RefMod bundle is flattened into its own members.
    refmod_4COMBOReference 4, or (none). A RefMod bundle is flattened into its own members.
    refmod_5COMBOReference 5, or (none). A RefMod bundle is flattened into its own members.
    refmod_6COMBOReference 6, or (none). A RefMod bundle is flattened into its own members.
    refmod_7COMBOReference 7, or (none). A RefMod bundle is flattened into its own members.
    refmod_8COMBOReference 8, or (none). A RefMod bundle is flattened into its own members.

    Outputs (2)

    NameTypeDescription
    pathSTRING—
    reportSTRING—