Skip to content

Navigation Menu

Sign in
Sign up
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Clipping values between -1 to 1 in the DDPM/DDIM scheduler. #492

Discussion options

Hello, hope you are doing well

pred_original_sample = torch.clamp(pred_original_sample, -1, 1)

In this line, the sample is clipped between -1 to 1. However, in the tutorials, the values were normalized from 0 to 255 to 0 to 1. Is there any specific reason why the sampling was clipped between -1 to 1?

If the dataset is normalized between 0 to 1, the predicted sample should also be clipped from 0 to 1. I would love to hear your opinion.

You must be logged in to vote

I agree that the clipping value should be an argument. So far I haven't found a sound explanation as to why the prediction must be clipped (this comes from the SD implementation). It seems to make things more stable (especially for direct sample prediction). In latent diffusion models, it does not make sense to clip between -1 and 1 because the range of the latents should be ~ Gaussian (which are way below -1 and over 1). I have trained without clipping and still managed to get good results, which makes me think that, for noise prediction, clipping between -1 and 1 should not make it very different from clipping between 0 and 1. Nonetheless, I will allow for min and max clipping value spe...

Replies: 2 comments

Comment options

me and @virginiafdez talked about allowing the user to pass the clipping values as args, i think this would solve the issue

You must be logged in to vote
0 replies
Comment options

I agree that the clipping value should be an argument. So far I haven't found a sound explanation as to why the prediction must be clipped (this comes from the SD implementation). It seems to make things more stable (especially for direct sample prediction). In latent diffusion models, it does not make sense to clip between -1 and 1 because the range of the latents should be ~ Gaussian (which are way below -1 and over 1). I have trained without clipping and still managed to get good results, which makes me think that, for noise prediction, clipping between -1 and 1 should not make it very different from clipping between 0 and 1. Nonetheless, I will allow for min and max clipping value specifications in an issue.

You must be logged in to vote
0 replies
Answer selected by Ahmad-Omar-Ahsan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /