Load Pre-trained Word Embeddings
I want to load pre-trained word embeddings from google news model = gensim.models.KeyedVectors.load_word2vec_format('GoogleNews-vectors-negative300.bin', binary=True) print (model.
Solution 1:
I'm loading them the same way and don't have that problem - I suspect that it's the print statement. Probably your stdout is setup for ascii only, whether it's in jupyter or on a terminal. To avoid that problem, I'd suggest opening a file with encoding like
with open("vocab.txt", "w", encoding="utf8") as vocab_out:
for word in model.wv.vocab:
vocab_out.write(word + "\n")
Post a Comment for "Load Pre-trained Word Embeddings"