In diffusion models, the distribution used to sample training timesteps can significantly affect model quality. Rather than sampling timesteps uniformly from [0, 1], a logit-normal distribution can concentrate training on more informative noise levels.
The logit-normal distribution is defined on the interval (0, 1) and is parameterized by a mean and standard deviation of an underlying normal distribution. Samples are generated by first drawing from a normal distribution and then applying a transformation that maps real-valued samples into the (0, 1) interval. The name "logit-normal" hints at the relationship between the logistic function and the normal distribution.
Write a function logit_normal_timesteps(num_samples, mean, std, seed) that:
num_samples timestep values from a logit-normal distributionmean and std as the mean and standard deviation of the underlying normal distributionnp.random.seed(seed) for reproducibility(num_samples,) with all values in (0, 1)