Skip to content

Commit c9b79e6

Browse files
committed
Merge branch 'concedo_experimental' into esocrok
2 parents 0cba282 + 539db70 commit c9b79e6

File tree

3 files changed

+34
-27
lines changed

3 files changed

+34
-27
lines changed

koboldcpp.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
extra_images_max = 4
7070

7171
# global vars
72-
KcppVersion = "1.99.4"
72+
KcppVersion = "1.100"
7373
showdebug = True
7474
kcpp_instance = None #global running instance
7575
global_memory = {"tunnel_url": "", "restart_target":"", "input_to_exit":False, "load_complete":False, "restart_model": "", "currentConfig": None, "modelOverride": None, "currentModel": None}
@@ -1731,7 +1731,7 @@ def sd_load_model(model_filename,vae_filename,lora_filename,t5xxl_filename,clipl
17311731
inputs.flash_attention = args.sdflashattention
17321732
inputs.offload_cpu = args.sdoffloadcpu
17331733
inputs.vae_cpu = args.sdvaecpu
1734-
inputs.clip_cpu = args.sdclipcpu
1734+
inputs.clip_cpu = False if args.sdclipgpu else True
17351735
sdconvdirect = sd_convdirect_option(args.sdconvdirect)
17361736
inputs.diffusion_conv_direct = sdconvdirect == 'full'
17371737
inputs.vae_conv_direct = sdconvdirect in ['vaeonly', 'full']
@@ -5718,7 +5718,7 @@ def hide_tooltip(event):
57185718
sd_flash_attention_var = ctk.IntVar(value=0)
57195719
sd_offload_cpu_var = ctk.IntVar(value=0)
57205720
sd_vae_cpu_var = ctk.IntVar(value=0)
5721-
sd_clip_cpu_var = ctk.IntVar(value=0)
5721+
sd_clip_gpu_var = ctk.IntVar(value=0)
57225722
sd_vaeauto_var = ctk.IntVar(value=0)
57235723
sd_tiled_vae_var = ctk.StringVar(value=str(default_vae_tile_threshold))
57245724
sd_convdirect_var = ctk.StringVar(value=str(sd_convdirect_choices[0]))
@@ -6503,7 +6503,7 @@ def toggletaesd(a,b,c):
65036503
makecheckbox(images_tab, "SD Flash Attention", sd_flash_attention_var, 44,padx=230, tooltiptxt="Enable Flash Attention for image diffusion. May save memory or improve performance.")
65046504
makecheckbox(images_tab, "Model CPU Offload", sd_offload_cpu_var, 50,padx=8, tooltiptxt="Offload image weights in RAM to save VRAM, swap into VRAM when needed.")
65056505
makecheckbox(images_tab, "VAE on CPU", sd_vae_cpu_var, 50,padx=160, tooltiptxt="Force VAE to CPU only for image generation.")
6506-
makecheckbox(images_tab, "CLIP on CPU", sd_clip_cpu_var, 50,padx=280, tooltiptxt="Force CLIP to CPU only for image generation.")
6506+
makecheckbox(images_tab, "CLIP on GPU", sd_clip_gpu_var, 50,padx=280, tooltiptxt="Put CLIP and T5 to GPU for image generation. Otherwise, CLIP will use CPU.")
65076507

65086508
# audio tab
65096509
audio_tab = tabcontent["Audio"]
@@ -6751,8 +6751,8 @@ def export_vars():
67516751
args.sdoffloadcpu = True
67526752
if sd_vae_cpu_var.get()==1:
67536753
args.sdvaecpu = True
6754-
if sd_clip_cpu_var.get()==1:
6755-
args.sdclipcpu = True
6754+
if sd_clip_gpu_var.get()==1:
6755+
args.sdclipgpu = True
67566756
args.sdthreads = (0 if sd_threads_var.get()=="" else int(sd_threads_var.get()))
67576757
args.sdclamped = (0 if int(sd_clamped_var.get())<=0 else int(sd_clamped_var.get()))
67586758
args.sdclampedsoft = (0 if int(sd_clamped_soft_var.get())<=0 else int(sd_clamped_soft_var.get()))
@@ -6997,7 +6997,7 @@ def import_vars(dict):
69976997
sd_flash_attention_var.set(1 if ("sdflashattention" in dict and dict["sdflashattention"]) else 0)
69986998
sd_offload_cpu_var.set(1 if ("sdoffloadcpu" in dict and dict["sdoffloadcpu"]) else 0)
69996999
sd_vae_cpu_var.set(1 if ("sdvaecpu" in dict and dict["sdvaecpu"]) else 0)
7000-
sd_clip_cpu_var.set(1 if ("sdclipcpu" in dict and dict["sdclipcpu"]) else 0)
7000+
sd_clip_gpu_var.set(1 if ("sdclipgpu" in dict and dict["sdclipgpu"]) else 0)
70017001
sd_convdirect_var.set(sd_convdirect_option(dict.get("sdconvdirect")))
70027002
sd_vae_var.set(dict["sdvae"] if ("sdvae" in dict and dict["sdvae"]) else "")
70037003
sd_t5xxl_var.set(dict["sdt5xxl"] if ("sdt5xxl" in dict and dict["sdt5xxl"]) else "")
@@ -8868,7 +8868,7 @@ def range_checker(arg: str):
88688868
sdparsergroup.add_argument("--sdflashattention", help="Enables Flash Attention for image generation.", action='store_true')
88698869
sdparsergroup.add_argument("--sdoffloadcpu", help="Offload image weights in RAM to save VRAM, swap into VRAM when needed.", action='store_true')
88708870
sdparsergroup.add_argument("--sdvaecpu", help="Force VAE to CPU only for image generation.", action='store_true')
8871-
sdparsergroup.add_argument("--sdclipcpu", help="Force CLIP to CPU only for image generation.", action='store_true')
8871+
sdparsergroup.add_argument("--sdclipgpu", help="Put CLIP and T5 to GPU for image generation. Otherwise, CLIP will use CPU.", action='store_true')
88728872
sdparsergroup.add_argument("--sdconvdirect", help="Enables Conv2D Direct. May improve performance or reduce memory usage. Might crash if not supported by the backend. Can be 'off' (default) to disable, 'full' to turn it on for all operations, or 'vaeonly' to enable only for the VAE.", type=sd_convdirect_option, choices=sd_convdirect_choices, default=sd_convdirect_choices[0])
88738873
sdparsergroupvae = sdparsergroup.add_mutually_exclusive_group()
88748874
sdparsergroupvae.add_argument("--sdvae", metavar=('[filename]'), help="Specify an image generation safetensors VAE which replaces the one in the model.", default="")

otherarch/sdcpp/sdtype_adapter.cpp

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -679,17 +679,32 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
679679
}
680680

