mirror of
https://github.com/neodyland/sbv2-api.git
synced 2025-12-25 08:39:57 +00:00
Compare commits
45 Commits
v0.2.0-alp
...
commit-e98
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99a4b130af | ||
|
|
d430a6cb51 | ||
|
|
61aae68d2d | ||
|
|
abb40d4d2d | ||
|
|
adb699efe7 | ||
|
|
00fa8025d7 | ||
|
|
38c5471dcc | ||
|
|
28e116e67d | ||
|
|
5127d48260 | ||
|
|
f6e9a52b13 | ||
|
|
9b7de85c46 | ||
|
|
45a221af23 | ||
|
|
97541d6a28 | ||
|
|
640ef16c4b | ||
|
|
2b5bc27db7 | ||
|
|
4d00fcd0bc | ||
|
|
6fc0a47a78 | ||
|
|
80e5ddee5b | ||
|
|
143d05c068 | ||
|
|
14d604091b | ||
|
|
6fc97b1f33 | ||
|
|
6c5ea9adce | ||
|
|
e262694702 | ||
|
|
554b82a504 | ||
|
|
0a911105a3 | ||
|
|
e5a4774e1a | ||
|
|
f036417046 | ||
|
|
3e0c24e0ec | ||
|
|
17c1a3467a | ||
|
|
db954ff710 | ||
|
|
3d2f36a0bf | ||
|
|
6a8b64208c | ||
|
|
f33791cf67 | ||
|
|
96eb51cf04 | ||
|
|
0f11b9a192 | ||
|
|
eefd5b723c | ||
|
|
c86a79cce5 | ||
|
|
fd7ba84eef | ||
|
|
6afa667f2e | ||
|
|
70b5852d1b | ||
|
|
208ac216b5 | ||
|
|
5f0c836a66 | ||
|
|
baebe4efd6 | ||
|
|
024751cb71 | ||
|
|
12269d9b86 |
@@ -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
4
.github/workflows/CI.Dockerfile
vendored
Normal 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
|
||||
47
.github/workflows/CI.yml
vendored
47
.github/workflows/CI.yml
vendored
@@ -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
67
Cargo.lock
generated
@@ -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",
|
||||
|
||||
12
README.md
12
README.md
@@ -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) - 辞書部分
|
||||
|
||||
@@ -43,4 +43,5 @@ aivmx = ["npyz", "base64"]
|
||||
base64 = ["dep:base64"]
|
||||
|
||||
[build-dependencies]
|
||||
dirs = "6.0.0"
|
||||
ureq = "3.0.6"
|
||||
|
||||
@@ -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(())
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user