Skip to content

Commit

Permalink
fix(api): correctly handle sliced kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jun 17, 2023
1 parent 1506f51 commit 7db53a8
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions api/onnx_web/convert/diffusion/lora.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,9 @@ def blend_loras(
down_w, down_h = kernel_slice(w, h, down_weight.shape)
up_w, up_h = kernel_slice(w, h, up_weight.shape)

weights[:, :, w, h] = up_weight[
:, :, up_w, up_h
].squeeze(3).squeeze(2) @ down_weight[
:, :, down_w, down_h
].squeeze(
3
).squeeze(
2
weights[:, :, w, h] = (
up_weight[:, :, up_w, up_h]
@ down_weight[:, :, down_w, down_h]
)

np_weights = weights.numpy() * (alpha / dim)
Expand Down

0 comments on commit 7db53a8

Please sign in to comment.