미리 훈련 된 모델을 사용하고 추가 어휘를 추가하려고합니다. 나는 그것에 문장의 1 열을 csv 파일이 있습니다.gensim - Word2vec 온라인 교육 - AttributeError : 'Word2Vec'객체에 'model_trimmed_post_training'속성이 없습니다.
import gensim
existing_model_fr = gensim.models.Word2Vec.load('./fr/fr.bin')
new_sentences = gensim.models.word2vec.LineSentence('./data/french.csv')
existing_model_fr.build_vocab(new_sentences, update=True)
existing_model_fr.train(new_sentences, total_examples=existing_model_fr.corpus_count, epochs=5)
existing_model_fr.save('new_model_fr')
existing_model_fr.train() 행에서 다음 오류가 발생합니다. 내가 뭘 놓치고 있니? 그것은 당신이 재산 model_trimmed_post_training
이 정의되지 않은 gensim의 이전 버전에서 모델을로드하는 것입니다
AttributeError Traceback (most recent call last) in()
/usr/local/lib/python3.5/dist-packages/gensim/models/word2vec.py in train(self, sentences, total_examples, total_words, epochs, start_alpha, end_alpha, word_count, queue_factor, report_delay, compute_loss) 863 is only called once, the model's cached iter value should be supplied as epochs value. 864 """ --> 865 if self.model_trimmed_post_training: 866 raise RuntimeError("Parameters for training were discarded using model_trimmed_post_training method") 867 if FAST_VERSION < 0:
AttributeError: 'Word2Vec' object has no attribute 'model_trimmed_post_training'
는 다음나요 그것은 = 거짓 existing_model_fr.compute_loss = 거짓 ... existing_model_fr.model_trimmed_post_training을했다 : 당신은 로딩 후, 재산 자신을 설정하지만,
train()
하기 전에 문제를 해결할 가능성이 있습니다 – Prabhat