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.
- model_diff
- text_encoder_diff
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| filename_prefix | STRING | loras/ComfyUI_extracted_lora | β |
| filename_suffix | STRING | {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_). |
| rank | INT | 161β4096 | LoRA 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_type | COMBO | Type 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_diff | BOOLEAN | true | If 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_zero | BOOLEAN | false | If True, skips saving the text encoder weights if any weight diff is zero. |
| skip_on_proj_diff_zero | BOOLEAN | false | If True, skips saving the text encoder weights if 'text_projection.weight' diff is zero. |
| embed_workflow | BOOLEAN | true | Enable or disable saving of workflow inside the LoRA metadata. Will not save metadata if it's disabled in ComfyUI globally. |
| model_diffopt | MODEL | The ModelSubtract output to be converted to a lora. | |
| text_encoder_diffopt | CLIP | The CLIPSubtract output to be converted to a lora. |
Outputs (0)
No outputs