@@ -775,7 +775,7 @@ class StableDiffusionGGML {
775775
776776 int64_t t0 = ggml_time_ms ();
777777 struct ggml_tensor * out = ggml_dup_tensor (work_ctx, x_t );
778- diffusion_model->compute (n_threads, x_t , timesteps, c, concat, NULL , NULL , {}, -1 , {}, 0 .f , &out);
778+ diffusion_model->compute (n_threads, x_t , timesteps, c, concat, NULL , NULL , {}, false , -1 , {}, 0 .f , &out);
779779 diffusion_model->free_compute_buffer ();
780780
781781 double result = 0 .f ;
@@ -1032,6 +1032,7 @@ class StableDiffusionGGML {
10321032 int start_merge_step,
10331033 SDCondition id_cond,
10341034 std::vector<ggml_tensor*> ref_latents = {},
1035+ bool increase_ref_index = false ,
10351036 ggml_tensor* denoise_mask = nullptr ) {
10361037 std::vector<int > skip_layers (guidance.slg .layers , guidance.slg .layers + guidance.slg .layer_count );
10371038
@@ -1126,6 +1127,7 @@ class StableDiffusionGGML {
11261127 cond.c_vector ,
11271128 guidance_tensor,
11281129 ref_latents,
1130+ increase_ref_index,
11291131 -1 ,
11301132 controls,
11311133 control_strength,
@@ -1139,6 +1141,7 @@ class StableDiffusionGGML {
11391141 id_cond.c_vector ,
11401142 guidance_tensor,
11411143 ref_latents,
1144+ increase_ref_index,
11421145 -1 ,
11431146 controls,
11441147 control_strength,
@@ -1160,6 +1163,7 @@ class StableDiffusionGGML {
11601163 uncond.c_vector ,
11611164 guidance_tensor,
11621165 ref_latents,
1166+ increase_ref_index,
11631167 -1 ,
11641168 controls,
11651169 control_strength,
@@ -1177,6 +1181,7 @@ class StableDiffusionGGML {
11771181 img_cond.c_vector ,
11781182 guidance_tensor,
11791183 ref_latents,
1184+ increase_ref_index,
11801185 -1 ,
11811186 controls,
11821187 control_strength,
@@ -1198,6 +1203,7 @@ class StableDiffusionGGML {
11981203 cond.c_vector ,
11991204 guidance_tensor,
12001205 ref_latents,
1206+ increase_ref_index,
12011207 -1 ,
12021208 controls,
12031209 control_strength,
@@ -1710,6 +1716,7 @@ char* sd_img_gen_params_to_str(const sd_img_gen_params_t* sd_img_gen_params) {
17101716 " \n "
17111717 " batch_count: %d\n "
17121718 " ref_images_count: %d\n "
1719+ " increase_ref_index: %s\n "
17131720 " control_strength: %.2f\n "
17141721 " style_strength: %.2f\n "
17151722 " normalize_input: %s\n "
@@ -1724,6 +1731,7 @@ char* sd_img_gen_params_to_str(const sd_img_gen_params_t* sd_img_gen_params) {
17241731 sd_img_gen_params->seed ,
17251732 sd_img_gen_params->batch_count ,
17261733 sd_img_gen_params->ref_images_count ,
1734+ BOOL_STR (sd_img_gen_params->increase_ref_index ),
17271735 sd_img_gen_params->control_strength ,
17281736 sd_img_gen_params->style_strength ,
17291737 BOOL_STR (sd_img_gen_params->normalize_input ),
@@ -1797,6 +1805,7 @@ sd_image_t* generate_image_internal(sd_ctx_t* sd_ctx,
17971805 bool normalize_input,
17981806 std::string input_id_images_path,
17991807 std::vector<ggml_tensor*> ref_latents,
1808+ bool increase_ref_index,
18001809 ggml_tensor* concat_latent = NULL ,
18011810 ggml_tensor* denoise_mask = NULL ) {
18021811 if (seed < 0 ) {
@@ -2054,6 +2063,7 @@ sd_image_t* generate_image_internal(sd_ctx_t* sd_ctx,
20542063 start_merge_step,
20552064 id_cond,
20562065 ref_latents,
2066+ increase_ref_index,
20572067 denoise_mask);
20582068 // print_ggml_tensor(x_0);
20592069 int64_t sampling_end = ggml_time_ms ();
@@ -2304,7 +2314,7 @@ sd_image_t* generate_image(sd_ctx_t* sd_ctx, const sd_img_gen_params_t* sd_img_g
23042314 LOG_INFO (" EDIT mode" );
23052315 }
23062316
2307- std::vector<struct ggml_tensor *> ref_latents;
2317+ std::vector<ggml_tensor*> ref_latents;
23082318 for (int i = 0 ; i < sd_img_gen_params->ref_images_count ; i++) {
23092319 ggml_tensor* img = ggml_new_tensor_4d (work_ctx,
23102320 GGML_TYPE_F32,
@@ -2359,6 +2369,7 @@ sd_image_t* generate_image(sd_ctx_t* sd_ctx, const sd_img_gen_params_t* sd_img_g
23592369 sd_img_gen_params->normalize_input ,
23602370 sd_img_gen_params->input_id_images_path ,
23612371 ref_latents,
2372+ sd_img_gen_params->increase_ref_index ,
23622373 concat_latent,
23632374 denoise_mask);
23642375
0 commit comments