issue loading custom packaged spacy model #8850
-
I have created a custom factory component, added it the pipeline, created extension to access the component, saved it using to_disk() and packed the component using When i load the custom packaged component using nlp = spacy.load("/path/to/pipeline")
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
After packaging, you want to install the model and then load it from the package name rather than the path. The included code is only loaded automatically if you load from an installed package. The actual names will be different but it looks something like this, look for the spacy package /path/to/model_name /output_dir
pip install /output_dir/en_model_name-0.0.0/dist/en_model_name-0.0.0.tar.gz Then: nlp = spacy.load("en_model_name") If you load from a path, you'll still need to import the additional code in an extra step before loading the model. |
Beta Was this translation helpful? Give feedback.
After packaging, you want to install the model and then load it from the package name rather than the path. The included code is only loaded automatically if you load from an installed package.
The actual names will be different but it looks something like this, look for the
.tar.gz
or.whl
in thedist/
subdirectory:Then:
If you load from a path, you'll still need to import the additional code in an extra step before loading the model.