Skip to content
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

[Rust]onnxruntimeをrust版voicevox_coreに導入 #135

Merged
merged 9 commits into from
May 25, 2022

Conversation

qwerty2501
Copy link
Contributor

内容

onnxruntimeをvoicevox_core rustに導入するPRです

関連 Issue

refs #128

その他

onnxruntimeの機能がちゃんと呼べてるかは get_supported_devicesのテストコードで確認している
initialize関数のボリュームが思っていた以上に重かったので、TODOコメントを残して実装は途中までにしてある

@qwerty2501 qwerty2501 marked this pull request as ready for review May 17, 2022 16:39
@qwerty2501 qwerty2501 changed the title Feature/append onnx runtime onnxruntimeをrust版voicevox_coreに導入 May 17, 2022
@@ -10,14 +10,17 @@ use std::sync::Mutex;
* これはC文脈の処理と実装をわけるためと、内部実装の変更がAPIに影響を与えにくくするためである
*/

#[repr(C)]
#[repr(i32)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

enumの場合はrepr(i32)が正しいらしいので修正

derive-getters = "0.2.0"
derive-new = "0.5.9"
once_cell = "1.10.0"
onnxruntime = { git = "https://github.com/qwerty2501/onnxruntime-rs.git", version = "0.0.16" }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

とりあえず私のリポジトリにforkしたものを参照するようにしました

[lib]
name = "core"
crate-type = ["cdylib"]

[dependencies]
anyhow = "1.0.57"
cfg-if = "1.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

directmlでbuildするかどうかで出力されるコードを変えたかったので条件わけしやすいように導入した

[lib]
name = "core"
crate-type = ["cdylib"]

[dependencies]
anyhow = "1.0.57"
Copy link
Contributor Author

@qwerty2501 qwerty2501 May 17, 2022

Choose a reason for hiding this comment

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

内部で発生したエラーをError内部のsourceとして保持するために導入

@qwerty2501 qwerty2501 force-pushed the feature/append_onnx_runtime branch from 7395664 to a53b00b Compare May 18, 2022 20:37
@qwerty2501 qwerty2501 force-pushed the feature/append_onnx_runtime branch 2 times, most recently from 3d876c9 to 93062cf Compare May 18, 2022 21:15
@qwerty2501 qwerty2501 changed the title onnxruntimeをrust版voicevox_coreに導入 [Rust]onnxruntimeをrust版voicevox_coreに導入 May 18, 2022
Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

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

正直全然ちゃんとわかってませんが、問題がありそうな箇所は見当たらなかったのでLGTM!!

derive-getters = "0.2.0"
derive-new = "0.5.9"
once_cell = "1.10.0"
onnxruntime = { git = "https://github.com/qwerty2501/onnxruntime-rs.git", version = "0.0.17" }
Copy link
Member

Choose a reason for hiding this comment

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

コミットIDの指定ってできそうでしょうか👀
指定しておくと、今後qwertyさんがご自身のonnxruntime-rsを気軽に修正できそうだなと思い。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

コミットID指定もできたはずですが、version指定のほうがやりやすいのでこっちにさせていただいて良いでしょうか?

Copy link
Contributor Author

@qwerty2501 qwerty2501 May 20, 2022

Choose a reason for hiding this comment

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

コミットID指定だとバージョンアップするたびにコミットIDを調べないといけないのでちょっと面倒です
version指定だとonnxruntime-rs projectのcargo file内のversionを更新する必要がありますが、こっちのほうが使う側は特に何も考えずにインクリメントればよいので楽かなと
あとversionの更新はきちんとやるべきだと思いますし

Copy link
Member

Choose a reason for hiding this comment

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

なるほどです!バージョンが良さそうに感じました!
(変更があまり発生しなさそうになったらぜひvoicevox側でもメンテしたいですね…!)

crates/voicevox_core/Cargo.toml Outdated Show resolved Hide resolved
crates/voicevox_core/src/lib.rs Show resolved Hide resolved
Copy link
Member

@PickledChair PickledChair left a comment

Choose a reason for hiding this comment

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

LGTM! コードが見やすく、とても参考になります……!
Approve したのですが、いくつか議論目的のコメントが残っていると思うので、それらの様子を見てからマージになるかと思います。よろしくお願いします。

crates/voicevox_core/src/lib.rs Show resolved Hide resolved
crates/voicevox_core/src/c_export.rs Show resolved Hide resolved
@Hiroshiba
Copy link
Member

LGTM!!

@Hiroshiba Hiroshiba merged commit 2a8b209 into VOICEVOX:rust May 25, 2022
qwerty2501 added a commit to qwerty2501/voicevox_core that referenced this pull request Jul 23, 2022
* Statusを仮実装した

* get_supported_devices を仮実装した

* エラーの名前とsourceの修正

* initialize関数を仮実装した

* get_supported_devicesが動作するかどうか確認するためのテストを追加

* lint errorを修正した

* version up onnxruntime-rs to 0.0.17

* TODOコメント追加

* Update crates/voicevox_core/Cargo.toml

Co-authored-by: Hiroshiba <[email protected]>

Co-authored-by: Hiroshiba <[email protected]>
@qryxip qryxip mentioned this pull request Apr 7, 2023
3 tasks
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.

3 participants