mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-04-20 03:13:30 +00:00
Correct DoRA implementation
This commit is contained in:
parent
a14c2fc356
commit
facf574a61
@ -413,11 +413,10 @@ def weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediat
|
|||||||
lora_diff *= alpha
|
lora_diff *= alpha
|
||||||
weight_calc = weight + function(lora_diff).type(weight.dtype)
|
weight_calc = weight + function(lora_diff).type(weight.dtype)
|
||||||
weight_norm = (
|
weight_norm = (
|
||||||
weight_calc.transpose(0, 1)
|
weight_calc
|
||||||
.reshape(weight_calc.shape[1], -1)
|
.reshape(weight_calc.shape[0], -1)
|
||||||
.norm(dim=1, keepdim=True)
|
.norm(dim=1, keepdim=True)
|
||||||
.reshape(weight_calc.shape[1], *[1] * (weight_calc.dim() - 1))
|
.reshape(weight_calc.shape[0], *[1] * (weight_calc.dim() - 1))
|
||||||
.transpose(0, 1)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
weight_calc *= (dora_scale / weight_norm).type(weight.dtype)
|
weight_calc *= (dora_scale / weight_norm).type(weight.dtype)
|
||||||
|
Loading…
Reference in New Issue
Block a user