Save and Load a Custom NER model #12441
Replies: 13 comments 2 replies
-
The tokenizer is not a normal pipeline component, so you cannot disable it when loading a model. I wonder thought, why do you use a custom tokenizer and why only during training? |
Beta Was this translation helpful? Give feedback.
-
I have data where I want tokenizer only during training and during inference I just need the NER part. Is there any way to do that? |
Beta Was this translation helpful? Give feedback.
-
This is something I tried:
But ran into this issue: |
Beta Was this translation helpful? Give feedback.
-
Hey vrunm, To use lookups for lemmatization and normalization you can install the pip install -U 'spacy[lookups]' |
Beta Was this translation helpful? Give feedback.
-
@kadarakos I tried this command but still ran into this issue:
|
Beta Was this translation helpful? Give feedback.
-
If you have installed the |
Beta Was this translation helpful? Give feedback.
-
@kadarakos
|
Beta Was this translation helpful? Give feedback.
-
Hey vrunm, Did you try to follow the error message? We spend quite a bit of time trying to make sure that the error messages in |
Beta Was this translation helpful? Give feedback.
-
@kadarakos That's how I have passed the training data:
|
Beta Was this translation helpful? Give feedback.
-
Your |
Beta Was this translation helpful? Give feedback.
-
@kadarakos Coming back to the original question what I meant originally to ask was I wanted the spacy tokenizer part only during training and during inference I just need the NER part. Is there any way to do that? Also I did go through the docs thoroughly and have got the training part to work. |
Beta Was this translation helpful? Give feedback.
-
Hey vrunn, It seems to me that you would benefit from familiarizing yourself a bit more with spaCy first before asking specific questions here. We made available for free a full course on spaCy: https://course.spacy.io/en/. We also have a guide to training pipelines that I think would be very informative for you: https://spacy.io/usage/training. |
Beta Was this translation helpful? Give feedback.
-
@kadarakos Thanks I read the docs in detail but could not find any specific code where you first use a tokenizer for the text and then disable it during inference and only use the NER part. Also I do understand the tokenizer is necessary for the NER pipeline. So I believe you can just disable all the other components and use the NER part during training? But it seems that approach does not work. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've trained a custom NER model in spaCy with a custom tokenizer. I'd like to save the NER model without the tokenizer. I tried the following code with I found in the spaCy support forum:
Any idea how can I load the model without the tokenizer, but get the full pipeline?
Also is their a way to save the model locally and then be able to load the model in a .py file for inference?
Beta Was this translation helpful? Give feedback.
All reactions