spaCy - Util.load_model_from_path



It is introduced in version 2.0. As the name suggests, this function will load a model from a data directory path.

It works by creating the language class and pipeline based on directory’s meta.json. Later on, it will call from_disk with the specified path. With this utility function, we can also easily test a new model that is yet to be packaged.

Arguments

The table below explains its arguments −

NAME TYPE DESCRIPTION
model_path unicode It is the path to the model the data directory.
disable List It represents the names of pipeline components to disable.
meta Dict It is model meta data. If this value is false, spaCy will try to load the meta from a meta.json in the same directory.

Example

An example for util.load_model_from_path() function is given below −

import spacy
nlp_model = spacy.util.load_model_from_path ("/path/to/data")
spacy_util_get_data_path.htm
Advertisements