mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-05-08 01:41:37 +00:00
reworked soft limit default restrictions for sd image gen
This commit is contained in:
parent
d432844cb9
commit
cb5755bc96
2 changed files with 6 additions and 13 deletions
|
|
@ -2123,9 +2123,6 @@ def sd_generate(genparams):
|
|||
sample_steps = (1 if sample_steps < 1 else (forced_steplimit if sample_steps > forced_steplimit else sample_steps))
|
||||
vid_req_frames = (1 if vid_req_frames < 1 else (100 if vid_req_frames > 100 else vid_req_frames))
|
||||
|
||||
if args.sdclamped:
|
||||
sample_steps = (40 if sample_steps > 40 else sample_steps)
|
||||
|
||||
inputs = sd_generation_inputs()
|
||||
inputs.prompt = prompt.encode("UTF-8")
|
||||
inputs.negative_prompt = negative_prompt.encode("UTF-8")
|
||||
|
|
|
|||
|
|
@ -849,8 +849,8 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
|
|||
const int default_res_limit = 8192; // arbitrary, just to simplify the code
|
||||
// avoid crashes due to bugs/limitations on certain models
|
||||
// although it can be possible for a single side to exceed 1024, the total resolution of the image
|
||||
// cannot exceed (832x832) for sd1/sd2 or (1280x1280) for sdxl/sd3/flux, to prevent crashing the server
|
||||
const int hard_megapixel_res_limit = (loadedsdver==SDVersion::VERSION_SD1 || loadedsdver==SDVersion::VERSION_SD2)?832:1280;
|
||||
// cannot exceed (832x832) for sd1/sd2 or (2048x2048) for sdxl/sd3/flux, to prevent crashing the server
|
||||
const int hard_megapixel_res_limit = (loadedsdver==SDVersion::VERSION_SD1 || loadedsdver==SDVersion::VERSION_SD2)?832:2048;
|
||||
|
||||
int img_hard_limit = default_res_limit;
|
||||
if (cfg_side_limit > 0) {
|
||||
|
|
@ -858,15 +858,11 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
|
|||
}
|
||||
|
||||
int img_soft_limit = default_res_limit;
|
||||
if (cfg_square_limit > 0) {
|
||||
img_soft_limit = std::max(std::min(cfg_square_limit, default_res_limit), 64);
|
||||
}
|
||||
|
||||
if (cfg_square_limit > 0 && sddebugmode == 1) {
|
||||
img_soft_limit = std::min(hard_megapixel_res_limit * 2, img_soft_limit); //double the limit for debugmode if cfg_square_limit is set
|
||||
} else {
|
||||
img_soft_limit = std::min(hard_megapixel_res_limit, img_soft_limit);
|
||||
if (cfg_square_limit <= 0) {
|
||||
cfg_square_limit = 1024; //defaults to 1 megapixel soft e.g. 1024x1024 if unspecified
|
||||
}
|
||||
img_soft_limit = std::max(std::min(cfg_square_limit, default_res_limit), 64);
|
||||
img_soft_limit = std::min(hard_megapixel_res_limit, img_soft_limit);
|
||||
|
||||
sd_fix_resolution(sd_params->width, sd_params->height, img_hard_limit, img_soft_limit);
|
||||
if (inputs.width != sd_params->width || inputs.height != sd_params->height) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue