Skip to content

Commit

Permalink
perp in diff space
Browse files Browse the repository at this point in the history
  • Loading branch information
ljleb committed Feb 11, 2024
1 parent a713785 commit 77d75d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sd_meh/merge_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,5 @@ def add_perpendicular(
) -> Tensor:
a_diff = a.float() - c.float()
b_diff = b.float() - c.float()
b_ortho = b_diff * torch.sum(a_diff * b_diff) / torch.norm(b_diff) ** 2
return (a + alpha * b_ortho).to(a.dtype)
b_perp = b_diff - a_diff * torch.sum(a_diff * b_diff) / torch.norm(a_diff) ** 2
return (a + alpha * b_perp).to(a.dtype)

0 comments on commit 77d75d4

Please sign in to comment.