9

I'm trying to use the FastText Python API https://pypi.python.org/pypi/fasttext Although, from what I've read, this API can't load the newer .bin model files at https://github.com/facebookresearch/fastText/blob/master/pretrained-vectors.md as suggested in https://github.com/salestock/fastText.py/issues/115

I've tried everything that is suggested at that issue, and furthermore https://github.com/Kyubyong/wordvectors doesn't have the .bin for English, otherwise the problem would be solved. Does anyone know of a work-around for this?

Filipe Aleixo
  • 3,924
  • 3
  • 41
  • 74

5 Answers5

2

Try the following steps to solve the issue. Its worked with me for Python 3.5 while loading a language identification model.

git clone https://github.com/facebookresearch/fastText.git
cd fastText
pip install .
Michael Mior
  • 28,107
  • 9
  • 89
  • 113
2

You can't use the package fasttext installed by pip. You use install fastText (capital T) from fasttext repo.

Prakash Pazhanisamy
  • 997
  • 1
  • 15
  • 25
James Ma
  • 21
  • 1
1

This error generally comes because of the version mismatch. Make sure you are using the same version of fasttext during the training and model loading time.

sumit dugar
  • 121
  • 1
  • 6
0

The package you are looking for is not on PyPI yet. You have to install it yourself by cloning the original repo and running the install script.

There is, however, an up-to-date version in PyPi Test which you can test and use.

You can also use this mirror, which has a copy of the official package you are looking for.

AlexPnt
  • 579
  • 5
  • 9
0

you may try pyfasttext instead:

!pip3 install pyfasttext
from pyfasttext import FastText
model = FastText("./model_position")

works, but some compatibility problems, e.g. you may use model.args["dim"] to replace get_dimension()

Jason D
  • 193
  • 1
  • 7