Hi! Your instinct wasn't actually wrong, but the problem in your code is that in the first example, you tried to add the nlp
object to the pipeline, and in your second example, you created a blank uninitialized entity recognizer with no weights, instead of using the one you previously trained.
The cleanest and most straightforward solution would be to save out a version of the en_core_web_sm
model with a tagger and parser, but no entity recognizer, and then use that as the base model when you train your entity recognizer with Prodigy:
nlp = spacy.load("en_core_web_sm")
nlp.remove_pipe("ner")
print(nlp.pipe_names) # ['tagger', 'parser']
nlp.to_disk("./en_tagger_parser_sm") # use that path for training
Alternatively, if you already have your entity recognizer trained, you can also just take the ner
pipe and add it to your base model:
nlp = spacy.load("en_core_web_sm")
nlp.remove_pipe("ner")
print(nlp.pipe_names) # ['tagger', 'parser']
nlp_entity = spacy.load("custom_ner_model")
# Get the ner pipe from this model and add it to base model
ner = nlp_entity.get_pipe("ner")
nlp.add_pipe(ner)
print(nlp.pipe_names) # ['tagger', 'parser', 'ner']
nlp.to_disk("./custom_model")