From a9e2d90a47d393c2fd0bb9cef966680c42977f56 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 16 Jul 2023 16:01:01 -0400 Subject: [PATCH] fix invalid config values --- modules/img2img.py | 8 +++++--- modules/txt2img.py | 5 +++++ scripts/xyz_grid.py | 6 +++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/img2img.py b/modules/img2img.py index 9c31296c8..0968ae6d6 100644 --- a/modules/img2img.py +++ b/modules/img2img.py @@ -69,14 +69,16 @@ def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_s shared.log.warning('Model not loaded') return [], '', '', 'Error: model not loaded' + shared.log.debug(f'img2img: id_task={id_task}|mode={mode}|prompt={prompt}|negative_prompt={negative_prompt}|prompt_styles={prompt_styles}|init_img={init_img}|sketch={sketch}|init_img_with_mask={init_img_with_mask}|inpaint_color_sketch={inpaint_color_sketch}|inpaint_color_sketch_orig={inpaint_color_sketch_orig}|init_img_inpaint={init_img_inpaint}|init_mask_inpaint={init_mask_inpaint}|steps={steps}|sampler_index={sampler_index}|latent_index={latent_index}|mask_blur={mask_blur}|mask_alpha={mask_alpha}|inpainting_fill={inpainting_fill}|restore_faces={restore_faces}|tiling={tiling}|n_iter={n_iter}|batch_size={batch_size}|cfg_scale={cfg_scale}|image_cfg_scale={image_cfg_scale}|clip_skip={clip_skip}|denoising_strength={denoising_strength}|seed={seed}|subseed{subseed}|subseed_strength={subseed_strength}|seed_resize_from_h={seed_resize_from_h}|seed_resize_from_w={seed_resize_from_w}|selected_scale_tab={selected_scale_tab}|height={height}|width={width}|scale_by={scale_by}|resize_mode={resize_mode}|inpaint_full_res={inpaint_full_res}|inpaint_full_res_padding={inpaint_full_res_padding}|inpainting_mask_invert={inpainting_mask_invert}|img2img_batch_input_dir={img2img_batch_input_dir}|img2img_batch_output_dir={img2img_batch_output_dir}|img2img_batch_inpaint_mask_dir={img2img_batch_inpaint_mask_dir}|override_settings_texts={override_settings_texts}|args={args}') + if init_img is None: shared.log.debug('Init image not set') - shared.log.debug(f'img2img: id_task={id_task}|mode={mode}|prompt={prompt}|negative_prompt={negative_prompt}|prompt_styles={prompt_styles}|init_img={init_img}|sketch={sketch}|init_img_with_mask={init_img_with_mask}|inpaint_color_sketch={inpaint_color_sketch}|inpaint_color_sketch_orig={inpaint_color_sketch_orig}|init_img_inpaint={init_img_inpaint}|init_mask_inpaint={init_mask_inpaint}|steps={steps}|sampler_index={sampler_index}|latent_index={latent_index}|mask_blur={mask_blur}|mask_alpha={mask_alpha}|inpainting_fill={inpainting_fill}|restore_faces={restore_faces}|tiling={tiling}|n_iter={n_iter}|batch_size={batch_size}|cfg_scale={cfg_scale}|image_cfg_scale={image_cfg_scale}|clip_skip={clip_skip}|denoising_strength={denoising_strength}|seed={seed}|subseed{subseed}|subseed_strength={subseed_strength}|seed_resize_from_h={seed_resize_from_h}|seed_resize_from_w={seed_resize_from_w}|selected_scale_tab={selected_scale_tab}|height={height}|width={width}|scale_by={scale_by}|resize_mode={resize_mode}|inpaint_full_res={inpaint_full_res}|inpaint_full_res_padding={inpaint_full_res_padding}|inpainting_mask_invert={inpainting_mask_invert}|img2img_batch_input_dir={img2img_batch_input_dir}|img2img_batch_output_dir={img2img_batch_output_dir}|img2img_batch_inpaint_mask_dir={img2img_batch_inpaint_mask_dir}|override_settings_texts={override_settings_texts}|args={args}') - if sampler_index is None: - shared.log.warning('Selected sampler is not enabled') sampler_index = 0 + if latent_index is None: + latent_index = 0 + override_settings = create_override_settings_dict(override_settings_texts) is_batch = mode == 5 diff --git a/modules/txt2img.py b/modules/txt2img.py index c0366504b..9f188a632 100644 --- a/modules/txt2img.py +++ b/modules/txt2img.py @@ -17,6 +17,11 @@ def txt2img(id_task: str, prompt: str, negative_prompt: str, prompt_styles, step shared.log.warning('Model not loaded') return [], '', '', 'Error: model not loaded' + if sampler_index is None: + sampler_index = 0 + if latent_index is None: + latent_index = 0 + p = processing.StableDiffusionProcessingTxt2Img( sd_model=shared.sd_model, outpath_samples=shared.opts.outdir_samples or shared.opts.outdir_txt2img_samples, diff --git a/scripts/xyz_grid.py b/scripts/xyz_grid.py index 96088d68a..ca5b55ac6 100644 --- a/scripts/xyz_grid.py +++ b/scripts/xyz_grid.py @@ -52,14 +52,14 @@ def apply_order(p, x, xs): def apply_sampler(p, x, xs): - sampler_name = sd_samplers.samplers_map.get(x, None) + sampler_name = sd_samplers.samplers_map.get(x.lower(), None) if sampler_name is None: shared.log.warning(f"XYZ grid: unknown sampler: {x}") else: p.sampler_name = sampler_name def apply_latent_sampler(p, x, xs): - latent_sampler = sd_samplers.samplers_map.get(x, None) + latent_sampler = sd_samplers.samplers_map.get(x.lower(), None) if latent_sampler is None: shared.log.warning(f"XYZ grid: unknown sampler: {x}") else: @@ -67,7 +67,7 @@ def apply_latent_sampler(p, x, xs): def confirm_samplers(p, xs): for x in xs: - if x not in sd_samplers.samplers_map: + if x.lower() not in sd_samplers.samplers_map: shared.log.warning(f"XYZ grid: unknown sampler: {x}")