zoubohao / DenoisingDiffusionProbabilityModel-ddpm-

This may be the simplest implement of DDPM. You can directly run Main.py to train the UNet on CIFAR-10 dataset and see the amazing process of denoising.
MIT License
1.48k stars 156 forks source link

Did you repeat the square operation? #12

Closed XueruiSu closed 1 year ago

XueruiSu commented 1 year ago

image F.mseloss can do the square operation, so may we not need to do the "**2." operation? image the position of the code is in the file named TrainCondition.py on the directory of DiffusionFreeGuidence

zoubohao commented 1 year ago

hhhhh, the 2 is for "b", batch size, not for the loss. Since the reduction parameter in F.mse_loss sets None, then the loss would be huge if we only use .sum()..... It is difficult for training and I prefer to use .sum() than .mean(). b 2 is used to control the scale of loss.

XueruiSu commented 1 year ago

thanks for reply