继续训练 FastText 模型
Continue training a FastText model
我已经下载了一个 .bin
FastText 模型,我将它与 gensim
一起使用,如下所示:
model = FastText.load_fasttext_format("cc.fr.300.bin")
我想继续训练模型以使其适应我的领域。检查后 FastText's Github and the Gensim documentation it seems like it is not currently feasible appart from using this person's proposed modification (尚未合并)。
我是不是漏掉了什么?
官方的 FastText 实现目前不支持该功能,尽管您可以找到与此问题相关的公开票证here。
您可以继续在某些版本的 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 模型并继续训练。
这里有各种pre-trained Wiki word models and vectors (or here).
Another example。 "注意:与 Word2Vec 的情况一样,您可以在使用 Gensim 的 fastText 本地实现的同时继续训练您的模型。"
我已经下载了一个 .bin
FastText 模型,我将它与 gensim
一起使用,如下所示:
model = FastText.load_fasttext_format("cc.fr.300.bin")
我想继续训练模型以使其适应我的领域。检查后 FastText's Github and the Gensim documentation it seems like it is not currently feasible appart from using this person's proposed modification (尚未合并)。
我是不是漏掉了什么?
官方的 FastText 实现目前不支持该功能,尽管您可以找到与此问题相关的公开票证here。
您可以继续在某些版本的 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 模型并继续训练。
这里有各种pre-trained Wiki word models and vectors (or here).
Another example。 "注意:与 Word2Vec 的情况一样,您可以在使用 Gensim 的 fastText 本地实现的同时继续训练您的模型。"