FastText - 无法加载model.bin,因为C ++扩展无法分配内存

问题描述 投票:7回答:4

我正在尝试使用FastText Python API https://pypi.python.org/pypi/fasttext虽然,根据我的阅读,这个API不能像https://github.com/facebookresearch/fastText/blob/master/pretrained-vectors.md中建议的那样在https://github.com/salestock/fastText.py/issues/115加载更新的.bin模型文件

我已经尝试了在那个问题上提出的所有内容,而且https://github.com/Kyubyong/wordvectors没有英语的.bin,否则问题就会解决。有没有人知道这方面的解决方法?

python nlp embedding fasttext
4个回答
2
投票

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

git clone https://github.com/facebookresearch/fastText.git
cd fastText
pip install .

1
投票

你不能使用pip安装的包fasttext。您可以使用fastText repo中的install fasttext(capital T)。


0
投票

您正在寻找的包尚未在PyPI上。您必须通过克隆原始仓库并运行安装脚本来自行安装。

但是,PyPi Test中有一个最新版本,您可以测试和使用它。

你也可以使用这个mirror,它有你正在寻找的官方包的副本。


0
投票

你可以试试pyfasttext:

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

有效,但有一些兼容性问题,例如你可以使用model.args [“dim”]来替换get_dimension()

© www.soinside.com 2019 - 2024. All rights reserved.