Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

'from allennlp.commands.elmo import ElmoEmbedder' not work even in 0.9.0 #5203

Closed
TITC opened this issue May 16, 2021 · 4 comments
Closed

'from allennlp.commands.elmo import ElmoEmbedder' not work even in 0.9.0 #5203

TITC opened this issue May 16, 2021 · 4 comments

Comments

@TITC
Copy link

TITC commented May 16, 2021

We removed the elmo command in v1.0. If you want to use the elmo command then you need to check out v0.9.0. We removed this command because elmo is becoming a bit old and we didn't think it made sense to continue supporting it as a top-level command.

version 0.9.0 worked fine. thx.

version 0.9.0 not work for me, any advice is welcome

Traceback (most recent call last):
  File "/content/sow-reap-paraphrasing/processing/get_elmo_embeds.py", line 1, in <module>
    from allennlp.commands.elmo import ElmoEmbedder
  File "/usr/local/lib/python3.7/dist-packages/allennlp/commands/__init__.py", line 8, in <module>
    from allennlp.commands.configure import Configure
  File "/usr/local/lib/python3.7/dist-packages/allennlp/commands/configure.py", line 26, in <module>
    from allennlp.service.config_explorer import make_app
  File "/usr/local/lib/python3.7/dist-packages/allennlp/service/config_explorer.py", line 24, in <module>
    from allennlp.common.configuration import configure, choices
  File "/usr/local/lib/python3.7/dist-packages/allennlp/common/configuration.py", line 17, in <module>
    from allennlp.data.dataset_readers import DatasetReader
  File "/usr/local/lib/python3.7/dist-packages/allennlp/data/__init__.py", line 1, in <module>
    from allennlp.data.dataset_readers.dataset_reader import DatasetReader
  File "/usr/local/lib/python3.7/dist-packages/allennlp/data/dataset_readers/__init__.py", line 10, in <module>
    from allennlp.data.dataset_readers.ccgbank import CcgBankDatasetReader
  File "/usr/local/lib/python3.7/dist-packages/allennlp/data/dataset_readers/ccgbank.py", line 9, in <module>
    from allennlp.data.dataset_readers.dataset_reader import DatasetReader
  File "/usr/local/lib/python3.7/dist-packages/allennlp/data/dataset_readers/dataset_reader.py", line 8, in <module>
    from allennlp.data.instance import Instance
  File "/usr/local/lib/python3.7/dist-packages/allennlp/data/instance.py", line 3, in <module>
    from allennlp.data.fields.field import DataArray, Field
  File "/usr/local/lib/python3.7/dist-packages/allennlp/data/fields/__init__.py", line 7, in <module>
    from allennlp.data.fields.array_field import ArrayField
  File "/usr/local/lib/python3.7/dist-packages/allennlp/data/fields/array_field.py", line 10, in <module>
    class ArrayField(Field[numpy.ndarray]):
  File "/usr/local/lib/python3.7/dist-packages/allennlp/data/fields/array_field.py", line 50, in ArrayField
    @overrides
  File "/usr/local/lib/python3.7/dist-packages/overrides/overrides.py", line 88, in overrides
    return _overrides(method, check_signature, check_at_runtime)
  File "/usr/local/lib/python3.7/dist-packages/overrides/overrides.py", line 114, in _overrides
    _validate_method(method, super_class, check_signature)
  File "/usr/local/lib/python3.7/dist-packages/overrides/overrides.py", line 135, in _validate_method
    ensure_signature_is_compatible(super_method, method, is_static)
  File "/usr/local/lib/python3.7/dist-packages/overrides/signature.py", line 93, in ensure_signature_is_compatible
    ensure_return_type_compatibility(super_type_hints, sub_type_hints, method_name)
  File "/usr/local/lib/python3.7/dist-packages/overrides/signature.py", line 288, in ensure_return_type_compatibility
    f"{method_name}: return type `{sub_return}` is not a `{super_return}`."
TypeError: ArrayField.empty_field: return type `None` is not a `<class 'allennlp.data.fields.field.Field'>`.

Originally posted by @TITC in #4384 (comment)

@TITC TITC changed the title from allennlp.commands.elmo import ElmoEmbedder not work even in 0.9.0 'from allennlp.commands.elmo import ElmoEmbedder' not work even in 0.9.0 May 16, 2021
@Kouuh
Copy link

Kouuh commented May 21, 2021

Did you solve the problem?

@TITC
Copy link
Author

TITC commented May 21, 2021

Did you solve the problem?

no

@AkshitaB
Copy link
Contributor

AkshitaB commented May 21, 2021

@TITC It appears to be because the latest overrides package breaks the older versions of allennlp (please see #5197).

As per a workaround suggested on that issue, can you try downgrading the version of overrides to 3.1.0?

@TITC
Copy link
Author

TITC commented May 21, 2021

@TITC It appears to be because the latest overrides package breaks the older versions of allennlp (please see #5197).

As per a workaround suggested on that issue, can you try downgrading the version of overrides to 3.1.0?

It works, great! Thanks for your kindly help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants