Skip to content

Commit b758a14

Browse files
committed
fix: avoid segfault for pix2pix models with no reference images
1 parent 5900ef6 commit b758a14

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

stable-diffusion.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,6 +2040,10 @@ sd_image_t* generate_image(sd_ctx_t* sd_ctx, const sd_img_gen_params_t* sd_img_g
20402040
if (sd_img_gen_params->ref_images_count > 0) {
20412041
LOG_INFO("EDIT mode");
20422042
}
2043+
else if (sd_ctx->sd->version == VERSION_SD1_PIX2PIX || sd_ctx->sd->version == VERSION_SDXL_PIX2PIX) {
2044+
LOG_ERROR("This model needs at least one reference image");
2045+
return NULL;
2046+
}
20432047

20442048
std::vector<struct ggml_tensor*> ref_latents;
20452049
for (int i = 0; i < sd_img_gen_params->ref_images_count; i++) {

0 commit comments

Comments
 (0)