mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-11 01:24:36 +00:00
quiet mode for sd
This commit is contained in:
parent
308f33fc00
commit
3f475970fa
3 changed files with 12 additions and 3 deletions
1
expose.h
1
expose.h
|
@ -119,6 +119,7 @@ struct sd_generation_inputs
|
||||||
const int height;
|
const int height;
|
||||||
const int seed;
|
const int seed;
|
||||||
const char * sample_method;
|
const char * sample_method;
|
||||||
|
const bool quiet = false;
|
||||||
};
|
};
|
||||||
struct sd_generation_outputs
|
struct sd_generation_outputs
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,7 +110,8 @@ class sd_generation_inputs(ctypes.Structure):
|
||||||
("width", ctypes.c_int),
|
("width", ctypes.c_int),
|
||||||
("height", ctypes.c_int),
|
("height", ctypes.c_int),
|
||||||
("seed", 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):
|
class sd_generation_outputs(ctypes.Structure):
|
||||||
_fields_ = [("status", ctypes.c_int),
|
_fields_ = [("status", ctypes.c_int),
|
||||||
|
@ -511,6 +512,7 @@ def sd_generate(genparams):
|
||||||
height = genparams.get("height", 512)
|
height = genparams.get("height", 512)
|
||||||
seed = genparams.get("seed", -1)
|
seed = genparams.get("seed", -1)
|
||||||
sample_method = genparams.get("sampler_name", "k_euler_a")
|
sample_method = genparams.get("sampler_name", "k_euler_a")
|
||||||
|
is_quiet = True if args.quiet else False
|
||||||
|
|
||||||
#clean vars
|
#clean vars
|
||||||
width = width - (width%64)
|
width = width - (width%64)
|
||||||
|
@ -544,6 +546,7 @@ def sd_generate(genparams):
|
||||||
inputs.height = height
|
inputs.height = height
|
||||||
inputs.seed = seed
|
inputs.seed = seed
|
||||||
inputs.sample_method = sample_method.lower().encode("UTF-8")
|
inputs.sample_method = sample_method.lower().encode("UTF-8")
|
||||||
|
inputs.quiet = is_quiet
|
||||||
ret = handle.sd_generate(inputs)
|
ret = handle.sd_generate(inputs)
|
||||||
outstr = ""
|
outstr = ""
|
||||||
if ret.status==1:
|
if ret.status==1:
|
||||||
|
|
|
@ -255,6 +255,8 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
|
||||||
sd_image_t * results;
|
sd_image_t * results;
|
||||||
sd_image_t* control_image = NULL;
|
sd_image_t* control_image = NULL;
|
||||||
|
|
||||||
|
bool is_quiet = inputs.quiet;
|
||||||
|
|
||||||
//sanitize prompts, remove quotes and limit lengths
|
//sanitize prompts, remove quotes and limit lengths
|
||||||
std::string cleanprompt = clean_input_prompt(inputs.prompt);
|
std::string cleanprompt = clean_input_prompt(inputs.prompt);
|
||||||
std::string cleannegprompt = clean_input_prompt(inputs.negative_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->width = inputs.width;
|
||||||
sd_params->height = inputs.height;
|
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);
|
fflush(stdout);
|
||||||
std::string sampler = inputs.sample_method;
|
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 (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",
|
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(),
|
sd_params->prompt.c_str(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue