我曾經對Python 3.5和基於我創建了一個項目gensim樣品和在我的項目中添加這些代碼: class MyCorpus(object):
def __iter__(self):
for line in open('files/2/mycorpus.txt'):
# assume there's one document per line, tokens s
我加載使用預訓練Doc2Vec型號: from gensim.models import Doc2Vec
model = Doc2Vec.load('/path/to/pretrained/model')
,我發現了以下錯誤: AttributeError: 'module' object has no attribute 'call_on_class_only' 有誰知道如何解決它。該模型
Im gensims最新版本,使用KeyedVectors加載來自文件的受過訓練的矢量,並且dosent需要實例化新的Word2Vec對象。但是現在我的代碼被破壞了,因爲我不能使用model.vector_size屬性。什麼是替代呢?我的意思是比kv[kv.index2word[0]].size更好的東西。