diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 1bb58c88f..49896b0de 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -16,6 +16,8 @@ on: type: boolean required: false default: false + # TODO: ライセンス表記およびモデル配布形体の方針が固まったら廃止 + # is_production: description: "製品版をビルドする" type: boolean @@ -158,7 +160,7 @@ jobs: build_and_deploy: needs: config - environment: ${{ inputs.is_production && 'production' || '' }} # 製品版のenvironment + environment: ${{ inputs.code_signing && 'production' || '' }} # コード署名用のenvironment strategy: matrix: include: ${{ fromJson(needs.config.outputs.includes) }} @@ -166,22 +168,7 @@ jobs: env: ASSET_NAME: voicevox_core-${{ matrix.artifact_name }}-${{ needs.config.outputs.version }} steps: - - uses: actions/checkout@v4 # 製品版ではない場合 - if: ${{ !inputs.is_production }} - - uses: actions/checkout@v4 # 製品版の場合 - if: inputs.is_production - with: - fetch-depth: 0 # 全履歴取得 - token: ${{ secrets.PRODUCTION_GITHUB_TOKEN }} - - name: Merge production branch - if: inputs.is_production - shell: bash - run: | - ( - git remote add private ${{ secrets.PRODUCTION_REPOSITORY_URL }} - git fetch private refs/tags/${{ env.PRODUCTION_REPOSITORY_TAG }} - git -c user.name=dummy -c user.email=dummy@dummy.dummy merge FETCH_HEAD - ) > /dev/null 2>&1 + - uses: actions/checkout@v4 - name: Set up Python 3.8 if: matrix.python_whl uses: actions/setup-python@v5 @@ -228,7 +215,6 @@ jobs: if ${{ matrix.python_whl }}; then cargo set-version "$VERSION" -p voicevox_core_python_api; fi - name: cache target uses: Swatinem/rust-cache@v2 - if: ${{ !inputs.is_production }} - name: build voicevox_core_c_api shell: bash run: | @@ -236,14 +222,7 @@ jobs: plain-cdylib) linking=load-onnxruntime ;; ios-xcframework) linking=link-onnxruntime ;; esac - function build() { - cargo build -p voicevox_core_c_api -vv --features "$linking" --target ${{ matrix.target }} --release - } - if ${{ !inputs.is_production }}; then - build - else - build > /dev/null 2>&1 - fi + cargo build -p voicevox_core_c_api -vv --features "$linking" --target ${{ matrix.target }} --release env: RUSTFLAGS: -C panic=abort - name: build voicevox_core_python_api @@ -254,26 +233,11 @@ jobs: pip install --upgrade poetry poetry config virtualenvs.create false (cd crates/voicevox_core_python_api && poetry install --with dev) - function build() { - maturin build --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --target ${{ matrix.target }} --release - } - if ${{ !inputs.is_production }}; then - build - else - build > /dev/null 2>&1 - fi + maturin build --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --target ${{ matrix.target }} --release echo "whl=$(find ./target/wheels -type f)" >> "$GITHUB_OUTPUT" - name: build voicevox_core_java_api if: contains(matrix.target, 'android') - run: | - function build() { - cargo build -p voicevox_core_java_api -vv --target ${{ matrix.target }} --release - } - if ${{ !inputs.is_production }}; then - build - else - build > /dev/null 2>&1 - fi + run: cargo build -p voicevox_core_java_api -vv --target ${{ matrix.target }} --release - name: Organize artifact run: | mkdir -p "artifact/${{ env.ASSET_NAME }}" diff --git a/.github/workflows/build_and_deploy_downloader.yml b/.github/workflows/build_and_deploy_downloader.yml index 20fd4d63a..256e17bd6 100644 --- a/.github/workflows/build_and_deploy_downloader.yml +++ b/.github/workflows/build_and_deploy_downloader.yml @@ -11,11 +11,6 @@ on: type: boolean required: false default: false - is_production: - description: "製品版をビルドする" - type: boolean - required: false - default: false release: types: - published @@ -42,7 +37,7 @@ defaults: jobs: deploy_and_deploy_downloader: - environment: ${{ inputs.is_production && 'production' || '' }} # コード署名用のenvironment + environment: ${{ inputs.code_signing && 'production' || '' }} # コード署名用のenvironment strategy: matrix: include: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d84d16442..f4c4d6ab1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -284,17 +284,12 @@ jobs: - run: cargo build -p test_util -vv # build scriptにより/crates/test_util/data/の生成 - run: poetry run maturin build --locked - run: poetry run maturin develop --locked - - name: 必要なDLLをコピーしてpytestを実行 - run: | - cp -v ../../target/debug/onnxruntime.dll . || true - cp -v ../../target/debug/libonnxruntime.so.* . || true - cp -v ../../target/debug/libonnxruntime.*.dylib . || true - - poetry run pytest + - name: pytestを実行 + run: poetry run pytest - name: Exampleを実行 run: | for file in ../../example/python/run{,-asyncio}.py; do - poetry run python "$file" ../test_util/data/model/sample.vvm --dict-dir ../test_util/data/open_jtalk_dic_utf_8-1.11 + poetry run python "$file" ../test_util/data/model/sample.vvm --dict-dir ../test_util/data/open_jtalk_dic_utf_8-1.11 --onnxruntime ../test_util/data/lib/*onnxruntime* done build-and-test-java-api: strategy: diff --git a/Cargo.lock b/Cargo.lock index dfb585fb2..531efc631 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4272,7 +4272,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "voicevox-ort" version = "2.0.0-rc.4" -source = "git+https://github.com/VOICEVOX/ort.git?rev=8627833456a69e7841ae2a29fd184752df8de8d9#8627833456a69e7841ae2a29fd184752df8de8d9" +source = "git+https://github.com/VOICEVOX/ort.git?rev=3ecf05d66e2e04435fde3c8200e5208ce2707eb7#3ecf05d66e2e04435fde3c8200e5208ce2707eb7" dependencies = [ "anyhow", "half", @@ -4289,7 +4289,7 @@ dependencies = [ [[package]] name = "voicevox-ort-sys" version = "2.0.0-rc.4" -source = "git+https://github.com/VOICEVOX/ort.git?rev=8627833456a69e7841ae2a29fd184752df8de8d9#8627833456a69e7841ae2a29fd184752df8de8d9" +source = "git+https://github.com/VOICEVOX/ort.git?rev=3ecf05d66e2e04435fde3c8200e5208ce2707eb7#3ecf05d66e2e04435fde3c8200e5208ce2707eb7" dependencies = [ "flate2", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index e3461156c..932e2b1d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,7 +99,7 @@ zip = "0.6.3" [workspace.dependencies.voicevox-ort] git = "https://github.com/VOICEVOX/ort.git" -rev = "8627833456a69e7841ae2a29fd184752df8de8d9" +rev = "3ecf05d66e2e04435fde3c8200e5208ce2707eb7" [workspace.dependencies.open_jtalk] git = "https://github.com/VOICEVOX/open_jtalk-rs.git" diff --git a/build_util/make_ios_xcframework.bash b/build_util/make_ios_xcframework.bash index 2d35fac88..e2608955e 100755 --- a/build_util/make_ios_xcframework.bash +++ b/build_util/make_ios_xcframework.bash @@ -65,9 +65,9 @@ for arch in "${arches[@]}"; do install_name_tool -id "@rpath/voicevox_core.framework/voicevox_core" \ "Framework-${arch}/voicevox_core.framework/voicevox_core" - # 依存ライブラリonnxruntimeへの@rpathを変更 + # onnxruntimeへの@rpathを、voicevox_onnxruntimeのXCFrameworkに変更 install_name_tool -change "@rpath/$dylib_string" \ - "@rpath/onnxruntime.framework/onnxruntime" \ + "@rpath/voicevox_onnxruntime.framework/voicevox_onnxruntime" \ "Framework-${arch}/voicevox_core.framework/voicevox_core" done diff --git a/crates/voicevox_core/src/devices.rs b/crates/voicevox_core/src/devices.rs index 0890c0cff..176e044b4 100644 --- a/crates/voicevox_core/src/devices.rs +++ b/crates/voicevox_core/src/devices.rs @@ -57,12 +57,7 @@ fn test_gpu( /// use voicevox_core::{nonblocking::Onnxruntime, SupportedDevices}; /// /// # voicevox_core::blocking::Onnxruntime::load_once() -/// # .filename(if cfg!(windows) { -/// # // Windows\System32\onnxruntime.dllを回避 -/// # test_util::ONNXRUNTIME_DYLIB_PATH -/// # } else { -/// # voicevox_core::blocking::Onnxruntime::LIB_VERSIONED_FILENAME -/// # }) +/// # .filename(test_util::ONNXRUNTIME_DYLIB_PATH) /// # .exec()?; /// # /// let onnxruntime = Onnxruntime::get().unwrap(); diff --git a/crates/voicevox_core/src/infer.rs b/crates/voicevox_core/src/infer.rs index e827ddd7d..baac7760c 100644 --- a/crates/voicevox_core/src/infer.rs +++ b/crates/voicevox_core/src/infer.rs @@ -1,9 +1,8 @@ pub(crate) mod domains; -mod model_file; pub(crate) mod runtimes; pub(crate) mod session_set; -use std::{borrow::Cow, collections::BTreeSet, fmt::Debug, ops::Index, sync::Arc}; +use std::{borrow::Cow, collections::BTreeSet, fmt::Debug}; use derive_new::new; use duplicate::duplicate_item; @@ -13,6 +12,7 @@ use thiserror::Error; use crate::{ devices::{DeviceSpec, GpuSpec}, + voice_model::ModelBytes, StyleType, SupportedDevices, }; @@ -37,7 +37,7 @@ pub(crate) trait InferenceRuntime: 'static { )] fn new_session( &self, - model: impl FnOnce() -> std::result::Result, DecryptModelError>, + model: &ModelBytes, options: InferenceSessionOptions, ) -> anyhow::Result<( Self::Session, @@ -51,7 +51,7 @@ pub(crate) trait InferenceRuntime: 'static { /// 共に扱われるべき推論操作の集合を示す。 pub(crate) trait InferenceDomain: Sized { type Operation: InferenceOperation; - type Manifest: Index>; + type Manifest; /// 対応する`StyleType`。 /// @@ -213,7 +213,3 @@ pub(crate) enum ExtractError { #[error(transparent)] Shape(#[from] ShapeError), } - -#[derive(Error, Debug)] -#[error("不正なモデルファイルです")] -pub(crate) struct DecryptModelError; diff --git a/crates/voicevox_core/src/infer/model_file.rs b/crates/voicevox_core/src/infer/model_file.rs deleted file mode 100644 index 470ce9a6b..000000000 --- a/crates/voicevox_core/src/infer/model_file.rs +++ /dev/null @@ -1,5 +0,0 @@ -use super::DecryptModelError; - -pub(super) fn decrypt(content: &[u8]) -> std::result::Result, DecryptModelError> { - Ok(content.to_owned()) -} diff --git a/crates/voicevox_core/src/infer/runtimes/onnxruntime.rs b/crates/voicevox_core/src/infer/runtimes/onnxruntime.rs index ffeb55e5f..0db3c644d 100644 --- a/crates/voicevox_core/src/infer/runtimes/onnxruntime.rs +++ b/crates/voicevox_core/src/infer/runtimes/onnxruntime.rs @@ -24,11 +24,12 @@ use ort::{ use crate::{ devices::{DeviceSpec, GpuSpec, SupportedDevices}, error::ErrorRepr, + voice_model::ModelBytes, }; use super::super::{ - DecryptModelError, InferenceRuntime, InferenceSessionOptions, InputScalarKind, - OutputScalarKind, OutputTensor, ParamInfo, PushInputTensor, + InferenceRuntime, InferenceSessionOptions, InputScalarKind, OutputScalarKind, OutputTensor, + ParamInfo, PushInputTensor, }; impl InferenceRuntime for self::blocking::Onnxruntime { @@ -72,7 +73,7 @@ impl InferenceRuntime for self::blocking::Onnxruntime { fn new_session( &self, - model: impl FnOnce() -> std::result::Result, DecryptModelError>, + model: &ModelBytes, options: InferenceSessionOptions, ) -> anyhow::Result<( Self::Session, @@ -96,8 +97,10 @@ impl InferenceRuntime for self::blocking::Onnxruntime { } }; - let model = model()?; - let sess = builder.commit_from_memory(&{ model })?; + let sess = match model { + ModelBytes::Onnx(onnx) => builder.commit_from_memory(onnx), + ModelBytes::VvBin(bin) => builder.commit_from_vv_bin(bin), + }?; let input_param_infos = sess .inputs @@ -271,12 +274,10 @@ pub(crate) mod blocking { /// # use voicevox_core as another_lib; /// # /// # fn main() -> anyhow::Result<()> { - /// # if cfg!(windows) { - /// # // Windows\System32\onnxruntime.dllを回避 - /// # voicevox_core::blocking::Onnxruntime::load_once() - /// # .filename(test_util::ONNXRUNTIME_DYLIB_PATH) - /// # .exec()?; - /// # } + /// # voicevox_core::blocking::Onnxruntime::load_once() + /// # .filename(test_util::ONNXRUNTIME_DYLIB_PATH) + /// # .exec()?; + /// # /// let ort1 = voicevox_core::blocking::Onnxruntime::load_once().exec()?; /// let ort2 = another_lib::nonblocking::Onnxruntime::get().expect("`ort1`と同一のはず"); /// assert_eq!(ptr_addr(ort1), ptr_addr(ort2)); @@ -299,7 +300,7 @@ pub(crate) mod blocking { /// ONNX Runtimeのライブラリ名。 #[cfg(feature = "load-onnxruntime")] #[cfg_attr(docsrs, doc(cfg(feature = "load-onnxruntime")))] - pub const LIB_NAME: &'static str = "onnxruntime"; + pub const LIB_NAME: &'static str = "voicevox_onnxruntime"; /// 推奨されるONNX Runtimeのバージョン。 #[cfg(feature = "load-onnxruntime")] @@ -460,12 +461,10 @@ pub(crate) mod nonblocking { /// # /// # #[pollster::main] /// # async fn main() -> anyhow::Result<()> { - /// # if cfg!(windows) { - /// # // Windows\System32\onnxruntime.dllを回避 - /// # voicevox_core::blocking::Onnxruntime::load_once() - /// # .filename(test_util::ONNXRUNTIME_DYLIB_PATH) - /// # .exec()?; - /// # } + /// # voicevox_core::blocking::Onnxruntime::load_once() + /// # .filename(test_util::ONNXRUNTIME_DYLIB_PATH) + /// # .exec()?; + /// # /// let ort1 = voicevox_core::nonblocking::Onnxruntime::load_once() /// .exec() /// .await?; @@ -495,7 +494,7 @@ pub(crate) mod nonblocking { #[cfg(feature = "load-onnxruntime")] #[cfg_attr(docsrs, doc(cfg(feature = "load-onnxruntime")))] // ブロッキング版と等しいことはテストで担保 - pub const LIB_NAME: &'static str = "onnxruntime"; + pub const LIB_NAME: &'static str = "voicevox_onnxruntime"; /// 推奨されるONNX Runtimeのバージョン。 #[cfg(feature = "load-onnxruntime")] diff --git a/crates/voicevox_core/src/infer/session_set.rs b/crates/voicevox_core/src/infer/session_set.rs index e94fff962..03af11864 100644 --- a/crates/voicevox_core/src/infer/session_set.rs +++ b/crates/voicevox_core/src/infer/session_set.rs @@ -4,10 +4,10 @@ use anyhow::bail; use enum_map::{Enum as _, EnumMap}; use itertools::Itertools as _; -use crate::error::ErrorRepr; +use crate::{error::ErrorRepr, voice_model::ModelBytes}; use super::{ - model_file, InferenceDomain, InferenceInputSignature, InferenceOperation, InferenceRuntime, + InferenceDomain, InferenceInputSignature, InferenceOperation, InferenceRuntime, InferenceSessionOptions, InferenceSignature, ParamInfo, }; @@ -18,7 +18,7 @@ pub(crate) struct InferenceSessionSet( impl InferenceSessionSet { pub(crate) fn new( rt: &R, - model_bytes: &EnumMap>, + model_bytes: &EnumMap, options: &EnumMap, ) -> anyhow::Result { let mut sessions = model_bytes @@ -28,7 +28,7 @@ impl InferenceSessionSet { ::PARAM_INFOS[op]; let (sess, actual_input_param_infos, actual_output_param_infos) = - rt.new_session(|| model_file::decrypt(model_bytes), options[op])?; + rt.new_session(model_bytes, options[op])?; check_param_infos(expected_input_param_infos, &actual_input_param_infos)?; check_param_infos(expected_output_param_infos, &actual_output_param_infos)?; diff --git a/crates/voicevox_core/src/manifest.rs b/crates/voicevox_core/src/manifest.rs index 8a8290887..29092454c 100644 --- a/crates/voicevox_core/src/manifest.rs +++ b/crates/voicevox_core/src/manifest.rs @@ -86,21 +86,44 @@ pub(crate) type ManifestDomains = inference_domain_map_values!(for Option, + pub(crate) predict_duration: ModelFile, #[index_for_fields(TalkOperation::PredictIntonation)] - pub(crate) predict_intonation_filename: Arc, + pub(crate) predict_intonation: ModelFile, #[index_for_fields(TalkOperation::GenerateFullIntermediate)] - pub(crate) generate_full_intermediate_filename: Arc, + pub(crate) generate_full_intermediate: ModelFile, #[index_for_fields(TalkOperation::RenderAudioSegment)] - pub(crate) render_audio_segment_filename: Arc, + pub(crate) render_audio_segment: ModelFile, #[serde(default)] pub(crate) style_id_to_inner_voice_id: StyleIdToInnerVoiceId, } +#[derive(Deserialize, Clone)] +pub(crate) struct ModelFile { + pub(crate) r#type: ModelFileType, + pub(crate) filename: Arc, +} + +#[cfg(test)] +impl Default for ModelFile { + fn default() -> Self { + Self { + r#type: ModelFileType::Onnx, + filename: "".into(), + } + } +} + +#[derive(Deserialize, Clone, Copy)] +#[serde(rename_all = "snake_case")] +pub(crate) enum ModelFileType { + Onnx, + VvBin, +} + #[serde_as] #[derive(Default, Clone, Deref, Deserialize)] #[deref(forward)] diff --git a/crates/voicevox_core/src/synthesizer.rs b/crates/voicevox_core/src/synthesizer.rs index b30d7c3ca..17b1b2f9c 100644 --- a/crates/voicevox_core/src/synthesizer.rs +++ b/crates/voicevox_core/src/synthesizer.rs @@ -1228,12 +1228,10 @@ pub(crate) mod blocking { /// AccelerationMode, InitializeOptions, /// }; /// - /// # if cfg!(windows) { - /// # // Windows\System32\onnxruntime.dllを回避 - /// # voicevox_core::blocking::Onnxruntime::load_once() - /// # .filename(test_util::ONNXRUNTIME_DYLIB_PATH) - /// # .exec()?; - /// # } + /// # voicevox_core::blocking::Onnxruntime::load_once() + /// # .filename(test_util::ONNXRUNTIME_DYLIB_PATH) + /// # .exec()?; + /// # /// let mut syntesizer = Synthesizer::new( /// Onnxruntime::load_once().exec()?, /// Arc::new(OpenJtalk::new(OPEN_JTALK_DIC_DIR).unwrap()), @@ -1625,12 +1623,10 @@ pub(crate) mod nonblocking { /// AccelerationMode, InitializeOptions, /// }; /// - /// # if cfg!(windows) { - /// # // Windows\System32\onnxruntime.dllを回避 - /// # voicevox_core::blocking::Onnxruntime::load_once() - /// # .filename(test_util::ONNXRUNTIME_DYLIB_PATH) - /// # .exec()?; - /// # } + /// # voicevox_core::blocking::Onnxruntime::load_once() + /// # .filename(test_util::ONNXRUNTIME_DYLIB_PATH) + /// # .exec()?; + /// # /// let mut syntesizer = Synthesizer::new( /// Onnxruntime::load_once().exec().await?, /// Arc::new(OpenJtalk::new(OPEN_JTALK_DIC_DIR).await.unwrap()), diff --git a/crates/voicevox_core/src/voice_model.rs b/crates/voicevox_core/src/voice_model.rs index c2920398b..e4d1b3b5a 100644 --- a/crates/voicevox_core/src/voice_model.rs +++ b/crates/voicevox_core/src/voice_model.rs @@ -5,7 +5,6 @@ use std::{ collections::HashMap, path::{Path, PathBuf}, - sync::Arc, }; use anyhow::{anyhow, Context as _}; @@ -26,7 +25,7 @@ use crate::{ domains::{inference_domain_map_values, InferenceDomainMap, TalkDomain, TalkOperation}, InferenceDomain, }, - manifest::{Manifest, ManifestDomains, StyleIdToInnerVoiceId}, + manifest::{Manifest, ManifestDomains, ModelFile, ModelFileType, StyleIdToInnerVoiceId}, SpeakerMeta, StyleMeta, StyleType, VoiceModelMeta, }; @@ -36,7 +35,7 @@ use crate::{ pub type RawVoiceModelId = Uuid; pub(crate) type ModelBytesWithInnerVoiceIdsByDomain = inference_domain_map_values!( - for Option<(StyleIdToInnerVoiceId, EnumMap>)> + for Option<(StyleIdToInnerVoiceId, EnumMap)> ); /// 音声モデルID。 @@ -140,17 +139,19 @@ impl Inner { .map(|manifest| { let indices = enum_map! { TalkOperation::PredictDuration => { - find_entry_index(&manifest.predict_duration_filename)? + find_entry_index(&manifest.predict_duration.filename)? } TalkOperation::PredictIntonation => { - find_entry_index(&manifest.predict_intonation_filename)? + find_entry_index(&manifest.predict_intonation.filename)? } TalkOperation::GenerateFullIntermediate => { - find_entry_index(&manifest.generate_full_intermediate_filename)? - } - TalkOperation::RenderAudioSegment => { - find_entry_index(&manifest.render_audio_segment_filename)? + find_entry_index( + &manifest.generate_full_intermediate.filename, + )? } + TalkOperation::RenderAudioSegment => find_entry_index( + &manifest.render_audio_segment.filename, + )?, }; Ok(InferenceModelEntry { indices, manifest }) @@ -204,8 +205,9 @@ impl Inner { macro_rules! read_file { ($entry:expr $(,)?) => {{ - let (index, filename): (usize, Arc) = $entry; - zip.read_file(index) + let (index, ModelFile { r#type, filename }): (usize, ModelFile) = $entry; + let bytes = zip + .read_file(index) .map_err(move |source| { error( LoadModelErrorKind::ReadZipEntry { @@ -214,7 +216,8 @@ impl Inner { source, ) }) - .await? + .await?; + ModelBytes::new(r#type, bytes) }}; } @@ -367,6 +370,20 @@ impl VoiceModelHeader { } } +pub(crate) enum ModelBytes { + Onnx(Vec), + VvBin(Vec), +} + +impl ModelBytes { + fn new(kind: ModelFileType, bytes: Vec) -> Self { + (match kind { + ModelFileType::Onnx => Self::Onnx, + ModelFileType::VvBin => Self::VvBin, + })(bytes) + } +} + impl InferenceDomainMap { /// manifestとして対応していない`StyleType`に対してエラーを発する。 /// diff --git a/crates/voicevox_core_c_api/src/compatible_engine.rs b/crates/voicevox_core_c_api/src/compatible_engine.rs index 92ecfcf94..f9f8bf865 100644 --- a/crates/voicevox_core_c_api/src/compatible_engine.rs +++ b/crates/voicevox_core_c_api/src/compatible_engine.rs @@ -7,6 +7,7 @@ use std::{ use libc::c_int; +use tracing::warn; use voicevox_core::{StyleId, VoiceModelId, __internal::interop::PerformInference as _}; use crate::{helpers::display_error, init_logger_once}; @@ -26,8 +27,20 @@ macro_rules! ensure_initialized { static ERROR_MESSAGE: LazyLock> = LazyLock::new(|| Mutex::new(String::new())); static ONNXRUNTIME: LazyLock<&'static voicevox_core::blocking::Onnxruntime> = LazyLock::new(|| { + let alt_onnxruntime_filename = voicevox_core::blocking::Onnxruntime::LIB_VERSIONED_FILENAME + .replace( + voicevox_core::blocking::Onnxruntime::LIB_NAME, + "onnxruntime", + ); voicevox_core::blocking::Onnxruntime::load_once() .exec() + .or_else(|err| { + warn!("{err}"); + warn!("falling back to `{alt_onnxruntime_filename}`"); + voicevox_core::blocking::Onnxruntime::load_once() + .filename(alt_onnxruntime_filename) + .exec() + }) .unwrap_or_else(|err| { display_error(&err); panic!("ONNX Runtimeをロードもしくは初期化ができなかったため、クラッシュします"); diff --git a/crates/voicevox_core_c_api/src/lib.rs b/crates/voicevox_core_c_api/src/lib.rs index 883103c81..7efb1e9e3 100644 --- a/crates/voicevox_core_c_api/src/lib.rs +++ b/crates/voicevox_core_c_api/src/lib.rs @@ -66,7 +66,7 @@ fn init_logger_once() { .with_env_filter(if env::var_os(EnvFilter::DEFAULT_ENV).is_some() { EnvFilter::from_default_env() } else { - "error,voicevox_core=info,voicevox_core_c_api=info,ort=info".into() + "error,voicevox_core=info,voicevox_core_c_api=info,ort=warn".into() }) .with_timer(local_time as fn(&mut Writer<'_>) -> _) .with_ansi(ansi) diff --git a/crates/voicevox_core_c_api/tests/e2e/log_mask.rs b/crates/voicevox_core_c_api/tests/e2e/log_mask.rs index 4e6d26482..7a19ca19f 100644 --- a/crates/voicevox_core_c_api/tests/e2e/log_mask.rs +++ b/crates/voicevox_core_c_api/tests/e2e/log_mask.rs @@ -1,5 +1,6 @@ use std::sync::LazyLock; +use const_format::concatcp; use regex::{Regex, Replacer}; use crate::assert_cdylib::Utf8Output; @@ -21,10 +22,22 @@ impl Utf8Output { ) } - pub(crate) fn mask_onnxruntime_version(self) -> Self { + pub(crate) fn mask_onnxruntime_filename(self) -> Self { self.mask_stderr( - static_regex!(regex::escape(ort::downloaded_version!())), - "{onnxruntime_version}", + static_regex!(regex::escape( + const { + if cfg!(windows) { + r"onnxruntime.dll" + } else if cfg!(target_os = "linux") { + concatcp!("libonnxruntime.so.", ort::downloaded_version!()) + } else if cfg!(target_os = "macos") { + concatcp!("libonnxruntime.", ort::downloaded_version!(), ".dylib") + } else { + panic!("unsupported") + } + } + )), + "{onnxruntime_filename}", ) } diff --git a/crates/voicevox_core_c_api/tests/e2e/snapshots.toml b/crates/voicevox_core_c_api/tests/e2e/snapshots.toml index d5168b3c5..9a9c81283 100644 --- a/crates/voicevox_core_c_api/tests/e2e/snapshots.toml +++ b/crates/voicevox_core_c_api/tests/e2e/snapshots.toml @@ -51,12 +51,14 @@ metas = ''' } ]''' stderr.windows = ''' -{timestamp} INFO ort: Loaded ONNX Runtime dylib with version '{onnxruntime_version}' +{timestamp} WARN voicevox_core::compatible_engine: ONNX Runtimeのロードまたは初期化ができませんでした +{timestamp} WARN voicevox_core::compatible_engine: falling back to `{onnxruntime_filename}` {windows-video-cards} {timestamp} INFO voicevox_core::synthesizer::inner: CPUを利用します ''' stderr.unix = ''' -{timestamp} INFO ort: Loaded ONNX Runtime dylib with version '{onnxruntime_version}' +{timestamp} WARN voicevox_core::compatible_engine: ONNX Runtimeのロードまたは初期化ができませんでした +{timestamp} WARN voicevox_core::compatible_engine: falling back to `{onnxruntime_filename}` {timestamp} INFO voicevox_core::synthesizer::inner: CPUを利用します ''' @@ -114,19 +116,15 @@ result_messages.24 = "ユーザー辞書の単語のバリデーションに失 result_messages.25 = "UUIDの変換に失敗しました" result_messages.28 = "モデルの形式が不正です" result_messages.29 = "推論ライブラリのロードまたは初期化ができませんでした" -stderr = ''' -{timestamp} INFO ort: Loaded ONNX Runtime dylib with version '{onnxruntime_version}' -''' +stderr = '' [simple_tts] output."こんにちは、音声合成の世界へようこそ".wav_length = 176172 stderr.windows = ''' -{timestamp} INFO ort: Loaded ONNX Runtime dylib with version '{onnxruntime_version}' {windows-video-cards} {timestamp} INFO voicevox_core::synthesizer::inner: CPUを利用します ''' stderr.unix = ''' -{timestamp} INFO ort: Loaded ONNX Runtime dylib with version '{onnxruntime_version}' {timestamp} INFO voicevox_core::synthesizer::inner: CPUを利用します ''' @@ -183,35 +181,29 @@ metas = ''' } ]''' stderr.windows = ''' -{timestamp} INFO ort: Loaded ONNX Runtime dylib with version '{onnxruntime_version}' {windows-video-cards} {timestamp} INFO voicevox_core::synthesizer::inner: CPUを利用します ''' stderr.unix = ''' -{timestamp} INFO ort: Loaded ONNX Runtime dylib with version '{onnxruntime_version}' {timestamp} INFO voicevox_core::synthesizer::inner: CPUを利用します ''' [tts_via_audio_query] output."こんにちは、音声合成の世界へようこそ".wav_length = 176172 stderr.windows = ''' -{timestamp} INFO ort: Loaded ONNX Runtime dylib with version '{onnxruntime_version}' {windows-video-cards} {timestamp} INFO voicevox_core::synthesizer::inner: CPUを利用します ''' stderr.unix = ''' -{timestamp} INFO ort: Loaded ONNX Runtime dylib with version '{onnxruntime_version}' {timestamp} INFO voicevox_core::synthesizer::inner: CPUを利用します ''' [user_dict_load] stderr.windows = ''' -{timestamp} INFO ort: Loaded ONNX Runtime dylib with version '{onnxruntime_version}' {windows-video-cards} {timestamp} INFO voicevox_core::synthesizer::inner: CPUを利用します ''' stderr.unix = ''' -{timestamp} INFO ort: Loaded ONNX Runtime dylib with version '{onnxruntime_version}' {timestamp} INFO voicevox_core::synthesizer::inner: CPUを利用します ''' diff --git a/crates/voicevox_core_c_api/tests/e2e/testcases/compatible_engine.rs b/crates/voicevox_core_c_api/tests/e2e/testcases/compatible_engine.rs index e69ad68fd..581edece5 100644 --- a/crates/voicevox_core_c_api/tests/e2e/testcases/compatible_engine.rs +++ b/crates/voicevox_core_c_api/tests/e2e/testcases/compatible_engine.rs @@ -97,7 +97,7 @@ impl assert_cdylib::TestCase for TestCase { fn assert_output(&self, output: Utf8Output) -> AssertResult { output .mask_timestamps() - .mask_onnxruntime_version() + .mask_onnxruntime_filename() .mask_windows_video_cards() .assert() .try_success()? diff --git a/crates/voicevox_core_c_api/tests/e2e/testcases/compatible_engine_load_model_before_initialize.rs b/crates/voicevox_core_c_api/tests/e2e/testcases/compatible_engine_load_model_before_initialize.rs index 7b709a83d..2d7ade9fd 100644 --- a/crates/voicevox_core_c_api/tests/e2e/testcases/compatible_engine_load_model_before_initialize.rs +++ b/crates/voicevox_core_c_api/tests/e2e/testcases/compatible_engine_load_model_before_initialize.rs @@ -33,7 +33,7 @@ impl assert_cdylib::TestCase for TestCase { fn assert_output(&self, output: Utf8Output) -> AssertResult { output .mask_timestamps() - .mask_onnxruntime_version() + .mask_onnxruntime_filename() .mask_windows_video_cards() .assert() .try_success()? diff --git a/crates/voicevox_core_c_api/tests/e2e/testcases/double_delete_synthesizer.rs b/crates/voicevox_core_c_api/tests/e2e/testcases/double_delete_synthesizer.rs index 170ee718f..f03583613 100644 --- a/crates/voicevox_core_c_api/tests/e2e/testcases/double_delete_synthesizer.rs +++ b/crates/voicevox_core_c_api/tests/e2e/testcases/double_delete_synthesizer.rs @@ -1,13 +1,21 @@ //! `voicevox_synthesizer_delete`を二度呼ぶとクラッシュすることを確認する。 -use std::{ffi::CString, mem::MaybeUninit, sync::LazyLock}; +use std::{ + env, + ffi::{CStr, CString}, + mem::MaybeUninit, + sync::LazyLock, +}; use assert_cmd::assert::AssertResult; +use const_format::concatcp; use indexmap::IndexSet; use libloading::Library; use serde::{Deserialize, Serialize}; use test_util::{ - c_api::{self, CApi, VoicevoxInitializeOptions, VoicevoxResultCode}, + c_api::{ + self, CApi, VoicevoxInitializeOptions, VoicevoxLoadOnnxruntimeOptions, VoicevoxResultCode, + }, OPEN_JTALK_DIC_DIR, }; @@ -28,10 +36,24 @@ impl assert_cdylib::TestCase for TestCase { let onnxruntime = { let mut onnxruntime = MaybeUninit::uninit(); - assert_ok(lib.voicevox_onnxruntime_load_once( - lib.voicevox_make_default_load_onnxruntime_options(), - onnxruntime.as_mut_ptr(), - )); + assert_ok( + lib.voicevox_onnxruntime_load_once( + VoicevoxLoadOnnxruntimeOptions { + filename: CStr::from_bytes_with_nul( + concatcp!( + env::consts::DLL_PREFIX, + "onnxruntime", + env::consts::DLL_SUFFIX, + '\0' + ) + .as_ref(), + ) + .expect("this ends with nul") + .as_ptr(), + }, + onnxruntime.as_mut_ptr(), + ), + ); onnxruntime.assume_init() }; diff --git a/crates/voicevox_core_c_api/tests/e2e/testcases/global_info.rs b/crates/voicevox_core_c_api/tests/e2e/testcases/global_info.rs index a36a7d9bd..fe9d518a1 100644 --- a/crates/voicevox_core_c_api/tests/e2e/testcases/global_info.rs +++ b/crates/voicevox_core_c_api/tests/e2e/testcases/global_info.rs @@ -1,10 +1,11 @@ -use std::{collections::HashMap, ffi::CStr, mem::MaybeUninit, str, sync::LazyLock}; +use std::{collections::HashMap, env, ffi::CStr, mem::MaybeUninit, str, sync::LazyLock}; use assert_cmd::assert::AssertResult; +use const_format::concatcp; use libloading::Library; use serde::{Deserialize, Serialize}; use serde_with::{serde_as, DisplayFromStr}; -use test_util::c_api::{self, CApi, VoicevoxResultCode}; +use test_util::c_api::{self, CApi, VoicevoxLoadOnnxruntimeOptions, VoicevoxResultCode}; use voicevox_core::SupportedDevices; use crate::{ @@ -29,10 +30,31 @@ impl assert_cdylib::TestCase for TestCase { let onnxruntime = { let mut onnxruntime = MaybeUninit::uninit(); - assert_ok(lib.voicevox_onnxruntime_load_once( - lib.voicevox_make_default_load_onnxruntime_options(), - onnxruntime.as_mut_ptr(), - )); + let _ = const { + if true { + 0 + } else { + panic!(); + } + }; + assert_ok( + lib.voicevox_onnxruntime_load_once( + VoicevoxLoadOnnxruntimeOptions { + filename: CStr::from_bytes_with_nul( + concatcp!( + env::consts::DLL_PREFIX, + "onnxruntime", + env::consts::DLL_SUFFIX, + '\0' + ) + .as_ref(), + ) + .expect("this ends with nul") + .as_ptr(), + }, + onnxruntime.as_mut_ptr(), + ), + ); onnxruntime.assume_init() }; @@ -89,7 +111,7 @@ impl assert_cdylib::TestCase for TestCase { fn assert_output(&self, output: Utf8Output) -> AssertResult { output .mask_timestamps() - .mask_onnxruntime_version() + .mask_onnxruntime_filename() .mask_windows_video_cards() .assert() .try_success()? diff --git a/crates/voicevox_core_c_api/tests/e2e/testcases/simple_tts.rs b/crates/voicevox_core_c_api/tests/e2e/testcases/simple_tts.rs index 1997d30e9..28e734ea4 100644 --- a/crates/voicevox_core_c_api/tests/e2e/testcases/simple_tts.rs +++ b/crates/voicevox_core_c_api/tests/e2e/testcases/simple_tts.rs @@ -1,10 +1,19 @@ -use std::{collections::HashMap, ffi::CString, mem::MaybeUninit, sync::LazyLock}; +use std::{ + collections::HashMap, + env, + ffi::{CStr, CString}, + mem::MaybeUninit, + sync::LazyLock, +}; use assert_cmd::assert::AssertResult; +use const_format::concatcp; use libloading::Library; use serde::{Deserialize, Serialize}; use test_util::{ - c_api::{self, CApi, VoicevoxInitializeOptions, VoicevoxResultCode}, + c_api::{ + self, CApi, VoicevoxInitializeOptions, VoicevoxLoadOnnxruntimeOptions, VoicevoxResultCode, + }, OPEN_JTALK_DIC_DIR, }; @@ -38,10 +47,24 @@ impl assert_cdylib::TestCase for TestCase { let onnxruntime = { let mut onnxruntime = MaybeUninit::uninit(); - assert_ok(lib.voicevox_onnxruntime_load_once( - lib.voicevox_make_default_load_onnxruntime_options(), - onnxruntime.as_mut_ptr(), - )); + assert_ok( + lib.voicevox_onnxruntime_load_once( + VoicevoxLoadOnnxruntimeOptions { + filename: CStr::from_bytes_with_nul( + concatcp!( + env::consts::DLL_PREFIX, + "onnxruntime", + env::consts::DLL_SUFFIX, + '\0' + ) + .as_ref(), + ) + .expect("this ends with nul") + .as_ptr(), + }, + onnxruntime.as_mut_ptr(), + ), + ); onnxruntime.assume_init() }; @@ -105,7 +128,7 @@ impl assert_cdylib::TestCase for TestCase { fn assert_output(&self, output: Utf8Output) -> AssertResult { output .mask_timestamps() - .mask_onnxruntime_version() + .mask_onnxruntime_filename() .mask_windows_video_cards() .assert() .try_success()? diff --git a/crates/voicevox_core_c_api/tests/e2e/testcases/synthesizer_new_output_json.rs b/crates/voicevox_core_c_api/tests/e2e/testcases/synthesizer_new_output_json.rs index ac662d06e..ecaced0c4 100644 --- a/crates/voicevox_core_c_api/tests/e2e/testcases/synthesizer_new_output_json.rs +++ b/crates/voicevox_core_c_api/tests/e2e/testcases/synthesizer_new_output_json.rs @@ -1,15 +1,19 @@ use std::{ + env, ffi::{CStr, CString}, mem::MaybeUninit, sync::LazyLock, }; use assert_cmd::assert::AssertResult; +use const_format::concatcp; use libloading::Library; use serde::{Deserialize, Serialize}; use test_util::{ - c_api::{self, CApi, VoicevoxInitializeOptions, VoicevoxResultCode}, + c_api::{ + self, CApi, VoicevoxInitializeOptions, VoicevoxLoadOnnxruntimeOptions, VoicevoxResultCode, + }, OPEN_JTALK_DIC_DIR, }; @@ -30,10 +34,24 @@ impl assert_cdylib::TestCase for TestCase { let onnxruntime = { let mut onnxruntime = MaybeUninit::uninit(); - assert_ok(lib.voicevox_onnxruntime_load_once( - lib.voicevox_make_default_load_onnxruntime_options(), - onnxruntime.as_mut_ptr(), - )); + assert_ok( + lib.voicevox_onnxruntime_load_once( + VoicevoxLoadOnnxruntimeOptions { + filename: CStr::from_bytes_with_nul( + concatcp!( + env::consts::DLL_PREFIX, + "onnxruntime", + env::consts::DLL_SUFFIX, + '\0' + ) + .as_ref(), + ) + .expect("this ends with nul") + .as_ptr(), + }, + onnxruntime.as_mut_ptr(), + ), + ); onnxruntime.assume_init() }; @@ -95,7 +113,7 @@ impl assert_cdylib::TestCase for TestCase { fn assert_output(&self, output: Utf8Output) -> AssertResult { output .mask_timestamps() - .mask_onnxruntime_version() + .mask_onnxruntime_filename() .mask_windows_video_cards() .assert() .try_success()? diff --git a/crates/voicevox_core_c_api/tests/e2e/testcases/tts_via_audio_query.rs b/crates/voicevox_core_c_api/tests/e2e/testcases/tts_via_audio_query.rs index 2536a73d3..32fabe3f4 100644 --- a/crates/voicevox_core_c_api/tests/e2e/testcases/tts_via_audio_query.rs +++ b/crates/voicevox_core_c_api/tests/e2e/testcases/tts_via_audio_query.rs @@ -1,10 +1,19 @@ -use std::{collections::HashMap, ffi::CString, mem::MaybeUninit, sync::LazyLock}; +use std::{ + collections::HashMap, + env, + ffi::{CStr, CString}, + mem::MaybeUninit, + sync::LazyLock, +}; use assert_cmd::assert::AssertResult; +use const_format::concatcp; use libloading::Library; use serde::{Deserialize, Serialize}; use test_util::{ - c_api::{self, CApi, VoicevoxInitializeOptions, VoicevoxResultCode}, + c_api::{ + self, CApi, VoicevoxInitializeOptions, VoicevoxLoadOnnxruntimeOptions, VoicevoxResultCode, + }, OPEN_JTALK_DIC_DIR, }; @@ -38,10 +47,24 @@ impl assert_cdylib::TestCase for TestCase { let onnxruntime = { let mut onnxruntime = MaybeUninit::uninit(); - assert_ok(lib.voicevox_onnxruntime_load_once( - lib.voicevox_make_default_load_onnxruntime_options(), - onnxruntime.as_mut_ptr(), - )); + assert_ok( + lib.voicevox_onnxruntime_load_once( + VoicevoxLoadOnnxruntimeOptions { + filename: CStr::from_bytes_with_nul( + concatcp!( + env::consts::DLL_PREFIX, + "onnxruntime", + env::consts::DLL_SUFFIX, + '\0' + ) + .as_ref(), + ) + .expect("this ends with nul") + .as_ptr(), + }, + onnxruntime.as_mut_ptr(), + ), + ); onnxruntime.assume_init() }; @@ -117,7 +140,7 @@ impl assert_cdylib::TestCase for TestCase { fn assert_output(&self, output: Utf8Output) -> AssertResult { output .mask_timestamps() - .mask_onnxruntime_version() + .mask_onnxruntime_filename() .mask_windows_video_cards() .assert() .try_success()? diff --git a/crates/voicevox_core_c_api/tests/e2e/testcases/user_dict_load.rs b/crates/voicevox_core_c_api/tests/e2e/testcases/user_dict_load.rs index 25915bc10..a6e234eaa 100644 --- a/crates/voicevox_core_c_api/tests/e2e/testcases/user_dict_load.rs +++ b/crates/voicevox_core_c_api/tests/e2e/testcases/user_dict_load.rs @@ -1,14 +1,18 @@ // ユーザー辞書の登録によって読みが変化することを確認するテスト。 // 辞書ロード前後でAudioQueryのkanaが変化するかどうかで確認する。 +use std::env; use std::ffi::{CStr, CString}; use std::mem::MaybeUninit; use std::sync::LazyLock; use assert_cmd::assert::AssertResult; +use const_format::concatcp; use libloading::Library; use serde::{Deserialize, Serialize}; -use test_util::c_api::{self, CApi, VoicevoxInitializeOptions, VoicevoxResultCode}; +use test_util::c_api::{ + self, CApi, VoicevoxInitializeOptions, VoicevoxLoadOnnxruntimeOptions, VoicevoxResultCode, +}; use test_util::OPEN_JTALK_DIC_DIR; use crate::{ @@ -55,10 +59,24 @@ impl assert_cdylib::TestCase for TestCase { let onnxruntime = { let mut onnxruntime = MaybeUninit::uninit(); - assert_ok(lib.voicevox_onnxruntime_load_once( - lib.voicevox_make_default_load_onnxruntime_options(), - onnxruntime.as_mut_ptr(), - )); + assert_ok( + lib.voicevox_onnxruntime_load_once( + VoicevoxLoadOnnxruntimeOptions { + filename: CStr::from_bytes_with_nul( + concatcp!( + env::consts::DLL_PREFIX, + "onnxruntime", + env::consts::DLL_SUFFIX, + '\0' + ) + .as_ref(), + ) + .expect("this ends with nul") + .as_ptr(), + }, + onnxruntime.as_mut_ptr(), + ), + ); onnxruntime.assume_init() }; @@ -134,7 +152,7 @@ impl assert_cdylib::TestCase for TestCase { fn assert_output(&self, output: Utf8Output) -> AssertResult { output .mask_timestamps() - .mask_onnxruntime_version() + .mask_onnxruntime_filename() .mask_windows_video_cards() .assert() .try_success()? diff --git a/crates/voicevox_core_c_api/tests/e2e/testcases/user_dict_manipulate.rs b/crates/voicevox_core_c_api/tests/e2e/testcases/user_dict_manipulate.rs index 313b00125..dd6457c1a 100644 --- a/crates/voicevox_core_c_api/tests/e2e/testcases/user_dict_manipulate.rs +++ b/crates/voicevox_core_c_api/tests/e2e/testcases/user_dict_manipulate.rs @@ -143,7 +143,7 @@ impl assert_cdylib::TestCase for TestCase { fn assert_output(&self, output: Utf8Output) -> AssertResult { output .mask_timestamps() - .mask_onnxruntime_version() + .mask_onnxruntime_filename() .mask_windows_video_cards() .assert() .try_success()? diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Onnxruntime.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Onnxruntime.java index 9a9cbe133..d957f4a0f 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Onnxruntime.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Onnxruntime.java @@ -20,7 +20,7 @@ */ public class Onnxruntime extends Dll { /** ONNX Runtimeのライブラリ名。 */ - public static final String LIB_NAME = "onnxruntime"; + public static final String LIB_NAME = "voicevox_onnxruntime"; /** 推奨されるONNX Runtimeのバージョン。 */ public static final String LIB_VERSION = "1.17.3"; diff --git a/crates/voicevox_core_java_api/lib/src/test/java/jp/hiroshiba/voicevoxcore/TestUtils.java b/crates/voicevox_core_java_api/lib/src/test/java/jp/hiroshiba/voicevoxcore/TestUtils.java index f505c327f..58c574a35 100644 --- a/crates/voicevox_core_java_api/lib/src/test/java/jp/hiroshiba/voicevoxcore/TestUtils.java +++ b/crates/voicevox_core_java_api/lib/src/test/java/jp/hiroshiba/voicevoxcore/TestUtils.java @@ -16,7 +16,9 @@ VoiceModelFile openModel() { } Onnxruntime loadOnnxruntime() { - final String FILENAME = "../../test_util/data/lib/" + Onnxruntime.LIB_VERSIONED_FILENAME; + final String FILENAME = + "../../test_util/data/lib/" + + Onnxruntime.LIB_VERSIONED_FILENAME.replace("voicevox_onnxruntime", "onnxruntime"); try { return Onnxruntime.loadOnce().filename(FILENAME).exec(); diff --git a/crates/voicevox_core_python_api/python/test/conftest.py b/crates/voicevox_core_python_api/python/test/conftest.py index 430e415c1..c55fcb4a4 100644 --- a/crates/voicevox_core_python_api/python/test/conftest.py +++ b/crates/voicevox_core_python_api/python/test/conftest.py @@ -13,7 +13,9 @@ / "test_util" / "data" / "lib" - / voicevox_core.blocking.Onnxruntime.LIB_VERSIONED_FILENAME + / voicevox_core.blocking.Onnxruntime.LIB_VERSIONED_FILENAME.replace( + "voicevox_onnxruntime", "onnxruntime" + ) ) open_jtalk_dic_dir = ( root_dir.parent.parent.parent / "test_util" / "data" / "open_jtalk_dic_utf_8-1.11" diff --git a/crates/voicevox_core_python_api/python/voicevox_core/_rust/asyncio.pyi b/crates/voicevox_core_python_api/python/voicevox_core/_rust/asyncio.pyi index d6359e038..8c346e449 100644 --- a/crates/voicevox_core_python_api/python/voicevox_core/_rust/asyncio.pyi +++ b/crates/voicevox_core_python_api/python/voicevox_core/_rust/asyncio.pyi @@ -69,7 +69,7 @@ class Onnxruntime: # ここの定数値が本物と合致するかどうかは、test_type_stub_consts.pyで担保する。 - LIB_NAME: str = "onnxruntime" + LIB_NAME: str = "voicevox_onnxruntime" """ONNX Runtimeのライブラリ名。""" LIB_VERSION: str = "1.17.3" diff --git a/crates/voicevox_core_python_api/python/voicevox_core/_rust/blocking.pyi b/crates/voicevox_core_python_api/python/voicevox_core/_rust/blocking.pyi index 9d73c032b..e2dd91fec 100644 --- a/crates/voicevox_core_python_api/python/voicevox_core/_rust/blocking.pyi +++ b/crates/voicevox_core_python_api/python/voicevox_core/_rust/blocking.pyi @@ -69,7 +69,7 @@ class Onnxruntime: # ここの定数値が本物と合致するかどうかは、test_type_stub_consts.pyで担保する。 - LIB_NAME: str = "onnxruntime" + LIB_NAME: str = "voicevox_onnxruntime" """ONNX Runtimeのライブラリ名。""" LIB_VERSION: str = "1.17.3" diff --git a/model/sample.vvm/manifest.json b/model/sample.vvm/manifest.json index 1075a0797..bc749319d 100644 --- a/model/sample.vvm/manifest.json +++ b/model/sample.vvm/manifest.json @@ -3,10 +3,22 @@ "id": "018fa5b1-146c-71e9-b523-6f6dabcf05fe", "metas_filename": "metas.json", "talk": { - "predict_duration_filename": "predict_duration.onnx", - "predict_intonation_filename": "predict_intonation.onnx", - "generate_full_intermediate_filename": "predict_spectrogram.onnx", - "render_audio_segment_filename": "vocoder.onnx", + "predict_duration": { + "type": "onnx", + "filename": "predict_duration.onnx" + }, + "predict_intonation": { + "type": "onnx", + "filename": "predict_intonation.onnx" + }, + "generate_full_intermediate": { + "type": "onnx", + "filename": "predict_spectrogram.onnx" + }, + "render_audio_segment": { + "type": "onnx", + "filename": "vocoder.onnx" + }, "style_id_to_inner_voice_id": { "302": 2, "303": 3