私は事前に訓練されたモデルを使用して、それに追加の語彙を追加しようとしています。私はそれに文の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()行で次のエラーが発生します。私は何が欠けていますか?
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'
は、以下のDID、それが働いた... existing_model_fr.model_trimmed_post_training = Falseの existing_model_fr.compute_loss =偽 – Prabhat