正在显示
13 个修改的文件
包含
284 行增加
和
324 行删除
| @@ -50,6 +50,35 @@ jobs: | @@ -50,6 +50,35 @@ jobs: | ||
| 50 | 50 | ||
| 51 | ls -lh ./wheelhouse/*.whl | 51 | ls -lh ./wheelhouse/*.whl |
| 52 | 52 | ||
| 53 | + - name: Publish to huggingface | ||
| 54 | + if: matrix.python-version == 'cp38' | ||
| 55 | + env: | ||
| 56 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} | ||
| 57 | + uses: nick-fields/retry@v2 | ||
| 58 | + with: | ||
| 59 | + max_attempts: 20 | ||
| 60 | + timeout_seconds: 200 | ||
| 61 | + shell: bash | ||
| 62 | + command: | | ||
| 63 | + git config --global user.email "csukuangfj@gmail.com" | ||
| 64 | + git config --global user.name "Fangjun Kuang" | ||
| 65 | + | ||
| 66 | + rm -rf huggingface | ||
| 67 | + export GIT_LFS_SKIP_SMUDGE=1 | ||
| 68 | + | ||
| 69 | + git clone https://huggingface.co/csukuangfj/sherpa-onnx-wheels huggingface | ||
| 70 | + cd huggingface | ||
| 71 | + git fetch | ||
| 72 | + git pull | ||
| 73 | + git merge -m "merge remote" --ff origin main | ||
| 74 | + | ||
| 75 | + cp -v ../wheelhouse/*.whl . | ||
| 76 | + | ||
| 77 | + git status | ||
| 78 | + git add . | ||
| 79 | + git commit -m "add more wheels" | ||
| 80 | + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels main | ||
| 81 | + | ||
| 53 | - uses: actions/upload-artifact@v3 | 82 | - uses: actions/upload-artifact@v3 |
| 54 | with: | 83 | with: |
| 55 | path: ./wheelhouse/*.whl | 84 | path: ./wheelhouse/*.whl |
| @@ -83,6 +83,35 @@ jobs: | @@ -83,6 +83,35 @@ jobs: | ||
| 83 | run: | | 83 | run: | |
| 84 | ls -lh ./wheelhouse/ | 84 | ls -lh ./wheelhouse/ |
| 85 | 85 | ||
| 86 | + - name: Publish to huggingface | ||
| 87 | + if: matrix.python-version == '3.8' | ||
| 88 | + env: | ||
| 89 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} | ||
| 90 | + uses: nick-fields/retry@v2 | ||
| 91 | + with: | ||
| 92 | + max_attempts: 20 | ||
| 93 | + timeout_seconds: 200 | ||
| 94 | + shell: bash | ||
| 95 | + command: | | ||
| 96 | + git config --global user.email "csukuangfj@gmail.com" | ||
| 97 | + git config --global user.name "Fangjun Kuang" | ||
| 98 | + | ||
| 99 | + rm -rf huggingface | ||
| 100 | + export GIT_LFS_SKIP_SMUDGE=1 | ||
| 101 | + | ||
| 102 | + git clone https://huggingface.co/csukuangfj/sherpa-onnx-wheels huggingface | ||
| 103 | + cd huggingface | ||
| 104 | + git fetch | ||
| 105 | + git pull | ||
| 106 | + git merge -m "merge remote" --ff origin main | ||
| 107 | + | ||
| 108 | + cp -v ../wheelhouse/*.whl . | ||
| 109 | + | ||
| 110 | + git status | ||
| 111 | + git add . | ||
| 112 | + git commit -m "add more wheels" | ||
| 113 | + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels main | ||
| 114 | + | ||
| 86 | - name: Upload wheel | 115 | - name: Upload wheel |
| 87 | uses: actions/upload-artifact@v3 | 116 | uses: actions/upload-artifact@v3 |
| 88 | with: | 117 | with: |
| @@ -6,152 +6,15 @@ on: | @@ -6,152 +6,15 @@ on: | ||
| 6 | - '*' | 6 | - '*' |
| 7 | 7 | ||
| 8 | workflow_dispatch: | 8 | workflow_dispatch: |
| 9 | - inputs: | ||
| 10 | - version: | ||
| 11 | - description: "Version information(e.g., v1.5.3) or auto" | ||
| 12 | - required: true | ||
| 13 | - | ||
| 14 | -env: | ||
| 15 | - VERSION: | ||
| 16 | - |- # Enter release tag name or version name in workflow_dispatch. Appropriate version if not specified | ||
| 17 | - ${{ github.event.release.tag_name || github.event.inputs.version }} | ||
| 18 | 9 | ||
| 19 | concurrency: | 10 | concurrency: |
| 20 | group: release-go-${{ github.ref }} | 11 | group: release-go-${{ github.ref }} |
| 21 | cancel-in-progress: true | 12 | cancel-in-progress: true |
| 22 | 13 | ||
| 23 | jobs: | 14 | jobs: |
| 24 | - linux-x86_64_wheel: | ||
| 25 | - if: github.repository_owner == 'k2-fsa' || github.repository_owner == 'csukuangfj' | ||
| 26 | - name: Linux x86_64 | ||
| 27 | - runs-on: ${{ matrix.os }} | ||
| 28 | - strategy: | ||
| 29 | - fail-fast: false | ||
| 30 | - matrix: | ||
| 31 | - os: [ubuntu-latest] | ||
| 32 | - | ||
| 33 | - steps: | ||
| 34 | - - uses: actions/checkout@v4 | ||
| 35 | - | ||
| 36 | - - name: SSH to GitHub | ||
| 37 | - run: | | ||
| 38 | - mkdir -p ~/.ssh/ | ||
| 39 | - cp scripts/go/ssh_config ~/.ssh/config | ||
| 40 | - echo "${{ secrets.MY_GITHUB_SSH_KEY }}" > ~/.ssh/github && chmod 600 ~/.ssh/github | ||
| 41 | - ssh github.com || true | ||
| 42 | - rm ~/.ssh/github | ||
| 43 | - | ||
| 44 | - # see https://cibuildwheel.readthedocs.io/en/stable/changelog/ | ||
| 45 | - # for a list of versions | ||
| 46 | - - name: Build wheels | ||
| 47 | - uses: pypa/cibuildwheel@v2.11.4 | ||
| 48 | - env: | ||
| 49 | - CIBW_BEFORE_BUILD: "pip install -U cmake numpy" | ||
| 50 | - CIBW_BUILD: "cp38-*64" | ||
| 51 | - CIBW_SKIP: "cp27-* cp35-* cp36-* *-win32 pp* *-musllinux* *-manylinux_i686" | ||
| 52 | - CIBW_BUILD_VERBOSITY: 3 | ||
| 53 | - CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH='/project/build/bdist.linux-x86_64/wheel/sherpa_onnx/lib' | ||
| 54 | - | ||
| 55 | - - name: Display wheels | ||
| 56 | - shell: bash | ||
| 57 | - run: | | ||
| 58 | - ls -lh ./wheelhouse/*.whl | ||
| 59 | - unzip -l ./wheelhouse/*.whl | ||
| 60 | - | ||
| 61 | - - uses: actions/upload-artifact@v3 | ||
| 62 | - with: | ||
| 63 | - name: ${{ matrix.os }}-wheels-for-go | ||
| 64 | - path: ./wheelhouse/*.whl | ||
| 65 | - | ||
| 66 | - macOS: | ||
| 67 | - name: macOS ${{ matrix.arch }} | ||
| 68 | - runs-on: ${{ matrix.os }} | ||
| 69 | - strategy: | ||
| 70 | - fail-fast: false | ||
| 71 | - matrix: | ||
| 72 | - os: [macos-latest] | ||
| 73 | - arch: [x86_64, arm64] | ||
| 74 | - | ||
| 75 | - steps: | ||
| 76 | - - uses: actions/checkout@v4 | ||
| 77 | - | ||
| 78 | - - name: ccache | ||
| 79 | - uses: hendrikmuhs/ccache-action@v1.2 | ||
| 80 | - with: | ||
| 81 | - key: ${{ matrix.os }}-${{ matrix.arch }} | ||
| 82 | - | ||
| 83 | - - name: Configure CMake | ||
| 84 | - shell: bash | ||
| 85 | - run: | | ||
| 86 | - export CMAKE_CXX_COMPILER_LAUNCHER=ccache | ||
| 87 | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | ||
| 88 | - cmake --version | ||
| 89 | - | ||
| 90 | - mkdir build | ||
| 91 | - cd build | ||
| 92 | - cmake -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D BUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -DCMAKE_INSTALL_PREFIX=./install .. | ||
| 93 | - | ||
| 94 | - - name: Build sherpa-onnx for macOS ${{ matrix.arch }} | ||
| 95 | - shell: bash | ||
| 96 | - run: | | ||
| 97 | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | ||
| 98 | - | ||
| 99 | - cd build | ||
| 100 | - make -j2 | ||
| 101 | - make install | ||
| 102 | - | ||
| 103 | - ls -lh lib | ||
| 104 | - ls -lh bin | ||
| 105 | - | ||
| 106 | - file install/lib/lib* | ||
| 107 | - | ||
| 108 | - - uses: actions/upload-artifact@v3 | ||
| 109 | - with: | ||
| 110 | - name: ${{ matrix.os }}-for-${{ matrix.arch }} | ||
| 111 | - path: ./build/install/lib/ | ||
| 112 | - | ||
| 113 | - windows: | ||
| 114 | - name: Windows ${{ matrix.arch }} | ||
| 115 | - runs-on: ${{ matrix.os }} | ||
| 116 | - strategy: | ||
| 117 | - fail-fast: false | ||
| 118 | - matrix: | ||
| 119 | - os: [windows-latest] | ||
| 120 | - arch: [x64, Win32] | ||
| 121 | - steps: | ||
| 122 | - - uses: actions/checkout@v4 | ||
| 123 | - with: | ||
| 124 | - fetch-depth: 0 | ||
| 125 | - | ||
| 126 | - - name: Configure CMake | ||
| 127 | - shell: bash | ||
| 128 | - run: | | ||
| 129 | - mkdir build | ||
| 130 | - cd build | ||
| 131 | - cmake -A ${{ matrix.arch }} -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=./install .. | ||
| 132 | - | ||
| 133 | - - name: Build sherpa-onnx for windows | ||
| 134 | - shell: bash | ||
| 135 | - run: | | ||
| 136 | - cd build | ||
| 137 | - cmake --build . --config Release -- -m:2 | ||
| 138 | - cmake --build . --config Release --target install -- -m:2 | ||
| 139 | - | ||
| 140 | - ls -lh install/* | ||
| 141 | - | ||
| 142 | - ls -lh install/lib | ||
| 143 | - ls -lh install/bin | ||
| 144 | - | ||
| 145 | - - name: Upload artifact | ||
| 146 | - uses: actions/upload-artifact@v3 | ||
| 147 | - with: | ||
| 148 | - name: sherpa-onnx-go-windows-${{ matrix.arch }} | ||
| 149 | - path: ./build/install/lib/ | ||
| 150 | - | ||
| 151 | - Release: | ||
| 152 | - name: Release | 15 | + release_go: |
| 16 | + name: Release go | ||
| 153 | runs-on: ubuntu-latest | 17 | runs-on: ubuntu-latest |
| 154 | - needs: [linux-x86_64_wheel, macOS, windows] | ||
| 155 | 18 | ||
| 156 | steps: | 19 | steps: |
| 157 | - uses: actions/checkout@v4 | 20 | - uses: actions/checkout@v4 |
| @@ -163,46 +26,8 @@ jobs: | @@ -163,46 +26,8 @@ jobs: | ||
| 163 | echo "${{ secrets.MY_GITHUB_SSH_KEY }}" > ~/.ssh/github && chmod 600 ~/.ssh/github | 26 | echo "${{ secrets.MY_GITHUB_SSH_KEY }}" > ~/.ssh/github && chmod 600 ~/.ssh/github |
| 164 | ssh github.com || true | 27 | ssh github.com || true |
| 165 | 28 | ||
| 166 | - - name: Retrieve artifact from ubuntu-latest | ||
| 167 | - uses: actions/download-artifact@v2 | ||
| 168 | - with: | ||
| 169 | - name: ubuntu-latest-wheels-for-go | ||
| 170 | - path: ./linux | ||
| 171 | - | ||
| 172 | - - name: Retrieve artifact from macos-latest (x86_64) | ||
| 173 | - uses: actions/download-artifact@v2 | ||
| 174 | - with: | ||
| 175 | - name: macos-latest-for-x86_64 | ||
| 176 | - path: ./macos-x86_64 | ||
| 177 | - | ||
| 178 | - - name: Retrieve artifact from macos-latest (arm64) | ||
| 179 | - uses: actions/download-artifact@v2 | ||
| 180 | - with: | ||
| 181 | - name: macos-latest-for-arm64 | ||
| 182 | - path: ./macos-arm64 | ||
| 183 | - | ||
| 184 | - - name: Retrieve artifact from windows-latest (x64) | ||
| 185 | - uses: actions/download-artifact@v2 | ||
| 186 | - with: | ||
| 187 | - name: sherpa-onnx-go-windows-x64 | ||
| 188 | - path: ./windows-x64 | ||
| 189 | - | ||
| 190 | - - name: Retrieve artifact from windows-latest (Win32) | ||
| 191 | - uses: actions/download-artifact@v2 | ||
| 192 | - with: | ||
| 193 | - name: sherpa-onnx-go-windows-Win32 | ||
| 194 | - path: ./windows-win32 | ||
| 195 | - | ||
| 196 | - - name: Unzip Ubuntu wheels | ||
| 197 | - shell: bash | ||
| 198 | - run: | | ||
| 199 | - cd linux | ||
| 200 | - ls -lh | ||
| 201 | - unzip ./*.whl | ||
| 202 | - tree . | ||
| 203 | - | ||
| 204 | - - name: Release go | ||
| 205 | - # if: env.VERSION != '' | 29 | + - name: Release |
| 206 | shell: bash | 30 | shell: bash |
| 207 | run: | | 31 | run: | |
| 208 | - ./scripts/go/release.sh | 32 | + cd scripts/go |
| 33 | + ./release.sh |
| @@ -95,6 +95,11 @@ jobs: | @@ -95,6 +95,11 @@ jobs: | ||
| 95 | ./run-vits-zh-aishell3.sh | 95 | ./run-vits-zh-aishell3.sh |
| 96 | rm -rf vits-zh-aishell3 | 96 | rm -rf vits-zh-aishell3 |
| 97 | 97 | ||
| 98 | + echo "Test vits-piper-en_US-lessac-medium" | ||
| 99 | + git clone https://huggingface.co/csukuangfj/vits-piper-en_US-lessac-medium | ||
| 100 | + ./run-vits-piper-en_US-lessac-medium.sh | ||
| 101 | + rm -rf vits-piper-en_US-lessac-medium | ||
| 102 | + | ||
| 98 | ls -lh *.wav | 103 | ls -lh *.wav |
| 99 | cp *.wav ../../tts-waves/ | 104 | cp *.wav ../../tts-waves/ |
| 100 | 105 | ||
| @@ -133,6 +138,11 @@ jobs: | @@ -133,6 +138,11 @@ jobs: | ||
| 133 | ./run-vits-zh-aishell3.sh | 138 | ./run-vits-zh-aishell3.sh |
| 134 | rm -rf vits-zh-aishell3 | 139 | rm -rf vits-zh-aishell3 |
| 135 | 140 | ||
| 141 | + echo "Test vits-piper-en_US-lessac-medium" | ||
| 142 | + git clone https://huggingface.co/csukuangfj/vits-piper-en_US-lessac-medium | ||
| 143 | + ./run-vits-piper-en_US-lessac-medium.sh | ||
| 144 | + rm -rf vits-piper-en_US-lessac-medium | ||
| 145 | + | ||
| 136 | ls -lh *.wav | 146 | ls -lh *.wav |
| 137 | cp *.wav ../../tts-waves/ | 147 | cp *.wav ../../tts-waves/ |
| 138 | 148 | ||
| @@ -140,6 +150,7 @@ jobs: | @@ -140,6 +150,7 @@ jobs: | ||
| 140 | if: matrix.os == 'windows-latest' && matrix.arch == 'x86' | 150 | if: matrix.os == 'windows-latest' && matrix.arch == 'x86' |
| 141 | shell: bash | 151 | shell: bash |
| 142 | run: | | 152 | run: | |
| 153 | + mkdir tts-waves | ||
| 143 | cd go-api-examples/non-streaming-tts | 154 | cd go-api-examples/non-streaming-tts |
| 144 | ls -lh | 155 | ls -lh |
| 145 | go mod tidy | 156 | go mod tidy |
| @@ -178,6 +189,11 @@ jobs: | @@ -178,6 +189,11 @@ jobs: | ||
| 178 | ./run-vits-zh-aishell3.sh | 189 | ./run-vits-zh-aishell3.sh |
| 179 | rm -rf vits-zh-aishell3 | 190 | rm -rf vits-zh-aishell3 |
| 180 | 191 | ||
| 192 | + echo "Test vits-piper-en_US-lessac-medium" | ||
| 193 | + git clone https://huggingface.co/csukuangfj/vits-piper-en_US-lessac-medium | ||
| 194 | + ./run-vits-piper-en_US-lessac-medium.sh | ||
| 195 | + rm -rf vits-piper-en_US-lessac-medium | ||
| 196 | + | ||
| 181 | ls -lh *.wav | 197 | ls -lh *.wav |
| 182 | cp *.wav ../../tts-waves/ | 198 | cp *.wav ../../tts-waves/ |
| 183 | 199 |
| @@ -65,6 +65,8 @@ jobs: | @@ -65,6 +65,8 @@ jobs: | ||
| 65 | run: | | 65 | run: | |
| 66 | mkdir tts-waves | 66 | mkdir tts-waves |
| 67 | 67 | ||
| 68 | + cp -v go-api-examples/non-streaming-tts/*.sh scripts/go/_internal/non-streaming-tts/ | ||
| 69 | + | ||
| 68 | cd scripts/go/_internal/non-streaming-tts/ | 70 | cd scripts/go/_internal/non-streaming-tts/ |
| 69 | ls -lh | 71 | ls -lh |
| 70 | go mod tidy | 72 | go mod tidy |
| @@ -89,6 +91,11 @@ jobs: | @@ -89,6 +91,11 @@ jobs: | ||
| 89 | ./run-vits-zh-aishell3.sh | 91 | ./run-vits-zh-aishell3.sh |
| 90 | rm -rf vits-zh-aishell3 | 92 | rm -rf vits-zh-aishell3 |
| 91 | 93 | ||
| 94 | + echo "Test vits-piper-en_US-lessac-medium" | ||
| 95 | + git clone https://huggingface.co/csukuangfj/vits-piper-en_US-lessac-medium | ||
| 96 | + ./run-vits-piper-en_US-lessac-medium.sh | ||
| 97 | + rm -rf vits-piper-en_US-lessac-medium | ||
| 98 | + | ||
| 92 | cp *.wav ../../../../tts-waves/ | 99 | cp *.wav ../../../../tts-waves/ |
| 93 | 100 | ||
| 94 | - uses: actions/upload-artifact@v3 | 101 | - uses: actions/upload-artifact@v3 |
| @@ -99,6 +106,8 @@ jobs: | @@ -99,6 +106,8 @@ jobs: | ||
| 99 | - name: Test non-streaming decoding files (macOS) | 106 | - name: Test non-streaming decoding files (macOS) |
| 100 | shell: bash | 107 | shell: bash |
| 101 | run: | | 108 | run: | |
| 109 | + cp -v go-api-examples/non-streaming-decode-files/*.sh scripts/go/_internal/non-streaming-decode-files/ | ||
| 110 | + | ||
| 102 | cd scripts/go/_internal/non-streaming-decode-files/ | 111 | cd scripts/go/_internal/non-streaming-decode-files/ |
| 103 | ls -lh | 112 | ls -lh |
| 104 | go mod tidy | 113 | go mod tidy |
| @@ -139,6 +148,7 @@ jobs: | @@ -139,6 +148,7 @@ jobs: | ||
| 139 | - name: Test streaming decoding files | 148 | - name: Test streaming decoding files |
| 140 | shell: bash | 149 | shell: bash |
| 141 | run: | | 150 | run: | |
| 151 | + cp -v go-api-examples/streaming-decode-files/*.sh scripts/go/_internal/streaming-decode-files | ||
| 142 | cd scripts/go/_internal/streaming-decode-files | 152 | cd scripts/go/_internal/streaming-decode-files |
| 143 | ls -lh | 153 | ls -lh |
| 144 | go mod tidy | 154 | go mod tidy |
| @@ -13,4 +13,4 @@ Cflags: -I"${includedir}" | @@ -13,4 +13,4 @@ Cflags: -I"${includedir}" | ||
| 13 | # Note: -lcargs is required only for the following file | 13 | # Note: -lcargs is required only for the following file |
| 14 | # https://github.com/k2-fsa/sherpa-onnx/blob/master/c-api-examples/decode-file-c-api.c | 14 | # https://github.com/k2-fsa/sherpa-onnx/blob/master/c-api-examples/decode-file-c-api.c |
| 15 | # We add it here so that users don't need to specify -lcargs when compiling decode-file-c-api.c | 15 | # We add it here so that users don't need to specify -lcargs when compiling decode-file-c-api.c |
| 16 | -Libs: -L"${libdir}" -lsherpa-onnx-c-api -lsherpa-onnx-core -lonnxruntime -lkaldi-decoder-core -lsherpa-onnx-kaldifst-core -lsherpa-onnx-fst -lkaldi-native-fbank-core -lpiper_phonemize -lespeak-ng -lucd -lcargs -Wl,-rpath,${libdir} @SHERPA_ONNX_PKG_CONFIG_EXTRA_LIBS@ | 16 | +Libs: -L"${libdir}" -lsherpa-onnx-c-api -lsherpa-onnx-core -lkaldi-decoder-core -lsherpa-onnx-kaldifst-core -lsherpa-onnx-fst -lkaldi-native-fbank-core -lpiper_phonemize -lespeak-ng -lucd -lcargs -lonnxruntime -Wl,-rpath,${libdir} @SHERPA_ONNX_PKG_CONFIG_EXTRA_LIBS@ |
| @@ -16,6 +16,7 @@ func main() { | @@ -16,6 +16,7 @@ func main() { | ||
| 16 | flag.StringVar(&config.Model.Vits.Model, "vits-model", "", "Path to the vits ONNX model") | 16 | flag.StringVar(&config.Model.Vits.Model, "vits-model", "", "Path to the vits ONNX model") |
| 17 | flag.StringVar(&config.Model.Vits.Lexicon, "vits-lexicon", "", "Path to lexicon.txt") | 17 | flag.StringVar(&config.Model.Vits.Lexicon, "vits-lexicon", "", "Path to lexicon.txt") |
| 18 | flag.StringVar(&config.Model.Vits.Tokens, "vits-tokens", "", "Path to tokens.txt") | 18 | flag.StringVar(&config.Model.Vits.Tokens, "vits-tokens", "", "Path to tokens.txt") |
| 19 | + flag.StringVar(&config.Model.Vits.DataDir, "vits-data-dir", "", "Path to espeak-ng-data") | ||
| 19 | 20 | ||
| 20 | flag.Float32Var(&config.Model.Vits.NoiseScale, "vits-noise-scale", 0.667, "noise_scale for VITS") | 21 | flag.Float32Var(&config.Model.Vits.NoiseScale, "vits-noise-scale", 0.667, "noise_scale for VITS") |
| 21 | flag.Float32Var(&config.Model.Vits.NoiseScaleW, "vits-noise-scale-w", 0.8, "noise_scale_w for VITS") | 22 | flag.Float32Var(&config.Model.Vits.NoiseScaleW, "vits-noise-scale-w", 0.8, "noise_scale_w for VITS") |
| @@ -24,6 +25,8 @@ func main() { | @@ -24,6 +25,8 @@ func main() { | ||
| 24 | flag.IntVar(&config.Model.NumThreads, "num-threads", 1, "Number of threads for computing") | 25 | flag.IntVar(&config.Model.NumThreads, "num-threads", 1, "Number of threads for computing") |
| 25 | flag.IntVar(&config.Model.Debug, "debug", 0, "Whether to show debug message") | 26 | flag.IntVar(&config.Model.Debug, "debug", 0, "Whether to show debug message") |
| 26 | flag.StringVar(&config.Model.Provider, "provider", "cpu", "Provider to use") | 27 | flag.StringVar(&config.Model.Provider, "provider", "cpu", "Provider to use") |
| 28 | + flag.StringVar(&config.RuleFsts, "tts-rule-fsts", "", "Path to rule.fst") | ||
| 29 | + flag.IntVar(&config.MaxNumSentences, "tts-max-num-sentences", 1, "Batch size") | ||
| 27 | 30 | ||
| 28 | flag.IntVar(&sid, "sid", 0, "Speaker ID. Used only for multi-speaker models") | 31 | flag.IntVar(&sid, "sid", 0, "Speaker ID. Used only for multi-speaker models") |
| 29 | flag.StringVar(&filename, "output-filename", "./generated.wav", "Filename to save the generated audio") | 32 | flag.StringVar(&filename, "output-filename", "./generated.wav", "Filename to save the generated audio") |
| 1 | +#!/usr/bin/env bash | ||
| 2 | + | ||
| 3 | +# please refer to | ||
| 4 | +# https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/vits.html#en-us-lessac-medium-english-single-speaker | ||
| 5 | +# to download the model before you run this script | ||
| 6 | + | ||
| 7 | +./non-streaming-tts \ | ||
| 8 | + --vits-model=./vits-piper-en_US-lessac-medium/en_US-lessac-medium.onnx \ | ||
| 9 | + --vits-data-dir=./vits-piper-en_US-lessac-medium/espeak-ng-data \ | ||
| 10 | + --vits-tokens=./vits-piper-en_US-lessac-medium/tokens.txt \ | ||
| 11 | + --output-filename=./liliana-piper-en_US-lessac-medium.wav \ | ||
| 12 | + 'liliana, the most beautiful and lovely assistant of our team!' |
| @@ -9,8 +9,18 @@ for sid in 10 33 99; do | @@ -9,8 +9,18 @@ for sid in 10 33 99; do | ||
| 9 | --vits-model=./vits-zh-aishell3/vits-aishell3.onnx \ | 9 | --vits-model=./vits-zh-aishell3/vits-aishell3.onnx \ |
| 10 | --vits-lexicon=./vits-zh-aishell3/lexicon.txt \ | 10 | --vits-lexicon=./vits-zh-aishell3/lexicon.txt \ |
| 11 | --vits-tokens=./vits-zh-aishell3/tokens.txt \ | 11 | --vits-tokens=./vits-zh-aishell3/tokens.txt \ |
| 12 | - --sid=10 \ | 12 | + --sid=$sid \ |
| 13 | --debug=1 \ | 13 | --debug=1 \ |
| 14 | --output-filename=./liliana-$sid.wav \ | 14 | --output-filename=./liliana-$sid.wav \ |
| 15 | "林美丽最美丽、最漂亮、最可爱!" | 15 | "林美丽最美丽、最漂亮、最可爱!" |
| 16 | + | ||
| 17 | +./non-streaming-tts \ | ||
| 18 | + --vits-model=./vits-zh-aishell3/vits-aishell3.onnx \ | ||
| 19 | + --vits-lexicon=./vits-zh-aishell3/lexicon.txt \ | ||
| 20 | + --vits-tokens=./vits-zh-aishell3/tokens.txt \ | ||
| 21 | + --tts-rule-fsts=./vits-zh-aishell3/rule.fst \ | ||
| 22 | + --sid=$sid \ | ||
| 23 | + --debug=1 \ | ||
| 24 | + --output-filename=./numbers-$sid.wav \ | ||
| 25 | + "数字12345.6789怎么念" | ||
| 16 | done | 26 | done |
| @@ -2,5 +2,5 @@ | @@ -2,5 +2,5 @@ | ||
| 2 | 2 | ||
| 3 | package sherpa_onnx | 3 | package sherpa_onnx |
| 4 | 4 | ||
| 5 | -// #cgo LDFLAGS: -L ${SRCDIR}/lib/x86_64-apple-darwin -lsherpa-onnx-c-api -lsherpa-onnx-core -lkaldi-native-fbank-core -lonnxruntime -Wl,-rpath,${SRCDIR}/lib/x86_64-apple-darwin | 5 | +// #cgo LDFLAGS: -L ${SRCDIR}/lib/x86_64-apple-darwin -lsherpa-onnx-c-api -lsherpa-onnx-core -lkaldi-native-fbank-core -lkaldi-decoder-core -lsherpa-onnx-kaldifst-core -lsherpa-onnx-fst -lpiper_phonemize -lespeak-ng -lucd -lonnxruntime -Wl,-rpath,${SRCDIR}/lib/x86_64-apple-darwin |
| 6 | import "C" | 6 | import "C" |
| @@ -5,145 +5,159 @@ set -ex | @@ -5,145 +5,159 @@ set -ex | ||
| 5 | git config --global user.email "csukuangfj@gmail.com" | 5 | git config --global user.email "csukuangfj@gmail.com" |
| 6 | git config --global user.name "Fangjun Kuang" | 6 | git config --global user.name "Fangjun Kuang" |
| 7 | 7 | ||
| 8 | -SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 9 | - | ||
| 10 | -echo "=========================================================================" | ||
| 11 | - | ||
| 12 | -git clone git@github.com:k2-fsa/sherpa-onnx-go-linux.git | ||
| 13 | - | ||
| 14 | -echo "Copy libs for Linux x86_64" | ||
| 15 | - | ||
| 16 | -rm -rf sherpa-onnx-go-linux/lib/x86_64-unknown-linux-gnu/lib* | ||
| 17 | - | ||
| 18 | -cp -v ./linux/sherpa_onnx/lib/libkaldi-native-fbank-core.so sherpa-onnx-go-linux/lib/x86_64-unknown-linux-gnu/ | ||
| 19 | -cp -v ./linux/sherpa_onnx/lib/libonnxruntime* sherpa-onnx-go-linux/lib/x86_64-unknown-linux-gnu/ | ||
| 20 | -cp -v ./linux/sherpa_onnx/lib/libsherpa-onnx-c-api.so sherpa-onnx-go-linux/lib/x86_64-unknown-linux-gnu/ | ||
| 21 | -cp -v ./linux/sherpa_onnx/lib/libsherpa-onnx-core.so sherpa-onnx-go-linux/lib/x86_64-unknown-linux-gnu/ | ||
| 22 | - | ||
| 23 | -echo "Copy sources for Linux x86_64" | ||
| 24 | -cp sherpa-onnx/c-api/c-api.h sherpa-onnx-go-linux/ | ||
| 25 | -cp scripts/go/sherpa_onnx.go sherpa-onnx-go-linux/ | ||
| 26 | - | ||
| 27 | -pushd sherpa-onnx-go-linux | ||
| 28 | -tag=$(git describe --abbrev=0 --tags) | ||
| 29 | -if [[ x"$VERSION" == x"auto" ]]; then | ||
| 30 | - # this is a pre-release | ||
| 31 | - if [[ $tag == ${SHERPA_ONNX_VERSION}* ]]; then | ||
| 32 | - # echo we have already release pre-release before, so just increment it | ||
| 33 | - last=$(echo $tag | rev | cut -d'.' -f 1 | rev) | ||
| 34 | - new_last=$((last+1)) | ||
| 35 | - new_tag=${SHERPA_ONNX_VERSION}-alpha.${new_last} | ||
| 36 | - else | ||
| 37 | - new_tag=${SHERPA_ONNX_VERSION}-alpha.1 | ||
| 38 | - fi | ||
| 39 | -else | ||
| 40 | - new_tag=$VERSION | ||
| 41 | -fi | ||
| 42 | - | ||
| 43 | -echo "new_tag: $new_tag" | ||
| 44 | -git add . | ||
| 45 | -git status | ||
| 46 | -git commit -m "Release $new_tag" && \ | ||
| 47 | -git push && \ | ||
| 48 | -git tag $new_tag && \ | ||
| 49 | -git push origin $new_tag || true | ||
| 50 | - | ||
| 51 | -popd | ||
| 52 | -echo "=========================================================================" | ||
| 53 | - | ||
| 54 | -git clone git@github.com:k2-fsa/sherpa-onnx-go-macos.git | ||
| 55 | - | ||
| 56 | -echo "Copy libs for macOS x86_64" | ||
| 57 | -rm -rf sherpa-onnx-go-macos/lib/x86_64-apple-darwin/lib* | ||
| 58 | -cp -v ./macos-x86_64/libkaldi-native-fbank-core.dylib sherpa-onnx-go-macos/lib/x86_64-apple-darwin | ||
| 59 | -cp -v ./macos-x86_64/libonnxruntime* sherpa-onnx-go-macos/lib/x86_64-apple-darwin | ||
| 60 | -cp -v ./macos-x86_64/libsherpa-onnx-c-api.dylib sherpa-onnx-go-macos/lib/x86_64-apple-darwin | ||
| 61 | -cp -v ./macos-x86_64/libsherpa-onnx-core.dylib sherpa-onnx-go-macos/lib/x86_64-apple-darwin | ||
| 62 | - | ||
| 63 | -echo "Copy libs for macOS arm64" | ||
| 64 | -rm -rf sherpa-onnx-go-macos/lib/aarch64-apple-darwin/lib* | ||
| 65 | -cp -v ./macos-arm64/libkaldi-native-fbank-core.dylib sherpa-onnx-go-macos/lib/aarch64-apple-darwin | ||
| 66 | -cp -v ./macos-arm64/libonnxruntime* sherpa-onnx-go-macos/lib/aarch64-apple-darwin | ||
| 67 | -cp -v ./macos-arm64/libsherpa-onnx-c-api.dylib sherpa-onnx-go-macos/lib/aarch64-apple-darwin | ||
| 68 | -cp -v ./macos-arm64/libsherpa-onnx-core.dylib sherpa-onnx-go-macos/lib/aarch64-apple-darwin | ||
| 69 | - | ||
| 70 | -echo "Copy sources for macOS" | ||
| 71 | -cp sherpa-onnx/c-api/c-api.h sherpa-onnx-go-macos/ | ||
| 72 | -cp scripts/go/sherpa_onnx.go sherpa-onnx-go-macos/ | ||
| 73 | - | ||
| 74 | -pushd sherpa-onnx-go-macos | ||
| 75 | -tag=$(git describe --abbrev=0 --tags) | ||
| 76 | -if [[ x"$VERSION" == x"auto" ]]; then | ||
| 77 | - # this is a pre-release | ||
| 78 | - if [[ $tag == ${SHERPA_ONNX_VERSION}* ]]; then | ||
| 79 | - # echo we have already release pre-release before, so just increment it | ||
| 80 | - last=$(echo $tag | rev | cut -d'.' -f 1 | rev) | ||
| 81 | - new_last=$((last+1)) | ||
| 82 | - new_tag=${SHERPA_ONNX_VERSION}-alpha.${new_last} | ||
| 83 | - else | ||
| 84 | - new_tag=${SHERPA_ONNX_VERSION}-alpha.1 | ||
| 85 | - fi | ||
| 86 | -else | ||
| 87 | - new_tag=$VERSION | ||
| 88 | -fi | ||
| 89 | - | ||
| 90 | -echo "new_tag: $new_tag" | ||
| 91 | -git add . | ||
| 92 | -git status | ||
| 93 | -git commit -m "Release $new_tag" && \ | ||
| 94 | -git push && \ | ||
| 95 | -git tag $new_tag && \ | ||
| 96 | -git push origin $new_tag || true | ||
| 97 | - | ||
| 98 | -popd | ||
| 99 | -echo "=========================================================================" | ||
| 100 | - | ||
| 101 | -git clone git@github.com:k2-fsa/sherpa-onnx-go-windows.git | ||
| 102 | -echo "Copy libs for Windows x86_64" | ||
| 103 | -rm -fv sherpa-onnx-go-windows/lib/x86_64-pc-windows-gnu/* | ||
| 104 | -cp -v ./windows-x64/kaldi-native-fbank-core.dll sherpa-onnx-go-windows/lib/x86_64-pc-windows-gnu | ||
| 105 | -cp -v ./windows-x64/onnxruntime.dll sherpa-onnx-go-windows/lib/x86_64-pc-windows-gnu | ||
| 106 | -cp -v ./windows-x64/sherpa-onnx-c-api.dll sherpa-onnx-go-windows/lib/x86_64-pc-windows-gnu | ||
| 107 | -cp -v ./windows-x64/sherpa-onnx-core.dll sherpa-onnx-go-windows/lib/x86_64-pc-windows-gnu | ||
| 108 | - | ||
| 109 | -echo "Copy libs for Windows x86" | ||
| 110 | -rm -fv sherpa-onnx-go-windows/lib/i686-pc-windows-gnu/* | ||
| 111 | -cp -v ./windows-win32/kaldi-native-fbank-core.dll sherpa-onnx-go-windows/lib/i686-pc-windows-gnu | ||
| 112 | -cp -v ./windows-win32/onnxruntime.dll sherpa-onnx-go-windows/lib/i686-pc-windows-gnu | ||
| 113 | -cp -v ./windows-win32/sherpa-onnx-c-api.dll sherpa-onnx-go-windows/lib/i686-pc-windows-gnu | ||
| 114 | -cp -v ./windows-win32/sherpa-onnx-core.dll sherpa-onnx-go-windows/lib/i686-pc-windows-gnu | ||
| 115 | - | ||
| 116 | -echo "Copy sources for Windows" | ||
| 117 | -cp sherpa-onnx/c-api/c-api.h sherpa-onnx-go-windows/ | ||
| 118 | -cp scripts/go/sherpa_onnx.go sherpa-onnx-go-windows/ | ||
| 119 | - | ||
| 120 | -pushd sherpa-onnx-go-windows | ||
| 121 | -tag=$(git describe --abbrev=0 --tags) | ||
| 122 | -if [[ x"$VERSION" == x"auto" ]]; then | ||
| 123 | - # this is a pre-release | ||
| 124 | - if [[ $tag == ${SHERPA_ONNX_VERSION}* ]]; then | ||
| 125 | - # echo we have already release pre-release before, so just increment it | ||
| 126 | - last=$(echo $tag | rev | cut -d'.' -f 1 | rev) | ||
| 127 | - new_last=$((last+1)) | ||
| 128 | - new_tag=${SHERPA_ONNX_VERSION}-alpha.${new_last} | ||
| 129 | - else | ||
| 130 | - new_tag=${SHERPA_ONNX_VERSION}-alpha.1 | ||
| 131 | - fi | ||
| 132 | -else | ||
| 133 | - new_tag=$VERSION | ||
| 134 | -fi | ||
| 135 | - | ||
| 136 | -echo "new_tag: $new_tag" | ||
| 137 | -git add . | ||
| 138 | -git status | ||
| 139 | -git commit -m "Release $new_tag" && \ | ||
| 140 | -git push && \ | ||
| 141 | -git tag $new_tag && \ | ||
| 142 | -git push origin $new_tag || true | ||
| 143 | - | ||
| 144 | -popd | ||
| 145 | - | ||
| 146 | -echo "=========================================================================" | ||
| 147 | - | 8 | +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) |
| 9 | +SHERPA_ONNX_DIR=$(realpath $SCRIPT_DIR/../..) | ||
| 10 | +echo "SCRIPT_DIR: $SCRIPT_DIR" | ||
| 11 | +echo "SHERPA_ONNX_DIR: $SHERPA_ONNX_DIR" | ||
| 12 | + | ||
| 13 | + | ||
| 14 | +SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" $SHERPA_ONNX_DIR/CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 15 | +echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" | ||
| 16 | + | ||
| 17 | +function linux() { | ||
| 18 | + echo "Process linux" | ||
| 19 | + git clone git@github.com:k2-fsa/sherpa-onnx-go-linux.git | ||
| 20 | + cp -v ./sherpa_onnx.go ./sherpa-onnx-go-linux/ | ||
| 21 | + cp -v ./_internal/c-api.h ./sherpa-onnx-go-linux/ | ||
| 22 | + | ||
| 23 | + rm -rf sherpa-onnx-go-linux/lib/x86_64-unknown-linux-gnu/lib* | ||
| 24 | + dst=$(realpath sherpa-onnx-go-linux/lib/x86_64-unknown-linux-gnu) | ||
| 25 | + mkdir t | ||
| 26 | + cd t | ||
| 27 | + wget -q https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | ||
| 28 | + unzip ./sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | ||
| 29 | + | ||
| 30 | + cp -v sherpa_onnx/lib/*.so* $dst | ||
| 31 | + | ||
| 32 | + cd .. | ||
| 33 | + rm -rf t | ||
| 34 | + | ||
| 35 | + rm -rf sherpa-onnx-go-linux/lib/aarch64-unknown-linux-gnu/lib* | ||
| 36 | + dst=$(realpath sherpa-onnx-go-linux/lib/aarch64-unknown-linux-gnu) | ||
| 37 | + mkdir t | ||
| 38 | + cd t | ||
| 39 | + wget -q https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | ||
| 40 | + unzip ./sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | ||
| 41 | + | ||
| 42 | + cp -v sherpa_onnx/lib/*.so* $dst | ||
| 43 | + | ||
| 44 | + cd .. | ||
| 45 | + rm -rf t | ||
| 46 | + | ||
| 47 | + rm -rf sherpa-onnx-go-linux/lib/arm-unknown-linux-gnueabihf/lib* | ||
| 48 | + dst=$(realpath sherpa-onnx-go-linux/lib/arm-unknown-linux-gnueabihf) | ||
| 49 | + mkdir t | ||
| 50 | + cd t | ||
| 51 | + wget -q https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-linux_armv7l.whl | ||
| 52 | + unzip ./sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-linux_armv7l.whl | ||
| 53 | + | ||
| 54 | + cp -v sherpa_onnx/lib/*.so* $dst | ||
| 55 | + | ||
| 56 | + cd .. | ||
| 57 | + rm -rf t | ||
| 58 | + | ||
| 59 | + echo "------------------------------" | ||
| 60 | + cd sherpa-onnx-go-linux | ||
| 61 | + git status | ||
| 62 | + git add . | ||
| 63 | + git commit -m "Release v$SHERPA_ONNX_VERSION" && \ | ||
| 64 | + git push && \ | ||
| 65 | + git tag v$SHERPA_ONNX_VERSION && \ | ||
| 66 | + git push origin v$SHERPA_ONNX_VERSION || true | ||
| 67 | + cd .. | ||
| 68 | + rm -rf sherpa-onnx-go-linux | ||
| 69 | +} | ||
| 70 | + | ||
| 71 | +function osx() { | ||
| 72 | + echo "Process osx-x64" | ||
| 73 | + git clone git@github.com:k2-fsa/sherpa-onnx-go-macos.git | ||
| 74 | + cp -v ./sherpa_onnx.go ./sherpa-onnx-go-macos/ | ||
| 75 | + cp -v ./_internal/c-api.h ./sherpa-onnx-go-macos/ | ||
| 76 | + | ||
| 77 | + rm -rf sherpa-onnx-go-macos/lib/x86_64-apple-darwin/lib* | ||
| 78 | + dst=$(realpath sherpa-onnx-go-macos/lib/x86_64-apple-darwin/) | ||
| 79 | + | ||
| 80 | + mkdir t | ||
| 81 | + cd t | ||
| 82 | + wget -q https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-macosx_10_14_x86_64.whl | ||
| 83 | + unzip ./sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-macosx_10_14_x86_64.whl | ||
| 84 | + | ||
| 85 | + cp -v sherpa_onnx/lib/*.dylib $dst/ | ||
| 86 | + | ||
| 87 | + cd .. | ||
| 88 | + rm -rf t | ||
| 89 | + | ||
| 90 | + echo "process macos arm64" | ||
| 91 | + rm -rf sherpa-onnx-go-macos/lib/aarch64-apple-darwin/lib* | ||
| 92 | + dst=$(realpath sherpa-onnx-go-macos/lib/aarch64-apple-darwin) | ||
| 93 | + | ||
| 94 | + mkdir t | ||
| 95 | + cd t | ||
| 96 | + wget -q https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-macosx_11_0_arm64.whl | ||
| 97 | + unzip ./sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-macosx_11_0_arm64.whl | ||
| 98 | + | ||
| 99 | + cp -v sherpa_onnx/lib/*.dylib $dst/ | ||
| 100 | + | ||
| 101 | + cd .. | ||
| 102 | + rm -rf t | ||
| 103 | + echo "------------------------------" | ||
| 104 | + cd sherpa-onnx-go-macos | ||
| 105 | + git status | ||
| 106 | + git add . | ||
| 107 | + git commit -m "Release v$SHERPA_ONNX_VERSION" && \ | ||
| 108 | + git push && \ | ||
| 109 | + git tag v$SHERPA_ONNX_VERSION && \ | ||
| 110 | + git push origin v$SHERPA_ONNX_VERSION || true | ||
| 111 | + cd .. | ||
| 112 | + rm -rf sherpa-onnx-go-macos | ||
| 113 | +} | ||
| 114 | + | ||
| 115 | +function windows() { | ||
| 116 | + echo "Process windows" | ||
| 117 | + git clone git@github.com:k2-fsa/sherpa-onnx-go-windows.git | ||
| 118 | + cp -v ./sherpa_onnx.go ./sherpa-onnx-go-windows/ | ||
| 119 | + cp -v ./_internal/c-api.h ./sherpa-onnx-go-windows/ | ||
| 120 | + | ||
| 121 | + rm -fv sherpa-onnx-go-windows/lib/x86_64-pc-windows-gnu/* | ||
| 122 | + dst=$(realpath sherpa-onnx-go-windows/lib/x86_64-pc-windows-gnu) | ||
| 123 | + mkdir t | ||
| 124 | + cd t | ||
| 125 | + wget -q https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-win_amd64.whl | ||
| 126 | + unzip ./sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-win_amd64.whl | ||
| 127 | + | ||
| 128 | + cp -v sherpa_onnx-${SHERPA_ONNX_VERSION}.data/data/bin/*.dll $dst | ||
| 129 | + cp -v sherpa_onnx-${SHERPA_ONNX_VERSION}.data/data/bin/*.lib $dst | ||
| 130 | + | ||
| 131 | + cd .. | ||
| 132 | + rm -rf t | ||
| 133 | + | ||
| 134 | + rm -fv sherpa-onnx-go-windows/lib/i686-pc-windows-gnu/* | ||
| 135 | + dst=$(realpath sherpa-onnx-go-windows/lib/i686-pc-windows-gnu) | ||
| 136 | + mkdir t | ||
| 137 | + cd t | ||
| 138 | + wget -q https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-win32.whl | ||
| 139 | + unzip ./sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-win32.whl | ||
| 140 | + | ||
| 141 | + cp -v sherpa_onnx-${SHERPA_ONNX_VERSION}.data/data/bin/*.dll $dst | ||
| 142 | + cp -v sherpa_onnx-${SHERPA_ONNX_VERSION}.data/data/bin/*.lib $dst | ||
| 143 | + | ||
| 144 | + cd .. | ||
| 145 | + rm -rf t | ||
| 146 | + echo "------------------------------" | ||
| 147 | + cd sherpa-onnx-go-windows | ||
| 148 | + git status | ||
| 149 | + git add . | ||
| 150 | + git commit -m "Release v$SHERPA_ONNX_VERSION" && \ | ||
| 151 | + git push && \ | ||
| 152 | + git tag v$SHERPA_ONNX_VERSION && \ | ||
| 153 | + git push origin v$SHERPA_ONNX_VERSION || true | ||
| 154 | + cd .. | ||
| 155 | + rm -rf sherpa-onnx-go-windows | ||
| 156 | +} | ||
| 157 | + | ||
| 158 | + | ||
| 159 | +windows | ||
| 160 | +linux | ||
| 161 | +osx | ||
| 148 | 162 | ||
| 149 | rm -fv ~/.ssh/github | 163 | rm -fv ~/.ssh/github |
| @@ -503,6 +503,7 @@ type OfflineTtsVitsModelConfig struct { | @@ -503,6 +503,7 @@ type OfflineTtsVitsModelConfig struct { | ||
| 503 | Model string // Path to the VITS onnx model | 503 | Model string // Path to the VITS onnx model |
| 504 | Lexicon string // Path to lexicon.txt | 504 | Lexicon string // Path to lexicon.txt |
| 505 | Tokens string // Path to tokens.txt | 505 | Tokens string // Path to tokens.txt |
| 506 | + DataDir string // Path to tokens.txt | ||
| 506 | NoiseScale float32 // noise scale for vits models. Please use 0.667 in general | 507 | NoiseScale float32 // noise scale for vits models. Please use 0.667 in general |
| 507 | NoiseScaleW float32 // noise scale for vits models. Please use 0.8 in general | 508 | NoiseScaleW float32 // noise scale for vits models. Please use 0.8 in general |
| 508 | LengthScale float32 // Please use 1.0 in general. Smaller -> Faster speech speed. Larger -> Slower speech speed | 509 | LengthScale float32 // Please use 1.0 in general. Smaller -> Faster speech speed. Larger -> Slower speech speed |
| @@ -523,6 +524,8 @@ type OfflineTtsModelConfig struct { | @@ -523,6 +524,8 @@ type OfflineTtsModelConfig struct { | ||
| 523 | 524 | ||
| 524 | type OfflineTtsConfig struct { | 525 | type OfflineTtsConfig struct { |
| 525 | Model OfflineTtsModelConfig | 526 | Model OfflineTtsModelConfig |
| 527 | + RuleFsts string | ||
| 528 | + MaxNumSentences int | ||
| 526 | } | 529 | } |
| 527 | 530 | ||
| 528 | type GeneratedAudio struct { | 531 | type GeneratedAudio struct { |
| @@ -547,6 +550,12 @@ func DeleteOfflineTts(tts *OfflineTts) { | @@ -547,6 +550,12 @@ func DeleteOfflineTts(tts *OfflineTts) { | ||
| 547 | // the returned tts to avoid memory leak | 550 | // the returned tts to avoid memory leak |
| 548 | func NewOfflineTts(config *OfflineTtsConfig) *OfflineTts { | 551 | func NewOfflineTts(config *OfflineTtsConfig) *OfflineTts { |
| 549 | c := C.struct_SherpaOnnxOfflineTtsConfig{} | 552 | c := C.struct_SherpaOnnxOfflineTtsConfig{} |
| 553 | + | ||
| 554 | + c.rule_fsts = C.CString(config.RuleFsts) | ||
| 555 | + defer C.free(unsafe.Pointer(c.rule_fsts)) | ||
| 556 | + | ||
| 557 | + c.max_num_sentences = C.int(config.MaxNumSentences) | ||
| 558 | + | ||
| 550 | c.model.vits.model = C.CString(config.Model.Vits.Model) | 559 | c.model.vits.model = C.CString(config.Model.Vits.Model) |
| 551 | defer C.free(unsafe.Pointer(c.model.vits.model)) | 560 | defer C.free(unsafe.Pointer(c.model.vits.model)) |
| 552 | 561 | ||
| @@ -556,6 +565,9 @@ func NewOfflineTts(config *OfflineTtsConfig) *OfflineTts { | @@ -556,6 +565,9 @@ func NewOfflineTts(config *OfflineTtsConfig) *OfflineTts { | ||
| 556 | c.model.vits.tokens = C.CString(config.Model.Vits.Tokens) | 565 | c.model.vits.tokens = C.CString(config.Model.Vits.Tokens) |
| 557 | defer C.free(unsafe.Pointer(c.model.vits.tokens)) | 566 | defer C.free(unsafe.Pointer(c.model.vits.tokens)) |
| 558 | 567 | ||
| 568 | + c.model.vits.data_dir = C.CString(config.Model.Vits.DataDir) | ||
| 569 | + defer C.free(unsafe.Pointer(c.model.vits.data_dir)) | ||
| 570 | + | ||
| 559 | c.model.vits.noise_scale = C.float(config.Model.Vits.NoiseScale) | 571 | c.model.vits.noise_scale = C.float(config.Model.Vits.NoiseScale) |
| 560 | c.model.vits.noise_scale_w = C.float(config.Model.Vits.NoiseScaleW) | 572 | c.model.vits.noise_scale_w = C.float(config.Model.Vits.NoiseScaleW) |
| 561 | c.model.vits.length_scale = C.float(config.Model.Vits.LengthScale) | 573 | c.model.vits.length_scale = C.float(config.Model.Vits.LengthScale) |
-
请 注册 或 登录 后发表评论