mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-01-26 19:09:45 +00:00
fix
This commit is contained in:
@@ -192,7 +192,7 @@ class DoubleStreamBlock(nn.Module):
|
||||
B, L, _ = img_qkv.shape
|
||||
H = self.num_heads
|
||||
D = img_qkv.shape[-1] // (3 * H)
|
||||
img_q, img_k, img_v = img_qkv.view(B, L, 3, H, D).permute(2, 0, 1, 3)
|
||||
img_q, img_k, img_v = img_qkv.view(B, L, 3, H, D).permute(2, 0, 3, 1, 4)
|
||||
del img_qkv
|
||||
|
||||
img_q, img_k = self.img_attn.norm(img_q, img_k, img_v)
|
||||
@@ -205,7 +205,7 @@ class DoubleStreamBlock(nn.Module):
|
||||
|
||||
# txt_q, txt_k, txt_v = rearrange(txt_qkv, "B L (K H D) -> K B H L D", K=3, H=self.num_heads)
|
||||
B, L, _ = txt_qkv.shape
|
||||
txt_q, txt_k, txt_v = txt_qkv.view(B, L, 3, H, D).permute(2, 0, 1, 3)
|
||||
txt_q, txt_k, txt_v = txt_qkv.view(B, L, 3, H, D).permute(2, 0, 3, 1, 4)
|
||||
del txt_qkv
|
||||
|
||||
txt_q, txt_k = self.txt_attn.norm(txt_q, txt_k, txt_v)
|
||||
@@ -260,8 +260,7 @@ class SingleStreamBlock(nn.Module):
|
||||
|
||||
# q, k, v = rearrange(qkv, "B L (K H D) -> K B H L D", K=3, H=self.num_heads)
|
||||
qkv = qkv.view(qkv.size(0), qkv.size(1), 3, self.num_heads, self.hidden_size // self.num_heads)
|
||||
qkv = qkv.permute(2, 0, 3, 1, 4) # (3, B, H, L, D)
|
||||
q, k, v = qkv[0], qkv[1], qkv[2]
|
||||
q, k, v = qkv.permute(2, 0, 3, 1, 4)
|
||||
del qkv
|
||||
|
||||
q, k = self.norm(q, k, v)
|
||||
|
||||
Reference in New Issue
Block a user