项目场景:
Semantic Role Labeling使用BiLSTM-crf
pytorch环境
问题描述
训练
def forward(self, x, poses, rels, sent_lengths):
mask = torch.ne(x, self.pad_index)
emissions = self.lstm_forward(x, poses, rels, sent_lengths)
return self.crflayer.decode(emissions, mask=mask)
原因分析:
pytorch-crf版本问题
解决方案:
pip install -U -i https://pypi.tuna.tsinghua.edu.cn/simple pytorch-crf==0.7.0
本文介绍了一个使用BiLSTM-CRF进行语义角色标注的项目,详细展示了如何在PyTorch环境中实现这一模型,并解决了在集成pytorch-crf过程中遇到的版本问题。
2262

被折叠的 条评论
为什么被折叠?



