Language.from_disk() does not load pipeline #5670
-
|
Loading a saved model via from_disk(...) does not load the pipeline, but the example from the docs suggests that I do not need to take care of this. How to reproduce the behaviourMinimum example: The result is: Your Environment
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
When you initialize a model with There can be cases where you want to handle things differently, but in general you probably want to use Lines 194 to 222 in 2d71545 |
Beta Was this translation helpful? Give feedback.
When you initialize a model with
English()it doesn't have any pipeline components, so it doesn't know to load them when you callfrom_disk(). If you add the right pipeline components and then runfrom_disk(), it will deserialize any that are in the current pipeline. See the example here: https://spacy.io/usage/saving-loading#pipelineThere can be cases where you want to handle things differently, but in general you probably want to use
spacy.load()to load models, since it takes care of these details for you. The docs are here: https://spacy.io/api/top-level#spacy.load and you can see what it's doing underneath here:spaCy/spacy/util.py
Lines 194 to 222 in 2d71545