Training a new (or existing) model with a new entity #13083
-
Hi, I would like to add a new entity to the NER of a new or existing model. We'll call this entity EPS. a) firstly, do you recommend creating a new model from scratch or updating the existing model? (we would like to use the large English model). Can you give me a code snippet of how this can be done? b) I noticed a lot of examples in pipelines, among them ner_demo, ner_demo_replace and ner_demo_update. I could not figure out how to use these templates - can you provide some instructions on how to modify and run these project? Also, which one of the above projects do you recommend using for adding a new NER type? c) lastly, do you recommend using the templates in b) or training the model in some other way? Thanks for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
While you can update an existing model to predict new entity types (this demo project does just that), it can be tricky to train it in such a way that the performance on existing entities doesn't suffer. So, it's usually easier to just train the model from scratch. If you are in need of training data, you could use the English model to predict the existing labels for raw text. These predictions can then be combined with the training data for the new labels to train the new model. The example pipelines are implemented as spaCy Projects - the documentation goes over how they work. |
Beta Was this translation helpful? Give feedback.
-
Madeesh, thanks for your informative reply.
I had a question with regards to the pipelines/ner_demo project which I am
using to train a model with a new NER type:
The workflows section in the project.yml file runs the train command and
the train-with-vectors command is commented out. Can you explain the
difference between the two and when I should use either one:
workflows:
all:
...
- train
# - train-with-vectors
...
Thanks.
…On Tue, Oct 24, 2023 at 5:31 AM Madeesh Kannan ***@***.***> wrote:
While you can update an existing model to predict new entity types (this
demo project
<https://github.com/explosion/projects/tree/v3/pipelines/ner_demo_update>
does just that), it can be tricky to train it in such a way that the
performance on existing entities doesn't suffer.
So, it's usually easier to just train the model from scratch. If you are
in need of training data, you could use the English model to predict the
existing labels for raw text. These predictions can then be combined with
the training data for the new labels to train the new model.
The example pipelines are implemented as spaCy Projects - the
documentation <https://spacy.io/usage/projects> goes over how they work.
—
Reply to this email directly, view it on GitHub
<#13083 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AI5PW7EFWH5LKMVKVOYAE7LYA6DFTAVCNFSM6AAAAAA6MTT6VSVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TGNRYGE2DI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
While you can update an existing model to predict new entity types (this demo project does just that), it can be tricky to train it in such a way that the performance on existing entities doesn't suffer.
So, it's usually easier to just train the model from scratch. If you are in need of training data, you could use the English model to predict the existing labels for raw text. These predictions can then be combined with the training data for the new labels to train the new model.
The example pipelines are implemented as spaCy Projects - the documentation goes over how they work.