Rename LoRA Keys
Fix mismatched tensor names without retraining anything
- output_path
Different LoRA trainers, and different exporters within the same trainer, don't always agree on what to call the same tensor. A LoRA trained one way might call a layer lora_unet_down_blocks_0_attentions_0_proj_in.lora_up.weight, while a different pipeline's export of conceptually the same layer uses a different naming scheme entirely - dots instead of underscores, a different prefix, a different ordering. The result "works" as a file, but a loader expecting one convention silently fails to apply it, or applies it to the wrong layer, with no error telling you why. This node exists for exactly that problem: it loads a LoRA, renames the specific keys you tell it to, and saves a new file with the fix baked in.
How it works
lora_name picks the source file from a dropdown. old_keys and new_keys are both multiline text fields - you list the exact tensor names you want changed and what you want them changed to. The node's own description confirms the mechanics plainly: it "loads a LoRA, renames specified keys, and saves it as a new safetensors file." output_filename (default renamed_lora) names the result. Output is a single output_path string.
This is a surgical tool, not a bulk pattern-replace - you're supplying exact key names, not a regex substitution across the whole file (that's closer to what use_regex does over on CheckpointPruneKeys, a different node with a different job). Which means you need to already know the exact old names before you touch this node.
The step before this one
You almost never start here. Run LoRAMetaKeys first, pointed at the same file - its keys output gives you the exact, correctly-spelled internal tensor names, which is the only reliable source for what to put in old_keys. Guessing at naming conventions from memory or from a different LoRA's structure is how you end up renaming nothing (because the old name didn't match anything in the file) or, worse, silently mismatching keys against the wrong tensors.
Installing it
ComfyUI Manager: search Model Utility Toolkit, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-ModelUtils
Restart ComfyUI. No downloads - this works on a LoRA file you already have.
Where people get burned
The number one mistake is a typo in old_keys that just doesn't match anything, so the rename silently does nothing for that key while the rest proceed - always spot-check the output file's keys afterward (with LoRAMetaKeys again) rather than assuming a clean run means every rename landed. The number one use case for this node in the wild is bridging a naming mismatch between a LoRA and the loader or workflow expecting a different convention - this pack ships a purpose-built version of exactly that problem for one specific architecture in AnimaLoraRename, which flips a diffusers-format Anima LoRA to the non-diffusers naming ComfyUI-native loaders expect. If you're hitting that particular mismatch, that dedicated node does the mapping for you instead of you hand-typing every key pair here.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| lora_name | COMBO | 0 options: | |
| old_keys | STRING | — | |
| new_keys | STRING | — | |
| output_filename | STRING | renamed_lora | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output_path | STRING | — |