Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error trying to predict: 'qasrl_parser is not a registered name for Model' #16

Open
rfernand2 opened this issue Feb 16, 2019 · 2 comments

Comments

@rfernand2
Copy link

rfernand2 commented Feb 16, 2019

On Linux 16.04, I did the following steps:

  • set up a clean py36
  • pip install allennlp
  • pip install nrl (seemed to be needed from first attempt to predict)
  • git clone nrl-qasrl
  • downloaded elmo/glove files into their respective data dirs
  • ran "download_pretrained.sh" script
  • created an input.txt file with contents {"sentence": "John went to the store."} {"sentence": "The man ate the burrito and threw the trash in the garbage"}

I tried predicting with command: python -m allennlp.run predict ./data/qasrl_parser_elmo input.txt --include-package nrl --predictor qasrl_parser --output-file output.txt

The following error was displayed: allennlp.common.checks.ConfigurationError: 'qasrl_parser is not a registered name for Model'

Console output with Stack trace:

(qa-srl) rfernand@labcoat-vm1:~/nrl-qasrl$ python -m allennlp.run predict ./data/qasrl_parser_elmo input.txt  --include-package nrl --predictor qasrl_parser --output-file output.txt
2019-02-16 15:50:20,371 - INFO - gensim.summarization.textcleaner - 'pattern' package not found; tag filters are not available for English
2019-02-16 15:50:20,381 - INFO - allennlp.models.archival - loading archive file ./data/qasrl_parser_elmo
Traceback (most recent call last):
  File "/data/anaconda/envs/qa-srl/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/run.py", line 18, in <module>
    main(prog="allennlp")
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/commands/__init__.py", line 72, in main
    args.func(args)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/commands/predict.py", line 187, in _predict
    predictor = _get_predictor(args)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/commands/predict.py", line 99, in _get_predictor
    overrides=args.overrides)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/models/archival.py", line 156, in load_archive
    cuda_device=cuda_device)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/models/model.py", line 321, in load
    return cls.by_name(model_type)._load(config, serialization_dir, weights_file, cuda_device)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/common/registrable.py", line 58, in by_name
    raise ConfigurationError("%s is not a registered name for %s" % (name, cls.__name__))
allennlp.common.checks.ConfigurationError: 'qasrl_parser is not a registered name for Model'
(qa-srl) rfernand@labcoat-vm1:~/nrl-qasrl$

@rfernand2 rfernand2 changed the title 'qasrl_parser is not a registered name for Model' error when trying to predict with model Error trying to predict: 'qasrl_parser is not a registered name for Model' Feb 16, 2019
@lx385095967
Copy link

You can try to output 'config["model"]["type"]' in 'model.py' file.

@zhibiao-boston
Copy link

On Linux 16.04, I did the following steps:

  • set up a clean py36
  • pip install allennlp
  • pip install nrl (seemed to be needed from first attempt to predict)
  • git clone nrl-qasrl
  • downloaded elmo/glove files into their respective data dirs
  • ran "download_pretrained.sh" script
  • created an input.txt file with contents {"sentence": "John went to the store."} {"sentence": "The man ate the burrito and threw the trash in the garbage"}

I tried predicting with command: python -m allennlp.run predict ./data/qasrl_parser_elmo input.txt --include-package nrl --predictor qasrl_parser --output-file output.txt

The following error was displayed: allennlp.common.checks.ConfigurationError: 'qasrl_parser is not a registered name for Model'

Console output with Stack trace:

(qa-srl) rfernand@labcoat-vm1:~/nrl-qasrl$ python -m allennlp.run predict ./data/qasrl_parser_elmo input.txt  --include-package nrl --predictor qasrl_parser --output-file output.txt
2019-02-16 15:50:20,371 - INFO - gensim.summarization.textcleaner - 'pattern' package not found; tag filters are not available for English
2019-02-16 15:50:20,381 - INFO - allennlp.models.archival - loading archive file ./data/qasrl_parser_elmo
Traceback (most recent call last):
  File "/data/anaconda/envs/qa-srl/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/run.py", line 18, in <module>
    main(prog="allennlp")
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/commands/__init__.py", line 72, in main
    args.func(args)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/commands/predict.py", line 187, in _predict
    predictor = _get_predictor(args)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/commands/predict.py", line 99, in _get_predictor
    overrides=args.overrides)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/models/archival.py", line 156, in load_archive
    cuda_device=cuda_device)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/models/model.py", line 321, in load
    return cls.by_name(model_type)._load(config, serialization_dir, weights_file, cuda_device)
  File "/data/anaconda/envs/qa-srl/lib/python3.6/site-packages/allennlp/common/registrable.py", line 58, in by_name
    raise ConfigurationError("%s is not a registered name for %s" % (name, cls.__name__))
allennlp.common.checks.ConfigurationError: 'qasrl_parser is not a registered name for Model'
(qa-srl) rfernand@labcoat-vm1:~/nrl-qasrl$

I got the same issue as your, may I ask whether you resolved the issue?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants