Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: generic progress events #6908

Merged
merged 10 commits into from
Sep 22, 2024

Conversation

psychedelicious
Copy link
Collaborator

Summary

Generalized progress events:

  • New invocation_progress event replaces invocation_denoise_progress event. It is emitted with a message and some optional args: percentage, image, image_size.
  • Invocation API updated with signal_progress method.
  • Updated SD, MultiDiffusion and FLUX to use new API. Also fixed some off-by-one kinda issues.
  • Added progress to spandrel nodes, so we get a progress bar as these nodes execute.
  • Updated UI to consume the new events.

Related Issues / Discussions

QA Instructions

How to test

Text matrix:

  • SD1.5, SDXL, FLUX
  • Send to Gallery, Send to Canvas
  • Canvas Tab, Upscaling Tab

Set the log level to trace in system settings, open the browser JS console and generate. You should see:

  • Console messages for each denoise event, starting from 0% and ending at 100%.
  • Progress images per usual. You'll notice that FLUX now displays its initial latents.
  • The progress bar should fill up at the last step.
  • For upscaling, the progress bar should tick along during the spandrel step, and you should get console logs.

Discussion items

  • Maybe signal_progress isn't the best name for the API method.
  • Maybe image_size should be image_display_size.
  • I have not updated the _new_invoke step callback handling. I'm not sure how to trigger this code path to test it, but the changes should be similar to the ones I made in b48db16 - just adjust the step and total_steps parameters.

Merge Plan

Would be nice to get this in for v5 but it's not super important.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)

@github-actions github-actions bot added api python PRs that change python files invocations PRs that change invocations backend PRs that change backend files services PRs that change app services frontend PRs that change frontend files labels Sep 21, 2024
@hipsterusername
Copy link
Member

I’m going to try to test this more hands on tomorrow and then we can get it in.

@psychedelicious psychedelicious changed the title Psyche/feat/generic progress events 2 feat: generic progress events Sep 22, 2024
Eliminate coupling on stable diffusion for progress events. Can be used for any node.
Any node can use this at any time to signal its progress to the client. The docstrings are detailed.
- Update the step callback methods in the invocation API to use the new signal_progress API
- Copy and update the `calc_percentage`, reducing special handling for step and total_steps - a followup commit will fix callers of the step callbacks
Each of these was a bit off:
- The SD callback started at `-1` and ended at `i`. Combined w/ the weird math on the previous `calc_percentage` util, this caused the progress bar to never finish.
- The MultiDiffusion callback had the same problems as SD.
- The FLUX callback didn't emit a pre-denoising step 0 image. It also reported total_steps as 1 higher than the actual step count.

Each of these now emit the expected events to the frontend:
- The initial latents at 0%
- Progress at each step, ending at 100%
This is now superseded by the invocation_progress event.
Both the vanilla and autoscale invocations report progress while processing each tile.

The autoscale version, which may run the spandrel model multiple times, also includes the current iteration.
@hipsterusername hipsterusername force-pushed the psyche/feat/generic-progress-events-2 branch from 28f4444 to 3cd8ccc Compare September 22, 2024 17:54
@hipsterusername hipsterusername merged commit a9f93c1 into main Sep 22, 2024
14 checks passed
@hipsterusername hipsterusername deleted the psyche/feat/generic-progress-events-2 branch September 22, 2024 18:20
@psychedelicious psychedelicious mentioned this pull request Oct 3, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api backend PRs that change backend files frontend PRs that change frontend files invocations PRs that change invocations python PRs that change python files services PRs that change app services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants