@@ -773,10 +773,10 @@ class StableDiffusionGGML {
773773 const std::vector<float >& sigmas,
774774 int start_merge_step,
775775 SDCondition id_cond,
776- std::vector<int > skip_layers = {},
777- float slg_scale = 2.5 ,
778- float skip_layer_start = 0.01 ,
779- float skip_layer_end = 0.2 ) {
776+ std::vector<int > skip_layers = {},
777+ float slg_scale = 2.5 ,
778+ float skip_layer_start = 0.01 ,
779+ float skip_layer_end = 0.2 ) {
780780 size_t steps = sigmas.size () - 1 ;
781781 // noise = load_tensor_from_file(work_ctx, "./rand0.bin");
782782 // print_ggml_tensor(noise);
@@ -875,7 +875,7 @@ class StableDiffusionGGML {
875875 negative_data = (float *)out_uncond->data ;
876876 }
877877
878- bool has_skiplayer = skip_layers.size () > 0 ;
878+ bool has_skiplayer = skip_layers.size () > 0 && slg_scale != 0.0 ;
879879 int stepCount = sigmas.size ();
880880 has_skiplayer = has_skiplayer && step > (int )(skip_layer_start * stepCount) && step < (int )(skip_layer_end * stepCount);
881881 float * skip_layer_data = NULL ;
@@ -1144,10 +1144,10 @@ sd_image_t* generate_image(sd_ctx_t* sd_ctx,
11441144 float style_ratio,
11451145 bool normalize_input,
11461146 std::string input_id_images_path,
1147- std::vector<int > skip_layers = {},
1148- float slg_scale = 2.5 ,
1149- float skip_layer_start = 0.01 ,
1150- float skip_layer_end = 0.2 ) {
1147+ std::vector<int > skip_layers = {},
1148+ float slg_scale = 2.5 ,
1149+ float skip_layer_start = 0.01 ,
1150+ float skip_layer_end = 0.2 ) {
11511151 if (seed < 0 ) {
11521152 // Generally, when using the provided command line, the seed is always >0.
11531153 // However, to prevent potential issues if 'stable-diffusion.cpp' is invoked as a library
0 commit comments