问题
I am using Gensim Library in python for using and training word2vector model. Recently, I was looking at initializing my model weights with some pre-trained word2vec model such as (GoogleNewDataset pretrained model). I have been struggling with it couple of weeks. Now, I just searched out that in gesim there is a function that can help me to initialize the weights of my model with pre-trained model weights. That is mentioned below:
reset_from(other_model)
Borrow shareable pre-built structures (like vocab) from the other_model. Useful if testing multiple models in parallel on the same corpus.
I don't know this function can do the same thing or not. Please help!!!
回答1:
You can now do incremental training with gensim. I would recommend loading the pretrained model and then doing an update.
from gensim.models import Word2Vec
model = Word2Vec.load('pretrained_model.emb')
model.build_vocab(new_sentences, update=True)
model.train(new_sentences)
来源:https://stackoverflow.com/questions/35985951/how-to-initialize-a-new-word2vec-model-with-pre-trained-model-weights