Skip to content

webui: support cancelation - #182

Merged
lstein merged 1 commit into
invoke-ai:mainfrom
bakkot:webui-cancel
Aug 30, 2022
Merged

webui: support cancelation#182
lstein merged 1 commit into
invoke-ai:mainfrom
bakkot:webui-cancel

Conversation

@bakkot

@bakkot bakkot commented Aug 29, 2022

Copy link
Copy Markdown
Contributor

This is on top of #181, which is itself on top of #180. (Github does not have a good way of staging multiple PRs.) Changes in this PR are just the "support cancelation" commit. This PR works even without #181, but it's a lot more useful with it.

This adds a button next to the progress bar which allows you to cancel the in-progress generation - e.g. if you asked for 5 images and then discovered after the first 2 that you want to tweak the prompt, or if the partial rendering from #180 was enough to know it wasn't what you were looking for. It accomplishes this by throwing an exception in the per-step callback and catching it outside the call to prompt2image, which, while a bit gross, is fundamentally the same thing as hitting ctrl-c and catching the KeyboardInterrupt. That's what the REPL does, so it should be ok.

Cancelation does need to wait for the current step to finish rather than actually being instant, but it's only a second or two of delay, and I didn't really want to get into dealing with actual interrupts or deeper magic.

screenshot of button Screen Shot 2022-08-29 at 12 23 12 AM

@bakkot

bakkot commented Aug 29, 2022

Copy link
Copy Markdown
Contributor Author

I'll rebase this after #186 and #181 are merged.

@lstein
lstein requested review from TesseractCat and lstein August 29, 2022 18:48

@lstein lstein left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good addition to the previus PR. Hopefully we can get both in soon. There are source conflicts, but they don't look too daunting.

@blessedcoolant

Copy link
Copy Markdown
Collaborator

I tested this PR. It's working fine. I can approve it if you want @lstein ... Both the streaming and the cancelation are working as expected.

@lstein

lstein commented Aug 30, 2022

Copy link
Copy Markdown
Collaborator

I tested this PR. It's working fine. I can approve it if you want @lstein ... Both the streaming and the cancelation are working as expected.
@blessedcoolant I'm trying to be disciplined about the code reviews, so if you could do a formal approval that would be great. Meanwhile I'll clean up the conflicts.

@lstein

lstein commented Aug 30, 2022

Copy link
Copy Markdown
Collaborator

@bakkot , we've run into the CRLF issue again. Could you fix the line endings and rebase?

@blessedcoolant

blessedcoolant commented Aug 30, 2022

Copy link
Copy Markdown
Collaborator

I tested this PR. It's working fine. I can approve it if you want @lstein ... Both the streaming and the cancelation are working as expected.
@blessedcoolant I'm trying to be disciplined about the code reviews, so if you could do a formal approval that would be great. Meanwhile I'll clean up the conflicts.

Yeah. I am doing formal ones. But on this one I held off because two PR's about the similar topic were open and the other one seemed to be in progress.

@bakkot

bakkot commented Aug 30, 2022

Copy link
Copy Markdown
Contributor Author

Rebased.

Comment thread ldm/dream/server.py
@lstein

lstein commented Aug 30, 2022

Copy link
Copy Markdown
Collaborator

@blessedcoolant indicated review approval in comments, so going ahead with merge.

@lstein
lstein merged commit 8bf321f into invoke-ai:main Aug 30, 2022
@bakkot
bakkot deleted the webui-cancel branch August 30, 2022 16:05
austinbrown34 pushed a commit to cognidesign/InvokeAI that referenced this pull request Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants