Fasttext: how can I READ the model.bin in java or python

Created on 22 Aug 2016  路  4Comments  路  Source: facebookresearch/fastText

thanks

Most helpful comment

For python, you can use the fasttext module

pip install fasttext

example to load the model:

import fasttext

# Load Skipgram or CBOW model
model = fasttext.load_model('model.bin')
# print some word vector
print model['king'] 

# Or load pre-trained classifier
classifier = fasttext.load_model('model.bin', label_prefix='__label__')

# To predict k-best labels from texts
classifier.predict(texts, k=3)

Link to the github repo: https://github.com/salestock/fastText.py

All 4 comments

For python, you can use the fasttext module

pip install fasttext

example to load the model:

import fasttext

# Load Skipgram or CBOW model
model = fasttext.load_model('model.bin')
# print some word vector
print model['king'] 

# Or load pre-trained classifier
classifier = fasttext.load_model('model.bin', label_prefix='__label__')

# To predict k-best labels from texts
classifier.predict(texts, k=3)

Link to the github repo: https://github.com/salestock/fastText.py

thanks very much

If having a C++ interface?

Thanks.

I wanted to leave a note here that the python library no long works with pre-trained word embeddings trained from Wikipedia:

https://github.com/salestock/fastText.py/issues/115

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ereday picture ereday  路  3Comments

ragvri picture ragvri  路  3Comments

hughbzhang picture hughbzhang  路  3Comments

loretoparisi picture loretoparisi  路  3Comments

pengyu picture pengyu  路  3Comments