aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-19 08:05:36 +0300
committerGitHub <noreply@github.com>2023-08-19 08:05:36 +0300
commit9182dd7e5d4e721f98d8292bfdf597897331fa78 (patch)
treec3d5192726fa681c2e5ae995cd14c7ab88097542
parentf739e3e05d52d6040fec62b561ad37c952ca7d22 (diff)
parent9d1d63afcaffc57e9dff5bdc59643ddd60f377e4 (diff)
Merge pull request #12634 from catboxanon/feat/live-preview-fast-interrupt
Improve interrupt speed
-rwxr-xr-xmodules/processing.py3
-rw-r--r--modules/sd_samplers_common.py2
-rw-r--r--modules/shared_options.py1
3 files changed, 5 insertions, 1 deletions
diff --git a/modules/processing.py b/modules/processing.py
index 0315e1fd..ea481fab 100755
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -1155,6 +1155,9 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
devices.torch_gc()
def sample_hr_pass(self, samples, decoded_samples, seeds, subseeds, subseed_strength, prompts):
+ if shared.state.interrupted:
+ return samples
+
self.is_hr_pass = True
target_width = self.hr_upscale_to_x
diff --git a/modules/sd_samplers_common.py b/modules/sd_samplers_common.py
index 7dc79ea8..f0bc8e6a 100644
--- a/modules/sd_samplers_common.py
+++ b/modules/sd_samplers_common.py
@@ -36,7 +36,7 @@ approximation_indexes = {"Full": 0, "Approx NN": 1, "Approx cheap": 2, "TAESD":
def samples_to_images_tensor(sample, approximation=None, model=None):
'''latents -> images [-1, 1]'''
- if approximation is None:
+ if approximation is None or (shared.state.interrupted and opts.live_preview_fast_interrupt):
approximation = approximation_indexes.get(opts.show_progress_type, 0)
if approximation == 2:
diff --git a/modules/shared_options.py b/modules/shared_options.py
index 79cbb92e..3e4bcaef 100644
--- a/modules/shared_options.py
+++ b/modules/shared_options.py
@@ -281,6 +281,7 @@ options_templates.update(options_section(('ui', "Live previews"), {
"show_progress_type": OptionInfo("Approx NN", "Live preview method", gr.Radio, {"choices": ["Full", "Approx NN", "Approx cheap", "TAESD"]}).info("Full = slow but pretty; Approx NN and TAESD = fast but low quality; Approx cheap = super fast but terrible otherwise"),
"live_preview_content": OptionInfo("Prompt", "Live preview subject", gr.Radio, {"choices": ["Combined", "Prompt", "Negative prompt"]}),
"live_preview_refresh_period": OptionInfo(1000, "Progressbar and preview update period").info("in milliseconds"),
+ "live_preview_fast_interrupt": OptionInfo(False, "Return image with chosen live preview method on interrupt").info("makes interrupts faster"),
}))
options_templates.update(options_section(('sampler-params', "Sampler parameters"), {