-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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(nodes): migrate cnet nodes away from controlnet_aux
#6831
Conversation
Note for reviewers: The vast majority of this PR is copy-pasted code from Review should focus on:
|
Deprecation class should be instituted. We probably want to de-clutter the node library sooner v later. It will be confusing for users. Or, maybe, deprecated nodes don't show up in the node library and are only visible on old workflows? |
Similar to the existing node, but without the resolution fields.
Similar to the existing node, but without the resolution fields.
Similar to the existing node, but without the resolution fields.
Similar to the existing node, but without any resizing and with a revised model loading API.
Similar to the existing node, but without any resizing and with a revised model loading API that uses the model manager.
Similar to the existing node, but without any resizing and with a revised model loading API that uses the model manager.
Similar to the existing node, but without any resizing and with a revised model loading API that uses the model manager.
Similar to the existing node, but without any resizing and with a revised model loading API that uses the model manager. All code related to the invocation now lives in the Invoke repo.
Similar to the existing node, but without any resizing and with a revised model loading API that uses the model manager. All code related to the invocation now lives in the Invoke repo.
8dab787
to
40cc149
Compare
Similar to the existing node, but without any resizing and with a revised model loading API that uses the model manager. All code related to the invocation now lives in the Invoke repo. Unfortunately, this includes a whole git repo for EfficientNet. I believe we could use the package `timm` instead of this, but it's beyond me.
Similar to the existing node, but without any resizing and with a revised model loading API that uses the model manager. All code related to the invocation now lives in the Invoke repo.
Similar to the existing node, but without any resizing. The backend logic was consolidated and modified so that it the model loading can be managed by the model manager. The ONNX Runtime `InferenceSession` class was added to the `AnyModel` union to satisfy the type checker.
- Changed name - Better field names
- Better field names
Human-readable field names.
Human-readable field names.
Use a generic to narrow the `type` field from `string` to a literal. Now you can do e.g. `adapter.type === 'control_layer_adapter'` and TS narrows the type.
They will still be usable if a workflow uses one. You just cannot add them directly.
It's a line segment detector, not general edge detector.
- Add backcompat for cnet model default settings - Default filter selection based on model type - Updated UI components to use new filter nodes - Added handling for failed filter executions, preventing filter from getting stuck in case it failed for some reason - New translations for all filters & fields
40cc149
to
7b8cc8b
Compare
This makes it a bit easier to call the action
|
Summary
This gets use closer to removing our dependency on the
controlnet_aux
package. This package provides a handful of classes that perform "controlnet preprocessing". Most of the classes which run a ML model.Why
Those classes have baked in image resizing logic, apparently intended for use in the A1111 controlnet extension:
detect_resolution: int
arg: Resizes the image to fit in the given dimension before running it through the processorimage_resolution: int
arg: Resizes the image to fit in the given dimension after running it through the processorThere are issues with this API:
Up until this point, these issues have not caused problems, because our controlnet implementation automatically resizes control images just before generation. This meant that the dimensions of the processed control images didn't really matter.
With Canvas v2, control image processing is implemented as layer filters. After processing, the image is put back onto the canvas, and should be the exact same size as it was before processing. It is not acceptable for the images to be differently sized.
How
Instead of making potentially breaking and hairy changes to the existing "controlnet processor" nodes, I've created a new set of nodes to be on filter duty in Canvas v2:
I have not migrated:
Nodes that have models have revised, separate classes that give our model manager control over model downloading, caching and loading.
This change does bring in a lot of code from
controlnet_aux
. The biggest chunk is the backend support for NormalBAE. Turns out there's a whole git repo embedded incontrolnet_aux
for the EfficientNet architecture... I understand thetimm
package can be used instead but I didn't pursue this.As mentioned, the new nodes skip all image resizing except where necessary for the model to run, in which case the images are resized back to the original dimensions before the node finishes. This makes it a lot easier to use these nodes too - just provide the image and settings. No need to futz around with
image_resolution
anddetect_resolution
.There are no changes to the existing nodes, so existing workflows will not break. That said, we may want to add a new value to the
Classification
enum used by nodes so that we can deprecate the existing nodes. Eventually we can drop thecontrolnet_aux
dependency entirely.Related Issues / Discussions
Discord & offline discussion
QA Instructions
I did a few rounds of testing:
In all cases, the outputs were identical where possible (the
controlnet_aux
resizing logic makes this impossible in some situations).Merge Plan
Once this merges, I'll update all of the linear UI to use the new nodes. Maybe there are some default workflows to update also?
Checklist