From 1564264a2a73c105feff95831790e753abae8a0b Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sat, 8 Aug 2026 00:10:18 +0000 Subject: [PATCH] Fail with a message when MiniMax-H3 is run in img_gen mode H3 is video-only: the denoiser always splits the packed latent into a video and an audio half, and only generate_video computes the audio length. Reaching generate_image with an H3 checkpoint therefore hits GGML_ASSERT(!audio_input_cache.empty()) and core dumps, after the minutes it takes to load the weights and with nothing in the output naming the cause. Forgetting --mode vid_gen is easy since it is the one flag not implied by passing --audio-vae. Before: SIGABRT, exit 134, a ggml assert and a stack trace. After: "MiniMax-H3 is a video model and cannot be run in img_gen mode; use --mode vid_gen", exit 1. The AnimateDiff branch routes vid_gen back through generate_image, but that is SD1.5 plus a motion module and never H3, so the guard cannot fire there. --- src/stable-diffusion.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/stable-diffusion.cpp b/src/stable-diffusion.cpp index f2b69cc02..5986163ad 100644 --- a/src/stable-diffusion.cpp +++ b/src/stable-diffusion.cpp @@ -5584,6 +5584,18 @@ SD_API bool generate_image(sd_ctx_t* sd_ctx, return false; } + // MiniMax-H3 is video-only. Its denoiser always splits the packed latent into a video and an + // audio half, and only generate_video ever computes the audio length, so reaching this + // function with an H3 checkpoint is guaranteed to die on + // GGML_ASSERT(!audio_input_cache.empty()) with a core dump, after the several minutes it + // takes to load the weights, and with nothing in the output pointing at the missing --mode. + // (The AnimateDiff path below routes vid_gen back through here, but that is SD1.5 plus a + // motion module, never H3.) + if (sd_version_is_minimax_h3(sd_ctx->sd->version)) { + LOG_ERROR("MiniMax-H3 is a video model and cannot be run in img_gen mode; use --mode vid_gen"); + return false; + } + sd_ctx->sd->reset_cancel_flag(); int64_t t0 = ggml_time_ms();