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.

fix(flux2): strip reference-image tokens from Heun preview latents (#9274)

Alexander Eichhorned49fab8e120
diff --git a/invokeai/backend/flux2/denoise.py b/invokeai/backend/flux2/denoise.py
index 2ff66236ce..30c287840b 100644
--- a/invokeai/backend/flux2/denoise.py
+++ b/invokeai/backend/flux2/denoise.py
@@ -195,13 +195,17 @@ def denoise(
preview_img = inpaint_extension.merge_intermediate_latents_with_init_latents(
preview_img, 0.0
)
+ # Extract only the generated image portion for preview (exclude reference images)
+ callback_latents = (
+ preview_img[:, :original_seq_len, :] if img_cond_seq is not None else preview_img
+ )
step_callback(
PipelineIntermediateState(
step=user_step,
order=2,
total_steps=total_steps,
timestep=int(t_curr * 1000),
- latents=preview_img,
+ latents=callback_latents,
),
)
else: