Skip to content

Euler multipass sampling#7890

Closed
catboxanon wants to merge 1 commit intoComfy-Org:masterfrom
catboxanon:feat/multipass
Closed

Euler multipass sampling#7890
catboxanon wants to merge 1 commit intoComfy-Org:masterfrom
catboxanon:feat/multipass

Conversation

@catboxanon
Copy link
Contributor

@catboxanon catboxanon commented May 1, 2025

This PR adds a multipass variant of Euler (+ ancestral, CFG++) sampling. Originally written by @aria1th (Ref), CFG++ support written by @LaVie024, and standard Euler support written by myself. Permission has been granted by both (co-)authors.

The gist of this sampler is that it performs more sampling steps for an (optionally) specified range of sigma values. The primary intent of this is to improve sampling quality at resolutions higher than that which the model was trained on.

Basic example below using a SDXL model, generated at a resolution of 1536x1536 (normally 1024x1024 would be expected).

Euler CFG++ Euler Multipass CFG++
1 2

ComfyUI technically is already capable of doing this by splitting sampling across sampler nodes (see workflow in #6183), but this wraps up this functionality into a convenient accessible sampler.

Co-authored-by: AngelBottomless <aria1th@naver.com>
Co-authored-by: LaVie024 <62406970+LaVie024@users.noreply.github.com>
@blepping
Copy link
Contributor

blepping commented May 1, 2025

Looks interesting but it might make more sense to do this as a scheduler thing instead? Then it could work with any (or most, anyway) samplers. A node that takes/returns SIGMAS and has parameters for start step, end step and expansion factor would be pretty easy to implement.

Unless I'm missing something you could do this internally if you still wanted to implement it as a sampler. Have a common function to adjust the schedule and then just delegate to the normal sampler function, that way you won't have to duplicate a bunch existing Euler sampler code.

@LaVie024
Copy link
Contributor

LaVie024 commented May 1, 2025

Looks interesting but it might make more sense to do this as a scheduler thing instead? Then it could work with any (or most, anyway) samplers. A node that takes/returns SIGMAS and has parameters for start step, end step and expansion factor would be pretty easy to implement.

Unless I'm missing something you could do this internally if you still wanted to implement it as a sampler. Have a common function to adjust the schedule and then just delegate to the normal sampler function, that way you won't have to duplicate a bunch existing Euler sampler code.

I think the final line in this PR does state why to do it as a sampler; because it is just a simple, one-click solution that has generally sane defaults for what it's original intention by AngelBottomless was. I could at least work on a separate PR to allow this to be done with any sampler via a node, but since Euler is so commonly used as a sampler, especially in Illustrious-based models now, it makes sense to at least have a default setup for an Euler Multistep implementation.

@blepping
Copy link
Contributor

blepping commented May 1, 2025

I think the final line in this PR does state why to do it as a sampler; because it is just a simple, one-click solution that has generally sane defaults for what it's original intention by AngelBottomless was.

Right now, it's something that would be very complicated to do manually. You'd need three separate sampler nodes, a several nodes to slice up sigmas, you'd have to manually calculate the slice points. Not sure how you'd even do the expansion part. It's pretty far beyond what a normal user would be capable of, and probably too much of a pain for advanced users to bother with.

What I was proposing is a node that just can expand a range of sigmas. You could even have the SIGMAS input optional and include widgets for generating sigmas in the node if you wanted. This would add one node to a normal custom sampling (using SamplerCustom, etc) workflow.

By the way, this isn't "multistep" like res_multistep and a few other samplers that exist which have actual different logic for sampling. This is only expanding a range of sigmas in the schedule, all the normal Euler sampler logic is the same as what exists.

@catboxanon catboxanon marked this pull request as draft May 1, 2025 13:56
@catboxanon
Copy link
Contributor Author

Closing in favor of #7901. Thanks for the suggestion, @blepping.

@catboxanon catboxanon closed this May 1, 2025
@catboxanon catboxanon deleted the feat/multipass branch May 2, 2025 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants