From fd66199769ebe0851d2ff33fdc7b191421822454 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Tue, 6 Sep 2022 19:33:51 +0300 Subject: added preview option --- modules/processing.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/processing.py') diff --git a/modules/processing.py b/modules/processing.py index e8923a7a..e615ffdc 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -176,6 +176,11 @@ def process_images(p: StableDiffusionProcessing) -> Processed: shared.state.job = f"Batch {n+1} out of {p.n_iter}" samples_ddim = p.sample(x=x, conditioning=c, unconditional_conditioning=uc) + if state.interrupted: + + # if we are interruped, sample returns just noise + # use the image collected previously in sampler loop + samples_ddim = shared.state.current_latent x_samples_ddim = p.sd_model.decode_first_stage(samples_ddim) x_samples_ddim = torch.clamp((x_samples_ddim + 1.0) / 2.0, min=0.0, max=1.0) -- cgit v1.2.3