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

fix(ui): control adapter errors #5953

Merged
merged 6 commits into from
Mar 13, 2024

Conversation

psychedelicious
Copy link
Collaborator

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Community Node Submission

Have you discussed this change with the InvokeAI team?

  • Yes
  • No, because:

Description

Fix two failure modes for control adapter graph creation:

  • Invalid control adapters making it past an initial filter, but being rejected later on
  • Usage of await within a forEach loop, causing a race condition

Related Tickets & Documents

I saw a post on discord but cannot find it now.

QA Instructions, Screenshots, Recordings

Control adapters should work

Merge Plan

This PR can be merged when approved

There wasn't enough validation of control adapters during graph building. It would be possible for a graph to be built with empty collect node, causing an error. Addressed with an extra check.

This should never happen in practice, because the invoke button should be disabled if an invalid CA is active.
The graph builders used awaited functions within `Array.prototype.forEach` loops. This doesn't do what you'd think. This caused graphs to be enqueued before they were fully constructed.

 Changed to `for..of` loops to fix this.
Until recently, this had a different shape than the ModelMetadataField. They are now the same, so we can re-use the ModelIdentifierField.
We can also totally remove the fetch logic because we store the same model data in state now.
@github-actions github-actions bot added python PRs that change python files invocations PRs that change invocations labels Mar 13, 2024
@psychedelicious
Copy link
Collaborator Author

I realized we can simplify things a bit more and followed this PR up with #5954.

Since the changes are related, I just merged that PR into this one. Notes from that PR:

For some time during the MM2 refactor, we wanted more model information in metadata than we we wanted to load models. We only stored the essential model-loading data in the frontend.

A separate pydantic model ModelMetadataField represented the enriched metadata. When building graphs, this required a fetch for the model configs so we could populate metadata correctly.

This recently changed, and app state now has everything we need for metadata. No need for a fetch or the separate ModelMetadataField.

@psychedelicious psychedelicious enabled auto-merge (rebase) March 13, 2024 23:50
@psychedelicious psychedelicious merged commit c66e8b3 into main Mar 13, 2024
14 checks passed
@psychedelicious psychedelicious deleted the psyche/fix/ui/control-adapter-errors branch March 13, 2024 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend PRs that change frontend files invocations PRs that change invocations python PRs that change python files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants