dwadden / dygiepp

Span-based system for named entity, relation, and event extraction.
MIT License
575 stars 120 forks source link

KeyError: 'None__ner_labels' when predicting on new dataset. #49

Closed muguruzawang closed 3 years ago

muguruzawang commented 3 years ago

I encounter the problem KeyError: 'None__ner_labels', when I try to use dygiepp to predict on new dataset. The following is the detail:

Traceback (most recent call last): File "/home/wangpancheng/anaconda3/envs/dygiepp/bin/allennlp", line 8, in sys.exit(run()) File "/home/wangpancheng/anaconda3/envs/dygiepp/lib/python3.7/site-packages/allennlp/main.py", line 34, in run main(prog="allennlp") File "/home/wangpancheng/anaconda3/envs/dygiepp/lib/python3.7/site-packages/allennlp/commands/init.py", line 118, in main args.func(args) File "/home/wangpancheng/anaconda3/envs/dygiepp/lib/python3.7/site-packages/allennlp/commands/predict.py", line 220, in _predict manager.run() File "/home/wangpancheng/anaconda3/envs/dygiepp/lib/python3.7/site-packages/allennlp/commands/predict.py", line 187, in run for model_input_instance, result in zip(batch, self._predict_instances(batch)): File "/home/wangpancheng/anaconda3/envs/dygiepp/lib/python3.7/site-packages/allennlp/commands/predict.py", line 146, in _predict_instances results = [self._predictor.predict_instance(batch_data[0])] File "/serverData2/wangpancheng/wpc/dygiepp/dygie/predictors/dygie.py", line 56, in predict_instance prediction = model.make_output_human_readable(model(model_input)).to_json() File "/home/wangpancheng/anaconda3/envs/dygiepp/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, *kwargs) File "/serverData2/wangpancheng/wpc/dygiepp/dygie/models/dygie.py", line 239, in forward spans, span_mask, span_embeddings, sentence_lengths, ner_labels, metadata) File "/home/wangpancheng/anaconda3/envs/dygiepp/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(input, kwargs) File "/serverData2/wangpancheng/wpc/dygiepp/dygie/models/ner.py", line 90, in forward scorer = self._ner_scorers[self._active_namespace] File "/home/wangpancheng/anaconda3/envs/dygiepp/lib/python3.7/site-packages/torch/nn/modules/container.py", line 286, in getitem return self._modules[key] KeyError: 'None__ner_labels'

dwadden commented 3 years ago

Did you get this working? The instructions here should help, let me know if you're still stuck.