Skip to content

Commit

Permalink
Add more Chinese TTS models (Mandarin and Cantonese) (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Feb 20, 2024
1 parent 5f075d0 commit d2cc48d
Show file tree
Hide file tree
Showing 25 changed files with 131 additions and 69 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/apk-kws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ jobs:
with:
fetch-depth: 0

# https://github.com/actions/setup-java
- uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '21'

- name: ccache
uses: hendrikmuhs/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/apk-speaker-identification.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
if: true
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/apk-tts-engine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
if: true
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/apk-tts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
with:
fetch-depth: 0

# https://github.com/actions/setup-java
- uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '21'

- name: ccache
uses: hendrikmuhs/[email protected]
with:
Expand Down Expand Up @@ -89,7 +95,7 @@ jobs:
if: true
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/apk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ jobs:
with:
fetch-depth: 0

# https://github.com/actions/setup-java
- uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '21'

- name: ccache
uses: hendrikmuhs/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-wheels-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
if: matrix.python-version == 'cp38'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-wheels-armv7l.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
if: matrix.python-version == '3.8'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-wheels-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
if: matrix.python-version == 'cp38'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-wheels-macos-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
if: matrix.python-version == 'cp38'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-wheels-macos-x64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
if: matrix.python-version == 'cp38'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-wheels-win32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
if: matrix.python-version == 'cp38'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-wheels-win64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
if: matrix.python-version == 'cp38'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/export-wenet-to-onnx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Publish to huggingface (aishell)
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ message(STATUS "C++ Standard version: ${CMAKE_CXX_STANDARD}")

include(CheckIncludeFileCXX)

if(UNIX AND NOT APPLE AND NOT SHERPA_ONNX_ENABLE_WASM)
if(UNIX AND NOT APPLE AND NOT SHERPA_ONNX_ENABLE_WASM AND NOT CMAKE_SYSTEM_NAME STREQUAL Android)
check_include_file_cxx(alsa/asoundlib.h SHERPA_ONNX_HAS_ALSA)
if(SHERPA_ONNX_HAS_ALSA)
add_definitions(-DSHERPA_ONNX_ENABLE_ALSA=1)
else()
message(WARNING "\
Could not find alsa/asoundlib.h !
We won't build sherpa-ncnn-alsa
We won't build sherpa-onnx-alsa
To fix that, please do:
(1) sudo apt-get install alsa-utils libasound2-dev
(2) rm -rf build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Feb 23 11:09:06 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Sep 10 18:03:03 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Feb 23 11:09:06 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Oct 23 15:40:58 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Sep 23 10:24:21 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Sep 23 20:50:52 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Feb 23 11:09:06 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
2 changes: 2 additions & 0 deletions scripts/apk/build-apk-speaker-identification.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ for arch in arm64-v8a armeabi-v7a x86_64 x86; do
cp -v ./build-android-$src_arch/install/lib/*.so ./android/SherpaOnnxSpeakerIdentification/app/src/main/jniLibs/$arch/

pushd ./android/SherpaOnnxSpeakerIdentification
sed -i.bak s/2048/9012/g ./gradle.properties
git diff ./gradle.properties
./gradlew build
popd

Expand Down
2 changes: 2 additions & 0 deletions scripts/apk/build-apk-tts-engine.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ for arch in arm64-v8a armeabi-v7a x86_64 x86; do
cp -v ./build-android-$src_arch/install/lib/*.so ./android/SherpaOnnxTtsEngine/app/src/main/jniLibs/$arch/

pushd ./android/SherpaOnnxTtsEngine
sed -i.bak s/2048/9012/g ./gradle.properties
git diff ./gradle.properties
./gradlew build
popd

Expand Down
2 changes: 2 additions & 0 deletions scripts/apk/build-apk-tts.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ for arch in arm64-v8a armeabi-v7a x86_64 x86; do
cp -v ./build-android-$src_arch/install/lib/*.so ./android/SherpaOnnxTts/app/src/main/jniLibs/$arch/

pushd ./android/SherpaOnnxTts
sed -i.bak s/2048/9012/g ./gradle.properties
git diff ./gradle.properties
./gradlew build
popd

Expand Down
136 changes: 87 additions & 49 deletions scripts/apk/generate-tts-apk-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class TtsModel:

def convert_lang_to_iso_639_3(models: List[TtsModel]):
for m in models:
m.lang_iso_639_3 = Lang(m.lang).pt3
if m.lang_iso_639_3 == "":
m.lang_iso_639_3 = Lang(m.lang).pt3


def get_coqui_models() -> List[TtsModel]:
Expand Down Expand Up @@ -209,54 +210,91 @@ def get_vits_models() -> List[TtsModel]:
lang="zh",
rule_fsts="vits-zh-aishell3/rule.fst",
),
# TtsModel(
# model_dir="vits-zh-hf-doom",
# model_name="doom.onnx",
# lang="zh",
# rule_fsts="vits-zh-hf-doom/rule.fst",
# ),
# TtsModel(
# model_dir="vits-zh-hf-echo",
# model_name="echo.onnx",
# lang="zh",
# rule_fsts="vits-zh-hf-echo/rule.fst",
# ),
# TtsModel(
# model_dir="vits-zh-hf-zenyatta",
# model_name="zenyatta.onnx",
# lang="zh",
# rule_fsts="vits-zh-hf-zenyatta/rule.fst",
# ),
# TtsModel(
# model_dir="vits-zh-hf-abyssinvoker",
# model_name="abyssinvoker.onnx",
# lang="zh",
# rule_fsts="vits-zh-hf-abyssinvoker/rule.fst",
# ),
# TtsModel(
# model_dir="vits-zh-hf-keqing",
# model_name="keqing.onnx",
# lang="zh",
# rule_fsts="vits-zh-hf-keqing/rule.fst",
# ),
# TtsModel(
# model_dir="vits-zh-hf-eula",
# model_name="eula.onnx",
# lang="zh",
# rule_fsts="vits-zh-hf-eula/rule.fst",
# ),
# TtsModel(
# model_dir="vits-zh-hf-bronya",
# model_name="bronya.onnx",
# lang="zh",
# rule_fsts="vits-zh-hf-bronya/rule.fst",
# ),
# TtsModel(
# model_dir="vits-zh-hf-theresa",
# model_name="theresa.onnx",
# lang="zh",
# rule_fsts="vits-zh-hf-theresa/rule.fst",
# ),
TtsModel(
model_dir="vits-zh-hf-doom",
model_name="doom.onnx",
lang="zh",
rule_fsts="vits-zh-hf-doom/rule.fst",
),
TtsModel(
model_dir="vits-zh-hf-echo",
model_name="echo.onnx",
lang="zh",
rule_fsts="vits-zh-hf-echo/rule.fst",
),
TtsModel(
model_dir="vits-zh-hf-zenyatta",
model_name="zenyatta.onnx",
lang="zh",
rule_fsts="vits-zh-hf-zenyatta/rule.fst",
),
TtsModel(
model_dir="vits-zh-hf-abyssinvoker",
model_name="abyssinvoker.onnx",
lang="zh",
rule_fsts="vits-zh-hf-abyssinvoker/rule.fst",
),
TtsModel(
model_dir="vits-zh-hf-keqing",
model_name="keqing.onnx",
lang="zh",
rule_fsts="vits-zh-hf-keqing/rule.fst",
),
TtsModel(
model_dir="vits-zh-hf-eula",
model_name="eula.onnx",
lang="zh",
rule_fsts="vits-zh-hf-eula/rule.fst",
),
TtsModel(
model_dir="vits-zh-hf-bronya",
model_name="bronya.onnx",
lang="zh",
rule_fsts="vits-zh-hf-bronya/rule.fst",
),
TtsModel(
model_dir="vits-zh-hf-theresa",
model_name="theresa.onnx",
lang="zh",
rule_fsts="vits-zh-hf-theresa/rule.fst",
),
TtsModel(
model_dir="vits-zh-hf-fanchen-wnj",
model_name="vits-zh-hf-fanchen-wnj.onnx",
lang="zh",
rule_fsts="vits-zh-hf-fanchen-wnj/rule.fst",
),
TtsModel(
model_dir="vits-zh-hf-fanchen-C",
model_name="vits-zh-hf-fanchen-C.onnx",
lang="zh",
rule_fsts="vits-zh-hf-fanchen-C/rule.fst",
),
TtsModel(
model_dir="vits-zh-hf-fanchen-ZhiHuiLaoZhe",
model_name="vits-zh-hf-fanchen-ZhiHuiLaoZhe.onnx",
lang="zh",
rule_fsts="vits-zh-hf-fanchen-ZhiHuiLaoZhe/rule.fst",
),
TtsModel(
model_dir="vits-zh-hf-fanchen-ZhiHuiLaoZhe_new",
model_name="vits-zh-hf-fanchen-ZhiHuiLaoZhe_new.onnx",
lang="zh",
rule_fsts="vits-zh-hf-fanchen-ZhiHuiLaoZhe_new/rule.fst",
),
TtsModel(
model_dir="vits-zh-hf-fanchen-unity",
model_name="vits-zh-hf-fanchen-unity.onnx",
lang="zh",
rule_fsts="vits-zh-hf-fanchen-unity/rule.fst",
),
TtsModel(
model_dir="vits-cantonese-hf-xiaomaiiwn",
model_name="vits-cantonese-hf-xiaomaiiwn.onnx",
lang="cantonese",
lang_iso_639_3="yue",
rule_fsts="vits-cantonese-hf-xiaomaiiwn/rule.fst",
),
# English (US)
TtsModel(model_dir="vits-vctk", model_name="vits-vctk.onnx", lang="en"),
# TtsModel(model_dir="vits-ljs", model_name="vits-ljs.onnx", lang="en"),
Expand Down

0 comments on commit d2cc48d

Please sign in to comment.