-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add node-based invocation system #1650
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good and nothing looks broken from the package perspective. Items below can be fixed now or later:
environments-and-requirements
can be nuked - no longer in usepyproject.toml
is looking good exceptpytest
andpytest-cov
are already set in the optionaltest
block, so can be removed from the main dependencies list.pytest.ini
and.coveragerc
- these should be defined inpyproject.toml
, but that's not critical and can be fixed anytimestatic/dream_web
- this may have crept in from a past commit - pretty sure it's obsoletescripts/invoke_new.py
- we could define a proper entrypoint intoldm/invoke/app/cli_app
for this, but not a blocker either
Manually had to install |
Done
Fixed
Not sure where/how to add these or I would. If you'd like to tell me where, I can fix it up now. Also, I'm pretty sure Python 3.10 is now required as a minimum due to some Pydantic type-hinting.
There's a
I figured we'd want to rearrange this and/or replace the old one with this (though this has existed since |
Hrm... I appear to have it installed in my environment. Doesn't hurt to add it to the list I guess. |
author Kyle Schouviller <kyle0654@hotmail.com> 1669872800 -0800 committer Kyle Schouviller <kyle0654@hotmail.com> 1676240900 -0800 Adding base node architecture Fix type annotation errors Runs and generates, but breaks in saving session Fix default model value setting. Fix deprecation warning. Fixed node api Adding markdown docs Simplifying Generate construction in apps [nodes] A few minor changes (#2510) * Pin api-related requirements * Remove confusing extra CORS origins list * Adds response models for HTTP 200 [nodes] Adding graph_execution_state to soon replace session. Adding tests with pytest. Minor typing fixes [nodes] Fix some small output query hookups [node] Fixing some additional typing issues [nodes] Move and expand graph code. Add base item storage and sqlite implementation. Update startup to match new code [nodes] Add callbacks to item storage [nodes] Adding an InvocationContext object to use for invocations to provide easier extensibility [nodes] New execution model that handles iteration [nodes] Fixing the CLI [nodes] Adding a note to the CLI [nodes] Split processing thread into separate service [node] Add error message on node processing failure Removing old files and duplicated packages Adding python-multipart
This PR adds the core of the node-based invocation system first discussed in https://github.com/invoke-ai/InvokeAI/discussions/597 and implements it through a basic CLI and API. This supersedes #1047, which was too far behind to rebase.
Architecture
Invocations
The core of the new system is invocations, found in
/ldm/invoke/app/invocations
. These represent individual nodes of execution, each with inputs and outputs. Core invocations are already implemented (txt2img
,img2img
,upscale
,face_restore
) as well as a debug invocation (show_image
). To implement a new invocation, all that is required is to add a new implementation in this folder (there is a markdown document describing the specifics, though it is slightly out-of-date).Sessions
Invocations and links between them are maintained in a session. These can be queued for invocation (either the next ready node, or all nodes). Some notes:
-1
to link from a previously executed node, and can link either specific outputs, or can opportunistically link all matching outputs by name and type by using*
.Services
These make up the core the invocation system, found in
/ldm/invoke/app/services
. One of the key design philosophies here is that most components should be replaceable when possible. For example, if someone wants to use cloud storage for their images, they should be able to replace the image storage service easily.The services are broken down as follows (several of these are intentionally implemented with an initial simple/naïve approach):
Apps
Apps are available through the
/scripts/invoke-new.py
script (to-be integrated/renamed).CLI
Implements a simple CLI. The CLI creates a single session, and automatically links all inputs to the previous node's output. Commands are automatically generated from all invocations, with command options being automatically generated from invocation inputs. Help is also available for the cli and for each command, and is very verbose. Additionally, the CLI supports command piping for single-line entry of multiple commands. Example:
API
Implements an API using FastAPI with Socket.io support for signaling. API documentation is available at
http://localhost:9090/docs
orhttp://localhost:9090/redoc
. This includes OpenAPI schema for all available invocations, session interaction APIs, and image APIs. Socket.io signals are per-session, and can be subscribed to by session id. These aren't currently auto-documented, though the code for event emission is centralized in/ldm/invoke/app/services/events.py
.A very simple test html and script are available at
http://localhost:9090/static/test.html
This demonstrates creating a session from a graph, invoking it, and receiving signals from Socket.io.What's left?