mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Update lora hotfix to new diffusers version(scale argument added)
This commit is contained in:
parent
604fc006b1
commit
ff3150a818
@ -772,11 +772,13 @@ diffusers.models.controlnet.ControlNetModel = ControlNetModel
|
|||||||
# NOTE: with this patch, torch.compile crashes on 2.0 torch(already fixed in nightly)
|
# NOTE: with this patch, torch.compile crashes on 2.0 torch(already fixed in nightly)
|
||||||
# https://github.com/huggingface/diffusers/pull/4315
|
# https://github.com/huggingface/diffusers/pull/4315
|
||||||
# https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/lora.py#L96C18-L96C18
|
# https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/lora.py#L96C18-L96C18
|
||||||
def new_LoRACompatibleConv_forward(self, x):
|
def new_LoRACompatibleConv_forward(self, hidden_states, scale: float = 1.0):
|
||||||
if self.lora_layer is None:
|
if self.lora_layer is None:
|
||||||
return super(diffusers.models.lora.LoRACompatibleConv, self).forward(x)
|
return super(diffusers.models.lora.LoRACompatibleConv, self).forward(hidden_states)
|
||||||
else:
|
else:
|
||||||
return super(diffusers.models.lora.LoRACompatibleConv, self).forward(x) + self.lora_layer(x)
|
return super(diffusers.models.lora.LoRACompatibleConv, self).forward(hidden_states) + (
|
||||||
|
scale * self.lora_layer(hidden_states)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
diffusers.models.lora.LoRACompatibleConv.forward = new_LoRACompatibleConv_forward
|
diffusers.models.lora.LoRACompatibleConv.forward = new_LoRACompatibleConv_forward
|
||||||
|
Loading…
Reference in New Issue
Block a user