You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the prediction step, if the input file contains only one sentence, it results in an error. For example, after all the preprocess was applied to the AMR 2.0 (LDC2017T10) data (following the steps in README.md), there will be a preprocessed test data file test.preproc in data/AMR/amr_2.0/ directory. However, if I removed all the "paragraphs" (that is, a pair of "comments" (including id, snt, and tags etc.) and AMR graph) except for the first paragraph from the file, and then apply the "6. Prediction" phase, the program shows the following error:
Traceback (most recent call last):
File ".../anaconda/envs/stog/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File ".../anaconda/envs/stog/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File ".../stog/stog/commands/predict.py", line 252, in <module>
_predict(args)
File ".../stog/stog/commands/predict.py", line 208, in _predict
manager.run()
File ".../stog/stog/commands/predict.py", line 182, in run
for model_input_instance, result in zip(batch, self._predict_instances(batch)):
File ".../stog/stog/commands/predict.py", line 143, in _predict_instances
results = [self._predictor.predict_instance(batch_data[0])]
File ".../stog/stog/predictors/predictor.py", line 46, in predict_instance
outputs = self._model.forward_on_instance(instance)
File ".../stog/stog/models/model.py", line 117, in forward_on_instance
raise NotImplementedError
NotImplementedError
This error occurs whenever input file with only one AMR paragraph was given to --input-file option of stog.commands.predict module. Also, if the input file contains more than two paragraphs, this error doesn't seem to be happening.
The text was updated successfully, but these errors were encountered:
For some reason, thre's an if statment in stog/commands/predict.py::_predict_instances() (about line 141) that sends the code on a different path if your batch_data size is 1 (ie.. only one sentence). The stog model doesn't have that code implemented. I'm not sure if there is still a valid reason for this but it appear to work if you comment-out the if/else.
Here's the revised function....
def _predict_instances(self, batch_data: List[Instance]) -> Iterator[str]:
# removed - doesn't work for single instance of batch data.
#if len(batch_data) == 1:
# results = [self._predictor.predict_instance(batch_data[0])]
#else:
results = self._predictor.predict_batch_instance(batch_data)
for output in results:
yield self._predictor.dump_line(output)
At the prediction step, if the input file contains only one sentence, it results in an error. For example, after all the preprocess was applied to the AMR 2.0 (LDC2017T10) data (following the steps in README.md), there will be a preprocessed test data file
test.preproc
indata/AMR/amr_2.0/
directory. However, if I removed all the "paragraphs" (that is, a pair of "comments" (including id, snt, and tags etc.) and AMR graph) except for the first paragraph from the file, and then apply the "6. Prediction" phase, the program shows the following error:This error occurs whenever input file with only one AMR paragraph was given to
--input-file
option ofstog.commands.predict
module. Also, if the input file contains more than two paragraphs, this error doesn't seem to be happening.The text was updated successfully, but these errors were encountered: