Dont load vectors in Language.from_config

This commit is contained in:
Matthew Honnibal 2020-07-28 21:59:30 +02:00
parent 30dd96c540
commit 7299419fe4
1 changed files with 4 additions and 2 deletions

View File

@ -1408,8 +1408,10 @@ class Language:
nlp = cls( nlp = cls(
create_tokenizer=create_tokenizer, create_lemmatizer=create_lemmatizer, create_tokenizer=create_tokenizer, create_lemmatizer=create_lemmatizer,
) )
if config["training"]["vectors"] is not None: # Note that we don't load vectors here, instead they get loaded explicitly
util.load_vectors_into_model(nlp, config["training"]["vectors"]) # inside stuff like the spacy train function. If we loaded them here,
# then we would load them twice at runtime: once when we make from config,
# and then again when we load from disk.
pipeline = config.get("components", {}) pipeline = config.get("components", {})
for pipe_name in config["nlp"]["pipeline"]: for pipe_name in config["nlp"]["pipeline"]:
if pipe_name not in pipeline: if pipe_name not in pipeline: