通过windows使用fasttext并生成二进制文件

2024-09-26 22:12:43 发布

您现在位置:Python中文网/ 问答频道 /正文

如果能得到您的帮助,我将非常感谢,我想使用windows 10下的fasttext(fasttext与mac和linux正式合作),这是我在此基础上安装的

https://subscription.packtpub.com/book/big_data_and_business_intelligence/9781789130997/1/ch01lvl1sec11/installing-fasttext

然后我想在下面运行这个代码(train prodigy sesne2vec)

我相信我的计算机中有正确的快速文本

我试过运行这个

https://github.com/explosion/sense2vec/blob/master/scripts/04_fasttext_train_vectors.py

但我面临着这个错误

我使用了这个命令

    !python 04_fasttext_train_vectors.py -c 10 "C:/Users/moha/Documents/Models/Debug/fasttext.dll" "   ../data/output02" "../data/output04"
   [i] Created temporary merged input file
   ..\data\output02\s2v_input.tmp
   [i] Training vectors
   C:/Users/moha/Documents/Models/Debug/fasttext.dll skipgram -thread 10 -input ..\data\output02       \s2v_input.tmp -output ..\data\output04\vectors_w2v_300dim -dim 300 -minn 0 -maxn 0 -minCount 10 -verbose 2
   [+] Deleted temporary input file
   ..\data\output02\s2v_input.tmp

   [x] Failed training vectors

   The system cannot execute the specified program.

如您所见,我使用“fasttext.dll”作为二进制文件

我想问题是如何在windows中使用等同于“make”的命令构建fastText?对于mac和Linux,说明如下:

Building fastText using make (preferred)
wget https://github.com/facebookresearch/fastText/archive/v0.9.1.zip
unzip v0.9.1.zip
cd fastText-0.9.1
make

这将为所有类以及主二进制fasttext生成对象文件。如果不打算使用默认的系统范围编译器,请更新Makefile开头定义的两个宏(CC和INCLUDES)

使用cmake构建fastText 目前,这不是发布的一部分,因此需要克隆主分支

 git clone https://github.com/facebookresearch/fastText.git
cd fastText
mkdir build && cd build && cmake ..
 make && make install

) 这是一个二进制文件,我可以在脚本中使用它,问题是我可以使用windows构建这个文件吗


Tags: 文件httpsgithubcominputdatamakewindows
2条回答

与我不同的是,我尝试使用sense2vec脚本来训练数据,但我使用了我以前下载的预训练向量中的bin文件:

d:/sense2vec/04_fasttext_train_vectors.py
ℹ Created temporary merged input file
D:\sense2vec\s2v_input.tmp
ℹ Training vectors
D:/fasttext/yahoo_answers.bin skipgram -thread 10 -input D:\sense2vec\s2v_input.tmp -output D:\sense2vec\vectors_w2v_300dim -dim 300 -minn 0 -maxn 0 -minCount 50 -verbose 2
✔ Deleted temporary input file
D:\sense2vec\s2v_input.tmp
✔ Successfully trained vectors
D:/sense2vec/
ℹ Creating vocabulary
D:/fasttext/yahoo_answers.bin dump D:\sense2vec\vectors_w2v_300dim.bin dict > D:\sense2vec\vocab.txt
✔ Successfully created vocabulary file
D:\sense2vec\vocab.txt

结果是vocab.txt,文件大小为0 kb(空)

更新: 我已经从https://pypi.org/project/fasttext-win/#files下载了fastext.exe 我已经完成了培训过程,这里是截图

fasttext.exe did the trick

相关问题 更多 >

    热门问题