ShannonAI / mrc-for-flat-nested-ner

Code for ACL 2020 paper `A Unified MRC Framework for Named Entity Recognition`
657 stars 117 forks source link

How to do inference? #60

Open 447428054 opened 3 years ago

447428054 commented 3 years ago

@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

ghost commented 3 years ago

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

ogunoz commented 3 years ago

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.

gouhaogou commented 3 years ago

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

xiaoya-li commented 3 years ago

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