Commit a459075d authored by AUTOMATIC1111's avatar AUTOMATIC1111
Browse files

actual solution to the uncommon hanging problem that is seemingly caused by...

actual solution to the uncommon hanging problem that is seemingly caused by multiple progress requests working on same tensor
parent d7c9c614
Loading
Loading
Loading
Loading
+22 −23
Original line number Diff line number Diff line
@@ -95,9 +95,12 @@ def progressapi(req: ProgressRequest):
    predicted_duration = elapsed_since_start / progress if progress > 0 else None
    eta = predicted_duration - elapsed_since_start if predicted_duration is not None else None

    live_preview = None
    id_live_preview = req.id_live_preview

    if opts.live_previews_enable and req.live_preview:
        shared.state.set_current_image()
    if opts.live_previews_enable and req.live_preview and shared.state.id_live_preview != req.id_live_preview:
        if shared.state.id_live_preview != req.id_live_preview:
            image = shared.state.current_image
            if image is not None:
                buffered = io.BytesIO()
@@ -116,10 +119,6 @@ def progressapi(req: ProgressRequest):
                base64_image = base64.b64encode(buffered.getvalue()).decode('ascii')
                live_preview = f"data:image/{opts.live_previews_image_format};base64,{base64_image}"
                id_live_preview = shared.state.id_live_preview
        else:
            live_preview = None
    else:
        live_preview = None

    return ProgressResponse(active=active, queued=queued, completed=completed, progress=progress, eta=eta, live_preview=live_preview, id_live_preview=id_live_preview, textinfo=shared.state.textinfo)

+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ def images_tensor_to_samples(image, approximation=None, model=None):


def store_latent(decoded):
    state.current_latent = decoded.clone()
    state.current_latent = decoded

    if opts.live_previews_enable and opts.show_progress_every_n_steps > 0 and shared.state.sampling_step % opts.show_progress_every_n_steps == 0:
        if not shared.parallel_processing_allowed:
+1 −1
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ class State:
        devices.torch_gc()

    def set_current_image(self):
        """sets self.current_image from self.current_latent if enough sampling steps have been made after the last call to this"""
        """if enough sampling steps have been made after the last call to this, sets self.current_image from self.current_latent, and modifies self.id_live_preview accordingly"""
        if not shared.parallel_processing_allowed:
            return