【问题标题】:is SOP(sentence order prediction) implemented?是否实施了 SOP(句序预测)?
【发布时间】:2020-05-14 14:13:45
【问题描述】:

我正在查看Huggingface 的Albert 版本。

但是,我找不到任何关于 SOP 的代码或评论。

我可以从modeling_from src/transformers/modeling_bert.py找到NSP(Next Sentence Prediction)实现。

if masked_lm_labels is not None and next_sentence_label is not None:
    loss_fct = CrossEntropyLoss()
    masked_lm_loss = loss_fct(prediction_scores.view(-1, self.config.vocab_size), masked_lm_labels.view(-1))
    next_sentence_loss = loss_fct(seq_relationship_score.view(-1, 2), next_sentence_label.view(-1))
    total_loss = masked_lm_loss + next_sentence_loss
    outputs = (total_loss,) + outputs

SOP 是从这里继承的,带有 SOP 风格的标签吗?或者我有什么遗漏吗?

【问题讨论】:

    标签: huggingface-transformers


    【解决方案1】:

    句子顺序损失为here

    sentence_order_loss = loss_fn(y_true=sentence_order_label, y_pred=sentence_order_reduced_logits)
    

    这只是一个交叉熵损失。

    【讨论】:

      猜你喜欢
      • 2021-09-25
      • 1970-01-01
      • 1970-01-01
      • 2010-10-29
      • 1970-01-01
      • 2012-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多