From 6f3210ebb9ddda23f50e727110f152e1b88b49b7 Mon Sep 17 00:00:00 2001 From: Paul O'Leary McCann Date: Tue, 15 Nov 2022 13:51:42 +0900 Subject: [PATCH] Use the equality check --- spacy/language.py | 8 +------- spacy/vectors.pyx | 1 + 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/spacy/language.py b/spacy/language.py index 967af1e62..836f3abf9 100644 --- a/spacy/language.py +++ b/spacy/language.py @@ -706,13 +706,7 @@ class Language: # Check source type if not isinstance(source, Language): raise ValueError(Errors.E945.format(name=source_name, source=type(source))) - # Check vectors, with faster checks first - if ( - self.vocab.vectors.shape != source.vocab.vectors.shape - or self.vocab.vectors.key2row != source.vocab.vectors.key2row - or self.vocab.vectors.to_bytes(exclude=["strings"]) - != source.vocab.vectors.to_bytes(exclude=["strings"]) - ): + if self.vocab.vectors != source.vocab.vectors: warnings.warn(Warnings.W113.format(name=source_name)) if source_name not in source.component_names: raise KeyError( diff --git a/spacy/vectors.pyx b/spacy/vectors.pyx index 584b84715..4a9dfe2a4 100644 --- a/spacy/vectors.pyx +++ b/spacy/vectors.pyx @@ -245,6 +245,7 @@ cdef class Vectors: def __eq__(self, other): + # Check for equality, with faster checks first return ( self.shape == other.shape and self.key2row == other.key2row