9

我正在尝试使用 FastText Python API https://pypi.python.org/pypi/fasttext虽然,根据我的阅读,此 API 无法在https://github加载较新的 .bin 模型文件.com/facebookresearch/fastText/blob/master/pretrained-vectors.md如https://github.com/salestock/fastText.py/issues/115中所建议

我已经尝试了在该问题上建议的所有内容,而且https://github.com/Kyubyong/wordvectors没有英文的 .bin,否则问题将得到解决。有谁知道解决这个问题的方法?

4

5 回答 5

2

请尝试以下步骤来解决问题。它在加载语言识别模型时与我一起使用 Python 3.5。

git clone https://github.com/facebookresearch/fastText.git
cd fastText
pip install .
于 2018-06-24T10:36:00.377 回答
2

不能使用fasttextpip 安装的包。您使用来自repo 的install fastText(大写 T) 。fasttext

于 2019-01-14T05:28:03.493 回答
1

此错误通常是由于版本不匹配造成的。确保在训练和模型加载期间使用相同版本的 fasttext。

于 2019-09-20T13:03:55.447 回答
0

你要找的包还没有在 PyPI 上。您必须通过克隆原始存储库并运行安装脚本来自己安装它。

但是,您可以测试和使用PyPi Test中的最新版本 。

你也可以使用这个镜像,里面有你要找的官方包的副本。

于 2019-02-06T18:46:12.453 回答
0

您可以尝试 pyfasttext 代替:

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

有效,但存在一些兼容性问题,例如您可以使用 model.args["dim"] 替换 get_dimension()

于 2019-03-18T05:02:15.680 回答