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 #6715

Closed
wants to merge 5 commits into from

Conversation

psychedelicious
Copy link
Collaborator

Summary

We don't have a way to signal progress in a generic way, so things like tiled spandrel are just an indeterminate progress bar in the UI. The UX is poor.

This PR is a first go at rectifying this. It adds a separate "generic" progress event, that accepts:

  • name: str: used to group progress events (along with the invocation's ID)
  • step: int | None: the current step (omit for indeterminate)
  • total_steps: int | None: the total steps (omit for indeterminate)
  • message: str | None: a message to display
  • image: ProgressImage | None = None: an image to display

No frontend implementation yet as I'm still unsure of the direction of this PR.

See code comments for discussion.

Related Issues / Discussions

Dunno if there are any.

QA Instructions

You can test this PR by opening the network monitor in your browser's dev tools, filtering for websockets and reviewing the events while using spandrel. Start with an image > 512x512 else you only get one step.

Merge Plan

n/a

Checklist

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

Some processes have steps, like denoising or a tiled spandel.

Denoising has its own step callback but we don't have any generic way to signal progress. Processes like a tiled spandrel run show indeterminate progress in the client.

This change introduces a new event to handle this: `InvocationGenericProgressEvent`

A simplified helper is added to the invocation API so nodes can easily emit progress as they do their thing.
@github-actions github-actions bot added api python PRs that change python files invocations PRs that change invocations services PRs that change app services labels Aug 3, 2024
@psychedelicious
Copy link
Collaborator Author

If we want to implement this change, once the details are stabilized I can play around with the frontend implementation. I don't anticipate it being difficult.

@hipsterusername
Copy link
Member

Good idea 🤘

- Merged `InvocationGenericProgressEvent` and `InvocationDenoiseProgressEvent` into single `InvocationProgressEvent`
- Simplified API - message is required, percentage and image are optional, no steps/total steps
- Added helper to build a `ProgressImage`
- Added field validation to `ProgressImage` width and height
- Added `ProgressImage` to `invocation_api.py`
- Updated `InvocationContext` utils
Minor changes to use the new progress event. Only additional feature is if the progress has a message, it is displayed as a tooltip on the progress bar.
@github-actions github-actions bot added the frontend PRs that change frontend files label Aug 4, 2024
@psychedelicious
Copy link
Collaborator Author

I've revised this PR a bit, simplifying the API and updating the frontend to use the new progress events.

Currently it's only the two spandrel nodes that signal progress with the new API. For the autoscale node, which does multiple spandrel runs, the progress bar resets for each. Its message looks like this: "Processing image (iteration 2, tile 4/25)".

While there is a message attached to each progress event, it's not yet used in the UI. I'd like to get this core implementation merged first, then iterate on the presentation.

I tried displaying the messages as a tooltip on the progress bar but it's not particularly discoverable. Maybe it should go on the invoke button tooltip? Not sure.

When that presentation is sorted, I'll update the UI's event handling to present model events as well as invocation start and complete events.


With this new flexible API, I'd like to explore some changes:

  • Wrap context.images.load with progress updates, so you get some feedback as to what is happening while that long PNG encode happens.
  • Currently, we have dedicated "model load" events. Maybe we should remove those and use this simpler API instead. The UI would have a single source of truth for execution status. Another option is more complicated frontend handling that updates the message with the last received event, be it a model load event or progress event. This sounds tedious.
  • When downloading auxiliary models, we can use this to signal progress.

is_canceled=self.is_canceled,
)

def signal_progress(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe this should called update_status instead?

@psychedelicious psychedelicious mentioned this pull request Aug 24, 2024
3 tasks
@RyanJDick RyanJDick mentioned this pull request Sep 3, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api 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