allenai / allennlp-semparse

A framework for building semantic parsers (including neural module networks) with AllenNLP, built by the authors of AllenNLP
Apache License 2.0
107 stars 24 forks source link

AssertionError: No super class method found for "decode" #24

Open tedgoddard opened 4 years ago

tedgoddard commented 4 years ago

I'm sure I must just be missing an installation step, but it looks like the base class in model.py really does not have a decode method:

pip3 install torch==1.5.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip3 install allennlp
pip3 install allennlp-models
pip3 install git+https://github.com/allenai/allennlp-semparse.git@339e617861a7616618a503cc98e1e9c8b28a1b06

from allennlp_semparse import predictors, models

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/allennlp_semparse/models/__init__.py", line 1, in <module>
    from allennlp_semparse.models.atis.atis_semantic_parser import AtisSemanticParser
  File "/usr/local/lib/python3.6/dist-packages/allennlp_semparse/models/atis/atis_semantic_parser.py", line 35, in <module>
    class AtisSemanticParser(Model):
  File "/usr/local/lib/python3.6/dist-packages/allennlp_semparse/models/atis/atis_semantic_parser.py", line 549, in AtisSemanticParser
    def decode(self, output_dict: Dict[str, torch.Tensor]) -> Dict[str, torch.Tensor]:
  File "/usr/local/lib/python3.6/dist-packages/overrides/overrides.py", line 67, in overrides
    raise AssertionError('No super class method found for "%s"' % method.__name__)
AssertionError: No super class method found for "decode"
matt-gardner commented 4 years ago

This repo has not yet been updated for allennlp 1.0. Please install allennlp 0.9 for now.

tedgoddard commented 4 years ago

Thanks so much for the quick update. Do you have a rough ETA on when allennlp-semparse will be integrated with 1.0? (I was hoping to update everything to 1.0, but perhaps would need to run a separate image for 0.9.)

matt-gardner commented 4 years ago

I don't think there's very much that needs to change, but no one is actively working on it right now, so I don't have an estimate, unfortunately.

It should just be a collection of really small things like the error that you found here (it's just renaming a method). If you want to help, it'd be awesome to just open a PR with an updated allennlp version in requirements.txt, and then we can see test failures. Hopefully there aren't too many, and they are easy. Getting that started would go a long way towards me prioritizing this work :).

tedgoddard commented 4 years ago

Very good, I'll start on that and ping you again when I have some progress (or extreme lack of progress).

tedgoddard commented 4 years ago

So I found the updated function for decode, made progress with DatasetReader and Predictor registration with test code improvements, then was stuck with an incorrect datatype being passed to gather(). I doubt I would have made much progress with that, but then noticed https://github.com/allenai/allennlp-semparse/pull/23 which removed a .float() that turned out to be the necessary change.

This now successfully answers questions from tables for me:

https://github.com/allenai/allennlp-semparse/pull/25