Nodes/ComfyUI-RyuuNoodles/Extract and Save Lora 🐲
ComfyUI Node

Extract and Save Lora 🐲

Saves the model and text encoder diffs as LoRA weights in .safetensors format. How is this different from the built-in Extract and Save LoRA node? This one allows you choose not to save text encoder weights if any text encoder key difference is 0 or if the sepcific *.transformers.text_projection.weight key is 0. It also allows you to choose file suffix, and adds keywords to the filename like r40 to indicate rank size, _TE / _noTE to indicate if the text encoder diff was included, and _biasdiff to indicate that bias differences were included. Workflow can also be saved by embedding it into the LoRA's metadata. It's possible this node doesn't quite work for the TE saving and all that, I've had unexpectedly mixed result for the same extracts when there shouldn't have been any nuance.

By DraconicDragonΒ·Created about a year agoΒ·Updated about a month agoΒ· 11
Extract and Save Lora 🐲
  • model_diff
  • text_encoder_diff
    β—„filename_prefixloras/ComfyUI_extracted_loraβ–Ί
    β—„filename_suffix{counter:05}β–Ί
    β—„rank16β–Ί
    β—„lora_typeβ–Ύβ–Ί
    β—„bias_difftrueβ–Ί
    β—„skip_on_any_diff_zerofalseβ–Ί
    β—„skip_on_proj_diff_zerofalseβ–Ί
    β—„embed_workflowtrueβ–Ί
    CategoryRyuuNoodles 🐲/Utils

    Inputs (10)

    NameTypeDefaultDescription
    filename_prefixSTRINGloras/ComfyUI_extracted_loraβ€”
    filename_suffixSTRING{counter:05}Suffix to append to the filename. Will be appended after '_noTE', '_biasdiff', etc. Use {counter} for a counter, it supports zero padding (E.g.: test_{counter:05}_ = test_00001_).
    rankINT161–4096LoRA network dimension size (LoRA Rank). Prefer 16-64 depending on how much data you want to have saved in relation to the checkpoint differences.
    lora_typeCOMBOType of LoRA to extract. Standard is the default (like normal trained LoRA; rank 32 ~= 217mb LoRA assuming TE diff is extracted too), full_diff saves the full weight diff (very large).
    bias_diffBOOLEANtrueIf enabled, includes .bias weight differences in the extracted LoRA. This can help match the original model behavior more closely, with minimal impact on file size.
    skip_on_any_diff_zeroBOOLEANfalseIf True, skips saving the text encoder weights if any weight diff is zero.
    skip_on_proj_diff_zeroBOOLEANfalseIf True, skips saving the text encoder weights if 'text_projection.weight' diff is zero.
    embed_workflowBOOLEANtrueEnable or disable saving of workflow inside the LoRA metadata. Will not save metadata if it's disabled in ComfyUI globally.
    model_diffoptMODELThe ModelSubtract output to be converted to a lora.
    text_encoder_diffoptCLIPThe CLIPSubtract output to be converted to a lora.

    Outputs (0)

    No outputs