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

モーフィング機能を追加する #713

Open
wants to merge 62 commits into
base: main
Choose a base branch
from

Conversation

qryxip
Copy link
Member

@qryxip qryxip commented Dec 24, 2023

内容

@White-Green さんのWhite-Green/WORLD_rsを利用してモーフィング機能を追加します。

  • sample.vvmにpermitted_synthesis_morphingの追加
    • テスト
  • Rust API
    • 実装
    • docstring
    • ビルド
  • C API
  • Python API
  • Java API

関連 Issue

その他

Comment on lines 164 to 168
// ==========================================WARNING==============================================
//
// DO NOT BYPASS THIS OR YOU MAY VIOLATE THE ToS OF THE MODELS
//
// ===============================================================================================
Copy link
Member Author

@qryxip qryxip Dec 24, 2023

Choose a reason for hiding this comment

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

なんか一言書いておいた方がよいかなと思い書いたのですが、これは多分違いますね。
(あと"ToS"じゃない)

書くとしたらどういう書き方がいいんでしょう?

Copy link
Member Author

Choose a reason for hiding this comment

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

なんか何も書かないのが正解な気がしたので消しました。
38b8732 (#713)

@qryxip
Copy link
Member Author

qryxip commented Dec 30, 2023

なんかわかりませんが、windows-2019でビルドできなくなるみたいですね… (2022だと多分通る)

Copy link
Member Author

@qryxip qryxip left a comment

Choose a reason for hiding this comment

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

なんかわかりませんが、windows-2019でビルドできなくなるみたいですね… (2022だと多分通る)

解決。

Comment on lines +128 to +132
- if: matrix.os == 'windows-2019'
name: Install Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "16.0"
Copy link
Member Author

Choose a reason for hiding this comment

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

リリース時以外スキップされるwindows-x86-cpu (i686-pc-windows-msvc)に対しても必要。あるとビルドできるし無いとビルドできない。

can_skip_in_simple_testを外して確かめた。

model/sample.vvm Outdated
Copy link
Member Author

Choose a reason for hiding this comment

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

変更:

metas.json
@@ -1,39 +1,45 @@
 [
   {
     "name": "dummy1",
     "styles": [
       {
         "name": "style1",
         "id": 0
       }
     ],
     "speaker_uuid": "574bc678-8370-44be-b941-08e46e7b47d7",
     "version": "0.0.1"
   },
   {
     "name": "dummy2",
     "styles": [
       {
         "name": "style2",
         "id": 1
       }
     ],
     "speaker_uuid": "dd9ccd75-75f6-40ce-a3db-960cbed2e905",
-    "version": "0.0.1"
+    "version": "0.0.1",
+    "supported_features": {
+      "permitted_synthesis_morphing": "ALL"
+    }
   },
   {
     "name": "dummy3",
     "styles": [
       {
         "name": "style3-1",
         "id": 302
       },
       {
         "name": "style3-2",
         "id": 303
       }
     ],
     "speaker_uuid": "5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3",
-    "version": "0.0.1"
+    "version": "0.0.1",
+    "supported_features": {
+      "permitted_synthesis_morphing": "SELF_ONLY"
+    }
   }
 ]

Copy link
Member Author

Choose a reason for hiding this comment

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

まーーた何も変更していないのにoutdatedになってる...

Copy link
Member Author

Choose a reason for hiding this comment

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

なんかこんな感じになりましたが、まあ動くのでよし?

zipinfo ./model/sample.vvm
Archive:  ./model/sample.vvm
Zip file size: 53465028 bytes, number of entries: 5
-rw-a--     3.0 fat 57149888 bx defN 79-Dec-31 00:00 decode.onnx
-rw-a--     3.0 fat      286 tx defN 23-Jul-28 05:39 manifest.json
-rw-r--r--  3.0 unx      819 tx defN 23-Dec-31 02:57 metas.json
-rw-a--     3.0 fat    53381 bx defN 79-Dec-31 00:00 predict_duration.onnx
-rw-a--     3.0 fat    30803 bx defN 79-Dec-31 00:00 predict_intonation.onnx
5 files, 57235177 bytes uncompressed, 53463918 bytes compressed:  6.6%

Copy link
Member Author

@qryxip qryxip left a comment

Choose a reason for hiding this comment

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

とりあえずこれでレビュー可能になったはず。

CStr::from_ptr(morphable_targets).to_bytes(),
)?[&self.target_style];

