diff --git a/spacy/pipeline/pipes.pyx b/spacy/pipeline/pipes.pyx index 153e053e2..100b5abfd 100644 --- a/spacy/pipeline/pipes.pyx +++ b/spacy/pipeline/pipes.pyx @@ -145,9 +145,7 @@ class Pipe(object): """Serialize the pipe to a bytestring.""" serialize = OrderedDict() serialize["cfg"] = lambda: srsly.json_dumps(self.cfg) - if self.model in (True, False, None): - serialize["model"] = lambda: self.model - else: + if self.model not in (True, False, None): serialize["model"] = self.model.to_bytes serialize["vocab"] = self.vocab.to_bytes return util.to_bytes(serialize, exclude) @@ -538,9 +536,7 @@ class Tagger(Pipe): def to_bytes(self, **exclude): serialize = OrderedDict() - if self.model in (None, True, False): - serialize['model'] = lambda: self.model - else: + if self.model not in (None, True, False): serialize['model'] = self.model.to_bytes serialize['vocab'] = self.vocab.to_bytes serialize['cfg'] = lambda: srsly.json_dumps(self.cfg) diff --git a/spacy/tests/regression/test_issue3289.py b/spacy/tests/regression/test_issue3289.py index 92b4ec853..ff423ddda 100644 --- a/spacy/tests/regression/test_issue3289.py +++ b/spacy/tests/regression/test_issue3289.py @@ -5,7 +5,6 @@ import pytest from spacy.lang.en import English -@pytest.mark.xfail def test_issue3289(): """Test that Language.to_bytes handles serializing a pipeline component with an uninitialized model."""