本文介绍了Gensim:如何使用以前的word2vec模型重新训练doc2vec模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过Doc2Vec建模,我训练了一个模型并保存了以下文件:

With Doc2Vec modelling, I have trained a model and saved following files:

1. model
2. model.docvecs.doctag_syn0.npy
3. model.syn0.npy
4. model.syn1.npy
5. model.syn1neg.npy

但是,我有一种标记文档并想再次训练模型的新方法.因为单词向量已经从以前的版本中获得了.有什么方法可以重用该模型(例如,将以前的w2v结果作为训练的初始向量)?有人知道该怎么做吗?

However, I have a new way to label the documents and want to train the model again. since the word vectors already obtained from previous version. Is there any way to reuse that model (e.g., taking the previous w2v results as initial vectors for training)? Any one know how to do it?

推荐答案

我已经知道,我们可以加载模型并继续进行训练.

I've figured out that, we can just load the model and continue to train.

model = Doc2Vec.load("old_model")
model.train(sentences)

这篇关于Gensim:如何使用以前的word2vec模型重新训练doc2vec模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 21:50