Commit 530fa39 for stable-diffusion.cpp
commit 530fa39073a89c7273eb5adb42f84a2dc1b70c0d
Author: Wagner Bruna <wbruna@users.noreply.github.com>
Date: Thu Oct 22 11:57:44 2026 -0300
fix: prevent z-image crash with reference images (#2185)
diff --git a/src/conditioning/conditioner.hpp b/src/conditioning/conditioner.hpp
index c0e0c03..26e11cd 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 1e3c2e2..a913ae7 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";