Skip to content

Commit fc68249

Browse files
committed
improve speed
1 parent 70b5775 commit fc68249

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

modules/fully_attention.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,11 @@ def forward(self, hidden_states, context=None, value=None, attention_mask=None,
197197
attention_mask = attention_mask.repeat_interleave(
198198
self.heads, dim=0)
199199

200-
if comfy.model_management.xformers_enabled():
201-
query = self.reshape_heads_to_batch_dim(query)
202-
key = self.reshape_heads_to_batch_dim(key)
203-
value = self.reshape_heads_to_batch_dim(value)
204-
hidden_states = self._memory_efficient_attention_xformers(
205-
query, key, value, attention_mask)
206-
hidden_states = hidden_states.to(query.dtype)
207-
else:
208-
hidden_states = self._attention_mechanism(
209-
query, key, value, attention_mask)
210-
query = self.reshape_heads_to_batch_dim(query)
211-
key = self.reshape_heads_to_batch_dim(key)
212-
value = self.reshape_heads_to_batch_dim(value)
200+
hidden_states = self._attention_mechanism(
201+
query, key, value, attention_mask)
202+
query = self.reshape_heads_to_batch_dim(query)
203+
key = self.reshape_heads_to_batch_dim(key)
204+
value = self.reshape_heads_to_batch_dim(value)
213205

214206
if h in [target_resolution]:
215207
hidden_states = rearrange(

0 commit comments

Comments
 (0)