jojkaart / ComfyUI-sampler-lcm-alternative

ComfyUI Custom Sampler nodes that adds a new improved LCM sampler function
GNU General Public License v3.0
113 stars 13 forks source link

ComfyUI-sampler-lcm-alternative

ComfyUI Custom Sampler nodes that add a new improved LCM sampler functions

This custom node repository adds three new nodes for ComfyUI to the Custom Sampler category. SamplerLCMAlternative, SamplerLCMCycle and LCMScheduler (just to save a few clicks, as you could also use the BasicScheduler and choose smg_uniform). Just clone it into your custom_nodes folder and you can start using it as soon as you restart ComfyUI.

Update 2024.06.29: I've added more parameters to SamplerLCMDualNoise. normalize_steps, reuse_lcm_noise and parallel. Update 2024.06.24: I've added a new sampler SamplerLCMDualNoise. I consider the others obsolete now due to how stunnigly well this new sampler works. It achieves great results on SD1.5 (yes, the ORIGINAL!) plus LCM Lora with CFG 1.0 and only positive prompt.

SamplerLCMDualNoise has four extra parameters.

SamplerLCMAlternative has two extra parameters.

With default parameters, this sampler acts exactly like the original LCM sampler from ComfyUI. When you start tuning, I recommend starting by setting euler_steps to half of the total step count this sampler will be handling. going higher will increase details/sharpness and lower will decrease both.

SamplerLCMCycle has three extra parameters. This sampler repeats a cycle of Euler and LCM sampling steps until inference is done. If you're doing txt2img with LCM and feel like LCM is giving boring or artificial looking images, give this sampler a try.

The default settings should work fine. I recommend using at least 6 steps to allow for 2 full cycles, that said, this sampler seems to really benefit from extra steps.

I also higly recommend using the RescaleCFG node when using LCM Lora. With that, you can bump CFG up to 3.0 and sometimes even higher, which really helps quality and the effectiveness of negative prompt.

Here's an example workflows for how to use SamplerLCMCycle and SamplerLCMDualNoise: SampleLCMCycle example SampleLCMDualNoise example

Here's also the example gen being shown in the SamplerLCMDualNoise workflow: SampleLCMDualNoise gen