apmoore1 / target-extraction

Target based extraction
https://apmoore1.github.io/target-extraction/
Apache License 2.0
4 stars 1 forks source link

Batch non-homogeneous instances error #5

Open apmoore1 opened 5 years ago

apmoore1 commented 5 years ago

This error:

allennlp.common.checks.ConfigurationError: 'You cannot construct a Batch with non-homogeneous Instances.

Is occurring due to the TargetSentiment dataset reader returning batches where some have instances that do contain categories where as others do not contain categories. This is all due to the dataset reader being too flexible with what it allows the dataset to contain and what it takes from it. The get around for now is too specify if you want the categories or not, however there will be issues the other way if you want to predict categories only and sometimes it has targets and sometimes it does not.

Therefore the optimal solution to this would probably see if they exist in the instance and if not create an empty field to get around the issue and pass the problem downstream to the model(s).