Add C++ runtime for vocos (#2014)

This commit is contained in:
Fangjun Kuang
2025-03-17 17:05:15 +08:00
committed by GitHub
parent 623cdc9eec
commit 0aacf02dd8
62 changed files with 558 additions and 162 deletions

View File

@@ -395,7 +395,7 @@ def get_matcha_models() -> List[TtsModel]:
s = [f"{m.model_dir}/{r}" for r in rule_fsts]
m.rule_fsts = ",".join(s)
m.dict_dir = m.model_dir + "/dict"
m.vocoder = "hifigan_v2.onnx"
m.vocoder = "vocos-22khz-univ.onnx"
english_persian_models = [
TtsModel(
@@ -416,7 +416,7 @@ def get_matcha_models() -> List[TtsModel]:
]
for m in english_persian_models:
m.data_dir = f"{m.model_dir}/espeak-ng-data"
m.vocoder = "hifigan_v2.onnx"
m.vocoder = "vocos-22khz-univ.onnx"
return chinese_models + english_persian_models

View File

@@ -20,8 +20,8 @@ if [ ! -f male/tokens.txt ]; then
curl -SL --output male/tokens.txt https://huggingface.co/mah92/Musa-FA_EN-Matcha-TTS-Model/resolve/main/tokens_sherpa_with_fa.txt
fi
if [ ! -f hifigan_v2.onnx ]; then
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/vocoder-models/hifigan_v2.onnx
if [ ! -f vocos-22khz-univ.onnx ]; then
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/vocoder-models/vocos-22khz-univ.onnx
fi
if [ ! -f .add-meta-data.done ]; then
@@ -31,14 +31,14 @@ fi
python3 ./test.py \
--am ./female/model.onnx \
--vocoder ./hifigan_v2.onnx \
--vocoder ./vocos-22khz-univ.onnx \
--tokens ./female/tokens.txt \
--text "This is a test. این یک نمونه ی تست فارسی است." \
--out-wav "./female-en-fa.wav"
python3 ./test.py \
--am ./male/model.onnx \
--vocoder ./hifigan_v2.onnx \
--vocoder ./vocos-22khz-univ.onnx \
--tokens ./male/tokens.txt \
--text "This is a test. این یک نمونه ی تست فارسی است." \
--out-wav "./male-en-fa.wav"