From 8577446d6f0294a5f895aeb08b12d724bd8fba12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20du=20Hamel?= Date: Mon, 4 Nov 2024 19:20:19 +0100 Subject: [PATCH] ignore slg if slg_scale is zero (optimization) --- stable-diffusion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stable-diffusion.cpp b/stable-diffusion.cpp index a922b5c5..d2908e9d 100644 --- a/stable-diffusion.cpp +++ b/stable-diffusion.cpp @@ -877,7 +877,7 @@ class StableDiffusionGGML { negative_data = (float*)out_uncond->data; } - bool has_skiplayer = skip_layers.size() > 0; + bool has_skiplayer = skip_layers.size() > 0 && slg_scale != 0.0; int stepCount = sigmas.size(); has_skiplayer = has_skiplayer && step > (int)(skip_layer_start * stepCount) && step < (int)(skip_layer_end * stepCount); float* skip_layer_data = NULL;