mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-03-09 23:44:55 +08:00
fix processing error that happens if batch_size is not a multiple of how many prompts/negative prompts there are #12509
This commit is contained in:
parent
7e77a38cbc
commit
79d4e81984
@ -382,13 +382,18 @@ class StableDiffusionProcessing:
|
|||||||
def setup_prompts(self):
|
def setup_prompts(self):
|
||||||
if type(self.prompt) == list:
|
if type(self.prompt) == list:
|
||||||
self.all_prompts = self.prompt
|
self.all_prompts = self.prompt
|
||||||
|
elif type(self.negative_prompt) == list:
|
||||||
|
self.all_prompts = [self.prompt] * len(self.negative_prompt)
|
||||||
else:
|
else:
|
||||||
self.all_prompts = self.batch_size * self.n_iter * [self.prompt]
|
self.all_prompts = self.batch_size * self.n_iter * [self.prompt]
|
||||||
|
|
||||||
if type(self.negative_prompt) == list:
|
if type(self.negative_prompt) == list:
|
||||||
self.all_negative_prompts = self.negative_prompt
|
self.all_negative_prompts = self.negative_prompt
|
||||||
else:
|
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_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]
|
self.all_negative_prompts = [shared.prompt_styles.apply_negative_styles_to_prompt(x, self.styles) for x in self.all_negative_prompts]
|
||||||
|
Loading…
Reference in New Issue
Block a user