buxiangzhiren / Asymmetric_VQGAN

MIT License
222 stars 9 forks source link

About the loss is normalized with batch size #7

Open JamesHao-ml opened 1 year ago

JamesHao-ml commented 1 year ago

Thanks for open sourcing the awesome work. However I find that the nll_loss is averaged over batch size, which means that it is summed over all pixels and channels. I have tried training and found the loss is very large. Is it a typo or intended? Thanks.

https://github.com/buxiangzhiren/Asymmetric_VQGAN/blob/406c5cd2e86b3e9565795cc5cd1e3aab304b1a44/ldm/modules/losses/contperceptual.py#L58C14-L58C14