From 12a22083db0f1c73adc3e6ba01c5c1d7a5fe989c Mon Sep 17 00:00:00 2001 From: Wagner Bruna Date: Sat, 24 Oct 2026 16:59:37 -0300 Subject: [PATCH] fix: skip reference image VAE encoding when latents have no consumer This could cause a crash with e.g. vlm_use_vae_input=false and odd-sized images. --- src/pipeline/image.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pipeline/image.cpp b/src/pipeline/image.cpp index 38ca95c0c8..089ff63eb5 100644 --- a/src/pipeline/image.cpp +++ b/src/pipeline/image.cpp @@ -274,9 +274,13 @@ namespace sd::pipeline { LOG_INFO("EDIT mode"); } + bool skip_vae_encoding = (sd->version == VERSION_HIDREAM_O1) || !( + ref_image_params.pass_to_dit || ref_image_params.vlm_use_vae_input || + sd_version_is_unet_edit(sd->version) || sd_version_is_pid(sd->version)); + std::vector> ref_latents; for (size_t i = 0; i < ref_images.size(); i++) { - if (sd->version == VERSION_HIDREAM_O1) { + if (skip_vae_encoding) { continue; } sd::Tensor ref_latent;