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 while running the code #14

Open
ammaarahmad1999 opened this issue Apr 24, 2021 · 4 comments
Open

Error while running the code #14

ammaarahmad1999 opened this issue Apr 24, 2021 · 4 comments

Comments

@ammaarahmad1999
Copy link

I have recieved the following error while running on pretrained model.
No module named allennlp.run
I don't know the reason. I am working on conda environment. And have already installed allennlp
I have used following command to run
allennlp ./scicite.tar.gz ./scicite_data/test.jsonl --predictor predcitor_scicite --include-package scicite --overrides "{'model':{'data_format':''}}"

@ammaarahmad1999
Copy link
Author

Last issues are solved but I am getting another error while running
Command: python -m allennlp predict ./scicite.tar.gz ./scicite_data/test.jsonl --predictor predictor_scicite --include-package scicite --overrides "{'model':{'data_format':'predictor_scicite'}}"

Error: from allennlp.data.dataset import Batch
ModuleNotFoundError: No module named 'allennlp.data.dataset'

@ygorg
Copy link

ygorg commented Jun 10, 2021

I'm adding here the steps I followed to successfully run the code in hope that it will help someone.

virtualenv env -p python3.7
source env/bin/activate
pip install allennlp==0.9 overrides==3.1.0 jsonlines python-levenshtein
# I didn't see that "constraints.txt" listed dependencies ...

# from scicite root
allennlp predict scicite.tar.gz path/to/my_data.jsonl --predictor predictor_scicite --include-package scicite --overrides "{'model':{'data_format':'', 'predict_mode': true}}" --output-file out.jsonl

# from anywhere else add "path/to/scicite" to PYTHONPATH
PYTHONPATH="path/to/scicite" allennlp predict "path/to/scicite/scicite.tar.gz" "path/to/my_data.jsonl" --predictor predictor_scicite --include-package scicite --overrides "{'model':{'data_format':'', 'predict_mode': true}}" --output-file out.jsonl

The data should look like this:

{
  "string": "the citation string",
  "citingPaperId": "0000", "citedPaperId": "0001",
  "excerpt_index": "0",
  "label": null, "sectionName": null
}

The ids and excerpt_index are metadata, the values do not affect the model. It seem like adding a sectionName will do something else see here ?
For the citation string, the citations markers are removed by this regex.

@Martin36
Copy link

I get another error when running:

TypeError: ArrayField.empty_field: return type `None` is not a `allennlp.data.fields.field.Field`.

I am running it with:

allennlp predict scicite.tar.gz data/scicite/dev.jsonl --predictor predictor_scicite --include-package scicite --overrides "{'model':{'data_format':'', 'predict_mode': true}}" --output-file out.jsonl

in a Conda env with Python version 3.6 and installed the packages following the guide in the README

@Martin36
Copy link

I got it working by installing the pip package mentioned here: allenai/specter#27 (comment)

pip install overrides==3.1.0

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