-
Notifications
You must be signed in to change notification settings - Fork 6
Description
I'm confused about the transition of CFG to CFG++ in some sampler cases.
Some samplers, such as iPNDM, extend euler and do the noise combination based on ODE/SDE or other methods during the sampling.
In euler, we have these:
x_next = denoised + d * sigmas[i + 1]
# Or k-diffusion style
dt = sigmas[i + 1] - sigmas[i]
x_next = x + d * dt
For example, a order-2 iPNDM sampling could be:
d_mix = (3 * d_curr - d_last) / 2
dt = sigmas[i + 1] - sigmas[i]
x_next = x + d_mix * dt
If we want to convert this to the CFG++ version, it might have different ways to consider.
The first one is considering the d_mix to be the whole noise in the current step.
denoised_mix = x - d_mix * sigmas[i]
x_next = denoised_mix + d_mix * sigmas[i + 1]
Since the latter term is renoising process, we just need to replace it with unconditional noise combination for CFG++.
Another one is trying to keep a denoised as the first term in the equation.
denoised = x - d_curr * sigmas[i]
x_next = denoised - 0.5 * (d_curr - d_last) * sigmas[i] + d_mix * sigmas[i + 1]
After we have the first term, we could convert the rest of terms to the unconditional ones. This might be more like the process that only keeps the first term with conditional one.
I wonder which one would be more proper transition for those samplers?