From a243bc7859b7ab92a28d28c11b0ed5525fa0d6ba Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Tue, 6 Sep 2022 02:09:01 +0300 Subject: added progressbar added an option to disable progressbar added interrupt support to DDIM/PLMS --- modules/img2img.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modules/img2img.py') diff --git a/modules/img2img.py b/modules/img2img.py index e6707f96..600a5172 100644 --- a/modules/img2img.py +++ b/modules/img2img.py @@ -55,7 +55,10 @@ def img2img(prompt: str, init_img, init_img_with_mask, steps: int, sampler_index initial_seed = None initial_info = None + state.job_count = n_iter + for i in range(n_iter): + p.n_iter = 1 p.batch_size = 1 p.do_not_save_grid = True @@ -72,6 +75,8 @@ def img2img(prompt: str, init_img, init_img_with_mask, steps: int, sampler_index p.denoising_strength = max(p.denoising_strength * 0.95, 0.1) history.append(processed.images[0]) + state.nextjob() + grid = images.image_grid(history, batch_size, rows=1) images.save_image(grid, p.outpath_grids, "grid", initial_seed, prompt, opts.grid_format, info=info, short_filename=not opts.grid_extended_filename) @@ -103,6 +108,8 @@ def img2img(prompt: str, init_img, init_img_with_mask, steps: int, sampler_index batch_count = math.ceil(len(work) / p.batch_size) print(f"SD upscaling will process a total of {len(work)} images tiled as {len(grid.tiles[0][2])}x{len(grid.tiles)} in a total of {batch_count} batches.") + state.job_count = batch_count + for i in range(batch_count): p.init_images = work[i*p.batch_size:(i+1)*p.batch_size] @@ -116,6 +123,8 @@ def img2img(prompt: str, init_img, init_img_with_mask, steps: int, sampler_index p.seed = processed.seed + 1 work_results += processed.images + state.nextjob() + image_index = 0 for y, h, row in grid.tiles: for tiledata in row: -- cgit v1.2.1