dygiepp
dygiepp copied to clipboard
TypeError: CorefResolver.make_output_human_readable: return type `None` is not a `typing.Dict[str, torch.Tensor]`.
Dear all, running your notebook for the integration of DyGIE in SpaCy, I get the following error:
TypeError Traceback (most recent call last) Input In [20], in <cell line: 2>() 1 import spacy ----> 2 from dygie.spacy_interface.spacy_interface import DygieppPipe 3 nlp = spacy.load('en_core_web_sm')
File ~\LAZY\dygie\spacy_interface\spacy_interface.py:3, in
File ~\LAZY\dygie\models_init_.py:1, in
File ~\LAZY\dygie\models\dygie.py:17, in
File ~\LAZY\dygie\models\coref.py:24, in
File ~\LAZY\dygie\models\coref.py:388, in CorefResolver() 383 output_dict["loss"] = negative_marginal_log_likelihood 385 return output_dict 387 @overrides --> 388 def make_output_human_readable(self, output_dict: Dict[str, torch.Tensor]): 389 """ 390 Converts the list of spans and predicted antecedent indices into clusters 391 of spans for each element in the batch. (...) 405 original document. 406 """ 408 # A tensor of shape (batch_size, num_spans_to_keep, 2), representing 409 # the start and end indices of each span.
File ~\anaconda3\lib\site-packages\overrides\overrides.py:88, in overrides(method, check_signature, check_at_runtime) 58 """Decorator to indicate that the decorated method overrides a method in 59 superclass. 60 The decorator code is executed while loading class. Using this method (...) 85 docstring from super class 86 """ 87 if method is not None: ---> 88 return _overrides(method, check_signature, check_at_runtime) 89 else: 90 return functools.partial( 91 overrides, 92 check_signature=check_signature, 93 check_at_runtime=check_at_runtime, 94 )
File ~\anaconda3\lib\site-packages\overrides\overrides.py:114, in _overrides(method, check_signature, check_at_runtime) 112 return wrapper # type: ignore 113 else: --> 114 _validate_method(method, super_class, check_signature) 115 return method 116 raise TypeError(f"{method.qualname}: No super class method found")
File ~\anaconda3\lib\site-packages\overrides\overrides.py:135, in _validate_method(method, super_class, check_signature) 129 method.doc = super_method.doc 130 if ( 131 check_signature 132 and not method.name.startswith("__") 133 and not isinstance(super_method, property) 134 ): --> 135 ensure_signature_is_compatible(super_method, method, is_static)
File ~\anaconda3\lib\site-packages\overrides\signature.py:93, in ensure_signature_is_compatible(super_callable, sub_callable, is_static) 90 same_main_module = _is_same_module(sub_callable, super_callable) 92 if super_type_hints is not None and sub_type_hints is not None: ---> 93 ensure_return_type_compatibility(super_type_hints, sub_type_hints, method_name) 94 ensure_all_kwargs_defined_in_sub( 95 super_sig, sub_sig, super_type_hints, sub_type_hints, is_static, method_name 96 ) 97 ensure_all_positional_args_defined_in_sub( 98 super_sig, 99 sub_sig, (...) 104 method_name, 105 )
File ~\anaconda3\lib\site-packages\overrides\signature.py:287, in ensure_return_type_compatibility(super_type_hints, sub_type_hints, method_name)
285 sub_return = sub_type_hints.get("return", None)
286 if not _issubtype(sub_return, super_return) and super_return is not None:
--> 287 raise TypeError(
288 f"{method_name}: return type {sub_return}
is not a {super_return}
."
289 )
TypeError: CorefResolver.make_output_human_readable: return type None
is not a typing.Dict[str, torch.Tensor]
.
Do you have any suggestions?
Hi,
The DyGIE / Spacy interface was added by @e3oroush. I unfortunately can't offer support, but maybe Ebi can help.
Dave
Hi, I'm sorry I haven't checked my notifications. I will try to take a look at it over the weekend.
Thanks!
I tried to reproduce the problem. but I couldn't. Can you send me the information about your Python environment?
Make sure to have sapcy==2.3.7
You can get the list of installed packages using pip freeze, explained here
I'm gonna close this for lack of activity. Feel free to reopen if this is still an issue.
Hello! I am facing the same issue. I followed the readme instructions and I followed the instructions regarding having spacy==2.3.7. My Python env. info: python 3.7.16. Could you suggest what the problem could be, please? Thanks
Hi, I'm traveling for the next two weeks but will try to take a look at this when I get back!
Taking a look now. Unfortunately as I mentioned earlier in the thread, I can't offer support for this but maybe @e3oroush can help?
Hi, I've just faced this TypeError. I used allennlp>2 and allennlp-models>2, which is not recommend in https://github.com/dwadden/dygiepp/issues/58
So I set
allennlp==1.1.0
allennlp-models==1.1.0
overrides==3.1.0
and fixed this problem !
Hi, I've just faced this TypeError. I used allennlp>2 and allennlp-models>2, which is not recommend in #58
So I set
allennlp==1.1.0 allennlp-models==1.1.0 overrides==3.1.0
and fixed this problem !
but it gives another error when i use overrides==7.7.0
:
TypeError: ArrayField.empty_field: return type `None` is not a `<class 'allennlp.data.fields.field.Field'>`.
Also, the cluster field is missing