// 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.

#713 (comment)の話ですが、通常synthesisと一緒にやった方がよいと思うので別PRにしたいと考えています。

@@ -145,6 +150,8 @@ pub enum ErrorKind {
UseUserDict,
/// ユーザー辞書の単語のバリデーションに失敗した。
InvalidWord,
/// 要求された機能を話者が持っていない。
Copy link
Member

Choose a reason for hiding this comment

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

todo!感が出るのはあまりよくない気がします。
https://github.com/VOICEVOX/voicevox_engine/blob/f43881bb5f4c6ab3a3a1e5786384d1ae62600696/run.py#L620
エンジンだと「指定されたスタイルペアでのモーフィングはできません」なので、シンプルにForbiddenMorphPairとか?

Copy link
Member Author

@qryxip qryxip Mar 28, 2024

Choose a reason for hiding this comment

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

そのエラーがエンジンに誕生した経緯を考えると、"forbidden"のような単語が表層に表れることはできるだけ避けた方がよいかなと思いました。

ほどよく煙に巻くことができ、かつ嘘を言わず事実を指し示す塩梅としてはこうなるかなと思った次第です。

@Hiroshiba ちょっと判断をお願いします。エラーメッセージは今こうなっています。

`{speaker_name}` ({speaker_uuid})は以下の機能を持ちません: `{target_speaker_name}` ({target_speaker_uuid})に対するモーフィング

Copy link
Member

Choose a reason for hiding this comment

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

すみません遅くなりました!!

permitted_synthesis_morphingという名前で、エラーが指定されたスタイルペアでのモーフィングはできませんなんですね
https://github.com/VOICEVOX/voicevox_engine/blob/a4749af418a0e9aa277c86e0c987ac2a42d336a9/voicevox_engine/metas/Metas.py#L46-L49

エンジンに合わせるならエラーは「モーフィングできなかった(Failed?)」ですかねぇ。
(いやそれは抽象度高すぎでしょという感じならコメントください 🙇 )

Comment on lines +28 to +94
case!(TestCase {
base_style: 0,
target_style: 0,
});
case!(TestCase {
base_style: 0,
target_style: 1,
});
case!(TestCase {
base_style: 0,
target_style: 302,
});
case!(TestCase {
base_style: 0,
target_style: 303,
});

case!(TestCase {
base_style: 1,
target_style: 0,
});
case!(TestCase {
base_style: 1,
target_style: 1,
});
case!(TestCase {
base_style: 1,
target_style: 302,
});
case!(TestCase {
base_style: 1,
target_style: 303,
});

case!(TestCase {
base_style: 302,
target_style: 0,
});
case!(TestCase {
base_style: 302,
target_style: 1,
});
case!(TestCase {
base_style: 302,
target_style: 302,
});
case!(TestCase {
base_style: 302,
target_style: 303,
});

case!(TestCase {
base_style: 303,
target_style: 0,
});
case!(TestCase {
base_style: 303,
target_style: 1,
});
case!(TestCase {
base_style: 303,
target_style: 302,
});
case!(TestCase {
base_style: 303,
target_style: 303,
});
Copy link
Member

Choose a reason for hiding this comment

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

https://docs.rs/duplicate/latest/duplicate/macro.duplicate.html
function macroのduplicateを二段重ねすればスッキリできそうな気がします。

Copy link
Member Author

@qryxip qryxip Mar 28, 2024

Choose a reason for hiding this comment

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

case!はここで定義しているマクロなので、cases!を作ってしまってTestCaseのコンストラクタも関数化(fn testcase(u32, u32) -> TestCase)すればいいように思えます。別PRで。

ただまあ、duplicateも悪くないかも。

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.

6 participants