From 530fa39073a89c7273eb5adb42f84a2dc1b70c0d Mon Sep 17 00:00:00 2001 From: Wagner Bruna Date: Thu, 22 Oct 2026 11:57:44 -0300 Subject: [PATCH] fix: prevent z-image crash with reference images (#2185) --- src/conditioning/conditioner.hpp | 5 ++++- src/pipeline/diffusion_engine.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/conditioning/conditioner.hpp b/src/conditioning/conditioner.hpp index c0e0c03b..26e11cd3 100644 --- a/src/conditioning/conditioner.hpp +++ b/src/conditioning/conditioner.hpp @@ -3045,7 +3045,10 @@ struct LLMEmbedder : public Conditioner { } else if (sd_version_is_z_image(version) || sd_version_is_z_image_l2p(version)) { prompt_template_encode_start_idx = 0; out_layers = {35}; // -2 - + if (conditioner_params.ref_images != nullptr && !conditioner_params.ref_images->empty()) { + LOG_ERROR("Z-Image currently does not support reference-image conditioning"); + return {}; + } if (conditioner_params.ref_images != nullptr && !conditioner_params.ref_images->empty()) { LOG_INFO("ZImageOmniPipeline"); prompt = "<|im_start|>user\n<|vision_start|>"; diff --git a/src/pipeline/diffusion_engine.cpp b/src/pipeline/diffusion_engine.cpp index 1e3c2e24..a913ae77 100644 --- a/src/pipeline/diffusion_engine.cpp +++ b/src/pipeline/diffusion_engine.cpp @@ -3223,7 +3223,7 @@ std::string StableDiffusionGGML::get_default_ref_image_preset(SDVersion version) return "qwen"; } else if (sd_version_is_mage_flow(version)) { return "mage_flow"; - } else if (sd_version_is_z_image(version) || sd_version_is_boogu_image(version)) { + } else if (sd_version_is_boogu_image(version)) { return "z_image_omni"; } else if (sd_version_is_llada_image(version)) { return "llada_image";