Skip to content

build!: コアを0.16にする #1587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

qryxip
Copy link
Member

@qryxip qryxip commented Apr 5, 2025

内容

一旦 #709 は抜きで、コア0.16の導入を行う。

関連 Issue

Fixes: #1659
Refs: #1571

スクリーンショット・動画など

その他

@@ -138,6 +139,15 @@ jobs:
DOWNLOAD_RESOURCE_PATH: download/resource
run: bash tools/process_voicevox_resource.bash

# NOTE: you must agree to the ToU
# FIXME: なんか数分かかるみたいなので、GitHub Releasesから持って来た方がよいかも
Copy link
Member Author

@qryxip qryxip Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そういやGitHub Releasesには無いんだった。自分でダウンローダーの実装とかしてたのに忘れてた。

となるとGitHubからのファイル単位ダウンロード(ダウンローダーはこれ)だけど、実際に速くなるのかは未調査。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cbc883c (#1587)
とりあえずFIXMEの文面を変更。

Copy link
Member

@Hiroshiba Hiroshiba Apr 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ジャストアイディアですが)

最初1回目は数分かかるのは仕方ないとして、キャッシュするのもありかもですね!
もしかしたらもうキャッシュされてたり・・・?
もしキャッシュされてるならFIXME外しちゃっても良いかも?

@@ -138,6 +139,15 @@ jobs:
DOWNLOAD_RESOURCE_PATH: download/resource
run: bash tools/process_voicevox_resource.bash

# NOTE: you must agree to the ToU
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: 上手い文面

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

