facebookresearch / LAMA

LAnguage Model Analysis
Other
1.36k stars 184 forks source link

import allennlp.modules.highway fails #53

Open cerisara opened 2 years ago

cerisara commented 2 years ago

I just installed LAMA without error on Ubuntu 20. The run_experiment script immediately crashes because of the following import: when I open python and just run

import allennlp.modules

I've got this error:

>>> import allennlp.modules
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/allennlp/modules/__init__.py", line 9, in <module>
    from allennlp.modules.elmo import Elmo
  File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/allennlp/modules/elmo.py", line 20, in <module>
    from allennlp.modules.highway import Highway
  File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/allennlp/modules/highway.py", line 12, in <module>
    class Highway(torch.nn.Module):
  File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/allennlp/modules/highway.py", line 49, in Highway
    def forward(self, inputs: torch.Tensor) -> torch.Tensor:  # pylint: disable=arguments-differ
  File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/overrides/overrides.py", line 88, in overrides
    return _overrides(method, check_signature, check_at_runtime)
  File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/overrides/overrides.py", line 114, in _overrides
    _validate_method(method, super_class, check_signature)
  File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/overrides/overrides.py", line 135, in _validate_method
    ensure_signature_is_compatible(super_method, method, is_static)
  File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/overrides/signature.py", line 104, in ensure_signature_is_compatible
    method_name,
  File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/overrides/signature.py", line 211, in ensure_all_positional_args_defined_in_sub
    raise TypeError(f"{method_name}: `{super_param.name}` must be present")
TypeError: Highway.forward: `input` must be present

Thank you !

Hannibal046 commented 2 years ago

pip install overrides==3.1.0 works for me

cerisara commented 2 years ago

Thank you, you're right: it's working with this specific version ! After that, it crashes because of a memory overflow, but that's another story ;-)

Thanks

Hannibal046 commented 2 years ago

https://github.com/facebookresearch/LAMA/issues/47, this fixes overflow problem

cerisara commented 2 years ago

Great, thanks !