Joint NER+REL training exception: operands could not be broadcast together with shapes... #9591
-
Hello Explosion! Now I have problem with get_loss function, as the sizes of truths and scores do not match and therefore gradient can't be calculated. Consequently training stops with an error:
Might it be that number of "predicted" candidate relations does not match the number of gold relations simply because number of predicted entities also doesn't match golds? I am attaching config file, rel_pipe.py code and text file with print-out trace. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
I've seen a few posts where people were trying to jointly train ner+rel and later reported success with no mention of exception I'm describing. But it seems to me like this exception requires some additions to "rel_pipe.py" code? |
Beta Was this translation helpful? Give feedback.
-
Hi, Please refrain from artificially bumping your thread and pinging various maintainers individually. We do our best to help anyone on these forums, but please be advised that this is on a best-effort basis, and the additional pings don't help. |
Beta Was this translation helpful? Give feedback.
-
Hi @MaticBernik, It's likely that the current implementation of the REL component needs to be further improved for more realistic use-cases other than the simplistic case that the example project & video dealt with.
I think this is due to how the function
(L190 in the original code), |
Beta Was this translation helpful? Give feedback.
Hi @MaticBernik,
It's likely that the current implementation of the REL component needs to be further improved for more realistic use-cases other than the simplistic case that the example project & video dealt with.
I think this is due to how the function
_examples_to_truth
is implemented.Where it says
(L190 in the original code),
you should try changing this to getting the instances from
eg.predicted
instead ofeg.reference
. I would assume that that will resolve your dimension shape issue…