Compare commits

...

45 Commits

Author SHA1 Message Date
tuna2134@コマリン親衛隊
99a4b130af Merge pull request #189 from tuna2134/renovate/ureq-3.x-lockfile 2025-03-01 16:59:08 +09:00
renovate[bot]
d430a6cb51 chore(deps): update rust crate ureq to v3.0.8 2025-02-28 18:57:35 +00:00
tuna2134@コマリン親衛隊
61aae68d2d Merge pull request #188 from tuna2134/tuna2134-patch-1
Fix example
2025-02-26 15:03:18 +09:00
tuna2134@コマリン親衛隊
abb40d4d2d Fix example 2025-02-26 14:38:09 +09:00
tuna2134@コマリン親衛隊
adb699efe7 Merge pull request #186 from tuna2134/renovate/pyo3-0.x-lockfile 2025-02-26 05:35:36 +09:00
renovate[bot]
00fa8025d7 fix(deps): update rust crate pyo3 to v0.23.5 2025-02-25 13:49:05 +00:00
googlefan256
38c5471dcc Merge pull request #184 from googlefan256/main
Pythonビルドの修正
2025-02-23 17:07:05 +09:00
googlefan256
28e116e67d Update CI.yml 2025-02-23 16:19:20 +09:00
Googlefan
5127d48260 fix 2025-02-23 07:04:20 +00:00
Googlefan
f6e9a52b13 fix 2025-02-23 06:49:49 +00:00
Googlefan
9b7de85c46 fix 2025-02-23 06:36:22 +00:00
Googlefan
45a221af23 fix 2025-02-23 06:22:19 +00:00
Googlefan
97541d6a28 fix 2025-02-23 06:08:26 +00:00
Googlefan
640ef16c4b miss 2025-02-23 05:49:06 +00:00
Googlefan
2b5bc27db7 tell me that I can use arm64 runner, f*** microsoft, update the doc NOW 2025-02-23 05:45:23 +00:00
Googlefan
4d00fcd0bc fix 2025-02-23 05:14:56 +00:00
Googlefan
6fc0a47a78 fix 2025-02-23 05:08:13 +00:00
Googlefan
80e5ddee5b fix 2025-02-23 05:05:40 +00:00
Googlefan
143d05c068 fix 2025-02-23 05:02:36 +00:00
Googlefan
14d604091b fix: shortcut 2025-02-23 04:58:12 +00:00
Googlefan
6fc97b1f33 revert 2025-02-23 04:52:02 +00:00
Googlefan
6c5ea9adce fix: reduce download 2025-02-23 04:48:52 +00:00
Googlefan
e262694702 fix 2025-02-23 04:45:58 +00:00
Googlefan
554b82a504 fix 2025-02-23 04:34:48 +00:00
Googlefan
0a911105a3 fix 2025-02-23 04:32:22 +00:00
Googlefan
e5a4774e1a fix 2025-02-23 04:29:15 +00:00
Googlefan
f036417046 fix 2025-02-23 04:27:14 +00:00
Googlefan
3e0c24e0ec fix 2025-02-23 04:16:23 +00:00
Googlefan
17c1a3467a fix 2025-02-23 04:14:49 +00:00
Googlefan
db954ff710 fix 2025-02-23 04:13:51 +00:00
Googlefan
3d2f36a0bf fix 2025-02-23 04:01:47 +00:00
Googlefan
6a8b64208c fix 2025-02-23 04:00:08 +00:00
Googlefan
f33791cf67 fix 2025-02-23 03:56:22 +00:00
Googlefan
96eb51cf04 fix 2025-02-23 03:53:46 +00:00
Googlefan
0f11b9a192 fix 2025-02-23 03:49:53 +00:00
Googlefan
eefd5b723c fix 2025-02-23 03:46:48 +00:00
Googlefan
c86a79cce5 fix 2025-02-23 03:22:13 +00:00
Googlefan
fd7ba84eef fix 2025-02-23 03:19:36 +00:00
googlefan256
6afa667f2e Update and rename build.yml to CI.yml 2025-02-23 12:17:53 +09:00
googlefan256
70b5852d1b Update build.yml 2025-02-23 12:12:48 +09:00
googlefan256
208ac216b5 Update and rename CI.yml to build.yml 2025-02-23 12:10:06 +09:00
googlefan256
5f0c836a66 Update CI.yml 2025-02-23 11:55:59 +09:00
googlefan256
baebe4efd6 Update .env.sample 2025-02-23 11:11:25 +09:00
googlefan256
024751cb71 Update README.md 2025-02-23 11:11:16 +09:00
tuna2134@コマリン親衛隊
12269d9b86 Fix: syntax 2025-02-23 08:20:06 +09:00
8 changed files with 108 additions and 43 deletions

View File

@@ -3,4 +3,5 @@ MODEL_PATH=models/tsukuyomi.sbv2
MODELS_PATH=models
TOKENIZER_PATH=models/tokenizer.json
ADDR=localhost:3000
RUST_LOG=warn
RUST_LOG=warn
HOLDER_MAX_LOADED_MODElS=20

