In this video, I show you how to package a trained spaCy model. For normal models with standard factories, such as ner, this is fairly straight forward. However, packaging models with custom functions, this is a bit more challenging. It requires you to add custom factories into the model so that it knows how to handle those custom functions. I show you how to add custom factories to your spaCy model's init file (easy). The error is below:
KeyError: "[E002] Can't find factory for 'en_narrow'. This usually happens when spaCy calls `nlp.create_pipe` with a component name that's not built in - for example, when constructing the pipeline from a model's meta.json. If you're using a custom component, you can write to `Language.factories['en_narrow']` or remove it from the model meta and add it via `nlp.add_pipe` instead."
Sample init file: https://github.com/wjbmattingly/ner_y...
Links for where I found my solutions, in addition to anonymous Mike:
https://stackoverflow.com/questions/5...
Ines' solution -- this video is a reduction of and borrows substantially from her great thread:
https://support.prodi.gy/t/adding-cus...
If you enjoy this video, please subscribe. I provide all my content at no cost. If you want to support my channel, please donate via
PayPal: https://www.paypal.com/cgi-bin/webscr...
Patreon: / wjbmattingly (its my www.themedievalworld.com account as well).
If there's a specific video you would like to see or a tutorial series, let me know in the comments and I will try and make it.
If you liked this video, check out www.PythonHumanities.com, where I have Coding Exercises, Lessons, on-site Python shells where you can experiment with code, and a text version of the material discussed here.
You can follow me at:
/ wjb_mattingly