mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-06-07 21:20:49 +00:00
Merge pull request #13170 from AUTOMATIC1111/re-fix-batch-img2img-output-dir-with-script
Re fix batch img2img output dir with script
This commit is contained in:
commit
591ad1dbc3
@ -117,6 +117,7 @@ def process_batch(p, input_dir, output_dir, inpaint_mask_dir, args, to_scale=Fal
|
|||||||
if output_dir:
|
if output_dir:
|
||||||
p.outpath_samples = output_dir
|
p.outpath_samples = output_dir
|
||||||
p.override_settings['save_to_dirs'] = False
|
p.override_settings['save_to_dirs'] = False
|
||||||
|
p.override_settings['save_images_replace_action'] = "Add number suffix"
|
||||||
if p.n_iter > 1 or p.batch_size > 1:
|
if p.n_iter > 1 or p.batch_size > 1:
|
||||||
p.override_settings['samples_filename_pattern'] = f'{image_path.stem}-[generation_number]'
|
p.override_settings['samples_filename_pattern'] = f'{image_path.stem}-[generation_number]'
|
||||||
else:
|
else:
|
||||||
@ -125,6 +126,7 @@ def process_batch(p, input_dir, output_dir, inpaint_mask_dir, args, to_scale=Fal
|
|||||||
proc = modules.scripts.scripts_img2img.run(p, *args)
|
proc = modules.scripts.scripts_img2img.run(p, *args)
|
||||||
|
|
||||||
if proc is None:
|
if proc is None:
|
||||||
|
p.override_settings.pop('save_images_replace_action', None)
|
||||||
process_images(p)
|
process_images(p)
|
||||||
|
|
||||||
|
|
||||||
|
@ -711,7 +711,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
|
|||||||
if p.scripts is not None:
|
if p.scripts is not None:
|
||||||
p.scripts.before_process(p)
|
p.scripts.before_process(p)
|
||||||
|
|
||||||
stored_opts = {k: opts.data[k] for k in p.override_settings.keys()}
|
stored_opts = {k: opts.data[k] for k in p.override_settings.keys() if k in opts.data}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# if no checkpoint override or the override checkpoint can't be found, remove override entry and load opts checkpoint
|
# if no checkpoint override or the override checkpoint can't be found, remove override entry and load opts checkpoint
|
||||||
|
Loading…
Reference in New Issue
Block a user