'AttributeError: 'Doc2Vec' object has no attribute 'dv'

I am trying a Lbl2Vec approach unsupervised text classification since I am using already given code to test but it still is not working. It is giving me attribute error that Doc2Vec has no attribute dv in it. I have seen the API and also checked the gensim update issue but it is still giving the same issue.

The error comes from:

# doc2vec model
** **Traceback (most recent call last)**
<ipython-input-14-02ddc79aea7e> in <module>()
      1 # train model
----> 2 lbl2vec_model.fit()

6 frames
/content/lbl2vec.py in _get_similar_documents(self, doc2vec_model, keywords, num_docs, similarity_threshold, min_num_docs)
    604                 # set num_docs to maximum number of available documents in
    605                 # doc2vec model
--> 606                 num_docs = len(doc2vec_model.dv.index_to_key)
    607 
    608             # get topics which are similar to keywords in decreasing similarity

AttributeError: 'Doc2Vec' object has no attribute 'dv'


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source