* Fix process_images where the number of images is not a multiple of (batch_size * n_iter), which would cause us to throw an exception.

* Add a textbox option to Prompts from file (ease of use and it makes it much easier to use on a mobile device)
* Fix the fact that Prompts from file was sometimes passing an empty batch.
This commit is contained in:
Tony Beeman
2022-09-17 01:34:33 -07:00
committed by AUTOMATIC1111
parent 140f893153
commit ba295b3268
2 changed files with 32 additions and 11 deletions

View File

@@ -188,7 +188,11 @@ def fix_seed(p):
def process_images(p: StableDiffusionProcessing) -> Processed:
"""this is the main loop that both txt2img and img2img use; it calls func_init once inside all the scopes and func_sample once per batch"""
assert p.prompt is not None
if type(p.prompt) == list:
assert(len(p.prompt) > 0)
else:
assert p.prompt is not None
devices.torch_gc()
fix_seed(p)
@@ -265,6 +269,9 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
seeds = all_seeds[n * p.batch_size:(n + 1) * p.batch_size]
subseeds = all_subseeds[n * p.batch_size:(n + 1) * p.batch_size]
if (len(prompts) == 0):
break
#uc = p.sd_model.get_learned_conditioning(len(prompts) * [p.negative_prompt])
#c = p.sd_model.get_learned_conditioning(prompts)
uc = prompt_parser.get_learned_conditioning(len(prompts) * [p.negative_prompt], p.steps)