mirror of
https://github.com/neodyland/sbv2-api.git
synced 2025-12-23 07:59:56 +00:00
Compare commits
47 Commits
commit-4de
...
commit-45c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45c3255a91 | ||
|
|
bf39890b3d | ||
|
|
120bc608d7 | ||
|
|
2fc547e38b | ||
|
|
98ddaa3c58 | ||
|
|
656e405cd7 | ||
|
|
9d6aa46fdf | ||
|
|
2fe90c6ede | ||
|
|
7faba2447b | ||
|
|
02ac0885e0 | ||
|
|
1f96b09f3b | ||
|
|
d583c1ca1c | ||
|
|
c135aac852 | ||
|
|
f31fa1d4f9 | ||
|
|
efec7cce14 | ||
|
|
61914129dc | ||
|
|
97c63a2e23 | ||
|
|
3475f47305 | ||
|
|
5493b91a84 | ||
|
|
bca6d04e7b | ||
|
|
d44ebe873e | ||
|
|
96b53d42cd | ||
|
|
9765ef51d2 | ||
|
|
e68f58d698 | ||
|
|
2124fe4650 | ||
|
|
0217c0a4d5 | ||
|
|
1de09597f5 | ||
|
|
38d86c9249 | ||
|
|
ddc132b27b | ||
|
|
558cd24677 | ||
|
|
6657b06786 | ||
|
|
2a8c9bafde | ||
|
|
d7065ac6eb | ||
|
|
0b1dbe4991 | ||
|
|
1ad588bfcf | ||
|
|
9733ba95fa | ||
|
|
843c16995c | ||
|
|
f0821ea957 | ||
|
|
abc9cec7c7 | ||
|
|
19e6b7f0e6 | ||
|
|
451f4497b6 | ||
|
|
e5e92f6211 | ||
|
|
b835577325 | ||
|
|
3caf93441a | ||
|
|
1dd3e02562 | ||
|
|
4990261ecd | ||
|
|
1d80eda325 |
11
.github/dependabot.yml
vendored
Normal file
11
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "cargo" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
@@ -1,4 +1,4 @@
|
||||
name: CI
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -6,7 +6,6 @@ on:
|
||||
- main
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
@@ -29,7 +28,7 @@ jobs:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- run: docker build . -f .github/workflows/CI.Dockerfile --tag ci
|
||||
- run: docker build . -f .github/workflows/build.Dockerfile --tag ci
|
||||
- name: Build wheels
|
||||
uses: PyO3/maturin-action@v1
|
||||
with:
|
||||
@@ -111,6 +110,7 @@ jobs:
|
||||
with:
|
||||
name: wheels-sdist
|
||||
path: ./crates/sbv2_bindings/dist
|
||||
|
||||
python-wheel:
|
||||
name: Wheel Upload
|
||||
runs-on: ubuntu-latest
|
||||
26
.github/workflows/lint.yml
vendored
Normal file
26
.github/workflows/lint.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: Lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
components:
|
||||
- rustfmt
|
||||
- clippy
|
||||
steps:
|
||||
- name: Setup
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
components: ${{ matrix.components }}
|
||||
- name: Format
|
||||
if: ${{ matrix.components == 'rustfmt' }}
|
||||
run: cargo fmt --all -- --check
|
||||
- name: Lint
|
||||
if: ${{ matrix.components == 'clippy' }}
|
||||
run: cargo clippy --all-targets --all-features -- -D warnings
|
||||
935
Cargo.lock
generated
935
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = ["./crates/sbv2_api", "./crates/sbv2_core", "./crates/sbv2_bindings", "./crates/sbv2_wasm", "crates/sbv2_editor"]
|
||||
resolver = "3"
|
||||
members = ["./crates/sbv2_api", "./crates/sbv2_core", "./crates/sbv2_bindings", "./crates/sbv2_wasm"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.2.0-alpha6"
|
||||
@@ -8,7 +8,7 @@ edition = "2021"
|
||||
description = "Style-Bert-VITSの推論ライブラリ"
|
||||
license = "MIT"
|
||||
readme = "./README.md"
|
||||
repository = "https://github.com/tuna2134/sbv2-api"
|
||||
repository = "https://github.com/neodyland/sbv2-api"
|
||||
documentation = "https://docs.rs/sbv2_core"
|
||||
|
||||
[workspace.dependencies]
|
||||
|
||||
1
LICENSE
1
LICENSE
@@ -1,6 +1,7 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 tuna2134
|
||||
Copyright (c) 2025- neodyland
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
## プログラミングに詳しくない方向け
|
||||
|
||||
[こちら](https://github.com/tuna2134/sbv2-gui?tab=readme-ov-file)を参照してください。
|
||||
[こちら](https://github.com/tuna2134/sbv2-gui)を参照してください。
|
||||
|
||||
コマンドやpythonの知識なしで簡単に使えるバージョンです。(できることはほぼ同じ)
|
||||
|
||||
@@ -75,7 +75,7 @@ CPUの場合は
|
||||
```sh
|
||||
docker run -it --rm -p 3000:3000 --name sbv2 \
|
||||
-v ./models:/work/models --env-file .env \
|
||||
ghcr.io/tuna2134/sbv2-api:cpu
|
||||
ghcr.io/neodyland/sbv2-api:cpu
|
||||
```
|
||||
|
||||
<details>
|
||||
@@ -90,7 +90,7 @@ CPUの場合は
|
||||
```bash
|
||||
docker run --platform linux/amd64 -it --rm -p 3000:3000 --name sbv2 \
|
||||
-v ./models:/work/models --env-file .env \
|
||||
ghcr.io/tuna2134/sbv2-api:cpu
|
||||
ghcr.io/neodyland/sbv2-api:cpu
|
||||
```
|
||||
</details>
|
||||
|
||||
@@ -99,7 +99,7 @@ CUDAの場合は
|
||||
docker run -it --rm -p 3000:3000 --name sbv2 \
|
||||
-v ./models:/work/models --env-file .env \
|
||||
--gpus all \
|
||||
ghcr.io/tuna2134/sbv2-api:cuda
|
||||
ghcr.io/neodyland/sbv2-api:cuda
|
||||
```
|
||||
|
||||
### 起動確認
|
||||
|
||||
@@ -16,8 +16,8 @@ env_logger.workspace = true
|
||||
log = "0.4.22"
|
||||
sbv2_core = { version = "0.2.0-alpha6", path = "../sbv2_core", features = ["aivmx"] }
|
||||
serde = { version = "1.0.210", features = ["derive"] }
|
||||
tokio = { version = "1.40.0", features = ["full"] }
|
||||
utoipa = { version = "5.0.0", features = ["axum_extras"] }
|
||||
tokio = { version = "1.46.1", features = ["full"] }
|
||||
utoipa = { version = "5.4.0", features = ["axum_extras"] }
|
||||
utoipa-scalar = { version = "0.3.0", features = ["axum"] }
|
||||
|
||||
[features]
|
||||
|
||||
@@ -53,12 +53,16 @@ struct SynthesizeRequest {
|
||||
text: String,
|
||||
ident: String,
|
||||
#[serde(default = "sdp_default")]
|
||||
#[schema(example = 0.0_f32)]
|
||||
sdp_ratio: f32,
|
||||
#[serde(default = "length_default")]
|
||||
#[schema(example = 1.0_f32)]
|
||||
length_scale: f32,
|
||||
#[serde(default = "style_id_default")]
|
||||
#[schema(example = 0_i32)]
|
||||
style_id: i32,
|
||||
#[serde(default = "speaker_id_default")]
|
||||
#[schema(example = 0_i64)]
|
||||
speaker_id: i64,
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ crate-type = ["cdylib"]
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
ndarray.workspace = true
|
||||
pyo3 = { version = "0.24.0", features = ["anyhow"] }
|
||||
pyo3 = { version = "0.25.1", features = ["anyhow"] }
|
||||
sbv2_core = { path = "../sbv2_core", features = ["std"], default-features = false }
|
||||
|
||||
[features]
|
||||
|
||||
@@ -136,6 +136,7 @@ impl TTSModel {
|
||||
/// -------
|
||||
/// voice_data : bytes
|
||||
/// 音声データ
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn synthesize<'p>(
|
||||
&'p mut self,
|
||||
py: Python<'p>,
|
||||
|
||||
@@ -16,7 +16,7 @@ env_logger.workspace = true
|
||||
hound = "3.5.1"
|
||||
jpreprocess = { version = "0.12.0", features = ["naist-jdic"] }
|
||||
ndarray.workspace = true
|
||||
npyz = { version = "0.8.3", optional = true }
|
||||
npyz = { version = "0.8.4", optional = true }
|
||||
num_cpus = "1.16.0"
|
||||
once_cell.workspace = true
|
||||
ort = { git = "https://github.com/pykeio/ort.git", version = "2.0.0-rc.9", optional = true }
|
||||
@@ -25,7 +25,7 @@ serde = { version = "1.0.210", features = ["derive"] }
|
||||
serde_json = "1.0.128"
|
||||
tar = "0.4.41"
|
||||
thiserror = "2.0.11"
|
||||
tokenizers = { version = "0.21.0", default-features = false }
|
||||
tokenizers = { version = "0.21.2", default-features = false }
|
||||
zstd = "0.13.2"
|
||||
|
||||
[features]
|
||||
@@ -44,4 +44,4 @@ base64 = ["dep:base64"]
|
||||
|
||||
[build-dependencies]
|
||||
dirs = "6.0.0"
|
||||
ureq = "3.0.6"
|
||||
ureq = "3.0.12"
|
||||
|
||||
@@ -5,21 +5,27 @@ use std::io::copy;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let static_path = home_dir().unwrap().join(".cache/sbv2/all.bin");
|
||||
let static_dir = home_dir().unwrap().join(".cache/sbv2");
|
||||
let static_path = static_dir.join("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();
|
||||
};
|
||||
println!("cargo:info=Dictionary file already exists, skipping download.");
|
||||
} else {
|
||||
println!("cargo:warning=Downloading dictionary file...");
|
||||
let mut response =
|
||||
ureq::get("https://huggingface.co/neody/sbv2-api-assets/resolve/main/dic/all.bin")
|
||||
.call()?;
|
||||
let mut response = response.body_mut().as_reader();
|
||||
let mut file = fs::File::create(&out_path)?;
|
||||
if !static_dir.exists() {
|
||||
fs::create_dir_all(static_dir)?;
|
||||
}
|
||||
let mut file = fs::File::create(&static_path)?;
|
||||
copy(&mut response, &mut file)?;
|
||||
}
|
||||
if !out_path.exists() && fs::hard_link(&static_path, &out_path).is_err() {
|
||||
println!("cargo:warning=Failed to create hard link, copying instead.");
|
||||
fs::copy(static_path, out_path)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -14,11 +14,9 @@ pub fn predict(
|
||||
"attention_mask" => TensorRef::from_array_view((vec![1, attention_masks.len() as i64], attention_masks.as_slice()))?,
|
||||
}
|
||||
)?;
|
||||
|
||||
let output = outputs["output"]
|
||||
.try_extract_tensor::<f32>()?
|
||||
.try_extract_array::<f32>()?
|
||||
.into_dimensionality::<Ix2>()?
|
||||
.to_owned();
|
||||
|
||||
Ok(output)
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ pub enum Error {
|
||||
Base64Error(#[from] base64::DecodeError),
|
||||
#[error("other")]
|
||||
OtherError(String),
|
||||
#[error("Style error: {0}")]
|
||||
StyleError(String),
|
||||
}
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
@@ -81,7 +81,7 @@ fn phone_tone_to_kana(phones: Vec<String>, tones: Vec<i32>) -> Vec<(String, i32)
|
||||
let tones = &tones[1..];
|
||||
let mut results = Vec::new();
|
||||
let mut current_mora = String::new();
|
||||
for ((phone, next_phone), (&tone, &next_tone)) in phones
|
||||
for ((phone, _next_phone), (&tone, &next_tone)) in phones
|
||||
.iter()
|
||||
.zip(phones.iter().skip(1))
|
||||
.zip(tones.iter().zip(tones.iter().skip(1)))
|
||||
@@ -123,7 +123,7 @@ impl JTalkProcess {
|
||||
.map(|(_letter, tone)| *tone)
|
||||
.collect();
|
||||
if tone_values.len() == 1 {
|
||||
assert!(tone_values == hash_set![0], "{:?}", tone_values);
|
||||
assert!(tone_values == hash_set![0], "{tone_values:?}");
|
||||
Ok(phone_tone_list)
|
||||
} else if tone_values.len() == 2 {
|
||||
if tone_values == hash_set![0, 1] {
|
||||
@@ -226,12 +226,12 @@ impl JTalkProcess {
|
||||
} else if PUNCTUATIONS.contains(&phone.as_str()) {
|
||||
result.push((phone, 0));
|
||||
} else {
|
||||
println!("phones {:?}", phone_with_punct);
|
||||
println!("phone_tone_list: {:?}", phone_tone_list);
|
||||
println!("result: {:?}", result);
|
||||
println!("tone_index: {:?}", tone_index);
|
||||
println!("phone: {:?}", phone);
|
||||
return Err(Error::ValueError(format!("Mismatched phoneme: {}", phone)));
|
||||
println!("phones {phone_with_punct:?}");
|
||||
println!("phone_tone_list: {phone_tone_list:?}");
|
||||
println!("result: {result:?}");
|
||||
println!("tone_index: {tone_index:?}");
|
||||
println!("phone: {phone:?}");
|
||||
return Err(Error::ValueError(format!("Mismatched phoneme: {phone}")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,8 +276,7 @@ impl JTalkProcess {
|
||||
}
|
||||
if !KATAKANA_PATTERN.is_match(&text) {
|
||||
return Err(Error::ValueError(format!(
|
||||
"Input must be katakana only: {}",
|
||||
text
|
||||
"Input must be katakana only: {text}"
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -285,7 +284,7 @@ impl JTalkProcess {
|
||||
let mora = mora.to_string();
|
||||
let (consonant, vowel) = MORA_KATA_TO_MORA_PHONEMES.get(&mora).unwrap();
|
||||
if consonant.is_none() {
|
||||
text = text.replace(&mora, &format!(" {}", vowel));
|
||||
text = text.replace(&mora, &format!(" {vowel}"));
|
||||
} else {
|
||||
text = text.replace(
|
||||
&mora,
|
||||
@@ -319,7 +318,7 @@ impl JTalkProcess {
|
||||
let (string, pron) = self.parse_to_string_and_pron(parts.clone());
|
||||
let mut yomi = pron.replace('’', "");
|
||||
let word = replace_punctuation(string);
|
||||
assert!(!yomi.is_empty(), "Empty yomi: {}", word);
|
||||
assert!(!yomi.is_empty(), "Empty yomi: {word}");
|
||||
if yomi == "、" {
|
||||
if !word
|
||||
.chars()
|
||||
@@ -330,7 +329,7 @@ impl JTalkProcess {
|
||||
yomi = word.clone();
|
||||
}
|
||||
} else if yomi == "?" {
|
||||
assert!(word == "?", "yomi `?` comes from: {}", word);
|
||||
assert!(word == "?", "yomi `?` comes from: {word}");
|
||||
yomi = "?".to_string();
|
||||
}
|
||||
seq_text.push(word);
|
||||
|
||||
@@ -21,10 +21,7 @@ pub fn load_model<P: AsRef<[u8]>>(model_file: P, bert: bool) -> Result<Session>
|
||||
#[cfg(feature = "cuda")]
|
||||
{
|
||||
#[allow(unused_mut)]
|
||||
let mut cuda = ort::execution_providers::CUDAExecutionProvider::default()
|
||||
.with_conv_algorithm_search(
|
||||
ort::execution_providers::cuda::CUDAExecutionProviderCuDNNConvAlgoSearch::Default,
|
||||
);
|
||||
let mut cuda = ort::execution_providers::CUDAExecutionProvider::default();
|
||||
#[cfg(feature = "cuda_tf32")]
|
||||
{
|
||||
cuda = cuda.with_tf32(true);
|
||||
@@ -101,11 +98,9 @@ pub fn synthesize(
|
||||
"noise_scale" => noise_scale,
|
||||
"noise_scale_w" => noise_scale_w,
|
||||
})?;
|
||||
|
||||
let audio_array = outputs["output"]
|
||||
.try_extract_tensor::<f32>()?
|
||||
.try_extract_array::<f32>()?
|
||||
.into_dimensionality::<Ix3>()?
|
||||
.to_owned();
|
||||
|
||||
Ok(audio_array)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::error::Result;
|
||||
use crate::error::{Error, Result};
|
||||
use ndarray::{s, Array1, Array2};
|
||||
use serde::Deserialize;
|
||||
|
||||
@@ -21,6 +21,18 @@ pub fn get_style_vector(
|
||||
style_id: i32,
|
||||
weight: f32,
|
||||
) -> Result<Array1<f32>> {
|
||||
if style_vectors.shape().len() != 2 {
|
||||
return Err(Error::StyleError(
|
||||
"Invalid shape for style vectors".to_string(),
|
||||
));
|
||||
}
|
||||
if style_id < 0 || style_id >= style_vectors.shape()[0] as i32 {
|
||||
return Err(Error::StyleError(format!(
|
||||
"Invalid style ID: {}. Max ID: {}",
|
||||
style_id,
|
||||
style_vectors.shape()[0] - 1
|
||||
)));
|
||||
}
|
||||
let mean = style_vectors.slice(s![0, ..]).to_owned();
|
||||
let style_vector = style_vectors.slice(s![style_id as usize, ..]).to_owned();
|
||||
let diff = (style_vector - &mean) * weight;
|
||||
|
||||
@@ -214,6 +214,7 @@ impl TTSModelHolder {
|
||||
)
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub fn parse_text_neo(
|
||||
&mut self,
|
||||
text: String,
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# StyleBertVITS2 wasm
|
||||
refer to https://github.com/tuna2134/sbv2-api
|
||||
refer to https://github.com/neodyland/sbv2-api
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "tuna2134",
|
||||
"contributes": ["neodyland"],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
|
||||
8
crates/sbv2_wasm/pnpm-lock.yaml
generated
8
crates/sbv2_wasm/pnpm-lock.yaml
generated
@@ -23,7 +23,7 @@ importers:
|
||||
version: 0.25.0
|
||||
typescript:
|
||||
specifier: ^5.7.3
|
||||
version: 5.7.3
|
||||
version: 5.8.3
|
||||
|
||||
packages:
|
||||
|
||||
@@ -290,8 +290,8 @@ packages:
|
||||
resolution: {integrity: sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
|
||||
typescript@5.7.3:
|
||||
resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==}
|
||||
typescript@5.8.3:
|
||||
resolution: {integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==}
|
||||
engines: {node: '>=14.17'}
|
||||
hasBin: true
|
||||
|
||||
@@ -499,6 +499,6 @@ snapshots:
|
||||
'@types/node': 22.13.5
|
||||
long: 5.3.1
|
||||
|
||||
typescript@5.7.3: {}
|
||||
typescript@5.8.3: {}
|
||||
|
||||
undici-types@6.20.0: {}
|
||||
|
||||
1
scripts/convert/.python-version
Normal file
1
scripts/convert/.python-version
Normal file
@@ -0,0 +1 @@
|
||||
3.11
|
||||
@@ -1,5 +1,6 @@
|
||||
style-bert-vits2
|
||||
git+https://github.com/neodyland/style-bert-vits2-ref
|
||||
onnxsim
|
||||
numpy<2
|
||||
zstandard
|
||||
onnxruntime
|
||||
cmake<4
|
||||
@@ -2,8 +2,16 @@ FROM rust AS builder
|
||||
WORKDIR /work
|
||||
COPY . .
|
||||
RUN cargo build -r --bin sbv2_api
|
||||
FROM gcr.io/distroless/cc-debian12
|
||||
FROM ubuntu AS upx
|
||||
WORKDIR /work
|
||||
RUN apt update && apt-get install -y upx binutils
|
||||
COPY --from=builder /work/target/release/sbv2_api /work/main
|
||||
COPY --from=builder /work/target/release/*.so /work
|
||||
CMD ["/work/main"]
|
||||
RUN upx --best --lzma /work/main
|
||||
RUN find /work -maxdepth 1 -name "*.so" -exec strip --strip-unneeded {} +
|
||||
RUN find /work -maxdepth 1 -name "*.so" -exec upx --best --lzma {} +
|
||||
FROM gcr.io/distroless/cc-debian12
|
||||
WORKDIR /work
|
||||
COPY --from=upx /work/main /work/main
|
||||
COPY --from=upx /work/*.so /work
|
||||
CMD ["/work/main"]
|
||||
|
||||
@@ -2,9 +2,16 @@ FROM rust AS builder
|
||||
WORKDIR /work
|
||||
COPY . .
|
||||
RUN cargo build -r --bin sbv2_api -F cuda,cuda_tf32
|
||||
FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04
|
||||
FROM ubuntu AS upx
|
||||
WORKDIR /work
|
||||
RUN apt update && apt-get install -y upx binutils
|
||||
COPY --from=builder /work/target/release/sbv2_api /work/main
|
||||
COPY --from=builder /work/target/release/*.so /work
|
||||
RUN upx --best --lzma /work/main
|
||||
RUN find /work -maxdepth 1 -name "*.so" -exec strip --strip-unneeded {} +
|
||||
FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04
|
||||
WORKDIR /work
|
||||
COPY --from=upx /work/main /work/main
|
||||
COPY --from=upx /work/*.so /work
|
||||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/work
|
||||
CMD ["/work/main"]
|
||||
CMD ["/work/main"]
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
docker run -it --rm -p 3000:3000 --name sbv2 \
|
||||
-v ./models:/work/models --env-file .env \
|
||||
ghcr.io/tuna2134/sbv2-api:cpu
|
||||
ghcr.io/neodyland/sbv2-api:cpu
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
docker run -it --rm -p 3000:3000 --name sbv2 \
|
||||
-v ./models:/work/models --env-file .env \
|
||||
--gpus all \
|
||||
ghcr.io/tuna2134/sbv2-api:cuda
|
||||
ghcr.io/neodyland/sbv2-api:cuda
|
||||
|
||||
Reference in New Issue
Block a user