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

TypeError when running prediction (problem with Predictor class) #5

Open
meganndare opened this issue Apr 30, 2023 · 0 comments
Open

Comments

@meganndare
Copy link

Hi, I am trying to use the best checkpoint for ZH provided by you to predict some AMRs given chinese sentences. However, when I run the prediction script, I'm getting a type error (see below). Additionally the same exact error occurs when I tried to run project_test.sh. Any idea how to get around this?

:~/code/xl-amr$ ./scripts/predict_multilingual.sh en models/xl-amr_lang_specific_zh_trans/
Predicting...Sun Apr 30 10:30:33 CEST 2023
/home/CE/mdare/anaconda3/envs/xlamr/lib/python3.6/site-packages/tqdm/__init__.py
Traceback (most recent call last):
  File "/home/CE/mdare/anaconda3/envs/xlamr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/CE/mdare/anaconda3/envs/xlamr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/local/home/CE/mdare/code/xl-amr/xlamr_stog/commands/predict.py", line 52, in <module>
    from xlamr_stog.predictors.predictor import Predictor, JsonDict
  File "/local/home/CE/mdare/code/xl-amr/xlamr_stog/predictors/__init__.py", line 1, in <module>
    from xlamr_stog.predictors.predictor import Predictor
  File "/local/home/CE/mdare/code/xl-amr/xlamr_stog/predictors/predictor.py", line 7, in <module>
    from xlamr_stog.data import DatasetReader, Instance
  File "/local/home/CE/mdare/code/xl-amr/xlamr_stog/data/__init__.py", line 1, in <module>
    from xlamr_stog.data.dataset_readers.dataset_reader import DatasetReader
  File "/local/home/CE/mdare/code/xl-amr/xlamr_stog/data/dataset_readers/__init__.py", line 10, in <module>
    from xlamr_stog.data.dataset_readers.dataset_reader import DatasetReader
  File "/local/home/CE/mdare/code/xl-amr/xlamr_stog/data/dataset_readers/dataset_reader.py", line 4, in <module>
    from xlamr_stog.data.instance import Instance
  File "/local/home/CE/mdare/code/xl-amr/xlamr_stog/data/instance.py", line 3, in <module>
    from xlamr_stog.data.fields.field import DataArray, Field
  File "/local/home/CE/mdare/code/xl-amr/xlamr_stog/data/fields/__init__.py", line 7, in <module>
    from xlamr_stog.data.fields.array_field import ArrayField
  File "/local/home/CE/mdare/code/xl-amr/xlamr_stog/data/fields/array_field.py", line 10, in <module>
    class ArrayField(Field[numpy.ndarray]):
  File "/local/home/CE/mdare/code/xl-amr/xlamr_stog/data/fields/array_field.py", line 42, in ArrayField
    @overrides
  File "/home/CE/mdare/anaconda3/envs/xlamr/lib/python3.6/site-packages/overrides/overrides.py", line 83, in overrides
    return _overrides(method, check_signature, check_at_runtime)
  File "/home/CE/mdare/anaconda3/envs/xlamr/lib/python3.6/site-packages/overrides/overrides.py", line 170, in _overrides
    _validate_method(method, super_class, check_signature)
  File "/home/CE/mdare/anaconda3/envs/xlamr/lib/python3.6/site-packages/overrides/overrides.py", line 189, in _validate_method
    ensure_signature_is_compatible(super_method, method, is_static)
  File "/home/CE/mdare/anaconda3/envs/xlamr/lib/python3.6/site-packages/overrides/signature.py", line 102, in ensure_signature_is_compatible
    ensure_return_type_compatibility(super_type_hints, sub_type_hints, method_name)
  File "/home/CE/mdare/anaconda3/envs/xlamr/lib/python3.6/site-packages/overrides/signature.py", line 303, 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 `xlamr_stog.data.fields.field.Field`.
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

1 participant