[英]Continue training a FastText model
我已經下載了一個.bin
FastText 模型,並將它與gensim
一起使用,如下所示:
model = FastText.load_fasttext_format("cc.fr.300.bin")
我想繼續訓練模型以使其適應我的領域。 在檢查了 FastText 的 Github和Gensim 文檔之后,使用此人提出的修改(尚未合並)似乎目前不可行。
我錯過了什么嗎?
您可以在 Gensim 的fastText
的某些版本(例如 v.3.7.*)中繼續訓練。 下面是一個“ 加載、推斷、繼續訓練”的例子
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()
加載預訓練模型並繼續訓練。
以下是各種預訓練的 Wiki 單詞模型和向量(或此處)。
另一個例子。 "注意:與 Word2Vec 的情況一樣,您可以在使用 Gensim 的本機實現 fastText 的同時繼續訓練您的模型。 "
官方的 FastText 實現目前不支持這一點,盡管您可以在此處找到與此問題相關的公開票證。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.