Skip to content

Commit

Permalink
remove unused code from pag attn procs (huggingface#8928)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-r-r-o-w authored Jul 26, 2024
1 parent 5c53ca5 commit ca0747a
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/diffusers/models/attention_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2962,12 +2962,6 @@ def __call__(
# perturbed path (identity attention)
batch_size, sequence_length, _ = hidden_states_ptb.shape

if attention_mask is not None:
attention_mask = attn.prepare_attention_mask(attention_mask, sequence_length, batch_size)
# scaled_dot_product_attention expects attention_mask shape to be
# (batch, heads, source_length, target_length)
attention_mask = attention_mask.view(batch_size, attn.heads, -1, attention_mask.shape[-1])

if attn.group_norm is not None:
hidden_states_ptb = attn.group_norm(hidden_states_ptb.transpose(1, 2)).transpose(1, 2)

Expand Down Expand Up @@ -3070,12 +3064,6 @@ def __call__(
# perturbed path (identity attention)
batch_size, sequence_length, _ = hidden_states_ptb.shape

if attention_mask is not None:
attention_mask = attn.prepare_attention_mask(attention_mask, sequence_length, batch_size)
# scaled_dot_product_attention expects attention_mask shape to be
# (batch, heads, source_length, target_length)
attention_mask = attention_mask.view(batch_size, attn.heads, -1, attention_mask.shape[-1])

if attn.group_norm is not None:
hidden_states_ptb = attn.group_norm(hidden_states_ptb.transpose(1, 2)).transpose(1, 2)

Expand Down

0 comments on commit ca0747a

Please sign in to comment.