From 72c964bcf408f34ecf7e9da94404213edec3e9e6 Mon Sep 17 00:00:00 2001 From: Sofie Van Landeghem Date: Sun, 16 Feb 2020 17:21:18 +0100 Subject: [PATCH] define pretrained_dims which is used by build_text_classifier (#5004) --- spacy/language.py | 1 + spacy/pipeline/pipes.pyx | 1 + 2 files changed, 2 insertions(+) diff --git a/spacy/language.py b/spacy/language.py index 5544b6341..869fa09a7 100644 --- a/spacy/language.py +++ b/spacy/language.py @@ -608,6 +608,7 @@ class Language(object): link_vectors_to_models(self.vocab) if self.vocab.vectors.data.shape[1]: cfg["pretrained_vectors"] = self.vocab.vectors.name + cfg['pretrained_dims'] = self.vocab.vectors.data.shape[1] if sgd is None: sgd = create_default_optimizer(Model.ops) self._optimizer = sgd diff --git a/spacy/pipeline/pipes.pyx b/spacy/pipeline/pipes.pyx index b4fecf5cb..3b190debe 100644 --- a/spacy/pipeline/pipes.pyx +++ b/spacy/pipeline/pipes.pyx @@ -1044,6 +1044,7 @@ class TextCategorizer(Pipe): self.add_label(cat) if self.model is True: self.cfg["pretrained_vectors"] = kwargs.get("pretrained_vectors") + self.cfg["pretrained_dims"] = kwargs.get("pretrained_dims") self.require_labels() self.model = self.Model(len(self.labels), **self.cfg) link_vectors_to_models(self.vocab)