我已经下载了一个.bin FastText 模型,我将它与gensim 一起使用,如下所示:
model = FastText.load_fasttext_format("cc.fr.300.bin")
我想继续训练模型以使其适应我的领域。检查后FastText's Github和 Gensim documentation从使用此人建议的 modification 来看,目前看来它不是可行的(尚未合并)。
我错过了什么吗?
请您参考如下方法:
您可以继续使用某些版本的 Gensim fastText(例如,v.3.7.*)进行训练。这是“Loading, inferring, continuing training”的示例
from gensim.test.utils import datapath
model = load_facebook_model(datapath("crime-and-punishment.bin"))
sent = [['lord', 'of', 'the', 'rings'], ['lord', 'of', 'the', 'semi-groups']]
model.build_vocab(sent, update=True)
model.train(sentences=sent, total_examples = len(sent), epochs=5)
出于某种原因,gensim.models.fasttext.load_facebook_model() 在 Windows 上缺失,但在 Mac 上存在。或者,可以使用 gensim.models.FastText.load_fasttext_format() 加载预训练模型并继续训练。
这里有各种pre-trained Wiki word models and vectors (或 here )。
Another example . “注意:与 Word2Vec 的情况一样,您可以在使用 Gensim 的 fastText 本地实现的同时继续训练您的模型。”
