cmu-multinlp icon indicating copy to clipboard operation
cmu-multinlp copied to clipboard

NotImplementedError raised when predicting on batches

Open karths8 opened this issue 5 years ago • 0 comments

I want to predict on single sentences using the multinlp pretrained model on SRL using this command

allennlp predict model.tar.gz ner-examples.jsonl --include-package brat_multitask --cuda-device 0 --predictor brat --weights-file best.th --output-file out.json

Unfortunately, I receive a NotImplementedError raised as follows:

Traceback (most recent call last):
  File "/home/karthik/anaconda3/envs/spanrel/bin/allennlp", line 8, in <module>
    sys.exit(run())
  File "/home/karthik/anaconda3/envs/spanrel/lib/python3.6/site-packages/allennlp/run.py", line 18, in run
    main(prog="allennlp")
  File "/home/karthik/anaconda3/envs/spanrel/lib/python3.6/site-packages/allennlp/commands/__init__.py", line 102, in main
    args.func(args)
  File "/home/karthik/anaconda3/envs/spanrel/lib/python3.6/site-packages/allennlp/commands/predict.py", line 204, in _predict
    manager.run()
  File "/home/karthik/anaconda3/envs/spanrel/lib/python3.6/site-packages/allennlp/commands/predict.py", line 183, in run
    for model_input_json, result in zip(batch_json, self._predict_json(batch_json)):
  File "/home/karthik/anaconda3/envs/spanrel/lib/python3.6/site-packages/allennlp/commands/predict.py", line 129, in _predict_json
    results = [self._predictor.predict_json(batch_data[0])]
  File "/home/karthik/anaconda3/envs/spanrel/lib/python3.6/site-packages/allennlp/predictors/predictor.py", line 57, in predict_json
    instance = self._json_to_instance(inputs)
  File "/home/karthik/anaconda3/envs/spanrel/lib/python3.6/site-packages/allennlp/predictors/predictor.py", line 104, in _json_to_instance
    raise NotImplementedError
NotImplementedError

Any fix for this? (allennlp 0.8.4)

karths8 avatar Aug 26 '20 13:08 karths8