Skip to content

Add node to extend sigmas#7901

Merged
comfyanonymous merged 4 commits intoComfy-Org:masterfrom
catboxanon:feat/expand-sigmas
May 2, 2025
Merged

Add node to extend sigmas#7901
comfyanonymous merged 4 commits intoComfy-Org:masterfrom
catboxanon:feat/expand-sigmas

Conversation

@catboxanon
Copy link
Contributor

@catboxanon catboxanon commented May 1, 2025

This PR adds a node that will extend the sigma values for a given sigma range. This is exactly identical functionality to #7890 but now applicable to any sampler -- see that PR for more details.

@liesened
Copy link
Contributor

liesened commented May 1, 2025

Personally I don't agree on the naming, it's sort of out of place. I'd suggest renaming a bunch of things:

  • expand -> extend
  • ExpandSigmas -> ExtendIntermediateSigmas
  • sigma_max -> start_at_sigma
  • sigma_min -> end_at_sigma
  • expanded_sigmas -> extended_sigmas

Also, I'd like to detach the interpolation space from the actual interpolation function, and introduce spacing input. This will make interpolating between steps using different functions easier to implement.

...

interpolator = {
    'linear': lambda x: x
    'cosine': lambda x: torch.sin(x*math.pi/2)
    'sine':   lambda x: 1 - torch.cos(x*math.pi/2)
}[spacing]

# linear space for our interpolation function
x = torch.linspace(0, 1, steps + 1)[1:-1]

for i in range(len(sigmas) - 1):

    ...

    if start_at_sigma <= sigma_current <= end_at_sigma:
        interpolated_steps = interpolator(x) * (sigma_next - sigma_current) + sigma_current
        extended_sigmas.extend(interpolated_steps.tolist())

...

Co-authored-by: liesen <liesen.dev@gmail.com>
@catboxanon catboxanon changed the title Add ExpandSigmas node Add node to extend sigmas May 1, 2025
@comfyanonymous comfyanonymous merged commit 551fe8d into Comfy-Org:master May 2, 2025
5 checks passed
@catboxanon catboxanon deleted the feat/expand-sigmas branch May 2, 2025 11:53
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