1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00

[LoRA] fix: torch.compile() for lora conv (#5298)

fix: torch.compile() for lora conv
This commit is contained in:
Sayak Paul
2023-10-06 17:14:47 +02:00
committed by GitHub
parent 872ae1dd12
commit 7eaae83f16

View File

@@ -164,7 +164,10 @@ class LoRACompatibleConv(nn.Conv2d):
hidden_states, self.weight, self.bias, self.stride, self.padding, self.dilation, self.groups
)
else:
return super().forward(hidden_states) + (scale * self.lora_layer(hidden_states))
original_outputs = F.conv2d(
hidden_states, self.weight, self.bias, self.stride, self.padding, self.dilation, self.groups
)
return original_outputs + (scale * self.lora_layer(hidden_states))
class LoRACompatibleLinear(nn.Linear):