This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hey all! Hopefully I can find some help here. I need someone with deep understanding of how Stable Diffusion works technically speaking (both theoretically and with Python code) and also how ComfyUI works so they could possibly lend me a hand with a custom node.
I'm trying to implement reference only "controlnet preprocessor". For those who don't know, it is a technique that works by patching the unet function so it can make two passes during an inference loop: one to write data of the reference image, another one to read it during the normal input image inference so the output emulates the reference image's style to an extent.
It's also necessary to patch the self-attention layer in order to write and read that data.
After some days of studying a lot, I finally managed to get my code working with no errors. I based my code on an example made for diffusers and adapted to ComfyUI logic. It's a custom node that takes as inputs a latent reference image and the model to patch.
However, I'm not happy with the results. I can tell it's working because it's possible to see some features of the reference image. Here are some examples of my testing (all using Dreamshaper):
Input reference:
Output:
Input (with the same prompt):
Output:
Same input reference but with "Dog walking in the park":
Same prompt without reference:
It's kind of obvious that it's taking slight features of the reference image, but it's not strong enough to be considered successful, even more considering all the testing was done with a style fidelity of 1 (the maximum value).
Automatic1111's controlnet extension can even copy character features.
So in conclusion, there is something missing in my code, but I can't tell what at this point. I admit I have made many assumptions during coding, but that's the reason why I'm asking for help. I need someone that understands and can tell me what is wrong with my implementation.
You can check my custom node's source code in my controlnet preprocessors fork. (Original repo by Fannovel16)
Subreddit
Post Details
- Posted
- 1 year ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/comfyui/com...