pytorch-lightning-vae icon indicating copy to clipboard operation
pytorch-lightning-vae copied to clipboard

the value of loss is negtive

Open severous opened this issue 4 years ago • 1 comments

I found the value of loss became negtive when training the model in my dataset.I hope you can give me a help

severous avatar Mar 22 '21 07:03 severous

I think the value of the loss is negative because in fact they are logging the negative elbo. Remember that elbo function is the evidence lower bound which is reconstruction loss - kl divergence. Since pytorch lightning does a minimization, they denote elbo with kl divergence - loss which is the opposite. In fact, you want to train the model using the original elbo function, that is, rec_loss - kl then you should maximize it. That's why you see the elbo in their implementation ends up being negative.

rafshar95 avatar Jul 16 '21 22:07 rafshar95