Nodes/ComfyUI-Rebase-LoRA/Rebase LoRA From Finetune
ComfyUI Node

Rebase LoRA From Finetune

Applies a source LoRA to the base MODEL/CLIP, subtracts the finetuned MODEL/CLIP, then writes a new LoRA/patch file relative to the finetuned weights.

By srv1n·Created 5 months ago·Updated 5 months ago· 0
Rebase LoRA From Finetune
  • base_model
  • finetuned_model
  • base_clip
  • finetuned_clip
  • saved_lora
  • report
base_lora_name
save_relpathrebased/rebased_lora
rank16
layer_scope
rank_mode
output_mode
strength_model1.00
strength_clip1.00
save_dtype
bias_difftrue
clamp_quantile0.990
include_cliptrue
compute_deviceauto
svd_modeauto
cuda_svd_driverauto
lowrank_oversample16
lowrank_niter2
Categorymodel_merging/lora

Inputs (21)

NameTypeDefaultDescription
base_modelMODEL
finetuned_modelMODEL
base_lora_nameCOMBOThe source LoRA trained on top of the base model.
save_relpathSTRINGrebased/rebased_loraRelative path inside the ComfyUI loras folder. .safetensors is optional.
rankINT161–4096
layer_scopeCOMBOoriginal_lora_only keeps only layers touched by the source LoRA. all_compatible_weights tries to recreate the full target delta.
rank_modeCOMBOReuse the input LoRA layer rank when possible, or force one fixed rank for every extracted layer.
output_modeCOMBOstandard writes LoRA factors where possible. full_diff_patch writes exact diff tensors instead.
strength_modelFLOAT1.00-10–10
strength_clipFLOAT1.00-10–10
save_dtypeCOMBOTensor dtype used in the written safetensors file.
bias_diffBOOLEANtrueWhen enabled, bias deltas are written as .diff_b patches.
clamp_quantileFLOAT0.9900–1Symmetric clamp used before writing LoRA factors. Set to 0 or 1 to disable.
include_clipBOOLEANtrueAlso extract text-encoder deltas when clip inputs are connected.
compute_deviceCOMBOautoWhere to run subtraction and SVD. GPU mainly helps standard LoRA extraction; full_diff_patch is usually fine on CPU.
svd_modeCOMBOautoauto uses full SVD for most layers and randomized low-rank SVD only when the requested rank is much smaller than the matrix.
cuda_svd_driverCOMBOautoCUDA-only torch.linalg.svd driver. Leave on auto unless you are tuning speed/accuracy.
lowrank_oversampleINT160–512Extra rank budget used by randomized low-rank SVD in auto/lowrank mode.
lowrank_niterINT20–16Power iterations for randomized low-rank SVD. Higher is slower but usually more accurate.
base_clipoptCLIP
finetuned_clipoptCLIP

Outputs (2)

NameTypeDescription
saved_loraSTRING
reportSTRING