piskvorky / gensim

Topic Modelling for Humans
https://radimrehurek.com/gensim
GNU Lesser General Public License v2.1
15.72k stars 4.38k forks source link

Doc2Vec.clear_sims bug #2755

Open pavellevap opened 4 years ago

pavellevap commented 4 years ago

I was reading Doc2Vec source code and noticed a probable bug in clear_sims method. https://github.com/RaRe-Technologies/gensim/blob/8d79794118a3adeda8cf9c873eb205cecf47cfef/gensim/models/doc2vec.py#L387

It sets vectors_docs_norm attribute of Word2VecKeyedVectors to None. However, Word2VecKeyedVectors does not have this attribute. So I think this line should be self.docvecs.vectors_docs_norm = None

gojomo commented 4 years ago

Yes, that's incorrect, thanks! The supporting KeyedVectors classes & handling of the cached normalized vectors (as handled by init_sims/clear_sims) is getting a big rework in #2698 (that may eliminate this method entirely)... I'll make sure this particular bug doesn't survive that work.