ArrayField.empty_field problem with DatasetReader
See original GitHub issueI 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:
- Created 2 years ago
- Comments:6
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
problem solved by this issue
pip install overrides==3.1.0
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.