question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ArrayField.empty_field problem with DatasetReader

See original GitHub issue

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"
        } ]
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

63reactions
Akirtncommented, Oct 11, 2021

problem solved by this issue

pip install overrides==3.1.0

0reactions
ringkasannetcommented, Jun 19, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - ArrayField missing 1 required positional argument
I have imported the following header file
Read more >
Allennlp: How to Know Which Index of the Outputtensor ...
specifying the inputs and outputs to.some model. allennlp 0.9.0TypeError: ArrayField.emptyfield: return type None is not a class 'allennlp.data.fields.field.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found