-
Notifications
You must be signed in to change notification settings - Fork 101
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
Add Stable Diffusion ControlNet #359
Conversation
Hey @joelpaulkoch, thanks for the PR! I will have a more detailed look later, for now a couple high-level comments :)
Having is a optional serving input sounds good (similar to how we have :seed, for example).
Since the difference is only in inputs, I would totally just have them as optional inputs in the
I think a separate module makes sense, in general I would have one module per diffusion type (SD, SD control net, SD XL, ...) and then a serving function for a task (currently only
I see in diffusers they have |
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.
Thanks for the updates, some more comments :)
) | ||
|> Nx.tile([256, 8, 3]) | ||
|> Nx.pad(0, [{192, 64, 0}, {192, 64, 0}, {0, 0, 0}]) | ||
|> Nx.transpose(axes: [1, 0, 2]) |
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.
This is an example that controls the stripes of the numbat (but doesn't always work that well). We might want to rewrite this or replace it with an actual scribble image.
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.
Could be a nice exercise to add a notebook that detects edges with Evision and uses it as edges control (like here), for the example here any tensor is fine though, just to give an idea. I also added a comment as a clarification :)
We could share more logic between the servings, but it's fine for now, we can refactor once there are more :) |
Btw. I updated the tests to use tiny checkpoints and generated reference values using hf/diffusers :) |
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.
@joelpaulkoch it's good to go, thanks for working on this!
I want to share my work on using ControlNet with Stable Diffusion. These are the three parts and notes on current limitations:
diffusers
implementation, at the moment I have a constant of 1 for this. Would you add it as (optional) input?diffusers
andbumblebee
), so I kept the test with "lllyasviel/sd-controlnet-scribble".:with_additional_residuals
and separate input and core functions. But in the end the only difference is that additional residuals are passed in and added. So alternatively this could go in the:base
architecture as optional inputs and add layers I guess.I've tried all the control nets listed here with the corresponding example and got sensible results for all but the normal map one. I'm not sure what's the issue with the normal map, but could imagine it's because of the preprocessing, or I simply did not run enough steps.