681681
std::vector<sd_image_t> reference_imgs;
682+
std::vector<sd_image_t> wan_imgs;
682683
bool is_wan = (loadedsdver == SDVersion::VERSION_WAN2 || loadedsdver == SDVersion::VERSION_WAN2_2_I2V || loadedsdver == SDVersion::VERSION_WAN2_2_TI2V);
683684
bool is_kontext = (loadedsdver==SDVersion::VERSION_FLUX && !loaded_model_is_chroma(sd_ctx));
684-
if(extra_image_data.size()>0 && (is_wan || is_kontext))
685+
if(extra_image_data.size()>0)
685686
{
686-
for(int i=0;i<extra_image_data.size();++i)
687+
if(is_kontext)
687688
{
688-
reference_imgs.push_back(extraimage_references[i]);
689+
for(int i=0;i<extra_image_data.size();++i)
690+
{
691+
reference_imgs.push_back(extraimage_references[i]);
692+
}
693+
if(!sd_is_quiet && sddebugmode==1)
694+
{
695+
printf("\nImage Gen: Using %d reference images\n",reference_imgs.size());
696+
}
689697
}
690-
if(!sd_is_quiet && sddebugmode==1)
698+
if(is_wan)
691699
{
692-
printf("\nImage Gen: Using %d reference images\n",reference_imgs.size());
700+
for(int i=0;i<extra_image_data.size();++i)
701+
{
702+
wan_imgs.push_back(extraimage_references[i]);
703+
}
704+
if(!sd_is_quiet && sddebugmode==1)
705+
{
706+
printf("\nImage Gen: Using %d video reference images\n",wan_imgs.size());
707+
}
693708
}
694709
}
695710

@@ -727,7 +742,6 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
727742

728743
params.ref_images = reference_imgs.data();
729744
params.ref_images_count = reference_imgs.size();
730-
731745
params.pm_params.id_images = photomaker_imgs.data();
732746
params.pm_params.id_images_count = photomaker_imgs.size();
733747

@@ -752,15 +766,15 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
752766
vid_gen_params.strength = params.strength;
753767
vid_gen_params.seed = params.seed;
754768
vid_gen_params.video_frames = vid_req_frames;
755-
if(reference_imgs.size()>0)
769+
if(wan_imgs.size()>0)
756770
{
757-
if(reference_imgs.size()>=1)
771+
if(wan_imgs.size()>=1)
758772
{
759-
vid_gen_params.init_image = reference_imgs[0];
773+
vid_gen_params.init_image = wan_imgs[0];
760774
}
761-
if(reference_imgs.size()>=2)
775+
if(wan_imgs.size()>=2)
762776
{
763-
vid_gen_params.end_image = reference_imgs[1];
777+
vid_gen_params.end_image = wan_imgs[1];
764778
}
765779
}
766780
if(!sd_is_quiet && sddebugmode==1)
@@ -775,7 +789,7 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
775789
<< "\nSTRENGTH:" << vid_gen_params.strength
776790
<< "\nFRAMES:" << vid_gen_params.video_frames
777791
<< "\nCTRL_FRM:" << vid_gen_params.control_frames_size
778-
<< "\nREF_IMGS:" << reference_imgs.size()
792+
<< "\nINIT_IMGS:" << wan_imgs.size()
779793
<< "\n\n";
780794
printf("%s", ss.str().c_str());
781795
}

otherarch/sdcpp/stable-diffusion.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -401,17 +401,10 @@ class StableDiffusionGGML {
401401
use_t5xxl = true;
402402
}
403403
if (!clip_on_cpu && !ggml_backend_is_cpu(backend) && use_t5xxl) {
404-
#if 0 // kcpp
405404
LOG_WARN(
406405
"!!!It appears that you are using the T5 model. Some backends may encounter issues with it."
407406
"If you notice that the generated images are completely black,"
408407
"try running the T5 model on the CPU using the --clip-on-cpu parameter.");
409-
#else
410-
if (conditioner_wtype != GGML_TYPE_F32) {
411-
LOG_INFO("CLIP: Forcing CPU backend for T5");
412-
clip_on_cpu = true;
413-
}
414-
#endif
415408
}
416409
if (clip_on_cpu && !ggml_backend_is_cpu(backend)) {
417410
LOG_INFO("CLIP: Using CPU backend");

0 commit comments

Comments
 (0)