first I want to thank you for the fantastic work. I just started working with spacy and prodigy and I love it so far. Especially the documentation of spacy is outstanding and a pleasure to read.
I currently want to train a new entity and followed the video [1] to do so. It all works fine to the last step. But now I noticed that my new model only knows this new entity and would not detect any of the other entities anymore, which is probably due to the --label STRIKE in prodigy ner.batch-train strikes_ner en_core_web_lg --output strikes-model --label STRIKE --eval-split 0.2 --n-iter 6 --batch-size 8. So I left this parameter out in order to train the model on all entities, as the documentation says:
If not set, all available labels will be used.
But this leads to the above mentioned KeyError: 'U-STRIKE' error. Can you please help me with that?
What you're seeing here might also be due to the "catastrophic forgetting" problem: as you're teaching the model about your new entity, it's overfitting on the data and "forgetting" what it had previously learned. So if you care about the other entity types, a simple solution is to mix in entities that the model previously recognised correctly. This is pretty easy to do with both Prodigy and spaCy. You can find more details and strategies in this thread:
As you suggested I added the line nlp.entity.add_label('STRIKE') to ner.py:327 and the problem still persists.
UPDATE: I added nlp.entity.add_label('STRIKE') to ner.py:333 (as I’m of course not creating a new pipe) and now it works. Thanks a lot.
@ines Thanks a lot for your input too. I’m going to read this article now. In any case I’m a bit confused by the documentation now. It made sense to me that my model only new about one label if I use the --label parameter to only teach it about that one. And that it would not overfit on that one in case I leave the label empty so that it trains on the new one, while not forgetting the old. Or is that a mistake in my thinking and even with leaving out --label it would forget about the old one if I don’t explicitly give it examples of the previously learned entities?