2
2

More than 1 year has passed since last update.

Raspberry Pi OS 64bitでVOICEVOX COREのビルド

Last updated at Posted at 2021-12-25

voicevox_coreはこちら
https://github.com/VOICEVOX/voicevox_core

Raspberry Pi 4 8G
Raspberry Pi OS 64bit(2021-05-07-raspios-buster-arm64-lite)

LinuxもPythonもましてやAIのことなどほとんど知識ないのでご容赦を。
~だったかも程度のメモで泥臭いと思います。

ONNX Runtimeのビルド準備

何をいれたのかうろ覚え...。

sudo apt install cmake

とはいえビルドでcmakeのバージョンが低いと怒られたためcmakeのサイトから最新バージョンをインストールした。

sudo apt install git build-essential libcurl4-openssl-dev libssl-dev libatlas-base-dev 
sudo apt install tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev libv4l-dev
sudo apt install libavutil56 libcairo-gobject2 libgtk-3-0  libpango-1.0-0 libavcodec58 libcairo2 libswscale5 libtiff5 libatk1.0-0 libavformat58 libgdk-pixbuf2.0-0 libpangocairo-1.0-0 libwebp6
pip3 install opencv-python

適当な作業ディレクトリへ

mkdir ~/tekitou
cd ~/tekitou

ONNX Runtimeをビルド

参考:https://axross-recipe.com/recipes/352

git clone https://github.com/microsoft/onnxruntime
cd onnxruntime
./build.sh --use_openmp --config Release --arm64 --update --build --build_shared_lib --build_wheel
pip3 install build/Linux/Release/dist/onnxruntime-{バージョン}.whl

↑pip3でのonnxruntimeインストールは不要かも。

you@raspberrypi:~/tekitou/onnxruntime $ find -name *.so
./build/Linux/Release/onnxruntime/capi/libonnxruntime_providers_shared.so
./build/Linux/Release/onnxruntime/capi/onnxruntime_pybind11_state.so
./build/Linux/Release/libonnxruntime_providers_shared.so
./build/Linux/Release/onnxruntime_pybind11_state.so
./build/Linux/Release/build/lib/onnxruntime/capi/libonnxruntime_providers_shared.so
./build/Linux/Release/build/lib/onnxruntime/capi/onnxruntime_pybind11_state.so
./build/Linux/Release/libtest_execution_provider.so
./build/Linux/Release/libcustom_op_library.so
./build/Linux/Release/libonnxruntime.so

libonnxruntime.soがあればオッケー。

VOICEVOX COREをビルド

cd ~/tekitou

git clone https://github.com/VOICEVOX/voicevox_core
cd voicevox_core
mkdir build
cd build
cmake .. -DONNXRUNTIME_DIR=~/tekitou/onnxruntime/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/tekitou/onnxruntime/build/Linux/Release/ cmake --build . --config Release
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/tekitou/onnxruntime/build/Linux/Release/ cmake --install .
cd ..
ORIGIN=~/tekitou/voicevox_core/core/lib/libcore.so LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/tekitou/onnxruntime/build/Linux/Release" python3 setup.py test
pip3 install .
cd example/python
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/tekitou/onnxruntime/build/Linux/Release python3 run.py --text "これは本当に実行できているんですか" --speaker_id 1 --root_dir_path="../../model"

エラーはなくdeprecated NumPyのワーニングがあったのみ。
(毎回ライブラリパスなどを追加していますがよくわかっていないので毎回やっています。)

you@raspberrypi:~/tekitou/voicevox_core/example/python $ ls
acoustic_feature_extractor.py  makelib.bat
core.pxd                       __pycache__
core.pyx                       requirements.txt
Dockerfile                     run.py
forwarder.py                   setup.py
full_context_label.py          これは本当に実行できているんですか-1.wav

おお!できたwavを神棚にお供えしたいほどの感動がありました!
再生してみると...(@~@)??

2
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
2
2