huggingface / huggingface/diffusers
Implementation error of v_prediction in eulara and eular
- Dominant language
- Python
- Stars
- 34.5k
- Forks
- 7.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 91
Description
I came across a potential inconsistency in the implementation of v_prediction within the Euler scheduler when examining the source code. Specifically, in the computation of pred_original_sample, the formula is given as:
`pred_original_sample = model_output * (-sigma / (sigma**2 + 1) ** 0.5) + (sample / (sigma**2 + 1))`
Where sigma is calculated as:
`sigmas = np.array(((1 - self.alphas_cumprod) / self.alphas_cumprod) ** 0.5)`
Substituting the definition of sigma into the equation for pred_original_sample, we arrive at:
`pred_original_sample = sample * alphas_cumprod - model_output * ((1-alphas_cumprod) ** 0.5)`
Here, it appears that `sample * alphas_cumprod` is missing a square root operation on `alphas_cumprod`. Shouldn't this be `sample * (alphas_cumprod**0.5)`? This seems to be an inconsistency, especially considering that in the DDIM scheduler as in
`(alpha_prod_t**0.5) * sample - (beta_prod_t**0.5) * model_output`.
Could this be an error?
Contributor guide
Assessment
This issue has not been assessed yet.