Home:ALL Converter>How to make 2 versions of Fasttext Python wrapper work together?

How to make 2 versions of Fasttext Python wrapper work together?

Ask Time:2018-07-04T02:34:32         Author:Dennis Golomazov

Json Formatter

We have used Facebook's Fasttext amazing library for a while. We access the trained models using the python wrapper (https://pypi.org/project/fasttext/). It used to be a third-party library, but is now maintained by Facebook and was merged to their repository.

The problem is that the two wrappers are not compatible. The old one is imported via import fasttext (lowercased) and the new one - via import fastText. The API is also somewhat different. But most importantly, the new library doesn't support the models trained by older Fasttext versions, whereas the old one does support them, but doesn't support the newly trained ones.

We're planning to migrate all our models to the new Fasttext version (it has quantization and is supposedly faster), but it takes time during which we need to support both types of models. So we need the both wrappers working side by side.

The problem with installing them together is that, despite the different module names, they try to get installed in the same directories by pip (fasttext). So one of them overwrites the other.

How to make them work side by side? Preferably within the same install prefix directory.

Author:Dennis Golomazov,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/51161006/how-to-make-2-versions-of-fasttext-python-wrapper-work-together
jfelectron :

The most reliable approach across platforms is to install one globally and the other as user:\n\npip install git+https://github.com/facebookresearch/fastText.git\npip install --user fasttext\n",
2019-04-05T18:48:15
yy