From f3753c2453c3a7bdbcfc52f2ddcfa7526828fe36 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 23 Jan 2018 19:16:05 +0100 Subject: [PATCH] Further model deserialization fixes re #1727 --- spacy/pipeline.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/pipeline.pyx b/spacy/pipeline.pyx index 529a8b468..c5f8065de 100644 --- a/spacy/pipeline.pyx +++ b/spacy/pipeline.pyx @@ -174,7 +174,7 @@ class Pipe(object): """Load the pipe from a bytestring.""" def load_model(b): if self.model is True: - self.cfg['pretrained_dims'] = self.vocab.vectors_length + self.cfg.setdefault('pretrained_dims', self.vocab.vectors_length) self.model = self.Model(**self.cfg) self.model.from_bytes(b) @@ -199,7 +199,7 @@ class Pipe(object): """Load the pipe from disk.""" def load_model(p): if self.model is True: - self.cfg['pretrained_dims'] = self.vocab.vectors_length + self.cfg.setdefault('pretrained_dims', self.vocab.vectors_length) self.model = self.Model(**self.cfg) self.model.from_bytes(p.open('rb').read())