-
Notifications
You must be signed in to change notification settings - Fork 121
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] yukarin_sa_forward と decode_forward を実装(yukarin_s_forward の再実装含む) #158
[Rust] yukarin_sa_forward と decode_forward を実装(yukarin_s_forward の再実装含む) #158
Conversation
…re/implements-yukarin_s_forward
…re/implements-yukarin_sa_forward-and-decode_forward
Co-authored-by: Hiroshiba <[email protected]>
一方、 |
あるいは、本 PR は |
こちら、型が合わないからRustのVecが作れないということですよね。 Rustよくわかってないのですが、何かしらのIterなら作れるかも?
コード量的にはどちらも一緒で良さそうなのですが、たしかにdecodeはむずかしそうなので分けても良さそうに感じました! |
直ちに解決するのは難しそうです。 |
@PickledChair |
いやenumだとだめかも・・・? |
ちょっとやってみようとしたのですが、 /// Trait used to map Rust types (for example `f32`) to ONNX types (for example `Float`)
pub trait TypeToTensorElementDataType {
/// Return the ONNX type for a Rust type
fn tensor_element_data_type() -> TensorElementDataType;
/// If the type is `String`, returns `Some` with utf8 contents, else `None`.
fn try_utf8_bytes(&self) -> Option<&[u8]>;
} |
@PickledChair そうですね。なのでonnxruntimeを修正する必要はありそうです |
なるほどです! 作戦は3つほどありそうです。
VOICEVOX的には、onnxruntimeの追従が簡単そうなので、意外と1番の方法が最も良いのかなと思っています。 2か3は、 @qwerty2501 さんさえよければ2の方がスピーディだと思いますが、お手数おかけしちゃうので、その場合は3が良いのかなと思っています。 |
「とりあえず音声合成に使用できるコア」を作るためには、今回の問題が最後のハードルになっていると思うので、2 か 3 でなんとか押し切れないかと感じているところです……! |
1はrunのとこだけonnxruntime-sysで実装するといびつになるのでちょっと避けたほうが良さそうですね |
なるほどです、お二人ともありがとうございます! 2か3に関しては、Rustに強く、かつonnxruntime-rsの地理にも詳しい @qwerty2501 さんがにお任せするのが一番速いかなと感じています。 2にしろ3にしろ、一旦マージしちゃえばチェックもしやすいのかなと思います! |
@PickledChair @Hiroshiba ちょっとonnxruntime-rsのラッパーの実装が高レベル過ぎて良くないと感じています。 |
これは本当にそうですね……。 最終的な形をどうするかは置いておくとして、最短で実装できそうな案を考えてみました。 1.
|
@PickledChair とりあえず今日頑張ってだめそうだったらその案にしようと思います |
@PickledChair 修正したので 0.0.24 にupgradeしてみてください 使い方は example 参照してください |
0.0.24 に upgrade し、新しい API を使って この後 test を追加したいと思います。また、エラーの定義の仕方・扱い方が自分でも微妙に見えるので、意見をいただければと思います……! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この機能のテストコードは正直私もどう書いていいかわからないですが最低限呼び出してOkかえることは確認したほうがいいと思います
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
処理を共通化できそうな箇所は結構ありますが、一旦マージしちゃって動かしてみるのが有線かなと思います!
了解です! とりあえず入力(エンジンの方で引数を観察して得たもの)を渡して Ok が返ることを確認するようなテストを書きました。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…含む) (VOICEVOX#158) * add yukarin_s_forward implementation * use replace method * use std::slice::from_raw_parts_mut * change argument type of Internal::yukarin_s_forward * fix to use proper speaker_id * use assert_eq * add yukarin_sa_forward implementation * add decode_forward implementation * Update crates/voicevox_core/src/internal.rs Co-authored-by: Hiroshiba <[email protected]> * add tensor of speaker_id in yukarin_sa_forward * remove allow unused_variables attribute * update onnxruntime-rs version to 0.0.24, and implement decode_forward * change return value of *-forward * change the way to convert from OrtOwnedTensor to Vec * add tests of yukarin_sa_forward and decode_forward * trivial change Co-authored-by: Hiroshiba <[email protected]>
内容
yukarin_sa_forward
とdecode_forward
の実装を目指します。現在、yukarin_sa_forward
が推論に失敗するので、draft にしています。現在、
decode_forward
の実装に取り組み中なので、draft にしています。入力テンソルのうち、
length
のみが次元0であるため、引数は複数の次元のテンソルが混在するVec
となっています。そのためにテンソルの型をArrayD<i64>
にして混在できるようにしてみましたが、それではうまくいかないようです。これでうまくいきました……!関連 Issue
ref #128