From defdf8a9273fc1cd7c5a4be738d3e888bb452e1c Mon Sep 17 00:00:00 2001 From: Adi Eyal Date: Sun, 8 Jan 2023 20:59:37 +0200 Subject: [PATCH] Fixed disable negative prompts Fixes #167 --- docs/CHANGELOG.md | 1 + scripts/dynamic_prompting.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 7883742..107e528 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,3 +1,4 @@ +- 2.2.3 Fixed disable negative prompts - see [#167](https://github.com/adieyal/sd-dynamic-prompts/issues/167) - 2.2.2 Fixed missing whitespace between wildcards - 2.2.1 Fixed unlink seed from prompt bug - see [#150](https://github.com/adieyal/sd-dynamic-prompts/issues/150#issuecomment-1374847700) - 2.2.0 Added option in advanced settings to save the raw prompt in the png metadata diff --git a/scripts/dynamic_prompting.py b/scripts/dynamic_prompting.py index a8752a7..0247c0f 100644 --- a/scripts/dynamic_prompting.py +++ b/scripts/dynamic_prompting.py @@ -43,7 +43,7 @@ if wildcard_dir is None: else: WILDCARD_DIR = Path(wildcard_dir) -VERSION = "2.2.2" +VERSION = "2.2.3" wildcard_manager = WildcardManager(WILDCARD_DIR) @@ -297,11 +297,15 @@ class Script(scripts.Script): ) all_prompts = generator.generate(original_prompt, num_images) - all_negative_prompts = generator.generate( - original_negative_prompt, num_images - ) total_prompts = len(all_prompts) + if disable_negative_prompt: + all_negative_prompts = [""] + else: + all_negative_prompts = generator.generate( + original_negative_prompt, num_images + ) + if len(all_negative_prompts) < total_prompts: all_negative_prompts = all_negative_prompts * ( total_prompts // len(all_negative_prompts) + 1