diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/call_queue.py | 1 | ||||
-rw-r--r-- | modules/img2img.py | 2 | ||||
-rw-r--r-- | modules/processing.py | 2 | ||||
-rw-r--r-- | modules/shared_options.py | 1 | ||||
-rw-r--r-- | modules/shared_state.py | 7 | ||||
-rw-r--r-- | modules/ui.py | 1 |
6 files changed, 11 insertions, 3 deletions
diff --git a/modules/call_queue.py b/modules/call_queue.py index ddf0d573..01c6d17f 100644 --- a/modules/call_queue.py +++ b/modules/call_queue.py @@ -78,6 +78,7 @@ def wrap_gradio_call(func, extra_outputs=None, add_stats=False): shared.state.skipped = False
shared.state.interrupted = False
+ shared.state.interrupted_next = False
shared.state.job_count = 0
if not add_stats:
diff --git a/modules/img2img.py b/modules/img2img.py index 75b3d346..829faa81 100644 --- a/modules/img2img.py +++ b/modules/img2img.py @@ -51,7 +51,7 @@ def process_batch(p, input_dir, output_dir, inpaint_mask_dir, args, to_scale=Fal if state.skipped:
state.skipped = False
- if state.interrupted:
+ if state.interrupted or state.interrupted_next:
break
try:
diff --git a/modules/processing.py b/modules/processing.py index f0656882..00de2ed2 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -865,7 +865,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed: if state.skipped:
state.skipped = False
- if state.interrupted:
+ if state.interrupted or state.interrupted_next:
break
sd_models.reload_model_weights() # model can be changed for example by refiner
diff --git a/modules/shared_options.py b/modules/shared_options.py index e813546f..7852e0ea 100644 --- a/modules/shared_options.py +++ b/modules/shared_options.py @@ -120,6 +120,7 @@ options_templates.update(options_section(('system', "System", "system"), { "disable_mmap_load_safetensors": OptionInfo(False, "Disable memmapping for loading .safetensors files.").info("fixes very slow loading speed in some cases"),
"hide_ldm_prints": OptionInfo(True, "Prevent Stability-AI's ldm/sgm modules from printing noise to console."),
"dump_stacks_on_signal": OptionInfo(False, "Print stack traces before exiting the program with ctrl+c."),
+ "interrupt_after_current": OptionInfo(False, "Interrupt generation after current image is finished on batch processing"),
}))
options_templates.update(options_section(('API', "API", "system"), {
diff --git a/modules/shared_state.py b/modules/shared_state.py index a68789cc..532fdcd8 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
@@ -79,6 +80,10 @@ class State: self.interrupted = True
log.info("Received interrupt request")
+ def interrupt_next(self):
+ self.interrupted_next = True
+ log.info("Received interrupt request, interrupt after current job")
+
def nextjob(self):
if shared.opts.live_previews_enable and shared.opts.show_progress_every_n_steps == -1:
self.do_set_current_image()
@@ -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()
diff --git a/modules/ui.py b/modules/ui.py index 1f91a33f..378529c7 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -177,7 +177,6 @@ def update_negative_prompt_token_counter(text, steps): return update_token_counter(text, steps, is_positive=False)
-
def setup_progressbar(*args, **kwargs):
pass
|