Skip to content

Instantly share code, notes, and snippets.

@infinityfuture
Created February 6, 2019 14:50
Show Gist options
  • Save infinityfuture/645ee25d27ea5ded2ca3203bc7e778ba to your computer and use it in GitHub Desktop.
Save infinityfuture/645ee25d27ea5ded2ca3203bc7e778ba to your computer and use it in GitHub Desktop.
Using Gensim train FastText Chinese Char vector
import pickle
from gensim.models.fasttext import FastText
# [ ['你', '好', '吗'] ]
sentences = pickle.load(open('./x.pkl', 'rb'))
model = FastText(size=64, window=10, min_count=1)
model.build_vocab(sentences=sentences)
model.train(sentences=sentences, total_examples=len(sentences), epochs=10)
model.wv.save_word2vec_format('./fasttext64.txt')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment