如何使用带有注意力的 BiLSTM 实现这个模型?

问题描述 投票:0回答:0

我有一个数据集,数据集中的每个样本都是 ,答案可能在文档中,现在,我想使用 BiLSTM 实现模型并注意。

模型有两个输入层,一层是问题层,另一层是documnet层。

模型输出层应该预测文档中的每个单词是否是答案的开始和结束

例如,给定一个问题作为输入: “谁发现了海王星?”

给定文档作为输入: “根据 Urbain Le Verrier 的预测,1846 年 9 月 23 日至 24 日晚上进行的望远镜观测证实了一颗大行星的存在”

问题的答案是“Urbain Le Verrier”

the output layer predict first word “with” is not start word or end of answer
the output layer predict first word “a” is not start word or end of answer
the output layer predict first word “prediction” is not start word or end of answer
the output layer predict first word “by” is not start word or end of answer
the output layer predict first word “Urbain” is start word of answer
the output layer predict first word “Le” is not start word or end of answer
the output layer predict first word “Verrier” is end word of answer

如何使用带有注意力的 BiLSTM 实现这个模型?

pytorch nlp
© www.soinside.com 2019 - 2024. All rights reserved.