-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
算loss的时候求均值的时候是不是可以优化 #51
Comments
肯定可以的 |
我想在tensorboard中同时显示rrhf_loss和sft_loss的loss曲线,在哪里添加呀? |
这里的
|
length永远是正的 |
是啊,length是正的,但是logit_label.sum(-1)是经过F.log_softmax()的,所以一定是负数,那负数➗更大的值,不是scores会增大吗?比如-2/1和-2/2 |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我看到在sft_loss 的时候直接求了平均,平均的分母是样本label的长度,包括不参与训练的,是否应该采用mask mean 就像:
item = -logit_label[max_idx]
return -torch.sum(item)/ torch.sum(labels!=-100)。##因为在gather_logits_labels 这一步把-100的prob已经变成0了
而不是-logit_label[max_idx].mean()
The text was updated successfully, but these errors were encountered: