aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-21 10:34:10 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-09-21 10:34:10 +0000
commit75dd274dd606f177247809d92a8c362abfbc5cdf (patch)
treed8a9937c0b525c63de53984f5544fcf60c72e537
parent45c46f4cb3d6924882bd944712be168c7c2f605d (diff)
downloadstable-diffusion-webui-gfx803-75dd274dd606f177247809d92a8c362abfbc5cdf.tar.gz
stable-diffusion-webui-gfx803-75dd274dd606f177247809d92a8c362abfbc5cdf.tar.bz2
stable-diffusion-webui-gfx803-75dd274dd606f177247809d92a8c362abfbc5cdf.zip
prevent seed extras from having effect when extras checkbox is not checked
-rw-r--r--modules/img2img.py3
-rw-r--r--modules/processing.py8
-rw-r--r--modules/txt2img.py3
-rw-r--r--modules/ui.py10
4 files changed, 16 insertions, 8 deletions
diff --git a/modules/img2img.py b/modules/img2img.py
index 05dbdaf3..6328f9d6 100644
--- a/modules/img2img.py
+++ b/modules/img2img.py
@@ -11,7 +11,7 @@ from modules.ui import plaintext_to_html
import modules.images as images
import modules.scripts
-def img2img(prompt: str, negative_prompt: str, prompt_style: str, prompt_style2: str, init_img, init_img_with_mask, init_mask, mask_mode, steps: int, sampler_index: int, mask_blur: int, inpainting_fill: int, restore_faces: bool, tiling: bool, mode: int, n_iter: int, batch_size: int, cfg_scale: float, denoising_strength: float, seed: int, subseed: int, subseed_strength: float, seed_resize_from_h: int, seed_resize_from_w: int, height: int, width: int, resize_mode: int, upscaler_index: str, upscale_overlap: int, inpaint_full_res: bool, inpainting_mask_invert: int, *args):
+def img2img(prompt: str, negative_prompt: str, prompt_style: str, prompt_style2: str, init_img, init_img_with_mask, init_mask, mask_mode, steps: int, sampler_index: int, mask_blur: int, inpainting_fill: int, restore_faces: bool, tiling: bool, mode: int, n_iter: int, batch_size: int, cfg_scale: float, denoising_strength: float, seed: int, subseed: int, subseed_strength: float, seed_resize_from_h: int, seed_resize_from_w: int, seed_enable_extras: bool, height: int, width: int, resize_mode: int, upscaler_index: str, upscale_overlap: int, inpaint_full_res: bool, inpainting_mask_invert: int, *args):
is_inpaint = mode == 1
is_upscale = mode == 2
@@ -43,6 +43,7 @@ def img2img(prompt: str, negative_prompt: str, prompt_style: str, prompt_style2:
subseed_strength=subseed_strength,
seed_resize_from_h=seed_resize_from_h,
seed_resize_from_w=seed_resize_from_w,
+ seed_enable_extras=seed_enable_extras,
sampler_index=sampler_index,
batch_size=batch_size,
n_iter=n_iter,
diff --git a/modules/processing.py b/modules/processing.py
index 256e8aae..e844b7e2 100644
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -46,7 +46,7 @@ def apply_color_correction(correction, image):
class StableDiffusionProcessing:
- def __init__(self, sd_model=None, outpath_samples=None, outpath_grids=None, prompt="", styles=None, seed=-1, subseed=-1, subseed_strength=0, seed_resize_from_h=-1, seed_resize_from_w=-1, sampler_index=0, batch_size=1, n_iter=1, steps=50, cfg_scale=7.0, width=512, height=512, restore_faces=False, tiling=False, do_not_save_samples=False, do_not_save_grid=False, extra_generation_params=None, overlay_images=None, negative_prompt=None):
+ def __init__(self, sd_model=None, outpath_samples=None, outpath_grids=None, prompt="", styles=None, seed=-1, subseed=-1, subseed_strength=0, seed_resize_from_h=-1, seed_resize_from_w=-1, seed_enable_extras=True, sampler_index=0, batch_size=1, n_iter=1, steps=50, cfg_scale=7.0, width=512, height=512, restore_faces=False, tiling=False, do_not_save_samples=False, do_not_save_grid=False, extra_generation_params=None, overlay_images=None, negative_prompt=None):
self.sd_model = sd_model
self.outpath_samples: str = outpath_samples
self.outpath_grids: str = outpath_grids
@@ -76,6 +76,12 @@ class StableDiffusionProcessing:
self.color_corrections = None
self.denoising_strength: float = 0
+ if not seed_enable_extras:
+ self.subseed = -1
+ self.subseed_strength = 0
+ self.seed_resize_from_h = 0
+ self.seed_resize_from_w = 0
+
def init(self, all_prompts, all_seeds, all_subseeds):
pass
diff --git a/modules/txt2img.py b/modules/txt2img.py
index 0e6a89ab..9123fca1 100644
--- a/modules/txt2img.py
+++ b/modules/txt2img.py
@@ -6,7 +6,7 @@ import modules.processing as processing
from modules.ui import plaintext_to_html
-def txt2img(prompt: str, negative_prompt: str, prompt_style: str, prompt_style2: str, steps: int, sampler_index: int, restore_faces: bool, tiling: bool, n_iter: int, batch_size: int, cfg_scale: float, seed: int, subseed: int, subseed_strength: float, seed_resize_from_h: int, seed_resize_from_w: int, height: int, width: int, enable_hr: bool, scale_latent: bool, denoising_strength: float, *args):
+def txt2img(prompt: str, negative_prompt: str, prompt_style: str, prompt_style2: str, steps: int, sampler_index: int, restore_faces: bool, tiling: bool, n_iter: int, batch_size: int, cfg_scale: float, seed: int, subseed: int, subseed_strength: float, seed_resize_from_h: int, seed_resize_from_w: int, seed_enable_extras: bool, height: int, width: int, enable_hr: bool, scale_latent: bool, denoising_strength: float, *args):
p = StableDiffusionProcessingTxt2Img(
sd_model=shared.sd_model,
outpath_samples=opts.outdir_samples or opts.outdir_txt2img_samples,
@@ -19,6 +19,7 @@ def txt2img(prompt: str, negative_prompt: str, prompt_style: str, prompt_style2:
subseed_strength=subseed_strength,
seed_resize_from_h=seed_resize_from_h,
seed_resize_from_w=seed_resize_from_w,
+ seed_enable_extras=seed_enable_extras,
sampler_index=sampler_index,
batch_size=batch_size,
n_iter=n_iter,
diff --git a/modules/ui.py b/modules/ui.py
index e290b3eb..0fbb081d 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -291,7 +291,7 @@ def create_seed_inputs():
seed_checkbox.change(change_visibility, show_progress=False, inputs=[seed_checkbox], outputs=seed_extras)
- return seed, reuse_seed, subseed, reuse_subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w
+ return seed, reuse_seed, subseed, reuse_subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w, seed_checkbox
def connect_reuse_seed(seed: gr.Number, reuse_seed: gr.Button, generation_info: gr.Textbox, dummy_component, is_subseed):
@@ -409,7 +409,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
width = gr.Slider(minimum=64, maximum=2048, step=64, label="Width", value=512)
height = gr.Slider(minimum=64, maximum=2048, step=64, label="Height", value=512)
- seed, reuse_seed, subseed, reuse_subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w = create_seed_inputs()
+ seed, reuse_seed, subseed, reuse_subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w, seed_checkbox = create_seed_inputs()
with gr.Group():
custom_inputs = modules.scripts.scripts_txt2img.setup_ui(is_img2img=False)
@@ -454,7 +454,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
batch_size,
cfg_scale,
seed,
- subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w,
+ subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w, seed_checkbox,
height,
width,
enable_hr,
@@ -554,7 +554,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
width = gr.Slider(minimum=64, maximum=2048, step=64, label="Width", value=512)
height = gr.Slider(minimum=64, maximum=2048, step=64, label="Height", value=512)
- seed, reuse_seed, subseed, reuse_subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w = create_seed_inputs()
+ seed, reuse_seed, subseed, reuse_subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w, seed_checkbox = create_seed_inputs()
with gr.Group():
custom_inputs = modules.scripts.scripts_img2img.setup_ui(is_img2img=True)
@@ -662,7 +662,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
cfg_scale,
denoising_strength,
seed,
- subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w,
+ subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w, seed_checkbox,
height,
width,
resize_mode,