yang-song / score_sde_pytorch

PyTorch implementation for Score-Based Generative Modeling through Stochastic Differential Equations (ICLR 2021, Oral)
https://arxiv.org/abs/2011.13456
Apache License 2.0
1.59k stars 294 forks source link

Why 999 must be multiplied when calculating score? #11

Open vrvrv opened 2 years ago

vrvrv commented 2 years ago

Hi,

I have some question on your code.

https://github.com/yang-song/score_sde_pytorch/blob/1618ddea340f3e4a2ed7852a0694a809775cf8d0/models/utils.py#L146-L159

When computing the score matching loss, it seems that you post process the output of model(A score model). But it doesn't make sense for me to multiplying 999 to t and doing scaling score = - score / std while you use the output of model on reverse(sampling) process.

https://github.com/yang-song/score_sde_pytorch/blob/1618ddea340f3e4a2ed7852a0694a809775cf8d0/sde_lib.py#L95-L97

Am I missing something?

yang-song commented 2 years ago

I did those just to make sure it matches the implementation of DDPM. They are by no means natural, and are also not necessary.