4
.github/workflows/CI.Dockerfile vendored Normal file
View File

@@ -0,0 +1,4 @@
FROM ubuntu:latest
RUN apt update && apt install openssl libssl-dev curl pkg-config software-properties-common -y && add-apt-repository ppa:deadsnakes/ppa && apt update && apt install python3.7 python3.8 python3.9 python3.10 python3.11 python3.12 python3.13 python3-pip python3 -y
ENV PIP_BREAK_SYSTEM_PACKAGES=1
RUN mkdir -p /root/.cache/sbv2 && curl https://huggingface.co/neody/sbv2-api-assets/resolve/main/dic/all.bin -o /root/.cache/sbv2/all.bin -L

View File

@@ -1,40 +1,35 @@
# This file is autogenerated by maturin v1.7.1
# To update, run
#
# maturin generate-ci github
#
name: CI
on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
workflow_dispatch:
permissions:
contents: read
contents: write
id-token: write
packages: write
jobs:
linux:
python-linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
- runner: ubuntu-24.04-arm
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: docker build . -f .github/workflows/CI.Dockerfile --tag ci
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
@@ -42,6 +37,7 @@ jobs:
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
container: ci
working-directory: ./crates/sbv2_bindings
- name: Upload wheels
uses: actions/upload-artifact@v4
@@ -49,7 +45,7 @@ jobs:
name: wheels-linux-${{ matrix.platform.target }}
path: ./crates/sbv2_bindings/dist
windows:
python-windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
@@ -75,7 +71,7 @@ jobs:
name: wheels-windows-${{ matrix.platform.target }}
path: ./crates/sbv2_bindings/dist
macos:
python-macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
@@ -100,7 +96,7 @@ jobs:
name: wheels-macos-${{ matrix.platform.target }}
path: ./crates/sbv2_bindings/dist
sdist:
python-sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -115,22 +111,37 @@ jobs:
with:
name: wheels-sdist
path: ./crates/sbv2_bindings/dist
python-wheel:
name: Wheel Upload
runs-on: ubuntu-latest
needs: [python-linux, python-windows, python-macos, python-sdist]
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- run: gh run download ${{ github.run_id }} -p wheels-*
- name: release
run: |
gh release create commit-${GITHUB_SHA:0:8} --prerelease wheels-*/*
release:
python-release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos, sdist]
needs: [python-linux, python-windows, python-macos, python-sdist]
environment: release
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/download-artifact@v4
- uses: actions/checkout@v4
- run: gh run download ${{ github.run_id }} -p wheels-*
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
build:
docker:
runs-on: ${{ matrix.machine.runner }}
strategy:
fail-fast: false
@@ -177,10 +188,10 @@ jobs:
tags: |
ghcr.io/${{ github.repository }}:latest-${{ matrix.tag }}-${{ matrix.machine.platform }}
merge:
docker-merge:
runs-on: ubuntu-latest
needs:
- build
- docker
steps:
- name: Download digests
uses: actions/download-artifact@v4

67
Cargo.lock generated
View File

@@ -462,6 +462,27 @@ dependencies = [
"crypto-common",
]
[[package]]
name = "dirs"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e"
dependencies = [
"dirs-sys",
]
[[package]]
name = "dirs-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
dependencies = [
"libc",
"option-ext",
"redox_users",
"windows-sys 0.59.0",
]
[[package]]
name = "displaydoc"
version = "0.2.5"
@@ -1695,6 +1716,12 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "option-ext"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "ort"
version = "2.0.0-rc.9"
@@ -1916,9 +1943,9 @@ dependencies = [
[[package]]
name = "pyo3"
version = "0.23.4"
version = "0.23.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57fe09249128b3173d092de9523eaa75136bf7ba85e0d69eca241c7939c933cc"
checksum = "7778bffd85cf38175ac1f545509665d0b9b92a198ca7941f131f85f7a4f9a872"
dependencies = [
"anyhow",
"cfg-if",
@@ -1935,9 +1962,9 @@ dependencies = [
[[package]]
name = "pyo3-build-config"
version = "0.23.4"
version = "0.23.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cd3927b5a78757a0d71aa9dff669f903b1eb64b54142a9bd9f757f8fde65fd7"
checksum = "94f6cbe86ef3bf18998d9df6e0f3fc1050a8c5efa409bf712e661a4366e010fb"
dependencies = [
"once_cell",
"target-lexicon",
@@ -1945,9 +1972,9 @@ dependencies = [
[[package]]
name = "pyo3-ffi"
version = "0.23.4"
version = "0.23.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dab6bb2102bd8f991e7749f130a70d05dd557613e39ed2deeee8e9ca0c4d548d"
checksum = "e9f1b4c431c0bb1c8fb0a338709859eed0d030ff6daa34368d3b152a63dfdd8d"
dependencies = [
"libc",
"pyo3-build-config",
@@ -1955,9 +1982,9 @@ dependencies = [
[[package]]
name = "pyo3-macros"
version = "0.23.4"
version = "0.23.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91871864b353fd5ffcb3f91f2f703a22a9797c91b9ab497b1acac7b07ae509c7"
checksum = "fbc2201328f63c4710f68abdf653c89d8dbc2858b88c5d88b0ff38a75288a9da"
dependencies = [
"proc-macro2",
"pyo3-macros-backend",
@@ -1967,9 +1994,9 @@ dependencies = [
[[package]]
name = "pyo3-macros-backend"
version = "0.23.4"
version = "0.23.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43abc3b80bc20f3facd86cd3c60beed58c3e2aa26213f3cda368de39c60a27e4"
checksum = "fca6726ad0f3da9c9de093d6f116a93c1a38e417ed73bf138472cf4064f72028"
dependencies = [
"heck",
"proc-macro2",
@@ -2063,6 +2090,17 @@ dependencies = [
"bitflags 2.8.0",
]
[[package]]
name = "redox_users"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b"
dependencies = [
"getrandom 0.2.15",
"libredox",
"thiserror 2.0.11",
]
[[package]]
name = "regex"
version = "1.11.1"
@@ -2254,6 +2292,7 @@ version = "0.2.0-alpha6"
dependencies = [
"anyhow",
"base64 0.22.1",
"dirs",
"dotenvy",
"env_logger",
"hound",
@@ -2887,9 +2926,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "ureq"
version = "3.0.6"
version = "3.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2e2dbdf4e95780e5d41804fab88b928a24585721018409eb429b1d29356bde"
checksum = "06f78313c985f2fba11100dd06d60dd402d0cabb458af4d94791b8e09c025323"
dependencies = [
"base64 0.22.1",
"der",
@@ -2909,9 +2948,9 @@ dependencies = [
[[package]]
name = "ureq-proto"
version = "0.3.0"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c51fe73e1d8c4e06bb2698286f7e7453c6fc90528d6d2e7fc36bb4e87fe09b1"
checksum = "64adb55464bad1ab1aa9229133d0d59d2f679180f4d15f0d9debe616f541f25e"
dependencies = [
"base64 0.22.1",
"http",

View File

@@ -48,8 +48,11 @@ JP-Extra しか対応していません。(基本的に対応する予定もあ
### models をインストール
https://huggingface.co/googlefan/sbv2_onnx_models/tree/main
`tokenizer.json`,`debert.onnx`,`tsukuyomi.sbv2`を models フォルダに配置
https://huggingface.co/neody/sbv2-api-assets/tree/main/deberta
から`tokenizer.json`,`debert.onnx`
https://huggingface.co/neody/sbv2-api-assets/tree/main/model
から`tsukuyomi.sbv2`
を models フォルダに配置
### .env ファイルの作成
@@ -118,9 +121,10 @@ curl http://localhost:3000/models
- `ADDR` `localhost:3000`などのようにサーバー起動アドレスをコントロールできます。
- `MODELS_PATH` sbv2モデルの存在するフォルダを指定できます。
- `RUST_LOG` おなじみlog levelです。
- `HOLDER_MAX_LOADED_MODElS` RAMにロードされるモデルの最大数を指定します。
## 謝辞
- [litagin02/Style-Bert-VITS2](https://github.com/litagin02/Style-Bert-VITS2) - このコード書くにあたり、ベースとなる部分を参考にさせていただきました。
- [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) - 辞書部分
- [Aivis Project](https://github.com/Aivis-Project/AivisSpeech-Engine) - 辞書部分

View File

@@ -43,4 +43,5 @@ aivmx = ["npyz", "base64"]
base64 = ["dep:base64"]
[build-dependencies]
dirs = "6.0.0"
ureq = "3.0.6"

View File

@@ -1,12 +1,18 @@
use dirs::home_dir;
use std::env;
use std::fs;
use std::io::copy;
use std::path::Path;
use std::path::PathBuf;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let out_dir = env::var("OUT_DIR")?;
let out_path = Path::new(&out_dir).join("all.bin");
if !out_path.exists() {
let static_path = home_dir().unwrap().join(".cache/sbv2/all.bin");
let out_path = PathBuf::from(&env::var("OUT_DIR").unwrap()).join("all.bin");
println!("cargo:rerun-if-changed=build.rs");
if static_path.exists() {
if fs::hard_link(&static_path, &out_path).is_err() {
fs::copy(static_path, out_path).unwrap();
};
} else {
println!("cargo:warning=Downloading dictionary file...");
let mut response =
ureq::get("https://huggingface.co/neody/sbv2-api-assets/resolve/main/dic/all.bin")
@@ -15,6 +21,5 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut file = fs::File::create(&out_path)?;
copy(&mut response, &mut file)?;
}
println!("cargo:rerun-if-changed=build.rs");
Ok(())
}

View File

@@ -12,7 +12,7 @@ def main():
style_vector = model.get_style_vector("amitaro", 0, 1.0)
with open("output.wav", "wb") as f:
f.write(
model.synthesize("おはようございます。", "amitaro", style_vector, 0.0, 0.5)
model.synthesize("おはようございます。", "amitaro", 0, 0, 0.0, 0.5)
)