diff --git a/gensim/models/keyedvectors.py b/gensim/models/keyedvectors.py index daa5482184..2fb0e15b20 100644 --- a/gensim/models/keyedvectors.py +++ b/gensim/models/keyedvectors.py @@ -258,6 +258,9 @@ def _load_specials(self, *args, **kwargs): # fixup rename of vocab into map if 'key_to_index' not in self.__dict__: self._upconvert_old_vocab() + # ensure older instances have next_index + if not hasattr(self, 'next_index'): + self.next_index = len(self) def _upconvert_old_vocab(self): """Convert a loaded, pre-gensim-4.0.0 version instance that had a 'vocab' dict of data objects."""