aboutsummaryrefslogtreecommitdiffstats
path: root/modules/shared_state.py
diff options
context:
space:
mode:
authorAnthony Fu <anthonyfu117@hotmail.com>2023-10-16 06:12:18 +0000
committerAnthony Fu <anthonyfu117@hotmail.com>2023-10-16 06:12:18 +0000
commit8aa13d5dce2789a7d0bd802e6d62453b3c380496 (patch)
tree6515dee9cb709d716cf233452a481dfe6fca2d5d /modules/shared_state.py
parent861cbd56363ffa0df3351cf1162f507425a178cd (diff)
downloadstable-diffusion-webui-gfx803-8aa13d5dce2789a7d0bd802e6d62453b3c380496.tar.gz
stable-diffusion-webui-gfx803-8aa13d5dce2789a7d0bd802e6d62453b3c380496.tar.bz2
stable-diffusion-webui-gfx803-8aa13d5dce2789a7d0bd802e6d62453b3c380496.zip
Interrupt after current generation
Diffstat (limited to 'modules/shared_state.py')
-rw-r--r--modules/shared_state.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/shared_state.py b/modules/shared_state.py
index a68789cc..c72c3f63 100644
--- a/modules/shared_state.py
+++ b/modules/shared_state.py
@@ -12,6 +12,7 @@ log = logging.getLogger(__name__)
class State:
skipped = False
interrupted = False
+ interrupted_next = False
job = ""
job_no = 0
job_count = 0
@@ -76,8 +77,12 @@ class State:
log.info("Received skip request")
def interrupt(self):
- self.interrupted = True
- log.info("Received interrupt request")
+ if shared.opts.interrupt_after_current and self.job_count > 1:
+ self.interrupted_next = True
+ log.info("Received interrupt request, interrupt after current job")
+ else:
+ self.interrupted = True
+ log.info("Received interrupt request")
def nextjob(self):
if shared.opts.live_previews_enable and shared.opts.show_progress_every_n_steps == -1:
@@ -91,6 +96,7 @@ class State:
obj = {
"skipped": self.skipped,
"interrupted": self.interrupted,
+ "interrupted_next": self.interrupted_next,
"job": self.job,
"job_count": self.job_count,
"job_timestamp": self.job_timestamp,
@@ -114,6 +120,7 @@ class State:
self.id_live_preview = 0
self.skipped = False
self.interrupted = False
+ self.interrupted_next = False
self.textinfo = None
self.job = job
devices.torch_gc()