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.

Having trouble running the "Getting started" section (even the tests do not run)

See original GitHub issue

Hi,

I am trying to run the KnowBert code but keep getting stuck with the following error when trying to run the tests or the “How to embed sentences or sentence pairs programmatically” snippet:

tests/evaluation/test_wic_reader.py:3: in <module>
    from kb.include_all import  WicDatasetReader
kb/include_all.py:2: in <module>
    from kb.kg_embedding import KGTupleReader, KGTupleModel
kb/kg_embedding.py:8: in <module>
    from allennlp.data import DatasetReader, Token, Vocabulary
/opt/conda/envs/knowbert/lib/python3.6/site-packages/allennlp/data/__init__.py:1: in <module>
    from allennlp.data.dataset_readers.dataset_reader import DatasetReader
/opt/conda/envs/knowbert/lib/python3.6/site-packages/allennlp/data/dataset_readers/__init__.py:10: in <module>
    from allennlp.data.dataset_readers.ccgbank import CcgBankDatasetReader
/opt/conda/envs/knowbert/lib/python3.6/site-packages/allennlp/data/dataset_readers/ccgbank.py:9: in <module>
    from allennlp.data.dataset_readers.dataset_reader import DatasetReader
/opt/conda/envs/knowbert/lib/python3.6/site-packages/allennlp/data/dataset_readers/dataset_reader.py:4: in <module>
    from allennlp.data.instance import Instance
/opt/conda/envs/knowbert/lib/python3.6/site-packages/allennlp/data/instance.py:4: in <module>
    from allennlp.data.fields import TextField, ListField, SpanField
/opt/conda/envs/knowbert/lib/python3.6/site-packages/allennlp/data/fields/__init__.py:7: in <module>
    from allennlp.data.fields.array_field import ArrayField
/opt/conda/envs/knowbert/lib/python3.6/site-packages/allennlp/data/fields/array_field.py:10: in <module>
    class ArrayField(Field[numpy.ndarray]):
/opt/conda/envs/knowbert/lib/python3.6/site-packages/allennlp/data/fields/array_field.py:45: in ArrayField
    @overrides
/opt/conda/envs/knowbert/lib/python3.6/site-packages/overrides/overrides.py:88: in overrides
    return _overrides(method, check_signature, check_at_runtime)
/opt/conda/envs/knowbert/lib/python3.6/site-packages/overrides/overrides.py:114: in _overrides
    _validate_method(method, super_class, check_signature)
/opt/conda/envs/knowbert/lib/python3.6/site-packages/overrides/overrides.py:135: in _validate_method
    ensure_signature_is_compatible(super_method, method, is_static)
/opt/conda/envs/knowbert/lib/python3.6/site-packages/overrides/signature.py:93: in ensure_signature_is_compatible
    ensure_return_type_compatibility(super_type_hints, sub_type_hints, method_name)
/opt/conda/envs/knowbert/lib/python3.6/site-packages/overrides/signature.py:288: in ensure_return_type_compatibility
    f"{method_name}: return type `{sub_return}` is not a `{super_return}`."
E   TypeError: ArrayField.empty_field: return type `None` is not a `allennlp.data.fields.field.Field`.

Steps to reproduce

  1. Enter a clean anaconda docker container docker run -it continuumio/anaconda3
  2. apt-get update && apt install -y g++ make
  3. git clone https://github.com/allenai/kb.git
  4. conda create -n knowbert python=3.6.7
  5. source activate knowbert
  6. pip install torch==1.2.0
  7. pip install -r requirements.txt
  8. python -c "import nltk; nltk.download('wordnet')"
  9. python -m spacy download en_core_web_sm
  10. pip install --editable .
  11. pytest -v tests

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
lunarie16commented, Jul 8, 2021

Before running tests downgrading to overrides==3.1.0 and scikit-learn==0.22.2 solves the issue!

0reactions
leonodeleecommented, Jun 7, 2022

@leonodelee Hello, have you tried following the steps I give in my answers to issue #39 ? If so and you still have trouble, please provide error messages, or if there are none, a more detailed description of the abnormal behavior.

Thank you for your kindful help, I solved this problem by ‘pip install allennlp==0.8.2’ and other install instructions in https://github.com/allenai/kb/issues/39

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tests not running in Test Explorer - visual studio
However, the tests are not running when using the Visual Studio test explorer. The Test Explorer is showing all unit tests, but once...
Read more >
C# unit test tutorial - Visual Studio (Windows) - Microsoft Learn
If Test Explorer is not open, open it by choosing Test > Windows > Test Explorer from the top menu bar (or press...
Read more >
Unit Testing Tutorial: 6 Best Practices to Get Up To Speed
3. Avoid Test Interdependence ... Each test should handle its own setup and tear down. The test runner will execute your stuff in...
Read more >
Getting Started With Testing in Python
Running Your Tests From PyCharm​​ If you're using the PyCharm IDE, you can run unittest or pytest by following these steps: In the...
Read more >
Testing: Getting Started - The PHP Framework For Web Artisans
Tests within your "Unit" test directory do not boot your Laravel ... execute the vendor/bin/phpunit or php artisan test commands to run your...
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