使用lm模型运行/re/standard进行预测
Describe the question
A clear and concise description of what the question is. 您好,预测阶段是不使用head和tail的offset信息,这样句子如果复杂,head或者tail如果多次出现,则会造成训练阶段和预测阶段不一致。如果我想修改让预测阶段也使用offset的信息,应该修改哪个文件。
Environment (please complete the following information):
- OS: [e.g. mac / window]
- Python Version [e.g. 3.6]
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
你好,predict.py的31行已经对offset信息进行处理,所以只需对45行函数_get_predict_instance进行修改,添加头尾实体offset信息即可
你好,predict.py的31行已经对offset信息进行处理,所以只需对45行函数_get_predict_instance进行修改,添加头尾实体offset信息即可
找到预测阶段应该使用offset的位置了,在https://github.com/zjunlp/DeepKE/blob/e4501db33d5756586334275508fce5ca4e41003a/src/deepke/relation_extraction/standard/tools/preprocess.py文件的123行, sent = sent.replace(d['head'], d['head_type'], 1).replace(d['tail'], d['tail_type'], 1) 这里没利用offset信息来让head_type替换head,tail_type来替换tail.这样的话,永远是排在第一个查找到的信息被替换。我看预测阶段的预处理是这样,还没找到训练阶段对应的代码,查看训练阶段是否使用offset的信息来替换。
对数据处理都是在那个preprocess.py里,可以根据需要自行修改