Extraltodeus/ComfyUI-AutomaticCFG

Could this be used outside ComfyUI?

Closed this issue · 1 comments

We love what you built and would like to explore using it outside of ComfyUI. Would this be an issue and require a lot of changes to the code?

Hello!

Well it REALLY depends on which feature. For the auto-cfg itself it should not be over-complicated. As the core logic is to use the cond/uncond to generate the denoised result as if using a CFG scale of 8. Then, take for each channel the mean of 25% of the highest values, the mean of 25% of the lowest values (as positive values) so you get two positive numbers. Average them and you get one which is what is used for the measure. After experimenting while developping this tool I settled on 0.8. Which is conveniently the default CFG divided by 10. So you then use this result to make a new denoised result using a CFG scale which will be basically doing 8 * (CFG scale / 10) / the result. So if the result happens to be 1.6 the new scale will become 4 so to correct the aim.

The used values are all arbitary decision based on experimentation.

For the other features such as the custom attention modifiers allowing for interesting experiment / crazy nonsense I have no idea how this could be implemented since I stopped using A1111 since a while (I only come to discover recently that Firefox hardware acceleration was the main cause of the hanging VAE but I see to reason to going back to it).