From 33ae0ccc7f299c5cf02724417370378b4713dd01 Mon Sep 17 00:00:00 2001 From: Wagner Bruna Date: Fri, 14 Nov 2025 11:33:02 -0300 Subject: [PATCH] fix: avoid crash with LoRAs and type override --- stable-diffusion.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/stable-diffusion.cpp b/stable-diffusion.cpp index 3e71ec0b..c41652f6 100644 --- a/stable-diffusion.cpp +++ b/stable-diffusion.cpp @@ -336,10 +336,14 @@ class StableDiffusionGGML { if (sd_ctx_params->lora_apply_mode == LORA_APPLY_AUTO) { bool have_quantized_weight = false; - for (const auto& [type, _] : wtype_stat) { - if (ggml_is_quantized(type)) { - have_quantized_weight = true; - break; + if (wtype != GGML_TYPE_COUNT && ggml_is_quantized(wtype)) { + have_quantized_weight = true; + } else { + for (const auto& [type, _] : wtype_stat) { + if (ggml_is_quantized(type)) { + have_quantized_weight = true; + break; + } } } if (have_quantized_weight) {