Update PixArt_blocks.py
Add dropout_p to SDP attention
This commit is contained in:
@@ -189,6 +189,7 @@ class AttentionKVCompress(Attention_):
|
||||
q, k, v = map(lambda t: t.transpose(1, 2),(q, k, v),)
|
||||
x = torch.nn.functional.scaled_dot_product_attention(
|
||||
q, k, v,
|
||||
dropout_p=self.attn_drop.p,
|
||||
attn_mask=attn_bias
|
||||
).transpose(1, 2).contiguous()
|
||||
x = x.view(B, N, C)
|
||||
@@ -467,4 +468,4 @@ class CaptionEmbedderDoubleBr(nn.Module):
|
||||
if (train and use_dropout) or (force_drop_ids is not None):
|
||||
global_caption, caption = self.token_drop(global_caption, caption, force_drop_ids)
|
||||
y_embed = self.proj(global_caption)
|
||||
return y_embed, caption
|
||||
return y_embed, caption
|
||||
|
||||
Reference in New Issue
Block a user