diff --git a/expose.h b/expose.h index c228f0a5d..fbed6ca3f 100644 --- a/expose.h +++ b/expose.h @@ -119,6 +119,7 @@ struct sd_generation_inputs const int height; const int seed; const char * sample_method; + const bool quiet = false; }; struct sd_generation_outputs { diff --git a/koboldcpp.py b/koboldcpp.py index a8f392662..46b20d687 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -110,7 +110,8 @@ class sd_generation_inputs(ctypes.Structure): ("width", ctypes.c_int), ("height", ctypes.c_int), ("seed", ctypes.c_int), - ("sample_method", ctypes.c_char_p)] + ("sample_method", ctypes.c_char_p), + ("quiet", ctypes.c_bool)] class sd_generation_outputs(ctypes.Structure): _fields_ = [("status", ctypes.c_int), @@ -511,6 +512,7 @@ def sd_generate(genparams): height = genparams.get("height", 512) seed = genparams.get("seed", -1) sample_method = genparams.get("sampler_name", "k_euler_a") + is_quiet = True if args.quiet else False #clean vars width = width - (width%64) @@ -544,6 +546,7 @@ def sd_generate(genparams): inputs.height = height inputs.seed = seed inputs.sample_method = sample_method.lower().encode("UTF-8") + inputs.quiet = is_quiet ret = handle.sd_generate(inputs) outstr = "" if ret.status==1: diff --git a/otherarch/sdcpp/sdtype_adapter.cpp b/otherarch/sdcpp/sdtype_adapter.cpp index e66182e40..6baca190e 100644 --- a/otherarch/sdcpp/sdtype_adapter.cpp +++ b/otherarch/sdcpp/sdtype_adapter.cpp @@ -255,6 +255,8 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs) sd_image_t * results; sd_image_t* control_image = NULL; + bool is_quiet = inputs.quiet; + //sanitize prompts, remove quotes and limit lengths std::string cleanprompt = clean_input_prompt(inputs.prompt); std::string cleannegprompt = clean_input_prompt(inputs.negative_prompt); @@ -267,7 +269,10 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs) sd_params->width = inputs.width; sd_params->height = inputs.height; - printf("\nGenerating Image (%d steps)\n",inputs.sample_steps); + if(!is_quiet) + { + printf("\nGenerating Image (%d steps)\n",inputs.sample_steps); + } fflush(stdout); std::string sampler = inputs.sample_method; @@ -302,7 +307,7 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs) if (sd_params->mode == TXT2IMG) { - if(sddebugmode==1) + if(!is_quiet && sddebugmode==1) { printf("\nPROMPT:%s\nNPROMPT:%s\nCLPSKP:%d\nCFGSCLE:%f\nW:%d\nH:%d\nSM:%d\nSTEP:%d\nSEED:%d\nBATCH:%d\nCIMG:%d\nCSTR:%f\n\n", sd_params->prompt.c_str(),