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

ArrayField.empty_field problem with DatasetReader #27

Open
pjuangph opened this issue Jun 7, 2021 · 6 comments
Open

ArrayField.empty_field problem with DatasetReader #27

pjuangph opened this issue Jun 7, 2021 · 6 comments

Comments

@pjuangph
Copy link

pjuangph commented Jun 7, 2021

I followed your instructions and I'm simply trying to get the predictor working with your dataset.

I see an error on initializing from allennlp.data.dataset_readers import DatasetReader

Exception has occurred: TypeError
ArrayField.empty_field: return type `None` is not a `<class 'allennlp.data.fields.field.Field'>`.
  File "/mnt/d/github/public/specter/src/allennlp/allennlp/data/fields/array_field.py", line 50, in ArrayField
    def empty_field(self):  # pylint: disable=no-self-use
  File "/mnt/d/github/public/specter/src/allennlp/allennlp/data/fields/array_field.py", line 10, in <module>
    class ArrayField(Field[numpy.ndarray]):
  File "/mnt/d/github/public/specter/src/allennlp/allennlp/data/fields/__init__.py", line 7, in <module>
    from allennlp.data.fields.array_field import ArrayField
  File "/mnt/d/github/public/specter/src/allennlp/allennlp/data/instance.py", line 3, in <module>
    from allennlp.data.fields.field import DataArray, Field
  File "/mnt/d/github/public/specter/src/allennlp/allennlp/data/dataset_readers/dataset_reader.py", line 8, in <module>

Here's how I am using it. I am launching the predict_command.py with the following arguments (see below). I even tried running from embed.py with the same arguments you showed in the Readme.md and I get the same error which is why I am investigating it this way. It doesn't even get to reading the arguments and the program has crashed.

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Predict_command.py",
            "type": "python",
            "request": "launch",
            "program": "specter/predict_command.py",
            "args": [
                "archive_file=./model.tar.gz",
                "input_file=data/sample-metadata.json",
                "--output-file=output.json",
                "--batch_size=16",
                "--cuda_device=-1",
                "--predictor=specter_predictor",
            ],
            "console": "integratedTerminal"
        } ]
}
@pjuangph
Copy link
Author

pjuangph commented Jun 10, 2021

Are you guys looking into this? This bug is preventing me from reproducing your work.

@armancohan
Copy link
Collaborator

We haven't seen this problem. Are you using the same AllenNLP version as in the requirements?
Also does this happen for a specific data point or it can't process anything?
Can you send us exact commands for reproducing the error?

@pjuangph
Copy link
Author

I followed the instructions on this page https://github.com/allenai/specter I started in the Download section, ran the conda create pip install then setup.py install. This all worked but when I went to the bottom part where you say to run embed.py, that part fails. I then debugged what embed was calling and that pointed me to this error.

Note I am using anaconda with WSL2.

@ringkasannet
Copy link

Hi guys, i am facing the same problem by following the instructions provided including the setups and requirements. i am trying to train using the original train.pkl and val.pkl using the following commands:

./scripts/run-exp-simple.sh -c experiment_configs/simple.jsonnet
-s model-output/ --num-epochs 2 --batch-size 4
--train-path data/preprocessed/train.pkl --dev-path data/preprocessed/val.pkl
--num-train-instances 55 --cuda-device 0

and receive:

TypeError: ArrayField.empty_field: return type None is not a <class 'allennlp.data.fields.field.Field'>.

Would highly appreciate any thoughts on this issue. Cheers

@ringkasannet
Copy link

It turns out that there is something wrong with the allennlp installation itself, when i run allennlp on the command line the error shows up. I tried reinstalling the current allennlp version using pip install allennlp but then it shows no module allennlp.run. So i uninstalled allennlp and try reinstalling the requirement with pip and suddenly it works. I dont know how exactly i can replicate the solution but it may give hints to people who are experiencing the same problem.

@Akirtn
Copy link

Akirtn commented Jun 23, 2021

problem solved by this issue

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

4 participants