We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
作者您好,在documents/pretraining/Causal LM for Continual Pre-training.md里面,有这样一句话输入时只需要直接将input_ids复制一份为label即可,麻烦问一下因为在计算loss的时候,label需要左移一位,那么这个操作是在哪一部分被完成的呢,是在trainer里面吗,可是trainer如何知道是causal loss呢
documents/pretraining/Causal LM for Continual Pre-training.md
输入时只需要直接将input_ids复制一份为label即可
The text was updated successfully, but these errors were encountered:
这部分操作是在模型的forward中实现。详见这里:https://github.com/HugAILab/HugNLP/blob/main/models/language_modeling/causal_lm.py 的122行
# Shift so that tokens < n predict n shift_logits = lm_logits[..., :-1, :].contiguous() shift_labels = labels[..., 1:].contiguous() # print("shift_labels=", shift_labels) # Flatten the tokens loss_fct = CrossEntropyLoss() loss = loss_fct(shift_logits.view(-1, shift_logits.size(-1)), shift_labels.view(-1))
Sorry, something went wrong.
No branches or pull requests
作者您好,在
documents/pretraining/Causal LM for Continual Pre-training.md
里面,有这样一句话输入时只需要直接将input_ids复制一份为label即可
,麻烦问一下因为在计算loss的时候,label需要左移一位,那么这个操作是在哪一部分被完成的呢,是在trainer里面吗,可是trainer如何知道是causal loss呢The text was updated successfully, but these errors were encountered: