allenai / allennlp

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

Getting error while building Allennlp #4492

Closed faysalhossain2007 closed 4 years ago

faysalhossain2007 commented 4 years ago

Checklist

Description

I am using python 3.7 in conda environment. I have installed allenlp using the pip command. Now I want to run the basic function using allennlp:

al = Predictor.from_path("https://s3-us-west-2.amazonaws.com/allennlp/models/fine-grained-ner-model-elmo-2018.12.21.tar.gz")
    al.predict("my age is 14.")

and it is throwing the following exception:

Python traceback:

```Traceback (most recent call last): File "/home/faysal/code/uiuc/dataprivacy/analyzer/src/detector.py", line 102, in run() File "/home/faysal/code/uiuc/dataprivacy/analyzer/src/detector.py", line 95, in run detect_using_allennlp() File "/home/faysal/code/uiuc/dataprivacy/analyzer/src/detector.py", line 11, in detect_using_allennlp al = Predictor.from_path("https://s3-us-west-2.amazonaws.com/allennlp/models/fine-grained-ner-model-elmo-2018.12.21.tar.gz") File "/home/faysal/anaconda3/envs/python3_7/lib/python3.7/site-packages/allennlp/predictors/predictor.py", line 275, in from_path load_archive(archive_path, cuda_device=cuda_device), File "/home/faysal/anaconda3/envs/python3_7/lib/python3.7/site-packages/allennlp/models/archival.py", line 199, in load_archive opt_level=opt_level, File "/home/faysal/anaconda3/envs/python3_7/lib/python3.7/site-packages/allennlp/models/model.py", line 406, in load return model_class._load(config, serialization_dir, weights_file, cuda_device, opt_level) File "/home/faysal/anaconda3/envs/python3_7/lib/python3.7/site-packages/allennlp/models/model.py", line 303, in _load model = Model.from_params(vocab=vocab, params=model_params) File "/home/faysal/anaconda3/envs/python3_7/lib/python3.7/site-packages/allennlp/common/from_params.py", line 580, in from_params **extras, File "/home/faysal/anaconda3/envs/python3_7/lib/python3.7/site-packages/allennlp/common/from_params.py", line 609, in from_params kwargs = create_kwargs(constructor_to_inspect, cls, params, **extras) File "/home/faysal/anaconda3/envs/python3_7/lib/python3.7/site-packages/allennlp/common/from_params.py", line 181, in create_kwargs cls.__name__, param_name, annotation, param.default, params, **extras File "/home/faysal/anaconda3/envs/python3_7/lib/python3.7/site-packages/allennlp/common/from_params.py", line 287, in pop_and_construct_arg return construct_arg(class_name, name, popped_params, annotation, default, **extras) File "/home/faysal/anaconda3/envs/python3_7/lib/python3.7/site-packages/allennlp/common/from_params.py", line 321, in construct_arg return annotation.from_params(params=popped_params, **subextras) File "/home/faysal/anaconda3/envs/python3_7/lib/python3.7/site-packages/allennlp/common/from_params.py", line 533, in from_params "from_params was passed a `params` object that was not a `Params`. This probably " allennlp.common.checks.ConfigurationError: from_params was passed a `params` object that was not a `Params`. This probably indicates malformed parameters in a configuration file, where something that should have been a dictionary was actually a list, or something else. This happened when constructing an object of type . ```

Related issues or possible duplicates

Environment

OS: Ubuntu 18.04 LTS

Python version: Python 3.7.7

Output of pip freeze:

``` absl-py==0.9.0 allennlp==1.1.0rc2.dev20200717 allennlp-models==1.1.0rc2.dev20200717 asgiref==3.2.7 astor==0.7.1 astunparse==1.6.3 attrs==19.3.0 beautifulsoup4==4.9.0 blinker==1.4 blis==0.4.1 boto3==1.14.23 botocore==1.17.23 brotlipy==0.7.0 bs4==0.0.1 cachetools==4.1.0 catalogue==1.0.0 certifi==2020.6.20 cffi==1.14.0 chardet==3.0.4 click==7.1.2 colorama==0.4.3 conllu==3.0 cryptography==2.9.2 cssselect==1.1.0 cycler==0.10.0 cymem==2.0.3 Django==3.0.6 docutils==0.15.2 esprima==4.0.1 filelock==3.0.12 fire==0.3.1 future==0.18.2 gast==0.3.3 google-api-core==1.17.0 google-auth==1.17.2 google-auth-oauthlib==0.4.1 google-cloud-bigquery==1.24.0 google-cloud-core==1.3.0 google-pasta==0.2.0 google-resumable-media==0.5.0 googleapis-common-protos==1.51.0 graphviz==0.14 grpcio==1.27.2 h5py==2.10.0 html5lib==1.1 idna==2.9 image==1.5.32 importlib-metadata==1.6.1 jmespath==0.10.0 joblib==0.13.2 jsonnet==0.16.0 jsonpickle==1.4.1 Keras==2.3.1 Keras-Applications==1.0.8 keras-metrics==1.1.0 Keras-Preprocessing==1.1.0 kiwisolver==1.2.0 -e git+https://github.com/lgsvl/PythonAPI.git@183ccdcb1d66fb827c074aaadacc012ec33da306#egg=lgsvl lxml==4.5.1 Mako==1.1.0 Markdown==3.2.2 MarkupSafe==1.1.1 matplotlib==3.2.1 mkl-fft==1.0.15 mkl-random==1.1.0 mkl-service==2.3.0 more-itertools==8.4.0 murmurhash==1.0.2 neobolt==1.7.17 neotime==1.7.4 nltk==3.5 numpy==1.18.1 oauthlib==3.0.1 opencv-python==4.2.0.34 opt-einsum==0+untagged.56.g2664021.dirty overrides==3.1.0 packaging==20.4 pandas==1.0.3 parse==1.15.0 Pillow==7.1.2 plac==1.1.3 pluggy==0.13.1 ply==3.11 preshed==3.0.2 prompt-toolkit==3.0.5 protobuf==3.12.3 py==1.9.0 py-rouge==1.1 py2neo==4.2.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycparser==2.20 Pygments==2.6.1 pygpu==0.7.6 PyJWT==1.7.1 pyOpenSSL==19.1.0 pyparsing==2.4.7 pyquery==1.4.1 PySocks==1.7.1 pytest==5.4.3 python-dateutil==2.8.1 pytz==2020.1 pywebcopy==6.3.0 PyYAML==5.3.1 regex==2020.7.14 requests==2.24.0 requests-oauthlib==1.2.0 rsa==4.6 s3transfer==0.3.3 sacremoses==0.0.43 scikit-learn==0.22.1 scipy==1.4.1 selenium==3.141.0 sentencepiece==0.1.91 six==1.14.0 slimit==0.8.1 soupsieve==2.0.1 spacy==2.2.4 sqlparse==0.3.1 srsly==1.0.2 tensorboard==2.2.2 tensorboard-plugin-wit==1.6.0.post3 tensorboardX==2.1 tensorflow==2.2.0 tensorflow-estimator==2.2.0 termcolor==1.1.0 Theano==1.0.4 thinc==7.4.0 tokenizers==0.8.1rc1 torch==1.5.0 torchvision==0.6.0 tqdm==4.47.0 transformers==3.0.2 urllib3==1.25.9 w3lib==1.22.0 wasabi==0.7.1 wcwidth==0.1.9 webencodings==0.5.1 websockets==7.0 Werkzeug==1.0.1 word2number==1.1 wrapt==1.12.1 zipp==3.1.0 ```

Steps to reproduce

Example source:

``` ```

epwalsh commented 4 years ago

This is a very old version of this model. See here for an up-to-date version: https://github.com/allenai/allennlp-models/blob/master/allennlp_models/pretrained.py#L37