Karras Sigma Schedule
Problem Statement
The EDM / Karras samplers parameterize diffusion by noise level sigma instead of a discrete beta schedule, and place the sampling sigmas on a warped grid controlled by rho. Build that schedule.
Background
Karras et al. (2022) define N sampling steps whose sigmas interpolate between sigma_max and sigma_min in a rho-warped space (higher rho concentrates steps near sigma_min):
σi=(σmax1/ρ+N−1i(σmin1/ρ−σmax1/ρ))ρ,i=0,…,N−1
so sigma_0 = sigma_max and sigma_{N-1} = sigma_min. A final sigma = 0 is appended for the last denoising jump to a clean sample.
Your Task
Implement:
def karras_sigmas(N, sigma_min, sigma_max, rho=7.0):
Return a list of N + 1 sigmas (the N warped values followed by 0.0), rounded to 4 decimals.
Input Format
- N (int): number of sampling steps, N >= 2.
- sigma_min, sigma_max (float): 0 < sigma_min < sigma_max.
- rho (float): warp exponent.
Output Format
- A list of N + 1 floats rounded to 4 decimals.
Sample
print(karras_sigmas(3, 0.1, 10.0, 7.0))
Output:
[10.0, 1.4507, 0.1, 0.0]
Example:
print(karras_sigmas(3, 0.1, 10.0, 7.0))
[10.0, 1.4507, 0.1, 0.0]
Endpoints are sigma_max=10 and sigma_min=0.1; the middle sigma is the midpoint in 1/rho space raised back to rho, giving 1.4507; a trailing 0.0 is appended.
Constraints:
N >= 2,0 < sigma_min < sigma_max,rho > 0.- Interpolate in
sigma^{1/rho}space, then raise torho. - Append a trailing
0.0; round to 4 decimals.