From 2f7154dc7025b25dc30fba9f395c10d17ace661d Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Tue, 9 Apr 2024 10:46:33 -0400 Subject: [PATCH] add option for fully random batch seeds --- CHANGELOG.md | 3 ++- TODO.md | 1 + modules/images.py | 2 +- modules/processing.py | 8 +++++++- modules/shared.py | 4 +++- wiki | 2 +- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccaa9f287..8b4d2dfcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log for SD.Next -## Update for 2024-04-07 +## Update for 2024-04-09 - **Features**: - **Gallery**: list, preview, search through all your images and videos! @@ -33,6 +33,7 @@ - Faster server startup - Add **MIGraphX** torch optimization engine, thanks @Disty0 - Styles apply wildcards to params + - Add option to make batch generations use fully random seed vs sequential - Make metadata in full screen viewer optional - Add VAE civitai scan metadata/preview - More efficient in-browser callbacks diff --git a/TODO.md b/TODO.md index db4fbea02..aae7db128 100644 --- a/TODO.md +++ b/TODO.md @@ -15,6 +15,7 @@ Main ToDo list can be found at [GitHub projects](https://github.com/users/vladma - stable diffusion 3.0 - pixart-sigma: - powerpaint: +- ella: ### Pipelines diff --git a/modules/images.py b/modules/images.py index ee7ed6f53..aa19eb58d 100644 --- a/modules/images.py +++ b/modules/images.py @@ -31,7 +31,7 @@ except Exception: def check_grid_size(imgs): mp = 0 for img in imgs: - mp += img.width * img.height + mp += img.width * img.height if img is not None else 0 mp = round(mp / 1000000) ok = mp <= shared.opts.img_max_size_mp if not ok: diff --git a/modules/processing.py b/modules/processing.py index 4257281e8..b7147c8b1 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -225,7 +225,13 @@ def process_init(p: StableDiffusionProcessing): if type(seed) == list: p.all_seeds = seed else: - p.all_seeds = [int(seed) + (x if p.subseed_strength == 0 else 0) for x in range(len(p.all_prompts))] + if shared.opts.sequential_seed: + p.all_seeds = [int(seed) + (x if p.subseed_strength == 0 else 0) for x in range(len(p.all_prompts))] + else: + p.all_seeds = [] + for i in range(len(p.all_prompts)): + seed = get_fixed_seed(p.seed) + p.all_seeds.append(int(seed) + (i if p.subseed_strength == 0 else 0)) if type(subseed) == list: p.all_subseeds = subseed else: diff --git a/modules/shared.py b/modules/shared.py index cd6e64d62..849435c85 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -470,8 +470,10 @@ options_templates.update(options_section(('advanced', "Inference Settings"), { "hypertile_vae_tile": OptionInfo(128, "HyperTile VAE tile size", gr.Slider, {"minimum": 0, "maximum": 1024, "step": 8}), "hypertile_vae_swap_size": OptionInfo(1, "HyperTile VAE swap size", gr.Slider, {"minimum": 1, "maximum": 10, "step": 1}), - "inference_other_sep": OptionInfo("

Other

", "", gr.HTML), + "inference_batch_sep": OptionInfo("

Batch

", "", gr.HTML), + "sequential_seed": OptionInfo(True, "Batch mode uses sequential seeds"), "batch_frame_mode": OptionInfo(False, "Parallel process images in batch"), + "inference_other_sep": OptionInfo("

Other

", "", gr.HTML), "inference_mode": OptionInfo("no-grad", "Torch inference mode", gr.Radio, {"choices": ["no-grad", "inference-mode", "none"]}), "sd_vae_sliced_encode": OptionInfo(False, "VAE sliced encode"), })) diff --git a/wiki b/wiki index 67f0f43e3..b95e6d67a 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 67f0f43e3d5ba87425bce6aa4eb1f129a12d8f65 +Subproject commit b95e6d67ad62c776c612172809d3cd94c3de7691