Nodes/Anima 28→40 批量 LoRA 转换器/Anima 28→40 批量 LoRA 转换器
ComfyUI Node

Anima 28→40 批量 LoRA 转换器

Your 28-layer Anima LoRAs won't load on a 40-layer build — this converts them in bulk

By R0smontis·Created about a month ago·Updated about a month ago· 2
Anima 28→40 批量 LoRA 转换器
    • summary
    source_modenames
    lora_names
    source_subfolderanima
    filter*
    output_subfolderanima_40
    name_suffix_40
    overwritefalse

    So you trained (or downloaded) Anima LoRAs against the original 28-block structure, and now a 40-layer Anima build won't load them. The weights aren't the problem - the key names are. Anima's transformer grew twelve extra blocks between the original 28, which means every blocks_N key in your LoRA points at the wrong layer. This node fixes exactly that: it remaps the keys, writes clean .safetensors files into your models/loras folder, and does it for a whole folder at once.

    The 28→40 mechanic, briefly

    The mapping spec comes from the sibling in-memory pack ComfyUI-Anima-28to40-Lora-Stack: the 40-layer model inserts 12 new blocks at positions 2, 5, 8, 11, 14, 17, 21, 24, 27, 30, 33, 36, and the original 28 blocks slide into the gaps. So old layer 0 stays 0, old 2 becomes 3, old 14 becomes 20, old 27 becomes 39. This node applies that mapping to every key in the file, renaming (for example) lora_unet_blocks_14_* to lora_unet_blocks_20_*. It recognizes three key prefixes - lora_unet_blocks_*, net.blocks.*, and diffusion_model.blocks.* - and deliberately ignores things like llm_adapter_blocks_* so it doesn't wreck non-main-model tensors.

    Two things are worth knowing before you trust it. First, it does not synthesize weights for the 12 new blocks - it renames tensors and rewrites the file, so those inserted layers simply carry no LoRA influence. Second, it keeps your metadata and appends a ss_anima_remap = "28to40" marker, so you can tell at a glance which files have been through it. It also validates strictly: no recognizable block keys, an index outside 0–27, or key collisions after remapping all abort before anything is written.

    The inputs that matter

    • source_mode - the one you actually set. names is strict: you paste a list (one per line, or comma/semicolon-separated) and any bad entry aborts the whole run. folder is lenient: it recursively scans source_subfolder (default anima), matches filter (default *, and it accepts globs or plain substrings), and skips anything it can't convert into a summary. For a first pass, use folder - you can't kill the run with one stray file.
    • output_subfolder (default anima_40) and name_suffix (default _40) - where converted files land and what they're called. anima/foo.safetensors becomes anima_40/anima/foo_40.safetensors, keeping the subfolder structure.
    • overwrite (default false) - with it off, existing targets are skipped and reported. Leave it off; you want the originals intact until you've verified a converted file actually loads.

    It's an output node: nothing wires out of it, and the single summary STRING output is a text report of what converted and what got skipped. You queue the workflow to run it, then read the summary. Because IS_CHANGED is set to NaN, it re-runs every time you queue, which is what you want from a batch tool.

    Installing it

    Easiest way is ComfyUI Manager - search anima-28to40-lora-converter. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/R0smontis/ComfyUI-Anima-28to40-Lora-Converter.git
    

    Restart ComfyUI. That's it - the README is explicit that there are no extra Python dependencies and no model files to download, which is rarer than it should be in this ecosystem. The only moving part is ComfyUI's own load_torch_file with safe_load=True.

    Where people get burned

    • Path strictness. Names must be relative to models/loras - absolute paths and .. are rejected outright. And note names mode fails fast, so a single bad path in a long list means a partial write and an error saying how many it got through.
    • Re-running on converted files. A 40-layer file fed back in trips the "may already be a 40-layer structure" check and won't be double-converted. That's a feature, and it's why _40 + overwrite=false is a safe default rather than an annoying one.
    • Wrong key prefixes. A LoRA from a trainer that names blocks differently will fail the strict validation with "no recognizable Anima block keys." The three supported prefixes cover the common cases, but not every trainer.

    Convert a small one first, load it in the 40-layer checkpoint, confirm the result, then point it at the whole folder. Batch conversion that quietly clobbers your library is the failure mode this node's defaults are designed to avoid.

    Categoryloaders/Anima

    Inputs (7)

    NameTypeDefaultDescription
    source_modeCOMBOnames2 options: names, folder
    lora_namesSTRING
    source_subfolderSTRINGanima
    filterSTRING*
    output_subfolderSTRINGanima_40
    name_suffixSTRING_40
    overwriteBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    summarySTRING