LoginSignup
4
2

More than 5 years have passed since last update.

fastTextをWindows環境(BashOnWindows)で実行するための準備

Posted at

Bash on Windowsの有効化

以下記事を参考にしてBash on Windowsを有効化する
参考URL)https://qiita.com/Aruneko/items/c79810b0b015bebf30bb

ホームディレクトリにfastTextをクローン

※%USERNAME%にはubuntuで作成したユーザ名を記載

$ cd home/%USERNAME%
$ git clone https://github.com/facebookresearch/fastText.git
$ cd fastText

必要なパッケージをインストール

  • make
  • g++
$ sudo apt-get update
$ sudo apt install make
$ sudo apt install g++

「sudo apt-get update」をやらないと、makeをインストールしようとする際、「E: Package 'make' has no installation candidate」が表示されるので、ここで大分躓きました。

インストールが完了したらmakeコマンドを実行

$ make
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/args.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/dictionary.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/productquantizer.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/matrix.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/qmatrix.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/vector.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/model.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/utils.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/fasttext.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops args.o dictionary.o productquantizer.o matrix.o qmatrix.o vector.o model.o utils.o fasttext.o src/main.cc -o fasttext

./fasttextコマンドが使えるか確認

$ ./fasttext
usage: fasttext <command> <args>

The commands supported by fasttext are:

  supervised              train a supervised classifier
  quantize                quantize a model to reduce the memory usage
  test                    evaluate a supervised classifier
  predict                 predict most likely labels
  predict-prob            predict most likely labels with probabilities
  skipgram                train a skipgram model
  cbow                    train a cbow model
  print-word-vectors      print word vectors given a trained model
  print-sentence-vectors  print sentence vectors given a trained model
  print-ngrams            print ngrams given a trained model and word
  nn                      query for nearest neighbors
  analogies               query for analogies
  dump                    dump arguments,dictionary,input/output vectors

ここまで来るのに相当時間が掛かってしまいました。
この後、学習

参考にしたサイト

fastTextをインストールしてみる
 ⇒Docker(CentOS)の環境でインストールしている記事。linuxという意味では同じなので参考になりました。
apt-get install openssh-serverでエラー
 ⇒makeインストール時のエラーメッセージで躓いたとき参考になりました。エラーメッセージはすぐ検索したほうがいいですね。

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2