71ecf15 (#1587): 色々書くのは #709 のときにやることにして、このPRでは何も書かないことにしようかなと。

Comment on lines -18 to +20
VOICEVOX_CORE_VERSION: "0.15.7"
ONNXRUNTIME_VERSION: "1.13.1"
VOICEVOX_CORE_VERSION: "0.16.0"
VOICEVOX_VVM_VERSION: "0.1.0"
ONNXRUNTIME_VERSION: "1.17.3"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diffの量を抑えるためにONNXRUNTIME_VERSIONのままにしたけど、このPR内でVOICEVOX_ONNXRUNTIME_VERSIONにした方がよいかも?

@qryxip qryxip marked this pull request as ready for review April 20, 2025 18:08
@qryxip qryxip requested a review from a team as a code owner April 20, 2025 18:08
@qryxip qryxip requested review from Hiroshiba and removed request for a team April 20, 2025 18:08
@qryxip
Copy link
Member Author

qryxip commented Apr 20, 2025

とりあえず後回しにしていたCUDA & cuDNN関係を片付けたのでdraft外しました。
あとはこのPRの状態のENGINEがちゃんと動くか確認するという流れになると思います。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

何故かわかりませんが100755 (GIT_FILEMODE_BLOB_EXECUTABLE相当)だったので100644にしておきました。


あとcudnn/LICENSEの方ですが、どうやら本来CRLFっぽいですがこのリポジトリではLFになっているっぽいです。多分autocrlfかなと。改行コード以外で差分は出ないっぽいのでこのPRでは見送ろうかなと思っています。

unzip -p cudnn-windows-x86_64-8.9.7.29_cuda12-archive.zip cudnn-windows-x86_64-8.9.7.29_cuda12-archive/LICENSE | file -
/dev/stdin: Unicode text, UTF-8 text, with very long lines (1028), with CRLF line terminators
warning: in the working copy of 'tools/licenses/cudnn/LICENSE', CRLF will be replaced by LF the next time Git touches it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

755

なるほどです!! windowsのファイルだったからとかありそう。

あとcudnn/LICENSEの方ですが、どうやら本来CRLFっぽいですがこのリポジトリではLFになっているっぽいです。

これはまあどっちでも良い気がしました!
そもそもこのライセンスの文面を入れる必要はないんですよね、多分・・・。
確か参考にしたソフトウェア(何だったか忘れましたが。。)の中に入ってたから、とりあえず入れておこうと思って入れた記憶があります。
別にこの文面を入れないといけない、という規約にはなってなかった・・・・・はず・・・?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

755

あ、念の為の補足ですが、このリポジトリで755になっていたので更新のついでにそのまま644にした次第です。

CRLF

Linux版だと普通にLFのようです。なので_Licenseに対すうるメモをWindows版じゃなくてLinux版のにしておけばおかしくはなくなるはず?

tar xvf ./cudnn-linux-x86_64-8.9.7.29_cuda12-archive.tar.xz cudnn-linux-x86_64-8.9.7.29_cuda12-archive/LICENSEfile ./cudnn-linux-x86_64-8.9.7.29_cuda12-archive/LICENSE
./cudnn-linux-x86_64-8.9.7.29_cuda12-archive/LICENSE: Unicode text, UTF-8 text, with very long lines (1028)

そもそもこのライセンスの文面を入れる必要はないんですよね、多分・・・。

今現時点でここに存在する以上はこのPRでは対応しようかなーと考えています。

license_text不要論ということでissue建てた方がいいですかね?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あ、なるほどです!!
このPRでは含めていただければと思っています・・・!!

issueはもしよかったら立てていただけると助かります!!!!!!感謝・・・!!!

@Hiroshiba
Copy link
Member

とりあえず後回しにしていたCUDA & cuDNN関係を片付けたのでdraft外しました。
あとはこのPRの状態のENGINEがちゃんと動くか確認するという流れになると思います。

ありがとうございます!!!!!!!

方針3つあるんですけど、どうしましょうか。

1つ目が @qryxip さんのところでビルドしていただく感じです。
普通にworkflow_dispatchになってるんで、どこでもビルドできるはずではあります。
どこかorg前提になってるところはなきにしもあらずかも・・・。

2つ目が一旦VOICEVOX側でproject-core-0.16みたいなのを作って、そちらにマージしてからビルドする流れです。
みんな試せるっちゃ試せるけどひと手間かかるので一長一短。

3つ目がえいやでmainブランチにマージする流れです。
できればこれは念のために避けたいかもです。
しばらくリリースの予定はありませんが、念のために1段階挟みたいかも。

まあでもVOICEVOX ENGINE側で課題を握れた方がいいので、2番目が一番まるそうな気がしてきました!
とりあえずレビューしてみます!!

@qryxip
Copy link
Member Author

qryxip commented Apr 20, 2025

1つ目が @qryxip さんのところでビルドしていただく感じです。

今開始してみました。
https://github.com/qryxip/voicevox_engine/actions/runs/14562288855

前は駄目だったのですが、$GITHUB_TOKENの権限がread onlyのままだったようで書き込み権限を与えたので大丈夫なはず。

@qryxip
Copy link
Member Author

qryxip commented Apr 25, 2025

d7ffcf4 (#1587)
#1659 の調査結果から、とりあえずWindowsをwindows-2022にしました。
test-engine-packageまで無事に通るようになっています。
https://github.com/qryxip/voicevox_engine/actions/runs/14669803025

@qryxip
Copy link
Member Author

qryxip commented Apr 26, 2025

とりあえず

方針3つあるんですけど、どうしましょうか。

1つ目が @qryxip さんのところでビルドしていただく感じです。

に話を戻すと、私のリポジトリで999.999.202504260207をビルドしてみました。次の5つを確認できれば、ビルドがちゃんとできているということになると思います。

[追記] 999.999.202504281454をビルドしました。

  • x86_64 Windows DirectML
  • x86_64 Windows NVIDIA GPU
  • x86_64 Linux NVIDIA GPU
  • Dockerfile (TARGETPLATFORM=linux/amd64, USE_GPU=false)
  • Dockerfile (TARGETPLATFORM=linux/amd64, USE_GPU=true)
  • Dockerfile (TARGETPLATFORM=linux/arm64/v8, USE_GPU=false)

@qryxip
Copy link
Member Author

qryxip commented Apr 29, 2025

#1587 (comment)
チェックボックスを更新しました。WindowsのCUDA版だけちょっと私以外の人が試していただけないかなと思っております。


Dockerについては一つやらかしがあったみたいで、 VOICEVOX/voicevox_core#954 もあるから/opt/voicevox_core//opt/voicevox_core/libにしないといけなかった…

RuntimeError: コアが見つかりません

[追記] ubuntu:20.04にしてるのも駄目っぽい。

RuntimeError: コアの読み込みに失敗しました:/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /opt/voicevox_core/lib/libvoicevox_core.so)

@qryxip
Copy link
Member Author

qryxip commented Apr 30, 2025

66a906e (#1587): Dockerfileを完成させる。手元での動作を確認。

Comment on lines -98 to +75
base_runtime_image: mirror.gcr.io/nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
base_runtime_image: mirror.gcr.io/nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu22.04
Copy link
Member Author

@qryxip qryxip Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なんかこれは駄目っぽくて動かない!
(OrtCUDAProviderOptionsV2までは通るけど、OrtSessionを開始するときにコケているらしいです)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CORE Python APIを動かしてみてエラー内容を覗いたらこんなのが出てきました。version is insufficientかぁ…。
(我々のORT/VVORTはCUDA 12.4とcuDNN 8でビルドしている)

Exception: Failed to create ONNX Runtime session: /home/runner/work/onnxruntime-builder/onnxruntime-builder/onnxruntime/core/providers/cuda/cuda_call.cc:121 std::conditional_t<THRW, void, onnxruntime::common::Status> onnxruntime::CudaCall(ERRTYPE, const char*, const char*, ERRTYPE, const char*, const char*, int) [with ERRTYPE = cudaError; bool THRW = true; std::conditional_t<THRW, void, onnxruntime::common::Status> = void] /home/runner/work/onnxruntime-builder/onnxruntime-builder/onnxruntime/core/providers/cuda/cuda_call.cc:114 std::conditional_t<THRW, void, onnxruntime::common::Status> onnxruntime::CudaCall(ERRTYPE, const char*, const char*, ERRTYPE, const char*, const char*, int) [with ERRTYPE = cudaError; bool THRW = true; std::conditional_t<THRW, void, onnxruntime::common::Status> = void] CUDA failure 35: CUDA driver version is insufficient for CUDA runtime version ; GPU=0 ; hostname=e1354849c946 ; file=/home/runner/work/onnxruntime-builder/onnxruntime-builder/onnxruntime/core/providers/cuda/cuda_execution_provider.cc ; line=245 ; expr=cudaSetDevice(info_.device_id);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

整理すると

  1. 我々の(VOICEVOX) ONNX Runtimeはv1.17であり、CUDA 11 & cuDNN 8、もしくはCUDA 12 & cuDNN 8での利用でなければならない。
  2. 我々の(VOICEVOX) ONNX Runtimeは現在CUDA 12.4 & cuDNN 8でビルドしている
  3. nvidia/cudaに12.4.0-cudnn8-runtime-ubuntu22.04みたいなのがあればよいが、無い。12.1.0-cudnn8-runtime-ubuntu22.04ならある。

という感じであり、CUDA 12.4でビルドした(VOICEVOX) ONNX RuntimeをCUDA 12.1のランタイムで動かそうとして失敗している、というのが現状かと思います。

このうち2.だけは手軽にどうにかできる範囲ではありそう。nvidia/cudaのイメージを使うのをやめて自前でダウンロードというのもありかも。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

うおお。。。cudnn9が入っている気がしますが、↓で動いたりしないですかね。。。
nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04

ちょっとこれは今後のためにもVOICEVOX ENGINEのdocker環境を別で用意するのではなく、ビルドしたパッケージ版エンジンをdocker内に突っ込む形にするのが良い気がしました。
ちょっと時間かかりそうですが一旦issue側にコメントしてみます。

あるいはリビルトですかね。。。。
そうなるとadditional libraryの方もリビルドする必要がある・・・?
まあまあいろんなとこに影響ある気はしそう。影響範囲が見定められないけどできなくはなさそう。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(review comment ではなく質問です🙇)
こちらの問題、この辺 #709 (comment) で挙がっていた懸念点とは関係ありそうでしょうか?
CUDA 上げると過去の core が動かなくなったりする...?

Copy link
Member

@Hiroshiba Hiroshiba Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tarepan
一言で言うと、たぶんそうな気がします!!!!!!!

まず、ただCUDAのバージョンをあげるだけであれば問題なさそうな気がします!
当時の僕の↓のコメントがそのまま使えそう。

なので一番最新のコアに合わせる形でonnxruntimeを用意し、それに合うCUDAとかを用意すれば良い・・・?


でもCUDAとは別の話で過去のcoreが動かなくなる気がすることに気づきました。
追記:CUDAバージョン変更と↓の名称変更の合わせ技で、過去のCUDA版コアが動かなくなることに気づきました!!

VOICEVOXコア0.16はonnxruntime.dllではなくvoicevox_onnxruntime.dllを参照します。
voicevox_onnxruntime.dllはVOICEOVX専用にビルドしたonnxruntimeです。一応過去のコアも動くはずではありますが、過去のコアはvoicevox_onnxruntime.dllではなくonnxruntime.dllを参照します。

つまりコア0.16には最新版CUDAが使えるvoicevox_onnxruntime.dllがあるけど、過去のコアはこのdllを見ないので結果的に動かないはず。。。。。。

手はいくつか考えられそうですが、ちょっとややこしくなるのでissueに転載の方に議論の場を移せればと思います!!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここの問題ですが、 #1669 をやってて気付いたのですが私が手元でdocker runする際に--gpusを忘れてたっぽい。もしかしてcuda:12.1.0-cudnn8-runtime-ubuntu22.04でも大丈夫なのかも…?

まあ #1669 は既にやる方向にはなってるので、そちらを進めたいと思います。

Copy link
Member

@Hiroshiba Hiroshiba May 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほど、あり得そう!!!

直感だとgpusつけようがつけまいがversionが合わないエラーにはならない気もする…?
もしかしたらコンテナ内ではなくホスト側のcudaが見えてエラーがなくなった…みたいな可能性もあり得なくはないかも………?

まあどちらにせよdockerコンテナの方針を変えるのが目処立ってるのでそちらがより良さそう感!

@qryxip
Copy link
Member Author

qryxip commented Apr 30, 2025

4bb6636 (#1587): build-engine-containerを更新。glibcの関係上Ubuntu 20.04で動かすのは厳しくなったので切り捨て。
(glibcだけ新しいのを持って来ればなんとかなりそうではありますが)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GHAでビルドしたWindows版エンジンがonnxruntime-builder製ORTを読み込めない
3 participants