SAG (Self-Attention-Guidance) for ComfyUI #188
Replies: 3 comments
-
I highly encourage you to try to convert it into a node! Creating custom nodes for ComfyUI is very straight forward if you are using the default types (IMAGE, INT, FLOAT, etc.). Another cool thing you could try doing is implement it so that people can just install the SAG extension in the custom_nodes folder in ComfyUI (best way is to share the existing extension code, this is how you do it). It would require a PR in the SAG repo, and you might want to ask the owner if he is interested before making a PR. He may also be interested to implement it. There is code in sd-webui-comfyui that loads custom nodes from A1111 extensions if they define any with the right folder hierarchy, but I wouldn't recommend it for normal nodes because it forces people to use sd-webui-comfyui to inject the nodes properly. It's definitely the way to do it if the node is always meant to be used with sd-webui-comfyui. |
Beta Was this translation helpful? Give feedback.
-
I just looked at the code for SAG, I think it needs to be implemented as a patch rather than as a node. For instance, you could patch the existing k_sampler nodes to add an additional SAG guidance slider just under CFG scale. I don't 100% understand the extension, but I don't think it's as straight forward as just implementing a node with the right inputs and outputs. Maybe it's doable with the model as an input/output to a custom node? Not 100% sure. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the information, thats a good starting point for me Because of my rather poor python skills I think I will try first to copy the regular KSampler, make it into a custom node and then try to implement a hack |
Beta Was this translation helpful? Give feedback.
-
SAG ( https://github.com/ashen-sensored/sd_webui_SAG ) can drastically enhance details or / and helps with skin detail in photorealistic portraits. I always use this in A1111 but it is completely missing from ComfyUI
I looked for some solutions to be able to use SAG in ComfyUI but so far I think I always need an instance of A1111 with your (neat and nice) extension running to be able to use this. Is it possible to ... convert this extension so that it is just a regular node?
I think I could program a SAG node but I haven't programmed in a few months so it would take me at least a week. I have experience in extension / script making, but not much in comfy nodes.
Beta Was this translation helpful? Give feedback.
All reactions