I use the model to predict named entities for new dataset but encounters the following problem:
Traceback (most recent call last):
File "scirex/predictors/predict_ner.py", line 123, in
main()
File "scirex/predictors/predict_ner.py", line 119, in main
predict(archive_folder, test_file, output_file, cuda_device)
File "scirex/predictors/predict_ner.py", line 35, in predict
instances = dataset_reader.read(test_file)
File "/home/jttang/.conda/envs/scirex_wpc/lib/python3.7/site-packages/allennlp/data/dataset_readers/dataset_reader.py", line 134, in read
instances = [instance for instance in Tqdm.tqdm(instances)]
File "/home/jttang/.conda/envs/scirex_wpc/lib/python3.7/site-packages/allennlp/data/dataset_readers/dataset_reader.py", line 134, in
instances = [instance for instance in Tqdm.tqdm(instances)]
File "/home/jttang/.conda/envs/scirex_wpc/lib/python3.7/site-packages/tqdm/_tqdm.py", line 1005, in iter
for obj in iterable:
File "/dat01/jttang/wpc/information_extraction/SciREX/SciREX/scirex/data/dataset_readers/scirex_full_reader.py", line 148, in _read
json_dict = clean_json_dict(json_dict)
File "/dat01/jttang/wpc/information_extraction/SciREX/SciREX/scirex/data/dataset_readers/scirex_full_reader.py", line 34, in clean_json_dict
entities: List[Tuple[int, int, BaseEntityType]] = json_dict["ner"]
KeyError: 'ner'
You mentioned new dataset only needs "doc_id","words","sentences","sections" fileds,but the code requires "ner" field. Could you show me some solutions, Thanks.
I use the model to predict named entities for new dataset but encounters the following problem: Traceback (most recent call last): File "scirex/predictors/predict_ner.py", line 123, in
main()
File "scirex/predictors/predict_ner.py", line 119, in main
predict(archive_folder, test_file, output_file, cuda_device)
File "scirex/predictors/predict_ner.py", line 35, in predict
instances = dataset_reader.read(test_file)
File "/home/jttang/.conda/envs/scirex_wpc/lib/python3.7/site-packages/allennlp/data/dataset_readers/dataset_reader.py", line 134, in read
instances = [instance for instance in Tqdm.tqdm(instances)]
File "/home/jttang/.conda/envs/scirex_wpc/lib/python3.7/site-packages/allennlp/data/dataset_readers/dataset_reader.py", line 134, in
instances = [instance for instance in Tqdm.tqdm(instances)]
File "/home/jttang/.conda/envs/scirex_wpc/lib/python3.7/site-packages/tqdm/_tqdm.py", line 1005, in iter
for obj in iterable:
File "/dat01/jttang/wpc/information_extraction/SciREX/SciREX/scirex/data/dataset_readers/scirex_full_reader.py", line 148, in _read
json_dict = clean_json_dict(json_dict)
File "/dat01/jttang/wpc/information_extraction/SciREX/SciREX/scirex/data/dataset_readers/scirex_full_reader.py", line 34, in clean_json_dict
entities: List[Tuple[int, int, BaseEntityType]] = json_dict["ner"]
KeyError: 'ner'
You mentioned new dataset only needs "doc_id","words","sentences","sections" fileds,but the code requires "ner" field. Could you show me some solutions, Thanks.