diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3b3f5d1..c5a899a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -162,5 +162,5 @@ jobs: push: true tags: | ghcr.io/${{ github.repository }}:${{ matrix.tag }} - file: docker/${{ matrix.tag }}.Dockerfile + file: scripts/docker/${{ matrix.tag }}.Dockerfile platforms: ${{ matrix.platform }} diff --git a/.gitignore b/.gitignore index 1b8d2ff..3559643 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ venv/ .env output.wav node_modules -dist/ \ No newline at end of file +dist/ +*.csv \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index e9a5e3e..5f13fce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.92" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f37166d7d48a0284b99dd824694c26119c700b53bf0d1540cdb147dbdaaf13" +checksum = "6b964d184e89d9b6b67dd2715bc8e74cf3107fb2b529990c90cf517326150bf4" [[package]] name = "async-trait" @@ -92,6 +92,12 @@ dependencies = [ "syn", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.4.0" @@ -124,7 +130,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper", "tokio", "tower", "tower-layer", @@ -147,7 +153,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper 1.0.1", + "sync_wrapper", "tower-layer", "tower-service", "tracing", @@ -180,6 +186,12 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "bincode" version = "1.3.3" @@ -279,6 +291,22 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "cpufeatures" version = "0.2.14" @@ -340,9 +368,9 @@ dependencies = [ [[package]] name = "csv" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" +checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf" dependencies = [ "csv-core", "itoa", @@ -394,6 +422,16 @@ dependencies = [ "syn", ] +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "pem-rfc7468", + "zeroize", +] + [[package]] name = "derive_builder" version = "0.20.2" @@ -519,9 +557,9 @@ checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -547,9 +585,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" +checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0" dependencies = [ "anstream", "anstyle", @@ -594,6 +632,12 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + [[package]] name = "filetime" version = "0.2.25" @@ -608,9 +652,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide", @@ -622,6 +666,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -646,6 +705,12 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + [[package]] name = "futures-task" version = "0.3.31" @@ -695,9 +760,28 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "h2" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] [[package]] name = "half" @@ -794,6 +878,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", + "h2", "http", "http-body", "httparse", @@ -802,22 +887,59 @@ dependencies = [ "pin-project-lite", "smallvec", "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", ] [[package]] name = "hyper-util" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", + "futures-channel", "futures-util", "http", "http-body", "hyper", "pin-project-lite", + "socket2", "tokio", "tower-service", + "tracing", ] [[package]] @@ -875,6 +997,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + [[package]] name = "is_terminal_polyfill" version = "1.70.1" @@ -911,7 +1039,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "145ee6f495871a0cde6d49ddfa0d103d07430c449d95b6d92fbfb032d622f0b7" dependencies = [ - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -925,71 +1053,53 @@ dependencies = [ [[package]] name = "jpreprocess" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05ad4316553f214144e04abb54a95f0ec55d9b8b5c4ae004f420ead40d07fe4" +checksum = "83db9c1370085636e1fed6cc87bf4de92b542ffc2397f340bc15230759d8eaf9" dependencies = [ "jlabel", "jpreprocess-core", "jpreprocess-dictionary", - "jpreprocess-dictionary-builder", "jpreprocess-jpcommon", "jpreprocess-naist-jdic", "jpreprocess-njd", - "lindera-core", + "lindera", "lindera-dictionary", - "lindera-tokenizer", "phf", ] [[package]] name = "jpreprocess-core" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe30c65ff4c092320f1bba3418ac111443a4827a9155442f6a7d8d0e3707cb51" +checksum = "1aec276b3cd0e291cfed484b81ecafac7caa658e967f37c1073c5e106a55e8b0" dependencies = [ "aho-corasick", "bincode", - "lindera-core", - "lindera-tokenizer", + "lindera", "once_cell", "regex", "serde", - "thiserror", + "thiserror 1.0.68", ] [[package]] name = "jpreprocess-dictionary" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c156a875d35ef6fedf31cb9d6bb3c562d16faad4506a5be27e2ed44357d755d4" -dependencies = [ - "anyhow", - "bincode", - "byteorder", - "jpreprocess-core", - "lindera-core", - "lindera-ipadic-builder", - "lindera-tokenizer", - "once_cell", - "serde", -] - -[[package]] -name = "jpreprocess-dictionary-builder" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cd89b119949a5071e6f49d805829f3dc17169eb7c6aab809e4f373c70098709" +checksum = "1f84675315762d9880f41c184d3854ef0578ca905fcca09a3d89784142e4446c" dependencies = [ "anyhow", "bincode", "byteorder", "csv", + "derive_builder", "glob", "jpreprocess-core", - "jpreprocess-dictionary", - "lindera-core", + "lindera", + "lindera-dictionary", "log", + "once_cell", "rayon", "serde", "yada", @@ -997,9 +1107,9 @@ dependencies = [ [[package]] name = "jpreprocess-jpcommon" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a95684847dcf9a95a94d74f725ca207e5106f2c0084959d9b328b7f8fcf3184" +checksum = "6f6b481d1f0dd259ef2ab368eec42140616826a8083e77f501286c108f9fad2c" dependencies = [ "jlabel", "jpreprocess-core", @@ -1008,38 +1118,33 @@ dependencies = [ [[package]] name = "jpreprocess-naist-jdic" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "472767e7dc48354e3b42759721ffc6b457856a339b10f9cb039749011f570cc2" +checksum = "f85955941185de40aa6202d06fc78ef8b08cb810adcc0674e711287931f22b89" dependencies = [ - "encoding", - "flate2", "jpreprocess-dictionary", - "jpreprocess-dictionary-builder", - "lindera-core", - "tar", - "ureq", + "lindera-dictionary", + "tokio", ] [[package]] name = "jpreprocess-njd" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25fc5071bd75e17af650bfe4697dfe7f5af8254965ce3242476698cee3c3b7af" +checksum = "168ece8bb1108a3477c9dec8e1cbed5104744c847a2f0fbf2d5b53c53fe10508" dependencies = [ "aho-corasick", "jpreprocess-core", "jpreprocess-dictionary", "jpreprocess-window", - "lindera-tokenizer", "phf", ] [[package]] name = "jpreprocess-window" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c06d7aceb8ce626a3318183096aa6dad82f046b3cec5d43e90066d1b07445a2" +checksum = "76f15d1def44b258c73ad66204e46f7f4be6f0876f2762b274017bf3f4aa8049" [[package]] name = "js-sys" @@ -1050,6 +1155,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kanaria" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f9d9652540055ac4fded998a73aca97d965899077ab1212587437da44196ff" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -1058,9 +1172,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.161" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libloading" @@ -1084,70 +1198,35 @@ dependencies = [ ] [[package]] -name = "lindera-cc-cedict-builder" -version = "0.32.2" +name = "lindera" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b8f642bc9c9130682569975772a17336c6aab26d11fc0f823f3e663167ace6" -dependencies = [ - "anyhow", - "lindera-core", - "lindera-decompress", - "lindera-dictionary-builder", -] - -[[package]] -name = "lindera-core" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c28191456debc98af6aa5f7db77872471983e9fa2a737b1c232b6ef543aed62" +checksum = "f1d8eeee3410e04f0375235b4420b105337db127e3759e6ceac52212f5b4e5ee" dependencies = [ "anyhow", "bincode", "byteorder", - "encoding_rs", - "log", + "csv", + "kanaria", + "lindera-dictionary", "once_cell", + "regex", "serde", - "thiserror", + "serde_json", + "serde_yaml", + "strum", + "strum_macros", + "unicode-blocks", + "unicode-normalization", + "unicode-segmentation", "yada", ] -[[package]] -name = "lindera-decompress" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4788a1ead2f63f3fc2888109272921dedd86a87b7d0bf05e9daab46600daac51" -dependencies = [ - "anyhow", - "flate2", - "serde", -] - [[package]] name = "lindera-dictionary" -version = "0.32.2" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf5f91725e32b9a21b1656baa7030766c9bafc4de4b4ddeb8ffdde7224dd2f6" -dependencies = [ - "anyhow", - "bincode", - "byteorder", - "lindera-cc-cedict-builder", - "lindera-core", - "lindera-ipadic-builder", - "lindera-ipadic-neologd-builder", - "lindera-ko-dic-builder", - "lindera-unidic-builder", - "serde", - "strum", - "strum_macros", -] - -[[package]] -name = "lindera-dictionary-builder" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e41f00ba7ac541b0ffd8c30e7a73f2dd197546cc5780462ec4f2e4782945a780" +checksum = "cbb14e04b9937c7382a20e5b135f9a6c7077e0d9a57a3f69e560471e57300476" dependencies = [ "anyhow", "bincode", @@ -1157,73 +1236,15 @@ dependencies = [ "encoding", "encoding_rs", "encoding_rs_io", + "flate2", "glob", - "lindera-core", - "lindera-decompress", "log", - "yada", -] - -[[package]] -name = "lindera-ipadic-builder" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf5031c52686128db13f774b2c5a8abfd52b4cc1f904041d8411aa19d630ce4d" -dependencies = [ - "anyhow", - "lindera-core", - "lindera-decompress", - "lindera-dictionary-builder", -] - -[[package]] -name = "lindera-ipadic-neologd-builder" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf36e40ace904741efdd883ed5c4dba6425f65156a0fb5d3f73a386335950dc" -dependencies = [ - "anyhow", - "lindera-core", - "lindera-decompress", - "lindera-dictionary-builder", -] - -[[package]] -name = "lindera-ko-dic-builder" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f2c60425abc1548570c2568858f74a1f042105ecd89faa39c651b4315350fd9" -dependencies = [ - "anyhow", - "lindera-core", - "lindera-decompress", - "lindera-dictionary-builder", -] - -[[package]] -name = "lindera-tokenizer" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "903e558981bcb6f59870aa7d6b4bcb09e8f7db778886a6a70f67fd74c9fa2ca3" -dependencies = [ - "bincode", - "lindera-core", - "lindera-dictionary", "once_cell", + "reqwest", "serde", - "serde_json", -] - -[[package]] -name = "lindera-unidic-builder" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e2c50015c242e02c451acb6748667ac6fd1d3d667cd7db48cd89e2f2d2377e" -dependencies = [ - "anyhow", - "lindera-core", - "lindera-decompress", - "lindera-dictionary-builder", + "tar", + "thiserror 2.0.11", + "yada", ] [[package]] @@ -1244,9 +1265,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" [[package]] name = "macro_rules_attribute" @@ -1349,6 +1370,23 @@ dependencies = [ "syn", ] +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "ndarray" version = "0.16.1" @@ -1428,9 +1466,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.2" +version = "1.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" [[package]] name = "onig" @@ -1454,10 +1492,54 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "openssl" +version = "0.10.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e14130c6a98cd258fdcb0fb6d744152343ff729cbfcb28c656a9d12b999fbcd" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "ort" -version = "2.0.0-rc.8" -source = "git+https://github.com/pykeio/ort.git#585efda15393c949010903990bd0a53e7d3d6ffe" +version = "2.0.0-rc.9" +source = "git+https://github.com/pykeio/ort.git#d738b1757bb375c8f7150cf566fc5a9d2c88008a" dependencies = [ "half", "libloading", @@ -1468,8 +1550,8 @@ dependencies = [ [[package]] name = "ort-sys" -version = "2.0.0-rc.8" -source = "git+https://github.com/pykeio/ort.git#585efda15393c949010903990bd0a53e7d3d6ffe" +version = "2.0.0-rc.9" +source = "git+https://github.com/pykeio/ort.git#d738b1757bb375c8f7150cf566fc5a9d2c88008a" dependencies = [ "flate2", "pkg-config", @@ -1507,6 +1589,15 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -1784,6 +1875,50 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "reqwest" +version = "0.12.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" +dependencies = [ + "base64 0.22.1", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-registry", +] + [[package]] name = "ring" version = "0.17.8" @@ -1824,15 +1959,22 @@ version = "0.23.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" dependencies = [ - "log", "once_cell", - "ring", "rustls-pki-types", "rustls-webpki", "subtle", "zeroize", ] +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "rustls-pki-types" version = "1.10.0" @@ -1905,7 +2047,7 @@ dependencies = [ "serde", "serde_json", "tar", - "thiserror", + "thiserror 2.0.11", "tokenizers", "zstd", ] @@ -1922,6 +2064,15 @@ dependencies = [ "wasm-bindgen-futures", ] +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -1929,19 +2080,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "serde" -version = "1.0.214" +name = "security-framework" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.218" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.218" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b" dependencies = [ "proc-macro2", "quote", @@ -1950,9 +2124,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.132" +version = "1.0.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6" dependencies = [ "itoa", "memchr", @@ -1982,6 +2156,19 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + [[package]] name = "sha2" version = "0.10.8" @@ -2014,6 +2201,15 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.13.2" @@ -2104,17 +2300,35 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "tar" @@ -2133,13 +2347,35 @@ version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" +[[package]] +name = "tempfile" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +dependencies = [ + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + [[package]] name = "thiserror" version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.68", +] + +[[package]] +name = "thiserror" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +dependencies = [ + "thiserror-impl 2.0.11", ] [[package]] @@ -2153,6 +2389,17 @@ dependencies = [ "syn", ] +[[package]] +name = "thiserror-impl" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -2170,9 +2417,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokenizers" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b172ffa9a2e5c31bbddc940cd5725d933ced983a9333bbebc4c7eda3bbce1557" +checksum = "9ecededfed68a69bc657e486510089e255e53c3d38cc7d4d59c8742668ca2cae" dependencies = [ "aho-corasick", "derive_builder", @@ -2195,7 +2442,7 @@ dependencies = [ "serde", "serde_json", "spm_precompiled", - "thiserror", + "thiserror 1.0.68", "unicode-normalization-alignments", "unicode-segmentation", "unicode_categories", @@ -2203,9 +2450,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.41.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" dependencies = [ "backtrace", "bytes", @@ -2221,9 +2468,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", @@ -2231,15 +2478,48 @@ dependencies = [ ] [[package]] -name = "tower" -version = "0.5.1" +name = "tokio-native-tls" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", "pin-project-lite", - "sync_wrapper 0.1.2", + "sync_wrapper", "tokio", "tower-layer", "tower-service", @@ -2278,6 +2558,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "typenum" version = "1.17.0" @@ -2290,6 +2576,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" +[[package]] +name = "unicode-blocks" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b12e05d9e06373163a9bb6bb8c263c261b396643a99445fe6b9811fd376581b" + [[package]] name = "unicode-ident" version = "1.0.13" @@ -2338,6 +2630,12 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + [[package]] name = "untrusted" version = "0.9.0" @@ -2346,18 +2644,34 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.10.1" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" +checksum = "217751151c53226090391713e533d9a5e904ba2570dabaaace29032687589c3e" dependencies = [ "base64 0.22.1", + "cc", + "der", "log", - "once_cell", - "rustls", + "native-tls", + "percent-encoding", + "rustls-pemfile", "rustls-pki-types", "socks", - "url", - "webpki-roots", + "ureq-proto", + "utf-8", + "webpki-root-certs", +] + +[[package]] +name = "ureq-proto" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c51fe73e1d8c4e06bb2698286f7e7453c6fc90528d6d2e7fc36bb4e87fe09b1" +dependencies = [ + "base64 0.22.1", + "http", + "httparse", + "log", ] [[package]] @@ -2371,6 +2685,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "utf8parse" version = "0.2.2" @@ -2413,12 +2733,27 @@ dependencies = [ "utoipa", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2503,10 +2838,10 @@ dependencies = [ ] [[package]] -name = "webpki-roots" -version = "0.26.6" +name = "webpki-root-certs" +version = "0.26.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +checksum = "09aed61f5e8d2c18344b3faa33a4c837855fe56642757754775548fee21386c4" dependencies = [ "rustls-pki-types", ] @@ -2533,6 +2868,36 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets", +] + [[package]] name = "windows-sys" version = "0.52.0" diff --git a/Cargo.toml b/Cargo.toml index c7ee18e..02c265f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,15 +1,16 @@ [workspace] resolver = "2" -members = ["sbv2_api", "sbv2_core", "sbv2_bindings", "sbv2_wasm"] +members = ["./crates/sbv2_api", "./crates/sbv2_core", "./crates/sbv2_bindings", "./crates/sbv2_wasm"] [workspace.dependencies] -anyhow = "1.0.86" +anyhow = "1.0.96" dotenvy = "0.15.7" -env_logger = "0.11.5" +env_logger = "0.11.6" ndarray = "0.16.1" -once_cell = "1.19.0" +once_cell = "1.20.3" [profile.release] -lto = true -debug = false strip = true +opt-level = "z" +lto = true +codegen-units = 1 diff --git a/README.md b/README.md index b7c972c..d13e1a6 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ JP-Extra しか対応していません。(基本的に対応する予定もあ ## 変換方法 -[こちら](https://github.com/tuna2134/sbv2-api/tree/main/convert)を参照してください。 +[こちら](https://github.com/tuna2134/sbv2-api/tree/main/scripts/convert)を参照してください。 ## Todo @@ -119,3 +119,4 @@ curl http://localhost:3000/models - [litagin02/Style-Bert-VITS2](https://github.com/litagin02/Style-Bert-VITS2) - このコードの書くにあたり、ベースとなる部分を参考にさせていただきました。 - [Googlefan](https://github.com/Googlefan256) - 彼にモデルを ONNX ヘ変換および効率化をする方法を教わりました。 +- [Aivis Project](https://github.com/Aivis-Project/AivisSpeech-Engine) - 辞書部分 \ No newline at end of file diff --git a/content.txt b/content.txt deleted file mode 100644 index caed4fc..0000000 --- a/content.txt +++ /dev/null @@ -1,14 +0,0 @@ -悪徳貴族として名高いヴェレット家の長男――オウガ・ヴェレットは転生者である。 -ブラック企業に勤め、過労死した彼には一つの夢があった。 - -「可愛いハーレム作って、美味い物を食べる。領民の税金で楽して好き放題な生活を送ってみせる!」 - -素晴らしき異世界ライフを夢見た彼は実現へ向けて、努力を始めた。 -ハーレムを築くためにいじめられてる平民の子を助けて恩を売ってやったり。 -労働力を手に入れるために多くの孤児を雇って教育したり。 -反乱を起きても鎮圧できるように魔法学院へ通って魔法を極める。 - -「クックック……! 順調、順調! 未来は明るいなぁ!」 - -――オウガはまだ知らない。 -楽な生活を送るためにしてきたことが評価され、世間から『聖者』様として呼ばれる未来を。 \ No newline at end of file diff --git a/sbv2_api/Cargo.toml b/crates/sbv2_api/Cargo.toml similarity index 100% rename from sbv2_api/Cargo.toml rename to crates/sbv2_api/Cargo.toml diff --git a/sbv2_api/build.rs b/crates/sbv2_api/build.rs similarity index 100% rename from sbv2_api/build.rs rename to crates/sbv2_api/build.rs diff --git a/sbv2_api/src/error.rs b/crates/sbv2_api/src/error.rs similarity index 100% rename from sbv2_api/src/error.rs rename to crates/sbv2_api/src/error.rs diff --git a/sbv2_api/src/main.rs b/crates/sbv2_api/src/main.rs similarity index 100% rename from sbv2_api/src/main.rs rename to crates/sbv2_api/src/main.rs diff --git a/sbv2_bindings/Cargo.toml b/crates/sbv2_bindings/Cargo.toml similarity index 100% rename from sbv2_bindings/Cargo.toml rename to crates/sbv2_bindings/Cargo.toml diff --git a/sbv2_bindings/pyproject.toml b/crates/sbv2_bindings/pyproject.toml similarity index 100% rename from sbv2_bindings/pyproject.toml rename to crates/sbv2_bindings/pyproject.toml diff --git a/sbv2_bindings/src/lib.rs b/crates/sbv2_bindings/src/lib.rs similarity index 100% rename from sbv2_bindings/src/lib.rs rename to crates/sbv2_bindings/src/lib.rs diff --git a/sbv2_bindings/src/sbv2.rs b/crates/sbv2_bindings/src/sbv2.rs similarity index 98% rename from sbv2_bindings/src/sbv2.rs rename to crates/sbv2_bindings/src/sbv2.rs index 0ecc414..05ea924 100644 --- a/sbv2_bindings/src/sbv2.rs +++ b/crates/sbv2_bindings/src/sbv2.rs @@ -107,7 +107,7 @@ impl TTSModel { /// style_vector : StyleVector /// スタイルベクトル fn get_style_vector( - &self, + &mut self, ident: String, style_id: i32, weight: f32, @@ -144,7 +144,7 @@ impl TTSModel { style_id: i32, sdp_ratio: f32, length_scale: f32, - ) -> anyhow::Result> { + ) -> anyhow::Result> { let data = self.model.easy_synthesize( ident.as_str(), &text, diff --git a/sbv2_bindings/src/style.rs b/crates/sbv2_bindings/src/style.rs similarity index 100% rename from sbv2_bindings/src/style.rs rename to crates/sbv2_bindings/src/style.rs diff --git a/sbv2_core/Cargo.toml b/crates/sbv2_core/Cargo.toml similarity index 81% rename from sbv2_core/Cargo.toml rename to crates/sbv2_core/Cargo.toml index 2f67aac..14dc1a7 100644 --- a/sbv2_core/Cargo.toml +++ b/crates/sbv2_core/Cargo.toml @@ -13,17 +13,17 @@ anyhow.workspace = true dotenvy.workspace = true env_logger.workspace = true hound = "3.5.1" -jpreprocess = { version = "0.10.0", features = ["naist-jdic"] } +jpreprocess = { version = "0.12.0", features = ["naist-jdic"] } ndarray.workspace = true num_cpus = "1.16.0" once_cell.workspace = true -ort = { git = "https://github.com/pykeio/ort.git", version = "2.0.0-rc.8", optional = true } +ort = { git = "https://github.com/pykeio/ort.git", version = "2.0.0-rc.9", optional = true } regex = "1.10.6" serde = { version = "1.0.210", features = ["derive"] } serde_json = "1.0.128" tar = "0.4.41" -thiserror = "1.0.63" -tokenizers = { version = "0.20.0", default-features = false } +thiserror = "2.0.11" +tokenizers = { version = "0.21.0", default-features = false } zstd = "0.13.2" [features] @@ -35,4 +35,4 @@ directml = ["ort/directml", "std"] tensorrt = ["ort/tensorrt", "std"] coreml = ["ort/coreml", "std"] default = ["std"] -no_std = ["tokenizers/unstable_wasm"] \ No newline at end of file +no_std = ["tokenizers/unstable_wasm"] diff --git a/sbv2_core/mora_convert.py b/crates/sbv2_core/mora_convert.py similarity index 100% rename from sbv2_core/mora_convert.py rename to crates/sbv2_core/mora_convert.py diff --git a/sbv2_core/src/bert.rs b/crates/sbv2_core/src/bert.rs similarity index 52% rename from sbv2_core/src/bert.rs rename to crates/sbv2_core/src/bert.rs index 0710bf6..d830606 100644 --- a/sbv2_core/src/bert.rs +++ b/crates/sbv2_core/src/bert.rs @@ -1,17 +1,18 @@ use crate::error::Result; use ndarray::{Array2, Ix2}; -use ort::Session; +use ort::session::Session; +use ort::value::TensorRef; pub fn predict( - session: &Session, + session: &mut Session, token_ids: Vec, attention_masks: Vec, ) -> Result> { let outputs = session.run( ort::inputs! { - "input_ids" => Array2::from_shape_vec((1, token_ids.len()), token_ids).unwrap(), - "attention_mask" => Array2::from_shape_vec((1, attention_masks.len()), attention_masks).unwrap(), - }? + "input_ids" => TensorRef::from_array_view((vec![1, token_ids.len() as i64], token_ids.as_slice()))?, + "attention_mask" => TensorRef::from_array_view((vec![1, attention_masks.len() as i64], attention_masks.as_slice()))?, + } )?; let output = outputs["output"] diff --git a/sbv2_core/src/error.rs b/crates/sbv2_core/src/error.rs similarity index 93% rename from sbv2_core/src/error.rs rename to crates/sbv2_core/src/error.rs index 6bb449e..1884407 100644 --- a/sbv2_core/src/error.rs +++ b/crates/sbv2_core/src/error.rs @@ -6,6 +6,8 @@ pub enum Error { TokenizerError(#[from] tokenizers::Error), #[error("JPreprocess error: {0}")] JPreprocessError(#[from] jpreprocess::error::JPreprocessError), + #[error("Lindera error: {0}")] + LinderaError(String), #[cfg(feature = "std")] #[error("ONNX error: {0}")] OrtError(#[from] ort::Error), diff --git a/sbv2_core/src/jtalk.rs b/crates/sbv2_core/src/jtalk.rs similarity index 96% rename from sbv2_core/src/jtalk.rs rename to crates/sbv2_core/src/jtalk.rs index 73aa2a8..5b57d5b 100644 --- a/sbv2_core/src/jtalk.rs +++ b/crates/sbv2_core/src/jtalk.rs @@ -1,21 +1,21 @@ use crate::error::{Error, Result}; use crate::mora::{MORA_KATA_TO_MORA_PHONEMES, VOWELS}; use crate::norm::{replace_punctuation, PUNCTUATIONS}; -use jpreprocess::*; +use jpreprocess::{kind, DefaultTokenizer, JPreprocess, SystemDictionaryConfig, UserDictionary}; use once_cell::sync::Lazy; use regex::Regex; use std::cmp::Reverse; use std::collections::HashSet; use std::sync::Arc; -type JPreprocessType = JPreprocess; +type JPreprocessType = JPreprocess; fn initialize_jtalk() -> Result { - let config = JPreprocessConfig { - dictionary: SystemDictionaryConfig::Bundled(kind::JPreprocessDictionaryKind::NaistJdic), - user_dictionary: None, - }; - let jpreprocess = JPreprocess::from_config(config)?; + let sdic = + SystemDictionaryConfig::Bundled(kind::JPreprocessDictionaryKind::NaistJdic).load()?; + let u = UserDictionary::load(include_bytes!("./dic/all.dic/all.bin")) + .map_err(|e| Error::LinderaError(e.to_string()))?; + let jpreprocess = JPreprocess::with_dictionaries(sdic, Some(u)); Ok(jpreprocess) } diff --git a/sbv2_core/src/lib.rs b/crates/sbv2_core/src/lib.rs similarity index 100% rename from sbv2_core/src/lib.rs rename to crates/sbv2_core/src/lib.rs diff --git a/sbv2_core/src/main.rs b/crates/sbv2_core/src/main.rs similarity index 94% rename from sbv2_core/src/main.rs rename to crates/sbv2_core/src/main.rs index 3a4cbdd..dc718b6 100644 --- a/sbv2_core/src/main.rs +++ b/crates/sbv2_core/src/main.rs @@ -6,7 +6,7 @@ fn main_inner() -> anyhow::Result<()> { use sbv2_core::tts; dotenvy::dotenv_override().ok(); env_logger::init(); - let text = fs::read_to_string("content.txt")?; + let text = "今日の天気は快晴です。"; let ident = "aaa"; let mut tts_holder = tts::TTSModelHolder::new( &fs::read(env::var("BERT_MODEL_PATH")?)?, diff --git a/crates/sbv2_core/src/model.rs b/crates/sbv2_core/src/model.rs new file mode 100644 index 0000000..82eaa0a --- /dev/null +++ b/crates/sbv2_core/src/model.rs @@ -0,0 +1,101 @@ +use crate::error::Result; +use ndarray::{array, Array1, Array2, Array3, Axis, Ix3}; +use ort::session::{builder::GraphOptimizationLevel, Session}; + +#[allow(clippy::vec_init_then_push, unused_variables)] +pub fn load_model>(model_file: P, bert: bool) -> Result { + let mut exp = Vec::new(); + #[cfg(feature = "tensorrt")] + { + if bert { + exp.push( + ort::execution_providers::TensorRTExecutionProvider::default() + .with_fp16(true) + .with_profile_min_shapes("input_ids:1x1,attention_mask:1x1") + .with_profile_max_shapes("input_ids:1x100,attention_mask:1x100") + .with_profile_opt_shapes("input_ids:1x25,attention_mask:1x25") + .build(), + ); + } + } + #[cfg(feature = "cuda")] + { + #[allow(unused_mut)] + let mut cuda = ort::execution_providers::CUDAExecutionProvider::default() + .with_conv_algorithm_search( + ort::execution_providers::CUDAExecutionProviderCuDNNConvAlgoSearch::Default, + ); + #[cfg(feature = "cuda_tf32")] + { + cuda = cuda.with_tf32(true); + } + exp.push(cuda.build()); + } + #[cfg(feature = "directml")] + { + exp.push(ort::execution_providers::DirectMLExecutionProvider::default().build()); + } + #[cfg(feature = "coreml")] + { + exp.push(ort::execution_providers::CoreMLExecutionProvider::default().build()); + } + exp.push(ort::execution_providers::CPUExecutionProvider::default().build()); + Ok(Session::builder()? + .with_execution_providers(exp)? + .with_optimization_level(GraphOptimizationLevel::Level3)? + .with_intra_threads(num_cpus::get_physical())? + .with_parallel_execution(true)? + .with_inter_threads(num_cpus::get_physical())? + .commit_from_memory(model_file.as_ref())?) +} + +#[allow(clippy::too_many_arguments)] +pub fn synthesize( + session: &mut Session, + bert_ori: Array2, + x_tst: Array1, + tones: Array1, + lang_ids: Array1, + style_vector: Array1, + sdp_ratio: f32, + length_scale: f32, +) -> Result> { + let bert_ori = bert_ori.insert_axis(Axis(0)); + let bert_ori = bert_ori.as_standard_layout(); + let bert = ort::value::TensorRef::from_array_view(&bert_ori)?; + let mut x_tst_lengths = array![x_tst.shape()[0] as i64]; + let x_tst_lengths = ort::value::TensorRef::from_array_view(&mut x_tst_lengths)?; + let mut x_tst = x_tst.insert_axis(Axis(0)); + let x_tst = ort::value::TensorRef::from_array_view(&mut x_tst)?; + let mut lang_ids = lang_ids.insert_axis(Axis(0)); + let lang_ids = ort::value::TensorRef::from_array_view(&mut lang_ids)?; + let mut tones = tones.insert_axis(Axis(0)); + let tones = ort::value::TensorRef::from_array_view(&mut tones)?; + let mut style_vector = style_vector.insert_axis(Axis(0)); + let style_vector = ort::value::TensorRef::from_array_view(&mut style_vector)?; + let sid = vec![1_i64]; + let sid = ort::value::TensorRef::from_array_view((vec![1_i64], sid.as_slice()))?; + let sdp_ratio = vec![sdp_ratio]; + let sdp_ratio = ort::value::TensorRef::from_array_view((vec![1_i64], sdp_ratio.as_slice()))?; + let length_scale = vec![length_scale]; + let length_scale = + ort::value::TensorRef::from_array_view((vec![1_i64], length_scale.as_slice()))?; + let outputs = session.run(ort::inputs! { + "x_tst" => x_tst, + "x_tst_lengths" => x_tst_lengths, + "sid" => sid, + "tones" => tones, + "language" => lang_ids, + "bert" => bert, + "style_vec" => style_vector, + "sdp_ratio" => sdp_ratio, + "length_scale" => length_scale, + })?; + + let audio_array = outputs["output"] + .try_extract_tensor::()? + .into_dimensionality::()? + .to_owned(); + + Ok(audio_array) +} diff --git a/sbv2_core/src/mora.rs b/crates/sbv2_core/src/mora.rs similarity index 100% rename from sbv2_core/src/mora.rs rename to crates/sbv2_core/src/mora.rs diff --git a/sbv2_core/src/mora_list.json b/crates/sbv2_core/src/mora_list.json similarity index 100% rename from sbv2_core/src/mora_list.json rename to crates/sbv2_core/src/mora_list.json diff --git a/sbv2_core/src/nlp.rs b/crates/sbv2_core/src/nlp.rs similarity index 100% rename from sbv2_core/src/nlp.rs rename to crates/sbv2_core/src/nlp.rs diff --git a/sbv2_core/src/norm.rs b/crates/sbv2_core/src/norm.rs similarity index 100% rename from sbv2_core/src/norm.rs rename to crates/sbv2_core/src/norm.rs diff --git a/sbv2_core/src/sbv2file.rs b/crates/sbv2_core/src/sbv2file.rs similarity index 100% rename from sbv2_core/src/sbv2file.rs rename to crates/sbv2_core/src/sbv2file.rs diff --git a/sbv2_core/src/style.rs b/crates/sbv2_core/src/style.rs similarity index 100% rename from sbv2_core/src/style.rs rename to crates/sbv2_core/src/style.rs diff --git a/sbv2_core/src/tokenizer.rs b/crates/sbv2_core/src/tokenizer.rs similarity index 100% rename from sbv2_core/src/tokenizer.rs rename to crates/sbv2_core/src/tokenizer.rs diff --git a/sbv2_core/src/tts.rs b/crates/sbv2_core/src/tts.rs similarity index 92% rename from sbv2_core/src/tts.rs rename to crates/sbv2_core/src/tts.rs index d248e31..d0a2c90 100644 --- a/sbv2_core/src/tts.rs +++ b/crates/sbv2_core/src/tts.rs @@ -1,7 +1,7 @@ use crate::error::{Error, Result}; use crate::{jtalk, model, style, tokenizer, tts_util}; use ndarray::{concatenate, Array1, Array2, Array3, Axis}; -use ort::Session; +use ort::session::Session; use tokenizers::Tokenizer; #[derive(PartialEq, Eq, Clone)] @@ -147,7 +147,7 @@ impl TTSModelHolder { /// This function is for low-level usage, use `easy_synthesize` for high-level usage. #[allow(clippy::type_complexity)] pub fn parse_text( - &self, + &mut self, text: &str, ) -> Result<(Array2, Array1, Array1, Array1)> { crate::tts_util::parse_text_blocking( @@ -155,15 +155,15 @@ impl TTSModelHolder { &self.jtalk, &self.tokenizer, |token_ids, attention_masks| { - crate::bert::predict(&self.bert, token_ids, attention_masks) + crate::bert::predict(&mut self.bert, token_ids, attention_masks) }, ) } - fn find_model>(&self, ident: I) -> Result<&TTSModel> { + fn find_model>(&mut self, ident: I) -> Result<&mut TTSModel> { let ident = ident.into(); self.models - .iter() + .iter_mut() .find(|m| m.ident == ident) .ok_or(Error::ModelNotFoundError(ident.to_string())) } @@ -209,7 +209,7 @@ impl TTSModelHolder { /// # Note /// This function is for low-level usage, use `easy_synthesize` for high-level usage. pub fn get_style_vector>( - &self, + &mut self, ident: I, style_id: i32, weight: f32, @@ -232,11 +232,6 @@ impl TTSModelHolder { options: SynthesizeOptions, ) -> Result> { self.find_and_load_model(ident)?; - let vits2 = &self - .find_model(ident)? - .vits2 - .as_ref() - .ok_or(Error::ModelNotFoundError(ident.into().to_string()))?; let style_vector = self.get_style_vector(ident, style_id, options.style_weight)?; let audio_array = if options.split_sentences { let texts: Vec<&str> = text.split('\n').collect(); @@ -246,8 +241,14 @@ impl TTSModelHolder { continue; } let (bert_ori, phones, tones, lang_ids) = self.parse_text(t)?; + + let vits2 = self + .find_model(ident)? + .vits2 + .as_mut() + .ok_or(Error::ModelNotFoundError(ident.into().to_string()))?; let audio = model::synthesize( - &vits2, + vits2, bert_ori.to_owned(), phones, tones, @@ -267,8 +268,14 @@ impl TTSModelHolder { )? } else { let (bert_ori, phones, tones, lang_ids) = self.parse_text(text)?; + + let vits2 = self + .find_model(ident)? + .vits2 + .as_mut() + .ok_or(Error::ModelNotFoundError(ident.into().to_string()))?; model::synthesize( - &vits2, + vits2, bert_ori.to_owned(), phones, tones, @@ -298,13 +305,13 @@ impl TTSModelHolder { length_scale: f32, ) -> Result> { self.find_and_load_model(ident)?; - let vits2 = &self + let vits2 = self .find_model(ident)? .vits2 - .as_ref() + .as_mut() .ok_or(Error::ModelNotFoundError(ident.into().to_string()))?; let audio_array = model::synthesize( - &vits2, + vits2, bert_ori.to_owned(), phones, tones, diff --git a/sbv2_core/src/tts_util.rs b/crates/sbv2_core/src/tts_util.rs similarity index 100% rename from sbv2_core/src/tts_util.rs rename to crates/sbv2_core/src/tts_util.rs diff --git a/sbv2_core/src/utils.rs b/crates/sbv2_core/src/utils.rs similarity index 100% rename from sbv2_core/src/utils.rs rename to crates/sbv2_core/src/utils.rs diff --git a/sbv2_wasm/Cargo.toml b/crates/sbv2_wasm/Cargo.toml similarity index 87% rename from sbv2_wasm/Cargo.toml rename to crates/sbv2_wasm/Cargo.toml index 4930456..ab7ae70 100644 --- a/sbv2_wasm/Cargo.toml +++ b/crates/sbv2_wasm/Cargo.toml @@ -13,7 +13,3 @@ once_cell.workspace = true js-sys = "0.3.70" ndarray.workspace = true wasm-bindgen-futures = "0.4.43" - -[profile.release] -lto = true -opt-level = "s" diff --git a/sbv2_wasm/README.md b/crates/sbv2_wasm/README.md similarity index 100% rename from sbv2_wasm/README.md rename to crates/sbv2_wasm/README.md diff --git a/sbv2_wasm/biome.json b/crates/sbv2_wasm/biome.json similarity index 100% rename from sbv2_wasm/biome.json rename to crates/sbv2_wasm/biome.json diff --git a/crates/sbv2_wasm/build.sh b/crates/sbv2_wasm/build.sh new file mode 100755 index 0000000..0db915a --- /dev/null +++ b/crates/sbv2_wasm/build.sh @@ -0,0 +1,5 @@ +wasm-pack build --target web sbv2_wasm +wasm-opt -O3 -o ./sbv2_wasm/pkg/sbv2_wasm_bg.wasm ./sbv2_wasm/pkg/sbv2_wasm_bg.wasm +wasm-strip ./sbv2_wasm/pkg/sbv2_wasm_bg.wasm +mkdir -p ./sbv2_wasm/dist +cp ./sbv2_wasm/sbv2_wasm/pkg/sbv2_wasm_bg.wasm ./sbv2_wasm/dist/sbv2_wasm_bg.wasm \ No newline at end of file diff --git a/sbv2_wasm/example.html b/crates/sbv2_wasm/example.html similarity index 100% rename from sbv2_wasm/example.html rename to crates/sbv2_wasm/example.html diff --git a/sbv2_wasm/example.js b/crates/sbv2_wasm/example.js similarity index 100% rename from sbv2_wasm/example.js rename to crates/sbv2_wasm/example.js diff --git a/sbv2_wasm/package.json b/crates/sbv2_wasm/package.json similarity index 69% rename from sbv2_wasm/package.json rename to crates/sbv2_wasm/package.json index 4d24dd6..c1c6e03 100644 --- a/sbv2_wasm/package.json +++ b/crates/sbv2_wasm/package.json @@ -13,13 +13,17 @@ "author": "tuna2134", "license": "MIT", "devDependencies": { - "@biomejs/biome": "^1.9.2", - "@types/node": "^22.7.4", - "esbuild": "^0.24.0", - "typescript": "^5.6.2" + "@biomejs/biome": "^1.9.4", + "@types/node": "^22.13.5", + "esbuild": "^0.25.0", + "typescript": "^5.7.3" }, "dependencies": { - "onnxruntime-web": "^1.19.2" + "onnxruntime-web": "^1.20.1" }, - "files": ["dist/*", "package.json", "README.md"] + "files": [ + "dist/*", + "package.json", + "README.md" + ] } diff --git a/sbv2_wasm/pnpm-lock.yaml b/crates/sbv2_wasm/pnpm-lock.yaml similarity index 53% rename from sbv2_wasm/pnpm-lock.yaml rename to crates/sbv2_wasm/pnpm-lock.yaml index 227d328..9e91833 100644 --- a/sbv2_wasm/pnpm-lock.yaml +++ b/crates/sbv2_wasm/pnpm-lock.yaml @@ -9,21 +9,21 @@ importers: .: dependencies: onnxruntime-web: - specifier: ^1.19.2 - version: 1.20.0 + specifier: ^1.20.1 + version: 1.20.1 devDependencies: '@biomejs/biome': - specifier: ^1.9.2 + specifier: ^1.9.4 version: 1.9.4 '@types/node': - specifier: ^22.7.4 - version: 22.8.0 + specifier: ^22.13.5 + version: 22.13.5 esbuild: - specifier: ^0.24.0 - version: 0.24.0 + specifier: ^0.25.0 + version: 0.25.0 typescript: - specifier: ^5.6.2 - version: 5.6.3 + specifier: ^5.7.3 + version: 5.7.3 packages: @@ -80,146 +80,152 @@ packages: cpu: [x64] os: [win32] - '@esbuild/aix-ppc64@0.24.0': - resolution: {integrity: sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==} + '@esbuild/aix-ppc64@0.25.0': + resolution: {integrity: sha512-O7vun9Sf8DFjH2UtqK8Ku3LkquL9SZL8OLY1T5NZkA34+wG3OQF7cl4Ql8vdNzM6fzBbYfLaiRLIOZ+2FOCgBQ==} engines: {node: '>=18'} cpu: [ppc64] os: [aix] - '@esbuild/android-arm64@0.24.0': - resolution: {integrity: sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==} + '@esbuild/android-arm64@0.25.0': + resolution: {integrity: sha512-grvv8WncGjDSyUBjN9yHXNt+cq0snxXbDxy5pJtzMKGmmpPxeAmAhWxXI+01lU5rwZomDgD3kJwulEnhTRUd6g==} engines: {node: '>=18'} cpu: [arm64] os: [android] - '@esbuild/android-arm@0.24.0': - resolution: {integrity: sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==} + '@esbuild/android-arm@0.25.0': + resolution: {integrity: sha512-PTyWCYYiU0+1eJKmw21lWtC+d08JDZPQ5g+kFyxP0V+es6VPPSUhM6zk8iImp2jbV6GwjX4pap0JFbUQN65X1g==} engines: {node: '>=18'} cpu: [arm] os: [android] - '@esbuild/android-x64@0.24.0': - resolution: {integrity: sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==} + '@esbuild/android-x64@0.25.0': + resolution: {integrity: sha512-m/ix7SfKG5buCnxasr52+LI78SQ+wgdENi9CqyCXwjVR2X4Jkz+BpC3le3AoBPYTC9NHklwngVXvbJ9/Akhrfg==} engines: {node: '>=18'} cpu: [x64] os: [android] - '@esbuild/darwin-arm64@0.24.0': - resolution: {integrity: sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==} + '@esbuild/darwin-arm64@0.25.0': + resolution: {integrity: sha512-mVwdUb5SRkPayVadIOI78K7aAnPamoeFR2bT5nszFUZ9P8UpK4ratOdYbZZXYSqPKMHfS1wdHCJk1P1EZpRdvw==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] - '@esbuild/darwin-x64@0.24.0': - resolution: {integrity: sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==} + '@esbuild/darwin-x64@0.25.0': + resolution: {integrity: sha512-DgDaYsPWFTS4S3nWpFcMn/33ZZwAAeAFKNHNa1QN0rI4pUjgqf0f7ONmXf6d22tqTY+H9FNdgeaAa+YIFUn2Rg==} engines: {node: '>=18'} cpu: [x64] os: [darwin] - '@esbuild/freebsd-arm64@0.24.0': - resolution: {integrity: sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==} + '@esbuild/freebsd-arm64@0.25.0': + resolution: {integrity: sha512-VN4ocxy6dxefN1MepBx/iD1dH5K8qNtNe227I0mnTRjry8tj5MRk4zprLEdG8WPyAPb93/e4pSgi1SoHdgOa4w==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] - '@esbuild/freebsd-x64@0.24.0': - resolution: {integrity: sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==} + '@esbuild/freebsd-x64@0.25.0': + resolution: {integrity: sha512-mrSgt7lCh07FY+hDD1TxiTyIHyttn6vnjesnPoVDNmDfOmggTLXRv8Id5fNZey1gl/V2dyVK1VXXqVsQIiAk+A==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] - '@esbuild/linux-arm64@0.24.0': - resolution: {integrity: sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==} + '@esbuild/linux-arm64@0.25.0': + resolution: {integrity: sha512-9QAQjTWNDM/Vk2bgBl17yWuZxZNQIF0OUUuPZRKoDtqF2k4EtYbpyiG5/Dk7nqeK6kIJWPYldkOcBqjXjrUlmg==} engines: {node: '>=18'} cpu: [arm64] os: [linux] - '@esbuild/linux-arm@0.24.0': - resolution: {integrity: sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==} + '@esbuild/linux-arm@0.25.0': + resolution: {integrity: sha512-vkB3IYj2IDo3g9xX7HqhPYxVkNQe8qTK55fraQyTzTX/fxaDtXiEnavv9geOsonh2Fd2RMB+i5cbhu2zMNWJwg==} engines: {node: '>=18'} cpu: [arm] os: [linux] - '@esbuild/linux-ia32@0.24.0': - resolution: {integrity: sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==} + '@esbuild/linux-ia32@0.25.0': + resolution: {integrity: sha512-43ET5bHbphBegyeqLb7I1eYn2P/JYGNmzzdidq/w0T8E2SsYL1U6un2NFROFRg1JZLTzdCoRomg8Rvf9M6W6Gg==} engines: {node: '>=18'} cpu: [ia32] os: [linux] - '@esbuild/linux-loong64@0.24.0': - resolution: {integrity: sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==} + '@esbuild/linux-loong64@0.25.0': + resolution: {integrity: sha512-fC95c/xyNFueMhClxJmeRIj2yrSMdDfmqJnyOY4ZqsALkDrrKJfIg5NTMSzVBr5YW1jf+l7/cndBfP3MSDpoHw==} engines: {node: '>=18'} cpu: [loong64] os: [linux] - '@esbuild/linux-mips64el@0.24.0': - resolution: {integrity: sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==} + '@esbuild/linux-mips64el@0.25.0': + resolution: {integrity: sha512-nkAMFju7KDW73T1DdH7glcyIptm95a7Le8irTQNO/qtkoyypZAnjchQgooFUDQhNAy4iu08N79W4T4pMBwhPwQ==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] - '@esbuild/linux-ppc64@0.24.0': - resolution: {integrity: sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==} + '@esbuild/linux-ppc64@0.25.0': + resolution: {integrity: sha512-NhyOejdhRGS8Iwv+KKR2zTq2PpysF9XqY+Zk77vQHqNbo/PwZCzB5/h7VGuREZm1fixhs4Q/qWRSi5zmAiO4Fw==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] - '@esbuild/linux-riscv64@0.24.0': - resolution: {integrity: sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==} + '@esbuild/linux-riscv64@0.25.0': + resolution: {integrity: sha512-5S/rbP5OY+GHLC5qXp1y/Mx//e92L1YDqkiBbO9TQOvuFXM+iDqUNG5XopAnXoRH3FjIUDkeGcY1cgNvnXp/kA==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] - '@esbuild/linux-s390x@0.24.0': - resolution: {integrity: sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==} + '@esbuild/linux-s390x@0.25.0': + resolution: {integrity: sha512-XM2BFsEBz0Fw37V0zU4CXfcfuACMrppsMFKdYY2WuTS3yi8O1nFOhil/xhKTmE1nPmVyvQJjJivgDT+xh8pXJA==} engines: {node: '>=18'} cpu: [s390x] os: [linux] - '@esbuild/linux-x64@0.24.0': - resolution: {integrity: sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==} + '@esbuild/linux-x64@0.25.0': + resolution: {integrity: sha512-9yl91rHw/cpwMCNytUDxwj2XjFpxML0y9HAOH9pNVQDpQrBxHy01Dx+vaMu0N1CKa/RzBD2hB4u//nfc+Sd3Cw==} engines: {node: '>=18'} cpu: [x64] os: [linux] - '@esbuild/netbsd-x64@0.24.0': - resolution: {integrity: sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==} + '@esbuild/netbsd-arm64@0.25.0': + resolution: {integrity: sha512-RuG4PSMPFfrkH6UwCAqBzauBWTygTvb1nxWasEJooGSJ/NwRw7b2HOwyRTQIU97Hq37l3npXoZGYMy3b3xYvPw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.25.0': + resolution: {integrity: sha512-jl+qisSB5jk01N5f7sPCsBENCOlPiS/xptD5yxOx2oqQfyourJwIKLRA2yqWdifj3owQZCL2sn6o08dBzZGQzA==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] - '@esbuild/openbsd-arm64@0.24.0': - resolution: {integrity: sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==} + '@esbuild/openbsd-arm64@0.25.0': + resolution: {integrity: sha512-21sUNbq2r84YE+SJDfaQRvdgznTD8Xc0oc3p3iW/a1EVWeNj/SdUCbm5U0itZPQYRuRTW20fPMWMpcrciH2EJw==} engines: {node: '>=18'} cpu: [arm64] os: [openbsd] - '@esbuild/openbsd-x64@0.24.0': - resolution: {integrity: sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==} + '@esbuild/openbsd-x64@0.25.0': + resolution: {integrity: sha512-2gwwriSMPcCFRlPlKx3zLQhfN/2WjJ2NSlg5TKLQOJdV0mSxIcYNTMhk3H3ulL/cak+Xj0lY1Ym9ysDV1igceg==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] - '@esbuild/sunos-x64@0.24.0': - resolution: {integrity: sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==} + '@esbuild/sunos-x64@0.25.0': + resolution: {integrity: sha512-bxI7ThgLzPrPz484/S9jLlvUAHYMzy6I0XiU1ZMeAEOBcS0VePBFxh1JjTQt3Xiat5b6Oh4x7UC7IwKQKIJRIg==} engines: {node: '>=18'} cpu: [x64] os: [sunos] - '@esbuild/win32-arm64@0.24.0': - resolution: {integrity: sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==} + '@esbuild/win32-arm64@0.25.0': + resolution: {integrity: sha512-ZUAc2YK6JW89xTbXvftxdnYy3m4iHIkDtK3CLce8wg8M2L+YZhIvO1DKpxrd0Yr59AeNNkTiic9YLf6FTtXWMw==} engines: {node: '>=18'} cpu: [arm64] os: [win32] - '@esbuild/win32-ia32@0.24.0': - resolution: {integrity: sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==} + '@esbuild/win32-ia32@0.25.0': + resolution: {integrity: sha512-eSNxISBu8XweVEWG31/JzjkIGbGIJN/TrRoiSVZwZ6pkC6VX4Im/WV2cz559/TXLcYbcrDN8JtKgd9DJVIo8GA==} engines: {node: '>=18'} cpu: [ia32] os: [win32] - '@esbuild/win32-x64@0.24.0': - resolution: {integrity: sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==} + '@esbuild/win32-x64@0.25.0': + resolution: {integrity: sha512-ZENoHJBxA20C2zFzh6AI4fT6RraMzjYw4xKWemRTRmRVtN9c5DcH9r/f2ihEkMjOW5eGgrwCslG/+Y/3bL+DHQ==} engines: {node: '>=18'} cpu: [x64] os: [win32] @@ -254,11 +260,11 @@ packages: '@protobufjs/utf8@1.1.0': resolution: {integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==} - '@types/node@22.8.0': - resolution: {integrity: sha512-84rafSBHC/z1i1E3p0cJwKA+CfYDNSXX9WSZBRopjIzLET8oNt6ht2tei4C7izwDeEiLLfdeSVBv1egOH916hg==} + '@types/node@22.13.5': + resolution: {integrity: sha512-+lTU0PxZXn0Dr1NBtC7Y8cR21AJr87dLLU953CWA6pMxxv/UDc7jYAY90upcrie1nRcD6XNG5HOYEDtgW5TxAg==} - esbuild@0.24.0: - resolution: {integrity: sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==} + esbuild@0.25.0: + resolution: {integrity: sha512-BXq5mqc8ltbaN34cDqWuYKyNhX8D/Z0J1xdtdQ8UcIIIyJyz+ZMKUt58tF3SrZ85jcfN/PZYhjR5uDQAYNVbuw==} engines: {node: '>=18'} hasBin: true @@ -268,14 +274,14 @@ packages: guid-typescript@1.0.9: resolution: {integrity: sha512-Y8T4vYhEfwJOTbouREvG+3XDsjr8E3kIr7uf+JZ0BYloFsttiHU0WfvANVsR7TxNUJa/WpCnw/Ino/p+DeBhBQ==} - long@5.2.3: - resolution: {integrity: sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==} + long@5.3.1: + resolution: {integrity: sha512-ka87Jz3gcx/I7Hal94xaN2tZEOPoUOEVftkQqZx2EeQRN7LGdfLlI3FvZ+7WDplm+vK2Urx9ULrvSowtdCieng==} - onnxruntime-common@1.20.0: - resolution: {integrity: sha512-9ehS4ul5fBszIcHhfxuDgk45lO+Fqrxmrgwk1Pxb1JRvbQiCB/v9Royv95SRCWHktLMviqNjBsEd/biJhd39cg==} + onnxruntime-common@1.20.1: + resolution: {integrity: sha512-YiU0s0IzYYC+gWvqD1HzLc46Du1sXpSiwzKb63PACIJr6LfL27VsXSXQvt68EzD3V0D5Bc0vyJTjmMxp0ylQiw==} - onnxruntime-web@1.20.0: - resolution: {integrity: sha512-IoUf8dqHFJLV4DUSz+Ok+xxyN6cQk57gb20m6PZE5gag3QXuvegYMq9dG8t/QF4JjTKIwvfvnr16ouzCCB9IMA==} + onnxruntime-web@1.20.1: + resolution: {integrity: sha512-TePF6XVpLL1rWVMIl5Y9ACBQcyCNFThZON/jgElNd9Txb73CIEGlklhYR3UEr1cp5r0rbGI6nDwwrs79g7WjoA==} platform@1.3.6: resolution: {integrity: sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==} @@ -284,13 +290,13 @@ packages: resolution: {integrity: sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==} engines: {node: '>=12.0.0'} - typescript@5.6.3: - resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==} + typescript@5.7.3: + resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==} engines: {node: '>=14.17'} hasBin: true - undici-types@6.19.8: - resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} + undici-types@6.20.0: + resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} snapshots: @@ -329,76 +335,79 @@ snapshots: '@biomejs/cli-win32-x64@1.9.4': optional: true - '@esbuild/aix-ppc64@0.24.0': + '@esbuild/aix-ppc64@0.25.0': optional: true - '@esbuild/android-arm64@0.24.0': + '@esbuild/android-arm64@0.25.0': optional: true - '@esbuild/android-arm@0.24.0': + '@esbuild/android-arm@0.25.0': optional: true - '@esbuild/android-x64@0.24.0': + '@esbuild/android-x64@0.25.0': optional: true - '@esbuild/darwin-arm64@0.24.0': + '@esbuild/darwin-arm64@0.25.0': optional: true - '@esbuild/darwin-x64@0.24.0': + '@esbuild/darwin-x64@0.25.0': optional: true - '@esbuild/freebsd-arm64@0.24.0': + '@esbuild/freebsd-arm64@0.25.0': optional: true - '@esbuild/freebsd-x64@0.24.0': + '@esbuild/freebsd-x64@0.25.0': optional: true - '@esbuild/linux-arm64@0.24.0': + '@esbuild/linux-arm64@0.25.0': optional: true - '@esbuild/linux-arm@0.24.0': + '@esbuild/linux-arm@0.25.0': optional: true - '@esbuild/linux-ia32@0.24.0': + '@esbuild/linux-ia32@0.25.0': optional: true - '@esbuild/linux-loong64@0.24.0': + '@esbuild/linux-loong64@0.25.0': optional: true - '@esbuild/linux-mips64el@0.24.0': + '@esbuild/linux-mips64el@0.25.0': optional: true - '@esbuild/linux-ppc64@0.24.0': + '@esbuild/linux-ppc64@0.25.0': optional: true - '@esbuild/linux-riscv64@0.24.0': + '@esbuild/linux-riscv64@0.25.0': optional: true - '@esbuild/linux-s390x@0.24.0': + '@esbuild/linux-s390x@0.25.0': optional: true - '@esbuild/linux-x64@0.24.0': + '@esbuild/linux-x64@0.25.0': optional: true - '@esbuild/netbsd-x64@0.24.0': + '@esbuild/netbsd-arm64@0.25.0': optional: true - '@esbuild/openbsd-arm64@0.24.0': + '@esbuild/netbsd-x64@0.25.0': optional: true - '@esbuild/openbsd-x64@0.24.0': + '@esbuild/openbsd-arm64@0.25.0': optional: true - '@esbuild/sunos-x64@0.24.0': + '@esbuild/openbsd-x64@0.25.0': optional: true - '@esbuild/win32-arm64@0.24.0': + '@esbuild/sunos-x64@0.25.0': optional: true - '@esbuild/win32-ia32@0.24.0': + '@esbuild/win32-arm64@0.25.0': optional: true - '@esbuild/win32-x64@0.24.0': + '@esbuild/win32-ia32@0.25.0': + optional: true + + '@esbuild/win32-x64@0.25.0': optional: true '@protobufjs/aspromise@1.1.2': {} @@ -424,51 +433,52 @@ snapshots: '@protobufjs/utf8@1.1.0': {} - '@types/node@22.8.0': + '@types/node@22.13.5': dependencies: - undici-types: 6.19.8 + undici-types: 6.20.0 - esbuild@0.24.0: + esbuild@0.25.0: optionalDependencies: - '@esbuild/aix-ppc64': 0.24.0 - '@esbuild/android-arm': 0.24.0 - '@esbuild/android-arm64': 0.24.0 - '@esbuild/android-x64': 0.24.0 - '@esbuild/darwin-arm64': 0.24.0 - '@esbuild/darwin-x64': 0.24.0 - '@esbuild/freebsd-arm64': 0.24.0 - '@esbuild/freebsd-x64': 0.24.0 - '@esbuild/linux-arm': 0.24.0 - '@esbuild/linux-arm64': 0.24.0 - '@esbuild/linux-ia32': 0.24.0 - '@esbuild/linux-loong64': 0.24.0 - '@esbuild/linux-mips64el': 0.24.0 - '@esbuild/linux-ppc64': 0.24.0 - '@esbuild/linux-riscv64': 0.24.0 - '@esbuild/linux-s390x': 0.24.0 - '@esbuild/linux-x64': 0.24.0 - '@esbuild/netbsd-x64': 0.24.0 - '@esbuild/openbsd-arm64': 0.24.0 - '@esbuild/openbsd-x64': 0.24.0 - '@esbuild/sunos-x64': 0.24.0 - '@esbuild/win32-arm64': 0.24.0 - '@esbuild/win32-ia32': 0.24.0 - '@esbuild/win32-x64': 0.24.0 + '@esbuild/aix-ppc64': 0.25.0 + '@esbuild/android-arm': 0.25.0 + '@esbuild/android-arm64': 0.25.0 + '@esbuild/android-x64': 0.25.0 + '@esbuild/darwin-arm64': 0.25.0 + '@esbuild/darwin-x64': 0.25.0 + '@esbuild/freebsd-arm64': 0.25.0 + '@esbuild/freebsd-x64': 0.25.0 + '@esbuild/linux-arm': 0.25.0 + '@esbuild/linux-arm64': 0.25.0 + '@esbuild/linux-ia32': 0.25.0 + '@esbuild/linux-loong64': 0.25.0 + '@esbuild/linux-mips64el': 0.25.0 + '@esbuild/linux-ppc64': 0.25.0 + '@esbuild/linux-riscv64': 0.25.0 + '@esbuild/linux-s390x': 0.25.0 + '@esbuild/linux-x64': 0.25.0 + '@esbuild/netbsd-arm64': 0.25.0 + '@esbuild/netbsd-x64': 0.25.0 + '@esbuild/openbsd-arm64': 0.25.0 + '@esbuild/openbsd-x64': 0.25.0 + '@esbuild/sunos-x64': 0.25.0 + '@esbuild/win32-arm64': 0.25.0 + '@esbuild/win32-ia32': 0.25.0 + '@esbuild/win32-x64': 0.25.0 flatbuffers@1.12.0: {} guid-typescript@1.0.9: {} - long@5.2.3: {} + long@5.3.1: {} - onnxruntime-common@1.20.0: {} + onnxruntime-common@1.20.1: {} - onnxruntime-web@1.20.0: + onnxruntime-web@1.20.1: dependencies: flatbuffers: 1.12.0 guid-typescript: 1.0.9 - long: 5.2.3 - onnxruntime-common: 1.20.0 + long: 5.3.1 + onnxruntime-common: 1.20.1 platform: 1.3.6 protobufjs: 7.4.0 @@ -486,9 +496,9 @@ snapshots: '@protobufjs/path': 1.1.2 '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 - '@types/node': 22.8.0 - long: 5.2.3 + '@types/node': 22.13.5 + long: 5.3.1 - typescript@5.6.3: {} + typescript@5.7.3: {} - undici-types@6.19.8: {} + undici-types@6.20.0: {} diff --git a/sbv2_wasm/src-js/index.ts b/crates/sbv2_wasm/src-js/index.ts similarity index 100% rename from sbv2_wasm/src-js/index.ts rename to crates/sbv2_wasm/src-js/index.ts diff --git a/sbv2_wasm/src/array_helper.rs b/crates/sbv2_wasm/src/array_helper.rs similarity index 100% rename from sbv2_wasm/src/array_helper.rs rename to crates/sbv2_wasm/src/array_helper.rs diff --git a/sbv2_wasm/src/lib.rs b/crates/sbv2_wasm/src/lib.rs similarity index 100% rename from sbv2_wasm/src/lib.rs rename to crates/sbv2_wasm/src/lib.rs diff --git a/sbv2_wasm/tsconfig.json b/crates/sbv2_wasm/tsconfig.json similarity index 100% rename from sbv2_wasm/tsconfig.json rename to crates/sbv2_wasm/tsconfig.json diff --git a/sbv2_core/src/model.rs b/sbv2_core/src/model.rs deleted file mode 100644 index 9f2a221..0000000 --- a/sbv2_core/src/model.rs +++ /dev/null @@ -1,85 +0,0 @@ -use crate::error::Result; -use ndarray::{array, Array1, Array2, Array3, Axis, Ix3}; -use ort::{GraphOptimizationLevel, Session}; - -#[allow(clippy::vec_init_then_push, unused_variables)] -pub fn load_model>(model_file: P, bert: bool) -> Result { - let mut exp = Vec::new(); - #[cfg(feature = "tensorrt")] - { - if bert { - exp.push( - ort::TensorRTExecutionProvider::default() - .with_fp16(true) - .with_profile_min_shapes("input_ids:1x1,attention_mask:1x1") - .with_profile_max_shapes("input_ids:1x100,attention_mask:1x100") - .with_profile_opt_shapes("input_ids:1x25,attention_mask:1x25") - .build(), - ); - } - } - #[cfg(feature = "cuda")] - { - #[allow(unused_mut)] - let mut cuda = ort::CUDAExecutionProvider::default() - .with_conv_algorithm_search(ort::CUDAExecutionProviderCuDNNConvAlgoSearch::Default); - #[cfg(feature = "cuda_tf32")] - { - cuda = cuda.with_tf32(true); - } - exp.push(cuda.build()); - } - #[cfg(feature = "directml")] - { - exp.push(ort::DirectMLExecutionProvider::default().build()); - } - #[cfg(feature = "coreml")] - { - exp.push(ort::CoreMLExecutionProvider::default().build()); - } - exp.push(ort::CPUExecutionProvider::default().build()); - Ok(Session::builder()? - .with_execution_providers(exp)? - .with_optimization_level(GraphOptimizationLevel::Level3)? - .with_intra_threads(num_cpus::get_physical())? - .with_parallel_execution(true)? - .with_inter_threads(num_cpus::get_physical())? - .commit_from_memory(model_file.as_ref())?) -} - -#[allow(clippy::too_many_arguments)] -pub fn synthesize( - session: &Session, - bert_ori: Array2, - x_tst: Array1, - tones: Array1, - lang_ids: Array1, - style_vector: Array1, - sdp_ratio: f32, - length_scale: f32, -) -> Result> { - let bert = bert_ori.insert_axis(Axis(0)); - let x_tst_lengths: Array1 = array![x_tst.shape()[0] as i64]; - let x_tst = x_tst.insert_axis(Axis(0)); - let lang_ids = lang_ids.insert_axis(Axis(0)); - let tones = tones.insert_axis(Axis(0)); - let style_vector = style_vector.insert_axis(Axis(0)); - let outputs = session.run(ort::inputs! { - "x_tst" => x_tst, - "x_tst_lengths" => x_tst_lengths, - "sid" => array![0_i64], - "tones" => tones, - "language" => lang_ids, - "bert" => bert, - "style_vec" => style_vector, - "sdp_ratio" => array![sdp_ratio], - "length_scale" => array![length_scale], - }?)?; - - let audio_array = outputs["output"] - .try_extract_tensor::()? - .into_dimensionality::()? - .to_owned(); - - Ok(audio_array) -} diff --git a/sbv2_wasm/build.sh b/sbv2_wasm/build.sh deleted file mode 100755 index 1d23f47..0000000 --- a/sbv2_wasm/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -wasm-pack build --target web sbv2_wasm -wasm-opt -O3 -o sbv2_wasm/pkg/sbv2_wasm_bg.wasm sbv2_wasm/pkg/sbv2_wasm_bg.wasm -mkdir -p sbv2_wasm/dist -cp sbv2_wasm/sbv2_wasm/pkg/sbv2_wasm_bg.wasm sbv2_wasm/dist/sbv2_wasm_bg.wasm \ No newline at end of file diff --git a/scripts/.gitignore b/scripts/.gitignore new file mode 100644 index 0000000..bd60ff3 --- /dev/null +++ b/scripts/.gitignore @@ -0,0 +1,5 @@ +*.json +venv/ +tmp/ +*.safetensors +*.npy \ No newline at end of file diff --git a/convert/README.md b/scripts/convert/README.md similarity index 100% rename from convert/README.md rename to scripts/convert/README.md diff --git a/convert/convert_deberta.py b/scripts/convert/convert_deberta.py similarity index 100% rename from convert/convert_deberta.py rename to scripts/convert/convert_deberta.py diff --git a/convert/convert_model.py b/scripts/convert/convert_model.py similarity index 100% rename from convert/convert_model.py rename to scripts/convert/convert_model.py diff --git a/convert/requirements.txt b/scripts/convert/requirements.txt similarity index 100% rename from convert/requirements.txt rename to scripts/convert/requirements.txt diff --git a/docker/cpu.Dockerfile b/scripts/docker/cpu.Dockerfile similarity index 100% rename from docker/cpu.Dockerfile rename to scripts/docker/cpu.Dockerfile diff --git a/docker/cuda.Dockerfile b/scripts/docker/cuda.Dockerfile similarity index 100% rename from docker/cuda.Dockerfile rename to scripts/docker/cuda.Dockerfile diff --git a/docker/run_cpu.sh b/scripts/docker/run_cpu.sh similarity index 100% rename from docker/run_cpu.sh rename to scripts/docker/run_cpu.sh diff --git a/docker/run_cuda.sh b/scripts/docker/run_cuda.sh similarity index 100% rename from docker/run_cuda.sh rename to scripts/docker/run_cuda.sh diff --git a/scripts/make_dict.sh b/scripts/make_dict.sh new file mode 100755 index 0000000..7b6a788 --- /dev/null +++ b/scripts/make_dict.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e +git clone https://github.com/Aivis-Project/AivisSpeech-Engine ./scripts/tmp --filter=blob:none -n +cd ./scripts/tmp +git checkout 168b2a1144afe300b0490d9a6dd773ec6e927667 -- resources/dictionaries/*.csv +cd ../.. +rm -rf ./crates/sbv2_core/src/dic +cp -r ./scripts/tmp/resources/dictionaries ./crates/sbv2_core/src/dic +rm -rf ./scripts/tmp +for file in ./crates/sbv2_core/src/dic/0*.csv; do + /usr/bin/cat "$file" + echo +done > ./crates/sbv2_core/src/all.csv +lindera build ./crates/sbv2_core/src/all.csv ./crates/sbv2_core/src/dic/all.dic -u -k ipadic \ No newline at end of file diff --git a/Colab-sbv2_bindings-CPU.ipynb b/scripts/sbv2-bindings-colab.ipynb similarity index 99% rename from Colab-sbv2_bindings-CPU.ipynb rename to scripts/sbv2-bindings-colab.ipynb index 1fee5fc..975e015 100644 --- a/Colab-sbv2_bindings-CPU.ipynb +++ b/scripts/sbv2-bindings-colab.ipynb @@ -16,7 +16,7 @@ "outputs": [], "source": [ "# 必要なパッケージのインストール\n", - "!pip install sbv2_bindings\n", + "%pip install sbv2_bindings\n", "\n", "# 必要なモジュールのインポート\n", "import os\n", diff --git a/test.py b/scripts/sbv2-test-api.py similarity index 100% rename from test.py rename to scripts/sbv2-test-api.py diff --git a/sbv2_bindings/examples/basic.py b/scripts/sbv2-test-bindings.py similarity index 72% rename from sbv2_bindings/examples/basic.py rename to scripts/sbv2-test-bindings.py index 0a833a2..7272c37 100644 --- a/sbv2_bindings/examples/basic.py +++ b/scripts/sbv2-test-bindings.py @@ -3,10 +3,10 @@ from sbv2_bindings import TTSModel def main(): print("Loading models...") - model = TTSModel.from_path("../models/debert.onnx", "../models/tokenizer.json") + model = TTSModel.from_path("./models/debert.onnx", "./models/tokenizer.json") print("Models loaded!") - model.load_sbv2file_from_path("amitaro", "../models/amitaro.sbv2") + model.load_sbv2file_from_path("amitaro", "./models/amitaro.sbv2") print("All setup is done!") style_vector = model.get_style_vector("amitaro", 0, 1.0)