Extracting entity relations with newly trained (from pretrained) named entity recognizer #5134
Replies: 4 comments
-
Hm, odd. I can't immediately think of (or see in your code) a reason why this wouldn't work anymore with your new model. As a sanity check: in the first part of you code where you're testing the newly trained model, can you show the print out results on the test sentences from the currency texts (i.e change And then check those results again after loading the model, right before you try to get the currency relations? So we can figure out where this goes wrong. |
Beta Was this translation helpful? Give feedback.
-
PS: also appreciate you posting on SO first! I did see it there, but as the post was quite long, I didn't have time to look into the details at the time |
Beta Was this translation helpful? Give feedback.
-
Thanks for your feedback. If I use updated trained model, it can detect the new entity "cases" and cardinal "100,000" however it loses the ability to detect money and date. When i trained the model, I trained it for thousands of sentences, using the base model en_core_web_sm itself to detect all entities and label them so as to avoid the model "forgetting" the old entities. |
Beta Was this translation helpful? Give feedback.
-
Ok so it looks like this is an instance of catastrophic forgetting - even though you've tried to avoid it, it may have still crept in. What I would suggest you to do is:
Because there's not really a bug or action item on our end, I'll close this issue, but feel free to follow up with your results and let me know if you run into further questions / problems. |
Beta Was this translation helpful? Give feedback.
-
I've posted my code and question on stackoverflow however didn't manage to get a response, not sure if this is a bug?
https://stackoverflow.com/questions/60621365/spacy-extract-named-entity-relations-from-trained-model
I've trained a model (using "en_core_web_sm" as base model transfer learning) to detect a new entity called "CASES". My new model successfully detects if the new entity is in a sentence, and remains able to detect other named entities.
However when using the new model to extract entity relations using the example code on spacy website. https://spacy.io/usage/examples
The new model gives no results... whilst the old base "en_core_web_sm" works as intended.
I'm not sure why this is, has this ability been deactivated somehow in the new model?
Beta Was this translation helpful? Give feedback.
All reactions