Clybius / ComfyUI-Latent-Modifiers

A repository of ComfyUI nodes which modify the latent during the diffusion process.
GNU General Public License v3.0
75 stars 9 forks source link

Add support for CADS #4

Open biscuit-biscuit opened 11 months ago

biscuit-biscuit commented 11 months ago

Hi, I've added support for the CADS algorithm (based on the webui plugin here). This allows for more varied generations by adding noise to the conditioning which decreases over time. I was planning on making it its own custom node but it seemed like it might be a good fit for this repo too, if the contribution is wanted.

I am bad at python and have never worked with torch before so the code might be rough .I can make changes to this PR if requested. And thank you for making such a great custom node. I was able to figure out how to do this based on the other code in this repo.

Clybius commented 11 months ago

Amazing work! I think it would possibly be the best to add it under the extra_noise_method option, as that way we could minimize the added sliders/params on the node.

Optimally, I'd prefer that the node is as small as possible (despite how large it is currently), so some user-adjustable parameters might need to have good defaults and just not be accessible.

Here's what I'm thinking could be done, with support for custom noise types. Comments have my thoughts:

"cads_enabled": (["Disabled", "Enabled"], ), # Move this to extra_noise_method
"cads_schedule_start": ("FLOAT", {"default": 0.6, "min": 0.0, "max": 1.0, "step":0.05}), # Optimally, just set good defaults for these
"cads_schedule_end": ("FLOAT", {"default": 0.9, "min": 0.0, "max": 1.0, "step":0.05}),  # Optimally, just set good defaults for these
"cads_noise_scale": ("FLOAT", {"default": 0.25, "min": 0.0, "max": 1.0, "step": 0.01}), # Can be extra_noise_multiplier?
"cads_enable_rescale": (["Enabled", "Disabled"], ), # Can maybe be moved to extra_noise_method under the name `cads_rescaled`?
"cads_rescale_factor": ("FLOAT", {"default": 0.25, "min": 0.0, "max": 1.0, "step": 0.01}), # Might just need a good default here for the time being, unless there's a smarter way to minimize slider usage.

I'll see what I can get workin' locally. I'm imagining that we could possibly get this supported with the existing noise types. Thanks again!