allenai / allennlp

An open-source NLP research library, built on PyTorch.
http://www.allennlp.org
Apache License 2.0
11.76k stars 2.25k forks source link

reading comprehension: 'Predictor' object has no attribute 'predict' #4297

Closed aoleiReiz closed 4 years ago

aoleiReiz commented 4 years ago

Checklist

Description

Python traceback:

``` predictor.predict( AttributeError: 'Predictor' object has no attribute 'predict' ```

Related issues or possible duplicates

Environment

OS: Windows

Python version: 3.6.8

Output of pip freeze:

``` allennlp==1.0.0rc1 allennlp-models==1.0.0rc1 atomicwrites==1.4.0 attrs==19.3.0 backcall==0.1.0 blis==0.4.1 boto3==1.13.18 botocore==1.16.18 catalogue==1.0.0 certifi==2020.4.5.1 chardet==3.0.4 click==7.1.2 colorama==0.4.3 conllu==2.3.2 cymem==2.0.3 dataclasses==0.7 decorator==4.4.2 docutils==0.15.2 en-core-web-sm==2.2.5 filelock==3.0.12 flaky==3.6.1 h5py==2.10.0 idna==2.9 importlib-metadata==1.6.0 ipython==7.14.0 ipython-genutils==0.2.0 jedi==0.17.0 jmespath==0.10.0 joblib==0.15.1 jsonpickle==1.4.1 more-itertools==8.3.0 murmurhash==1.0.2 nltk==3.5 numpy==1.18.4 overrides==2.8.0 packaging==20.4 parso==0.7.0 pickleshare==0.7.5 Pillow==7.1.2 plac==1.1.3 pluggy==0.13.1 preshed==3.0.2 prompt-toolkit==3.0.5 protobuf==3.12.2 py==1.8.1 py-rouge==1.1 Pygments==2.6.1 pyparsing==2.4.7 pytest==5.4.2 python-dateutil==2.8.1 regex==2020.5.14 requests==2.23.0 responses==0.10.14 s3transfer==0.3.3 sacremoses==0.0.43 scikit-learn==0.23.1 scipy==1.4.1 semantic-version==2.8.5 sentencepiece==0.1.91 six==1.15.0 spacy==2.2.4 srsly==1.0.2 tensorboardX==2.0 thinc==7.4.0 threadpoolctl==2.0.0 tokenizers==0.5.2 torch==1.4.0 torchvision==0.4.2 tqdm==4.46.0 traitlets==4.3.3 transformers==2.8.0 urllib3==1.25.9 wasabi==0.6.0 wcwidth==0.1.9 word2number==1.1 zipp==3.1.0 ```

Steps to reproduce

Example source:

``` from allennlp_models.rc import bidaf from allennlp.predictors.predictor import Predictor predictor = Predictor.from_path("bidaf-elmo-model-2020.03.19.tar.gz") predictor.predict( inputs={"passage":"The Matrix is a 1999 science fiction action film written and directed by The Wachowskis, starring Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss, Hugo Weaving, and Joe Pantoliano.", "question":"Who stars in The Matrix?"} ) ```

epwalsh commented 4 years ago

Closing as this is a duplicate and has been fixed, just update allennlp and allennlp-models:

pip install -—upgrade allennlp allennlp-models pip install --upgrade --pre allennlp allennlp-models

matt-gardner commented 4 years ago

I think you also need --pre until we have a stable release.