BalancedMSE icon indicating copy to clipboard operation
BalancedMSE copied to clipboard

about GAILoss

Open luxianlebron opened this issue 2 years ago • 1 comments

Thank you for your work.

gmm = {k: gmm[k].reshape(1, -1).expand(pred.shape[0], -1) for k in gmm}
mse_term = F.mse_loss(pred, target, reduction='none') / 2 / noise_var + 0.5 * noise_var.log()
sum_var = gmm['variances'] + noise_var
balancing_term = - 0.5 * sum_var.log() - 0.5 * (pred - gmm['means']).pow(2) / sum_var + gmm['weights'].log()
balancing_term = torch.logsumexp(balancing_term, dim=-1, keepdim=True)

when I use gai loss, my pred size is [128], but the data of gmm is [128, 8] after expand. How I solve this, looking forward to your recovery

luxianlebron avatar Oct 13 '22 14:10 luxianlebron

I tried this: image

is this work? when I use this,model training fails to converge

luxianlebron avatar Oct 13 '22 14:10 luxianlebron

Sorry for the late reply. You may try adding a new dimension to pred by pred = pred.unsqueeze(-1).

jiawei-ren avatar Nov 24 '22 05:11 jiawei-ren

@luxianlebron, I also met the same problem. Did you find the way to let model converge?

jimmy133719 avatar Jan 18 '23 15:01 jimmy133719