BatsResearch/wiser

TypeError: ArrayField.empty_field: return type `None` is not a `<class 'allennlp.data.fields.field.Field'>

anjani-dhrangadhariya opened this issue · 0 comments

I get this error upon importing the generative model from wiser.generative import Model

Could this be because of the older implementation of AllenNLP? wiser uses allennlp 0.8.4.

Traceback below:

Traceback (most recent call last):
  File "temp.py", line 7, in <module>
    from wiser.generative import Model
  File "/home/wiser/wiser/generative/__init__.py", line 1, in <module>
    from .util import *
  File "/home/wiser/wiser/generative/util.py", line 3, in <module>
    from wiser.eval import score_predictions
  File "/home/wiser/wiser/eval/__init__.py", line 1, in <module>
    from .util import *
  File "/home/wiser/wiser/eval/util.py", line 4, in <module>
    from allennlp.data import Instance
  File "/home/pico/lib/python3.8/site-packages/allennlp/data/__init__.py", line 1, in <module>
    from allennlp.data.dataset_readers.dataset_reader import DatasetReader
  File "/home/pico/lib/python3.8/site-packages/allennlp/data/dataset_readers/__init__.py", line 10, in <module>
    from allennlp.data.dataset_readers.ccgbank import CcgBankDatasetReader
  File "/home/pico/lib/python3.8/site-packages/allennlp/data/dataset_readers/ccgbank.py", line 9, in <module>
    from allennlp.data.dataset_readers.dataset_reader import DatasetReader
  File "/home/pico/lib/python3.8/site-packages/allennlp/data/dataset_readers/dataset_reader.py", line 8, in <module>
    from allennlp.data.instance import Instance
  File "/home/pico/lib/python3.8/site-packages/allennlp/data/instance.py", line 3, in <module>
    from allennlp.data.fields.field import DataArray, Field
  File "/home/pico/lib/python3.8/site-packages/allennlp/data/fields/__init__.py", line 7, in <module>
    from allennlp.data.fields.array_field import ArrayField
  File "/home/pico/lib/python3.8/site-packages/allennlp/data/fields/array_field.py", line 10, in <module>
    class ArrayField(Field[numpy.ndarray]):
  File "/home/pico/lib/python3.8/site-packages/allennlp/data/fields/array_field.py", line 51, in ArrayField
    def empty_field(self):  # pylint: disable=no-self-use
  File "/home/pico/lib/python3.8/site-packages/overrides/overrides.py", line 83, in overrides
    return _overrides(method, check_signature, check_at_runtime)
  File "/home/pico/lib/python3.8/site-packages/overrides/overrides.py", line 170, in _overrides
    _validate_method(method, super_class, check_signature)
  File "/home/pico/lib/python3.8/site-packages/overrides/overrides.py", line 189, in _validate_method
    ensure_signature_is_compatible(super_method, method, is_static)
  File "/home/pico/lib/python3.8/site-packages/overrides/signature.py", line 102, in ensure_signature_is_compatible
    ensure_return_type_compatibility(super_type_hints, sub_type_hints, method_name)
  File "/home/pico/lib/python3.8/site-packages/overrides/signature.py", line 302, in ensure_return_type_compatibility
    raise TypeError(
TypeError: ArrayField.empty_field: return type `None` is not a `<class 'allennlp.data.fields.field.Field'>`.