aboutsummaryrefslogtreecommitdiffstats
path: root/modules/processing.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-15 05:46:17 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2023-08-15 05:46:17 +0000
commit79d4e81984171a047d6c71d97a67dda7dd87c43c (patch)
tree5b58b434be76d49aed0846238a9b45655e8faee8 /modules/processing.py
parent7e77a38cbc155baf96db66064afbdd40df715335 (diff)
downloadstable-diffusion-webui-gfx803-79d4e81984171a047d6c71d97a67dda7dd87c43c.tar.gz
stable-diffusion-webui-gfx803-79d4e81984171a047d6c71d97a67dda7dd87c43c.tar.bz2
stable-diffusion-webui-gfx803-79d4e81984171a047d6c71d97a67dda7dd87c43c.zip
fix processing error that happens if batch_size is not a multiple of how many prompts/negative prompts there are #12509
Diffstat (limited to 'modules/processing.py')
-rwxr-xr-xmodules/processing.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/processing.py b/modules/processing.py
index 25a19a77..1d098302 100755
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -382,13 +382,18 @@ class StableDiffusionProcessing:
def setup_prompts(self):
if type(self.prompt) == list:
self.all_prompts = self.prompt
+ elif type(self.negative_prompt) == list:
+ self.all_prompts = [self.prompt] * len(self.negative_prompt)
else:
self.all_prompts = self.batch_size * self.n_iter * [self.prompt]
if type(self.negative_prompt) == list:
self.all_negative_prompts = self.negative_prompt
else:
- self.all_negative_prompts = self.batch_size * self.n_iter * [self.negative_prompt]
+ self.all_negative_prompts = [self.negative_prompt] * len(self.all_prompts)
+
+ if len(self.all_prompts) != len(self.all_negative_prompts):
+ raise RuntimeError(f"Received a different number of prompts ({len(self.all_prompts)}) and negative prompts ({len(self.all_negative_prompts)})")
self.all_prompts = [shared.prompt_styles.apply_styles_to_prompt(x, self.styles) for x in self.all_prompts]
self.all_negative_prompts = [shared.prompt_styles.apply_negative_styles_to_prompt(x, self.styles) for x in self.all_negative_prompts]