ShannonAI / mrc-for-flat-nested-ner

Code for ACL 2020 paper `A Unified MRC Framework for Named Entity Recognition`

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to do inference?

447428054 opened this issue · comments

@YuxianMeng @littlesulley需要得到预测的结果,是改写trainer里面的test函数嘛?
之后报个错
result = trainer.test(model=model, test_dataloaders=model.test_dataloader())
print(result)

ValueError: Dataloader returned 0 length. Please make sure that your Dataloader at least returns 1 batch

我自己写了个inference函数,不知道是否有帮到你~
https://github.com/HsiaYu/mrc-for-flat-nested-ner/blob/master/inference.py

Is there an update about how to do inference? the link you shared is not reachable. Either it is a private repo or the link is not correct.

你好,请问你有预测代码吗

Hi~ Thanks for asking.
We update the codebase and code for inference using the trained MRC-NER model can be found in https://github.com/ShannonAI/mrc-for-flat-nested-ner/blob/master/inference.py

  1. The inference script for flat NER can be found at https://github.com/ShannonAI/mrc-for-flat-nested-ner/blob/master/scripts/flat_inference.sh
  2. The inference script for nested NER can be found at https://github.com/ShannonAI/mrc-for-flat-nested-ner/blob/master/scripts/nested_inference.sh