Skip to content

Commit af5bed2

Browse files
committed
Fix Flex.2 inpaint mode crash (+ use scale factor)
1 parent 2350bd7 commit af5bed2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stable-diffusion.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2535,9 +2535,9 @@ sd_image_t* generate_image(sd_ctx_t* sd_ctx, const sd_img_gen_params_t* sd_img_g
25352535
if (sd_version_is_inpaint(sd_ctx->sd->version)) {
25362536
int64_t mask_channels = 1;
25372537
if (sd_ctx->sd->version == VERSION_FLUX_FILL) {
2538-
mask_channels = 8 * 8; // flatten the whole mask
2538+
mask_channels = sd_ctx->sd->get_vae_scale_factor() * sd_ctx->sd->get_vae_scale_factor(); // flatten the whole mask
25392539
} else if (sd_ctx->sd->version == VERSION_FLEX_2) {
2540-
mask_channels = 1 + init_latent->ne[2];
2540+
mask_channels = 1 + sd_ctx->sd->get_latent_channel();
25412541
}
25422542
ggml_tensor* masked_latent = nullptr;
25432543

0 commit comments

Comments
 (0)