Skip to content

Commit

Permalink
Redo attention processor to support other attention types
Browse files Browse the repository at this point in the history
  • Loading branch information
StAlKeR7779 committed Jun 27, 2024
1 parent a0a0c57 commit cd2dccf
Show file tree
Hide file tree
Showing 3 changed files with 347 additions and 116 deletions.
4 changes: 2 additions & 2 deletions invokeai/backend/stable_diffusion/diffusers_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,6 @@ def latents_from_embeddings(
# latents = noise * self.scheduler.init_noise_sigma # it's like in t2l according to diffusers
latents = self.scheduler.add_noise(latents, noise, batched_init_timestep)

self._adjust_memory_efficient_attention(latents)

# Handle mask guidance (a.k.a. inpainting).
mask_guidance: AddsMaskGuidance | None = None
if mask is not None and not is_inpainting_model(self.unet):
Expand Down Expand Up @@ -371,6 +369,8 @@ def latents_from_embeddings(
)
unet_attention_patcher = UNetAttentionPatcher(ip_adapters)
attn_ctx = unet_attention_patcher.apply_ip_adapter_attention(self.invokeai_diffuser.model)
else:
self._adjust_memory_efficient_attention(latents)

with attn_ctx:
callback(
Expand Down
Loading

0 comments on commit cd2dccf

Please sign in to comment.