Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

Merge remote-tracking branch 'origin/main' into feat/rocm-windows-memory

Alexander Eichhorne568b2a74ec4
diff --cc invokeai/app/invocations/krea2/krea2_denoise.py
index c794d51468,3b6c3c094f..d9aca4e851
--- a/invokeai/app/invocations/krea2/krea2_denoise.py
+++ b/invokeai/app/invocations/krea2/krea2_denoise.py
@@@ -500,18 -559,13 +563,21 @@@ class Krea2DenoiseInvocation(BaseInvoca
negative_text_seq_len=neg_prompt_embeds.shape[1] if neg_prompt_embeds is not None else None,
do_cfg=do_cfg,
num_loras=len(self.transformer.loras),
- regional_attention_mask_bytes=self._regional_attention_mask_bytes(
- pos_extension, neg_extension, inference_dtype
- ),
+ regional_attention_mask_bytes=regional_attention_mask_bytes,
+ style_reference_kv_bytes=(
+ style_extension.kv_cache_bytes(inference_dtype) if style_extension is not None else 0
+ ),
)
+ # The activation estimate assumes a fused kernel. Where the build has none for this attention -- ROCm on
+ # Windows, MPS -- the score matrix is built as well (chunked on ROCm, see `install_rocm_sdpa_guard`).
+ estimated_working_memory += self._attention_score_bytes(
+ transformer_info.model,
+ seq_len=image_seq_len
+ + max(pos_prompt_embeds.shape[1], neg_prompt_embeds.shape[1] if neg_prompt_embeds is not None else 0),
+ has_attn_mask=regional_attention_mask_bytes > 0,
+ device=device,
+ dtype=inference_dtype,
+ )
# An int8_tensorwise build stores its linears quantized and materializes the dequantized,
# derotated weight per forward call. That transient is alive alongside the activations above,
# so it is added rather than compared -- and it is invisible to an activation estimate, which