正在显示
55 个修改的文件
包含
155 行增加
和
117 行删除
| @@ -2,7 +2,7 @@ function(download_asio) | @@ -2,7 +2,7 @@ function(download_asio) | ||
| 2 | include(FetchContent) | 2 | include(FetchContent) |
| 3 | 3 | ||
| 4 | set(asio_URL "https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-24-0.tar.gz") | 4 | set(asio_URL "https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-24-0.tar.gz") |
| 5 | - set(asio_URL2 "https://hub.nuaa.cf/chriskohlhoff/asio/archive/refs/tags/asio-1-24-0.tar.gz") | 5 | + set(asio_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/asio-asio-1-24-0.tar.gz") |
| 6 | set(asio_HASH "SHA256=cbcaaba0f66722787b1a7c33afe1befb3a012b5af3ad7da7ff0f6b8c9b7a8a5b") | 6 | set(asio_HASH "SHA256=cbcaaba0f66722787b1a7c33afe1befb3a012b5af3ad7da7ff0f6b8c9b7a8a5b") |
| 7 | 7 | ||
| 8 | # If you don't have access to the Internet, | 8 | # If you don't have access to the Internet, |
| @@ -2,7 +2,7 @@ function(download_cargs) | @@ -2,7 +2,7 @@ function(download_cargs) | ||
| 2 | include(FetchContent) | 2 | include(FetchContent) |
| 3 | 3 | ||
| 4 | set(cargs_URL "https://github.com/likle/cargs/archive/refs/tags/v1.0.3.tar.gz") | 4 | set(cargs_URL "https://github.com/likle/cargs/archive/refs/tags/v1.0.3.tar.gz") |
| 5 | - set(cargs_URL2 "https://hub.nuaa.cf/likle/cargs/archive/refs/tags/v1.0.3.tar.gz") | 5 | + set(cargs_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/cargs-1.0.3.tar.gz") |
| 6 | set(cargs_HASH "SHA256=ddba25bd35e9c6c75bc706c126001b8ce8e084d40ef37050e6aa6963e836eb8b") | 6 | set(cargs_HASH "SHA256=ddba25bd35e9c6c75bc706c126001b8ce8e084d40ef37050e6aa6963e836eb8b") |
| 7 | 7 | ||
| 8 | # If you don't have access to the Internet, | 8 | # If you don't have access to the Internet, |
| @@ -2,7 +2,7 @@ function(download_cppjieba) | @@ -2,7 +2,7 @@ function(download_cppjieba) | ||
| 2 | include(FetchContent) | 2 | include(FetchContent) |
| 3 | 3 | ||
| 4 | set(cppjieba_URL "https://github.com/csukuangfj/cppjieba/archive/refs/tags/sherpa-onnx-2024-04-19.tar.gz") | 4 | set(cppjieba_URL "https://github.com/csukuangfj/cppjieba/archive/refs/tags/sherpa-onnx-2024-04-19.tar.gz") |
| 5 | - set(cppjieba_URL2 "https://hub.nuaa.cf/csukuangfj/cppjieba/archive/refs/tags/sherpa-onnx-2024-04-19.tar.gz") | 5 | + set(cppjieba_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/cppjieba-sherpa-onnx-2024-04-19.tar.gz") |
| 6 | set(cppjieba_HASH "SHA256=03e5264687f0efaef05487a07d49c3f4c0f743347bfbf825df4b30cc75ac5288") | 6 | set(cppjieba_HASH "SHA256=03e5264687f0efaef05487a07d49c3f4c0f743347bfbf825df4b30cc75ac5288") |
| 7 | 7 | ||
| 8 | # If you don't have access to the Internet, | 8 | # If you don't have access to the Internet, |
| @@ -2,7 +2,7 @@ function(download_eigen) | @@ -2,7 +2,7 @@ function(download_eigen) | ||
| 2 | include(FetchContent) | 2 | include(FetchContent) |
| 3 | 3 | ||
| 4 | set(eigen_URL "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz") | 4 | set(eigen_URL "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz") |
| 5 | - set(eigen_URL2 "https://huggingface.co/csukuangfj/kaldi-hmm-gmm-cmake-deps/resolve/main/eigen-3.4.0.tar.gz") | 5 | + set(eigen_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/eigen-3.4.0.tar.gz") |
| 6 | set(eigen_HASH "SHA256=8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72") | 6 | set(eigen_HASH "SHA256=8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72") |
| 7 | 7 | ||
| 8 | # If you don't have access to the Internet, | 8 | # If you don't have access to the Internet, |
| @@ -2,7 +2,7 @@ function(download_espeak_ng_for_piper) | @@ -2,7 +2,7 @@ function(download_espeak_ng_for_piper) | ||
| 2 | include(FetchContent) | 2 | include(FetchContent) |
| 3 | 3 | ||
| 4 | set(espeak_ng_URL "https://github.com/csukuangfj/espeak-ng/archive/f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip") | 4 | set(espeak_ng_URL "https://github.com/csukuangfj/espeak-ng/archive/f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip") |
| 5 | - set(espeak_ng_URL2 "https://hub.nuaa.cf/csukuangfj/espeak-ng/archive/f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip") | 5 | + set(espeak_ng_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/espeak-ng-f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip") |
| 6 | set(espeak_ng_HASH "SHA256=70cbf4050e7a014aae19140b05e57249da4720f56128459fbe3a93beaf971ae6") | 6 | set(espeak_ng_HASH "SHA256=70cbf4050e7a014aae19140b05e57249da4720f56128459fbe3a93beaf971ae6") |
| 7 | 7 | ||
| 8 | set(BUILD_ESPEAK_NG_TESTS OFF CACHE BOOL "" FORCE) | 8 | set(BUILD_ESPEAK_NG_TESTS OFF CACHE BOOL "" FORCE) |
| @@ -2,7 +2,7 @@ function(download_googltest) | @@ -2,7 +2,7 @@ function(download_googltest) | ||
| 2 | include(FetchContent) | 2 | include(FetchContent) |
| 3 | 3 | ||
| 4 | set(googletest_URL "https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz") | 4 | set(googletest_URL "https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz") |
| 5 | - set(googletest_URL2 "https://hub.nuaa.cf/google/googletest/archive/refs/tags/v1.13.0.tar.gz") | 5 | + set(googletest_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/googletest-1.13.0.tar.gz") |
| 6 | set(googletest_HASH "SHA256=ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363") | 6 | set(googletest_HASH "SHA256=ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363") |
| 7 | 7 | ||
| 8 | # If you don't have access to the Internet, | 8 | # If you don't have access to the Internet, |
| @@ -3,6 +3,7 @@ function(download_hclust_cpp) | @@ -3,6 +3,7 @@ function(download_hclust_cpp) | ||
| 3 | 3 | ||
| 4 | # The latest commit as of 2024.09.29 | 4 | # The latest commit as of 2024.09.29 |
| 5 | set(hclust_cpp_URL "https://github.com/csukuangfj/hclust-cpp/archive/refs/tags/2024-09-29.tar.gz") | 5 | set(hclust_cpp_URL "https://github.com/csukuangfj/hclust-cpp/archive/refs/tags/2024-09-29.tar.gz") |
| 6 | + set(hclust_cpp_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/hclust-cpp-2024-09-29.tar.gz") | ||
| 6 | set(hclust_cpp_HASH "SHA256=abab51448a3cb54272aae07522970306e0b2cc6479d59d7b19e7aee4d6cedd33") | 7 | set(hclust_cpp_HASH "SHA256=abab51448a3cb54272aae07522970306e0b2cc6479d59d7b19e7aee4d6cedd33") |
| 7 | 8 | ||
| 8 | # If you don't have access to the Internet, | 9 | # If you don't have access to the Internet, |
| @@ -20,6 +21,7 @@ function(download_hclust_cpp) | @@ -20,6 +21,7 @@ function(download_hclust_cpp) | ||
| 20 | set(hclust_cpp_URL "${f}") | 21 | set(hclust_cpp_URL "${f}") |
| 21 | file(TO_CMAKE_PATH "${hclust_cpp_URL}" hclust_cpp_URL) | 22 | file(TO_CMAKE_PATH "${hclust_cpp_URL}" hclust_cpp_URL) |
| 22 | message(STATUS "Found local downloaded hclust_cpp: ${hclust_cpp_URL}") | 23 | message(STATUS "Found local downloaded hclust_cpp: ${hclust_cpp_URL}") |
| 24 | + set(hclust_cpp_URL2) | ||
| 23 | break() | 25 | break() |
| 24 | endif() | 26 | endif() |
| 25 | endforeach() | 27 | endforeach() |
| @@ -2,7 +2,7 @@ function(download_kaldi_decoder) | @@ -2,7 +2,7 @@ function(download_kaldi_decoder) | ||
| 2 | include(FetchContent) | 2 | include(FetchContent) |
| 3 | 3 | ||
| 4 | set(kaldi_decoder_URL "https://github.com/k2-fsa/kaldi-decoder/archive/refs/tags/v0.2.6.tar.gz") | 4 | set(kaldi_decoder_URL "https://github.com/k2-fsa/kaldi-decoder/archive/refs/tags/v0.2.6.tar.gz") |
| 5 | - set(kaldi_decoder_URL2 "https://hub.nuaa.cf/k2-fsa/kaldi-decoder/archive/refs/tags/v0.2.6.tar.gz") | 5 | + set(kaldi_decoder_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/kaldi-decoder-0.2.6.tar.gz") |
| 6 | set(kaldi_decoder_HASH "SHA256=b13c78b37495cafc6ef3f8a7b661b349c55a51abbd7f7f42f389408dcf86a463") | 6 | set(kaldi_decoder_HASH "SHA256=b13c78b37495cafc6ef3f8a7b661b349c55a51abbd7f7f42f389408dcf86a463") |
| 7 | 7 | ||
| 8 | set(KALDI_DECODER_BUILD_PYTHON OFF CACHE BOOL "" FORCE) | 8 | set(KALDI_DECODER_BUILD_PYTHON OFF CACHE BOOL "" FORCE) |
| @@ -2,7 +2,7 @@ function(download_kaldi_native_fbank) | @@ -2,7 +2,7 @@ function(download_kaldi_native_fbank) | ||
| 2 | include(FetchContent) | 2 | include(FetchContent) |
| 3 | 3 | ||
| 4 | set(kaldi_native_fbank_URL "https://github.com/csukuangfj/kaldi-native-fbank/archive/refs/tags/v1.20.0.tar.gz") | 4 | set(kaldi_native_fbank_URL "https://github.com/csukuangfj/kaldi-native-fbank/archive/refs/tags/v1.20.0.tar.gz") |
| 5 | - set(kaldi_native_fbank_URL2 "https://hub.nuaa.cf/csukuangfj/kaldi-native-fbank/archive/refs/tags/v1.20.0.tar.gz") | 5 | + set(kaldi_native_fbank_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/kaldi-native-fbank-1.20.0.tar.gz") |
| 6 | set(kaldi_native_fbank_HASH "SHA256=c6195b3cf374eef824644061d3c04f6b2a9267ae554169cbaa9865c89c1fe4f9") | 6 | set(kaldi_native_fbank_HASH "SHA256=c6195b3cf374eef824644061d3c04f6b2a9267ae554169cbaa9865c89c1fe4f9") |
| 7 | 7 | ||
| 8 | set(KALDI_NATIVE_FBANK_BUILD_TESTS OFF CACHE BOOL "" FORCE) | 8 | set(KALDI_NATIVE_FBANK_BUILD_TESTS OFF CACHE BOOL "" FORCE) |
| @@ -2,7 +2,7 @@ function(download_kaldifst) | @@ -2,7 +2,7 @@ function(download_kaldifst) | ||
| 2 | include(FetchContent) | 2 | include(FetchContent) |
| 3 | 3 | ||
| 4 | set(kaldifst_URL "https://github.com/k2-fsa/kaldifst/archive/refs/tags/v1.7.11.tar.gz") | 4 | set(kaldifst_URL "https://github.com/k2-fsa/kaldifst/archive/refs/tags/v1.7.11.tar.gz") |
| 5 | - set(kaldifst_URL2 "https://hub.nuaa.cf/k2-fsa/kaldifst/archive/refs/tags/v1.7.11.tar.gz") | 5 | + set(kaldifst_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/kaldifst-1.7.11.tar.gz") |
| 6 | set(kaldifst_HASH "SHA256=b43b3332faa2961edc730e47995a58cd4e22ead21905d55b0c4a41375b4a525f") | 6 | set(kaldifst_HASH "SHA256=b43b3332faa2961edc730e47995a58cd4e22ead21905d55b0c4a41375b4a525f") |
| 7 | 7 | ||
| 8 | # If you don't have access to the Internet, | 8 | # If you don't have access to the Internet, |
| @@ -15,7 +15,7 @@ if(BUILD_SHARED_LIBS) | @@ -15,7 +15,7 @@ if(BUILD_SHARED_LIBS) | ||
| 15 | endif() | 15 | endif() |
| 16 | 16 | ||
| 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-aarch64-static_lib-1.17.1.zip") | 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-aarch64-static_lib-1.17.1.zip") |
| 18 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-aarch64-static_lib-1.17.1.zip") | 18 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-linux-aarch64-static_lib-1.17.1.zip") |
| 19 | set(onnxruntime_HASH "SHA256=831b9a3869501040b4399de85f34c4f170e2bcbd41881edaeb553f8dc4080985") | 19 | set(onnxruntime_HASH "SHA256=831b9a3869501040b4399de85f34c4f170e2bcbd41881edaeb553f8dc4080985") |
| 20 | 20 | ||
| 21 | # If you don't have access to the Internet, | 21 | # If you don't have access to the Internet, |
| @@ -15,7 +15,7 @@ if(NOT BUILD_SHARED_LIBS) | @@ -15,7 +15,7 @@ if(NOT BUILD_SHARED_LIBS) | ||
| 15 | endif() | 15 | endif() |
| 16 | 16 | ||
| 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-aarch64-glibc2_17-Release-1.17.1-patched.zip") | 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-aarch64-glibc2_17-Release-1.17.1-patched.zip") |
| 18 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-aarch64-glibc2_17-Release-1.17.1-patched.zip") | 18 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-linux-aarch64-glibc2_17-Release-1.17.1-patched.zip") |
| 19 | set(onnxruntime_HASH "SHA256=6e0e68985f8dd1f643e5a4dbe7cd54c9e176a0cc62249c6bee0699b87fc6d4fb") | 19 | set(onnxruntime_HASH "SHA256=6e0e68985f8dd1f643e5a4dbe7cd54c9e176a0cc62249c6bee0699b87fc6d4fb") |
| 20 | 20 | ||
| 21 | # If you don't have access to the Internet, | 21 | # If you don't have access to the Internet, |
| @@ -15,7 +15,7 @@ if(BUILD_SHARED_LIBS) | @@ -15,7 +15,7 @@ if(BUILD_SHARED_LIBS) | ||
| 15 | endif() | 15 | endif() |
| 16 | 16 | ||
| 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-arm-static_lib-1.17.1.zip") | 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-arm-static_lib-1.17.1.zip") |
| 18 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-arm-static_lib-1.17.1.zip") | 18 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-linux-arm-static_lib-1.17.1.zip") |
| 19 | set(onnxruntime_HASH "SHA256=3f2ba38156d2facfb732c0fe53bc1eaaf2791d9a91dd240380e3d53716798b09") | 19 | set(onnxruntime_HASH "SHA256=3f2ba38156d2facfb732c0fe53bc1eaaf2791d9a91dd240380e3d53716798b09") |
| 20 | 20 | ||
| 21 | # If you don't have access to the Internet, | 21 | # If you don't have access to the Internet, |
| @@ -15,7 +15,7 @@ if(NOT BUILD_SHARED_LIBS) | @@ -15,7 +15,7 @@ if(NOT BUILD_SHARED_LIBS) | ||
| 15 | endif() | 15 | endif() |
| 16 | 16 | ||
| 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-arm-1.17.1-patched.zip") | 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-arm-1.17.1-patched.zip") |
| 18 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-arm-1.17.1-patched.zip") | 18 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-linux-arm-1.17.1-patched.zip") |
| 19 | set(onnxruntime_HASH "SHA256=4ec00f7adc7341c068babea3d0f607349655e598222d4212115ae4f52619efdb") | 19 | set(onnxruntime_HASH "SHA256=4ec00f7adc7341c068babea3d0f607349655e598222d4212115ae4f52619efdb") |
| 20 | 20 | ||
| 21 | # If you don't have access to the Internet, | 21 | # If you don't have access to the Internet, |
| @@ -15,7 +15,7 @@ if(BUILD_SHARED_LIBS) | @@ -15,7 +15,7 @@ if(BUILD_SHARED_LIBS) | ||
| 15 | endif() | 15 | endif() |
| 16 | 16 | ||
| 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.18.0/onnxruntime-linux-riscv64-static_lib-1.18.0.zip") | 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.18.0/onnxruntime-linux-riscv64-static_lib-1.18.0.zip") |
| 18 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.18.0/onnxruntime-linux-riscv64-static_lib-1.18.0.zip") | 18 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-linux-riscv64-static_lib-1.18.0.zip") |
| 19 | set(onnxruntime_HASH "SHA256=77ecc51d8caf0953755db6edcdec2fc03bce3f6d379bedd635be50bb95f88da5") | 19 | set(onnxruntime_HASH "SHA256=77ecc51d8caf0953755db6edcdec2fc03bce3f6d379bedd635be50bb95f88da5") |
| 20 | 20 | ||
| 21 | # If you don't have access to the Internet, | 21 | # If you don't have access to the Internet, |
| @@ -15,7 +15,7 @@ if(NOT BUILD_SHARED_LIBS) | @@ -15,7 +15,7 @@ if(NOT BUILD_SHARED_LIBS) | ||
| 15 | endif() | 15 | endif() |
| 16 | 16 | ||
| 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.14.1/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip") | 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.14.1/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip") |
| 18 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.14.1/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip") | 18 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip") |
| 19 | set(onnxruntime_HASH "SHA256=c2cbc5af081ff82f46640befd85433811486daaf28e702163c6e4e75020fde81") | 19 | set(onnxruntime_HASH "SHA256=c2cbc5af081ff82f46640befd85433811486daaf28e702163c6e4e75020fde81") |
| 20 | 20 | ||
| 21 | # If you don't have access to the Internet, | 21 | # If you don't have access to the Internet, |
| @@ -20,7 +20,7 @@ endif() | @@ -20,7 +20,7 @@ endif() | ||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-x64-gpu-1.17.1-patched.zip") | 22 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-x64-gpu-1.17.1-patched.zip") |
| 23 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-x64-gpu-1.17.1-patched.zip") | 23 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-linux-x64-gpu-1.17.1-patched.zip") |
| 24 | set(onnxruntime_HASH "SHA256=1261de176e8d9d4d2019f8fa8c732c6d11494f3c6e73168ab6d2cc0903f22551") | 24 | set(onnxruntime_HASH "SHA256=1261de176e8d9d4d2019f8fa8c732c6d11494f3c6e73168ab6d2cc0903f22551") |
| 25 | 25 | ||
| 26 | # If you don't have access to the Internet, | 26 | # If you don't have access to the Internet, |
| @@ -15,7 +15,7 @@ if(BUILD_SHARED_LIBS) | @@ -15,7 +15,7 @@ if(BUILD_SHARED_LIBS) | ||
| 15 | endif() | 15 | endif() |
| 16 | 16 | ||
| 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-x64-static_lib-1.17.1-glibc2_17.zip") | 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-x64-static_lib-1.17.1-glibc2_17.zip") |
| 18 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-x64-static_lib-1.17.1-glibc2_17.zip") | 18 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-linux-x64-static_lib-1.17.1-glibc2_17.zip") |
| 19 | set(onnxruntime_HASH "SHA256=b646beeb983de843a267096d4457d832f93089f5e7264fd54b48cff207cb2068") | 19 | set(onnxruntime_HASH "SHA256=b646beeb983de843a267096d4457d832f93089f5e7264fd54b48cff207cb2068") |
| 20 | 20 | ||
| 21 | # If you don't have access to the Internet, | 21 | # If you don't have access to the Internet, |
| @@ -15,7 +15,7 @@ if(NOT BUILD_SHARED_LIBS) | @@ -15,7 +15,7 @@ if(NOT BUILD_SHARED_LIBS) | ||
| 15 | endif() | 15 | endif() |
| 16 | 16 | ||
| 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-x64-glibc2_17-Release-1.17.1-patched.zip") | 17 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-x64-glibc2_17-Release-1.17.1-patched.zip") |
| 18 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-x64-glibc2_17-Release-1.17.1-patched.zip") | 18 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-linux-x64-glibc2_17-Release-1.17.1-patched.zip") |
| 19 | set(onnxruntime_HASH "SHA256=cb90c51a195bdd453aaf1582f3ef63b466dafbb15c4b8a552ca4dce3769e1d1e") | 19 | set(onnxruntime_HASH "SHA256=cb90c51a195bdd453aaf1582f3ef63b466dafbb15c4b8a552ca4dce3769e1d1e") |
| 20 | 20 | ||
| 21 | # If you don't have access to the Internet, | 21 | # If you don't have access to the Internet, |
| @@ -13,7 +13,7 @@ if(BUILD_SHARED_LIBS) | @@ -13,7 +13,7 @@ if(BUILD_SHARED_LIBS) | ||
| 13 | endif() | 13 | endif() |
| 14 | 14 | ||
| 15 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-osx-arm64-static_lib-1.17.1.zip") | 15 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-osx-arm64-static_lib-1.17.1.zip") |
| 16 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-osx-arm64-static_lib-1.17.1.zip") | 16 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-osx-arm64-static_lib-1.17.1.zip") |
| 17 | set(onnxruntime_HASH "SHA256=b88a4017251c159fea005aefe836bd0cf4d0bc7454e2810784f84a42143f17eb") | 17 | set(onnxruntime_HASH "SHA256=b88a4017251c159fea005aefe836bd0cf4d0bc7454e2810784f84a42143f17eb") |
| 18 | 18 | ||
| 19 | # If you don't have access to the Internet, | 19 | # If you don't have access to the Internet, |
| @@ -13,7 +13,7 @@ if(NOT BUILD_SHARED_LIBS) | @@ -13,7 +13,7 @@ if(NOT BUILD_SHARED_LIBS) | ||
| 13 | endif() | 13 | endif() |
| 14 | 14 | ||
| 15 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-osx-arm64-1.17.1.tgz") | 15 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-osx-arm64-1.17.1.tgz") |
| 16 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-osx-arm64-1.17.1.tgz") | 16 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-osx-arm64-1.17.1.tgz") |
| 17 | set(onnxruntime_HASH "SHA256=89566f424624a7ad9a7d9d5e413c44b9639a994d7171cf409901d125b16e2bb3") | 17 | set(onnxruntime_HASH "SHA256=89566f424624a7ad9a7d9d5e413c44b9639a994d7171cf409901d125b16e2bb3") |
| 18 | 18 | ||
| 19 | # If you don't have access to the Internet, | 19 | # If you don't have access to the Internet, |
| @@ -14,7 +14,7 @@ if(BUILD_SHARED_LIBS) | @@ -14,7 +14,7 @@ if(BUILD_SHARED_LIBS) | ||
| 14 | endif() | 14 | endif() |
| 15 | 15 | ||
| 16 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-osx-universal2-static_lib-1.17.1.zip") | 16 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-osx-universal2-static_lib-1.17.1.zip") |
| 17 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-osx-universal2-static_lib-1.17.1.zip") | 17 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-osx-universal2-static_lib-1.17.1.zip") |
| 18 | set(onnxruntime_HASH "SHA256=45599dbd2fb9dd52d6505930c0e82ca165391e222a68f5606b9ea9d4f3922e15") | 18 | set(onnxruntime_HASH "SHA256=45599dbd2fb9dd52d6505930c0e82ca165391e222a68f5606b9ea9d4f3922e15") |
| 19 | 19 | ||
| 20 | # If you don't have access to the Internet, | 20 | # If you don't have access to the Internet, |
| @@ -14,7 +14,7 @@ if(NOT BUILD_SHARED_LIBS) | @@ -14,7 +14,7 @@ if(NOT BUILD_SHARED_LIBS) | ||
| 14 | endif() | 14 | endif() |
| 15 | 15 | ||
| 16 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-osx-universal2-1.17.1.tgz") | 16 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-osx-universal2-1.17.1.tgz") |
| 17 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-osx-universal2-1.17.1.tgz") | 17 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-osx-universal2-1.17.1.tgz") |
| 18 | set(onnxruntime_HASH "SHA256=9fa57fa6f202a373599377ef75064ae568fda8da838632b26a86024c7378d306") | 18 | set(onnxruntime_HASH "SHA256=9fa57fa6f202a373599377ef75064ae568fda8da838632b26a86024c7378d306") |
| 19 | 19 | ||
| 20 | # If you don't have access to the Internet, | 20 | # If you don't have access to the Internet, |
| @@ -13,7 +13,7 @@ if(BUILD_SHARED_LIBS) | @@ -13,7 +13,7 @@ if(BUILD_SHARED_LIBS) | ||
| 13 | endif() | 13 | endif() |
| 14 | 14 | ||
| 15 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-osx-x86_64-static_lib-1.17.1.zip") | 15 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-osx-x86_64-static_lib-1.17.1.zip") |
| 16 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-osx-x86_64-static_lib-1.17.1.zip") | 16 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-osx-x86_64-static_lib-1.17.1.zip") |
| 17 | set(onnxruntime_HASH "SHA256=5ff8efb97e50e257943c6c588328d2c57b649278098d3b468036f02755b60903") | 17 | set(onnxruntime_HASH "SHA256=5ff8efb97e50e257943c6c588328d2c57b649278098d3b468036f02755b60903") |
| 18 | 18 | ||
| 19 | # If you don't have access to the Internet, | 19 | # If you don't have access to the Internet, |
| @@ -13,7 +13,7 @@ if(NOT BUILD_SHARED_LIBS) | @@ -13,7 +13,7 @@ if(NOT BUILD_SHARED_LIBS) | ||
| 13 | endif() | 13 | endif() |
| 14 | 14 | ||
| 15 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-osx-x86_64-1.17.1.tgz") | 15 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-osx-x86_64-1.17.1.tgz") |
| 16 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-osx-x86_64-1.17.1.tgz") | 16 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-osx-x86_64-1.17.1.tgz") |
| 17 | set(onnxruntime_HASH "SHA256=86c6b6896434084ff5086eebc4e9ea90be1ed4d46743f92864f46ee43e7b5059") | 17 | set(onnxruntime_HASH "SHA256=86c6b6896434084ff5086eebc4e9ea90be1ed4d46743f92864f46ee43e7b5059") |
| 18 | 18 | ||
| 19 | # If you don't have access to the Internet, | 19 | # If you don't have access to the Internet, |
| @@ -11,7 +11,7 @@ if(BUILD_SHARED_LIBS) | @@ -11,7 +11,7 @@ if(BUILD_SHARED_LIBS) | ||
| 11 | endif() | 11 | endif() |
| 12 | 12 | ||
| 13 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-wasm-static_lib-simd-1.17.1.zip") | 13 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-wasm-static_lib-simd-1.17.1.zip") |
| 14 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-wasm-static_lib-simd-1.17.1.zip") | 14 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-wasm-static_lib-simd-1.17.1.zip") |
| 15 | set(onnxruntime_HASH "SHA256=8f07778e4233cf5a61a9d0795d90c5497177fbe8a46b701fda2d8d4e2b11cef8") | 15 | set(onnxruntime_HASH "SHA256=8f07778e4233cf5a61a9d0795d90c5497177fbe8a46b701fda2d8d4e2b11cef8") |
| 16 | 16 | ||
| 17 | # If you don't have access to the Internet, | 17 | # If you don't have access to the Internet, |
| @@ -16,7 +16,7 @@ if(NOT BUILD_SHARED_LIBS) | @@ -16,7 +16,7 @@ if(NOT BUILD_SHARED_LIBS) | ||
| 16 | endif() | 16 | endif() |
| 17 | 17 | ||
| 18 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-arm64-1.17.1.zip") | 18 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-arm64-1.17.1.zip") |
| 19 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-arm64-1.17.1.zip") | 19 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-arm64-1.17.1.zip") |
| 20 | set(onnxruntime_HASH "SHA256=47782cebcab0fd7a1f0a3f0676b088c1bc0f4fbf21666f6fe57570dc362fa5a8") | 20 | set(onnxruntime_HASH "SHA256=47782cebcab0fd7a1f0a3f0676b088c1bc0f4fbf21666f6fe57570dc362fa5a8") |
| 21 | 21 | ||
| 22 | # If you don't have access to the Internet, | 22 | # If you don't have access to the Internet, |
| @@ -20,7 +20,7 @@ if(NOT SHERPA_ONNX_ENABLE_DIRECTML) | @@ -20,7 +20,7 @@ if(NOT SHERPA_ONNX_ENABLE_DIRECTML) | ||
| 20 | endif() | 20 | endif() |
| 21 | 21 | ||
| 22 | set(onnxruntime_URL "https://globalcdn.nuget.org/packages/microsoft.ml.onnxruntime.directml.1.14.1.nupkg") | 22 | set(onnxruntime_URL "https://globalcdn.nuget.org/packages/microsoft.ml.onnxruntime.directml.1.14.1.nupkg") |
| 23 | -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/microsoft.ml.onnxruntime.directml.1.14.1.nupkg") | 23 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/microsoft.ml.onnxruntime.directml.1.14.1.nupkg") |
| 24 | set(onnxruntime_HASH "SHA256=c8ae7623385b19cd5de968d0df5383e13b97d1b3a6771c9177eac15b56013a5a") | 24 | set(onnxruntime_HASH "SHA256=c8ae7623385b19cd5de968d0df5383e13b97d1b3a6771c9177eac15b56013a5a") |
| 25 | 25 | ||
| 26 | # If you don't have access to the Internet, | 26 | # If you don't have access to the Internet, |
| @@ -158,4 +158,4 @@ file(GLOB directml_lib_files "${directml_SOURCE_DIR}/bin/x64-win/DirectML.*") | @@ -158,4 +158,4 @@ file(GLOB directml_lib_files "${directml_SOURCE_DIR}/bin/x64-win/DirectML.*") | ||
| 158 | message(STATUS "DirectML lib files: ${directml_lib_files}") | 158 | message(STATUS "DirectML lib files: ${directml_lib_files}") |
| 159 | 159 | ||
| 160 | install(FILES ${directml_lib_files} DESTINATION lib) | 160 | install(FILES ${directml_lib_files} DESTINATION lib) |
| 161 | -install(FILES ${directml_lib_files} DESTINATION bin) | ||
| 161 | +install(FILES ${directml_lib_files} DESTINATION bin) |
| @@ -20,7 +20,7 @@ if(NOT SHERPA_ONNX_ENABLE_GPU) | @@ -20,7 +20,7 @@ if(NOT SHERPA_ONNX_ENABLE_GPU) | ||
| 20 | endif() | 20 | endif() |
| 21 | 21 | ||
| 22 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-x64-gpu-1.17.1.zip") | 22 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-x64-gpu-1.17.1.zip") |
| 23 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-x64-gpu-1.17.1.zip") | 23 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x64-gpu-1.17.1.zip") |
| 24 | set(onnxruntime_HASH "SHA256=b7a66f50ad146c2ccb43471d2d3b5ad78084c2d4ddbd3ea82d65f86c867408b2") | 24 | set(onnxruntime_HASH "SHA256=b7a66f50ad146c2ccb43471d2d3b5ad78084c2d4ddbd3ea82d65f86c867408b2") |
| 25 | 25 | ||
| 26 | # If you don't have access to the Internet, | 26 | # If you don't have access to the Internet, |
| @@ -16,7 +16,7 @@ if(BUILD_SHARED_LIBS) | @@ -16,7 +16,7 @@ if(BUILD_SHARED_LIBS) | ||
| 16 | endif() | 16 | endif() |
| 17 | 17 | ||
| 18 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x64-static_lib-${CMAKE_BUILD_TYPE}-1.17.1.tar.bz2") | 18 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x64-static_lib-${CMAKE_BUILD_TYPE}-1.17.1.tar.bz2") |
| 19 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x64-static_lib-${CMAKE_BUILD_TYPE}-1.17.1.tar.bz2") | 19 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x64-static_lib-${CMAKE_BUILD_TYPE}-1.17.1.tar.bz2") |
| 20 | if(CMAKE_BUILD_TYPE STREQUAL Debug) | 20 | if(CMAKE_BUILD_TYPE STREQUAL Debug) |
| 21 | set(onnxruntime_HASH "SHA256=ecc68d914541c3b6ebc36148af63fe2a6af0f4f955b35199d612698d23169fa5") | 21 | set(onnxruntime_HASH "SHA256=ecc68d914541c3b6ebc36148af63fe2a6af0f4f955b35199d612698d23169fa5") |
| 22 | elseif(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) | 22 | elseif(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) |
| @@ -20,7 +20,7 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL Release) | @@ -20,7 +20,7 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL Release) | ||
| 20 | endif() | 20 | endif() |
| 21 | 21 | ||
| 22 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x64-static_lib-1.17.1.tar.bz2") | 22 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x64-static_lib-1.17.1.tar.bz2") |
| 23 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x64-static_lib-1.17.1.tar.bz2") | 23 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x64-static_lib-1.17.1.tar.bz2") |
| 24 | set(onnxruntime_HASH "SHA256=42a0c02fda945d1d72433b2a7cdb2187d51cb4d7f3af462c6ae07b25314d5fb3") | 24 | set(onnxruntime_HASH "SHA256=42a0c02fda945d1d72433b2a7cdb2187d51cb4d7f3af462c6ae07b25314d5fb3") |
| 25 | 25 | ||
| 26 | # If you don't have access to the Internet, | 26 | # If you don't have access to the Internet, |
| @@ -16,7 +16,7 @@ if(NOT BUILD_SHARED_LIBS) | @@ -16,7 +16,7 @@ if(NOT BUILD_SHARED_LIBS) | ||
| 16 | endif() | 16 | endif() |
| 17 | 17 | ||
| 18 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-x64-1.17.1.zip") | 18 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-x64-1.17.1.zip") |
| 19 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-x64-1.17.1.zip") | 19 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x64-1.17.1.zip") |
| 20 | set(onnxruntime_HASH "SHA256=4802af9598db02153d7da39432a48823ff69b2fb4b59155461937f20782aa91c") | 20 | set(onnxruntime_HASH "SHA256=4802af9598db02153d7da39432a48823ff69b2fb4b59155461937f20782aa91c") |
| 21 | 21 | ||
| 22 | # If you don't have access to the Internet, | 22 | # If you don't have access to the Internet, |
| @@ -17,7 +17,7 @@ endif() | @@ -17,7 +17,7 @@ endif() | ||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x86-static_lib-${CMAKE_BUILD_TYPE}-1.17.1.tar.bz2") | 19 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x86-static_lib-${CMAKE_BUILD_TYPE}-1.17.1.tar.bz2") |
| 20 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x86-static_lib-${CMAKE_BUILD_TYPE}-1.17.1.tar.bz2") | 20 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x86-static_lib-${CMAKE_BUILD_TYPE}-1.17.1.tar.bz2") |
| 21 | if(CMAKE_BUILD_TYPE STREQUAL Debug) | 21 | if(CMAKE_BUILD_TYPE STREQUAL Debug) |
| 22 | set(onnxruntime_HASH "SHA256=b08b223fe09a5640472eec487ff42e4df6bf726e8aba9de40f443a1fabea3334") | 22 | set(onnxruntime_HASH "SHA256=b08b223fe09a5640472eec487ff42e4df6bf726e8aba9de40f443a1fabea3334") |
| 23 | elseif(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) | 23 | elseif(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) |
| @@ -20,7 +20,7 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL Release) | @@ -20,7 +20,7 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL Release) | ||
| 20 | endif() | 20 | endif() |
| 21 | 21 | ||
| 22 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x86-static_lib-1.17.1.tar.bz2") | 22 | set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x86-static_lib-1.17.1.tar.bz2") |
| 23 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x86-static_lib-1.17.1.tar.bz2") | 23 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x86-static_lib-1.17.1.tar.bz2") |
| 24 | set(onnxruntime_HASH "SHA256=52375d3fabc7b437c955a664bfeb9cb7a6391f5219c4b7d3b87ff690416d4b9e") | 24 | set(onnxruntime_HASH "SHA256=52375d3fabc7b437c955a664bfeb9cb7a6391f5219c4b7d3b87ff690416d4b9e") |
| 25 | 25 | ||
| 26 | # If you don't have access to the Internet, | 26 | # If you don't have access to the Internet, |
| @@ -16,7 +16,7 @@ if(NOT BUILD_SHARED_LIBS) | @@ -16,7 +16,7 @@ if(NOT BUILD_SHARED_LIBS) | ||
| 16 | endif() | 16 | endif() |
| 17 | 17 | ||
| 18 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-x86-1.17.1.zip") | 18 | set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-x86-1.17.1.zip") |
| 19 | -set(onnxruntime_URL2 "https://hub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-x86-1.17.1.zip") | 19 | +set(onnxruntime_URL2 "https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x86-1.17.1.zip") |
| 20 | set(onnxruntime_HASH "SHA256=9404130825474bd36b2538ed925d6b5f2cf1fb6a443f3e125054ae3470019291") | 20 | set(onnxruntime_HASH "SHA256=9404130825474bd36b2538ed925d6b5f2cf1fb6a443f3e125054ae3470019291") |
| 21 | 21 | ||
| 22 | # If you don't have access to the Internet, | 22 | # If you don't have access to the Internet, |
| @@ -4,7 +4,7 @@ function(download_openfst) | @@ -4,7 +4,7 @@ function(download_openfst) | ||
| 4 | include(FetchContent) | 4 | include(FetchContent) |
| 5 | 5 | ||
| 6 | set(openfst_URL "https://github.com/csukuangfj/openfst/archive/refs/tags/sherpa-onnx-2024-06-19.tar.gz") | 6 | set(openfst_URL "https://github.com/csukuangfj/openfst/archive/refs/tags/sherpa-onnx-2024-06-19.tar.gz") |
| 7 | - set(openfst_URL2 "https://hub.nuaa.cf/csukuangfj/openfst/archive/refs/tags/sherpa-onnx-2024-06-19.tar.gz") | 7 | + set(openfst_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/openfst-sherpa-onnx-2024-06-19.tar.gz") |
| 8 | set(openfst_HASH "SHA256=5c98e82cc509c5618502dde4860b8ea04d843850ed57e6d6b590b644b268853d") | 8 | set(openfst_HASH "SHA256=5c98e82cc509c5618502dde4860b8ea04d843850ed57e6d6b590b644b268853d") |
| 9 | 9 | ||
| 10 | # If you don't have access to the Internet, | 10 | # If you don't have access to the Internet, |
| @@ -2,7 +2,7 @@ function(download_piper_phonemize) | @@ -2,7 +2,7 @@ function(download_piper_phonemize) | ||
| 2 | include(FetchContent) | 2 | include(FetchContent) |
| 3 | 3 | ||
| 4 | set(piper_phonemize_URL "https://github.com/csukuangfj/piper-phonemize/archive/dc6b5f4441bffe521047086930b0fc12686acd56.zip") | 4 | set(piper_phonemize_URL "https://github.com/csukuangfj/piper-phonemize/archive/dc6b5f4441bffe521047086930b0fc12686acd56.zip") |
| 5 | - set(piper_phonemize_URL2 "https://hub.nuaa.cf/csukuangfj/piper-phonemize/archive/dc6b5f4441bffe521047086930b0fc12686acd56.zip") | 5 | + set(piper_phonemize_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/piper-phonemize-dc6b5f4441bffe521047086930b0fc12686acd56.zip") |
| 6 | set(piper_phonemize_HASH "SHA256=b9faa04204b1756fa455a962abb1f037041c040133d55be58d11f11ab9b3ce14") | 6 | set(piper_phonemize_HASH "SHA256=b9faa04204b1756fa455a962abb1f037041c040133d55be58d11f11ab9b3ce14") |
| 7 | 7 | ||
| 8 | # If you don't have access to the Internet, | 8 | # If you don't have access to the Internet, |
| @@ -2,7 +2,7 @@ function(download_pybind11) | @@ -2,7 +2,7 @@ function(download_pybind11) | ||
| 2 | include(FetchContent) | 2 | include(FetchContent) |
| 3 | 3 | ||
| 4 | set(pybind11_URL "https://github.com/pybind/pybind11/archive/refs/tags/v2.10.2.tar.gz") | 4 | set(pybind11_URL "https://github.com/pybind/pybind11/archive/refs/tags/v2.10.2.tar.gz") |
| 5 | - set(pybind11_URL2 "https://hub.nuaa.cf/pybind/pybind11/archive/refs/tags/v2.10.2.tar.gz") | 5 | + set(pybind11_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/pybind11-2.10.2.tar.gz") |
| 6 | set(pybind11_HASH "SHA256=93bd1e625e43e03028a3ea7389bba5d3f9f2596abc074b068e70f4ef9b1314ae") | 6 | set(pybind11_HASH "SHA256=93bd1e625e43e03028a3ea7389bba5d3f9f2596abc074b068e70f4ef9b1314ae") |
| 7 | 7 | ||
| 8 | # If you don't have access to the Internet, | 8 | # If you don't have access to the Internet, |
| @@ -2,7 +2,7 @@ function(download_simple_sentencepiece) | @@ -2,7 +2,7 @@ function(download_simple_sentencepiece) | ||
| 2 | include(FetchContent) | 2 | include(FetchContent) |
| 3 | 3 | ||
| 4 | set(simple-sentencepiece_URL "https://github.com/pkufool/simple-sentencepiece/archive/refs/tags/v0.7.tar.gz") | 4 | set(simple-sentencepiece_URL "https://github.com/pkufool/simple-sentencepiece/archive/refs/tags/v0.7.tar.gz") |
| 5 | - set(simple-sentencepiece_URL2 "https://hub.nuaa.cf/pkufool/simple-sentencepiece/archive/refs/tags/v0.7.tar.gz") | 5 | + set(simple-sentencepiece_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/simple-sentencepiece-0.7.tar.gz") |
| 6 | set(simple-sentencepiece_HASH "SHA256=1748a822060a35baa9f6609f84efc8eb54dc0e74b9ece3d82367b7119fdc75af") | 6 | set(simple-sentencepiece_HASH "SHA256=1748a822060a35baa9f6609f84efc8eb54dc0e74b9ece3d82367b7119fdc75af") |
| 7 | 7 | ||
| 8 | # If you don't have access to the Internet, | 8 | # If you don't have access to the Internet, |
| @@ -3,7 +3,7 @@ function(download_websocketpp) | @@ -3,7 +3,7 @@ function(download_websocketpp) | ||
| 3 | 3 | ||
| 4 | # The latest commit on the develop branch os as 2022-10-22 | 4 | # The latest commit on the develop branch os as 2022-10-22 |
| 5 | set(websocketpp_URL "https://github.com/zaphoyd/websocketpp/archive/b9aeec6eaf3d5610503439b4fae3581d9aff08e8.zip") | 5 | set(websocketpp_URL "https://github.com/zaphoyd/websocketpp/archive/b9aeec6eaf3d5610503439b4fae3581d9aff08e8.zip") |
| 6 | - set(websocketpp_URL2 "https://hub.nuaa.cf/zaphoyd/websocketpp/archive/b9aeec6eaf3d5610503439b4fae3581d9aff08e8.zip") | 6 | + set(websocketpp_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/websocketpp-b9aeec6eaf3d5610503439b4fae3581d9aff08e8.zip") |
| 7 | set(websocketpp_HASH "SHA256=1385135ede8191a7fbef9ec8099e3c5a673d48df0c143958216cd1690567f583") | 7 | set(websocketpp_HASH "SHA256=1385135ede8191a7fbef9ec8099e3c5a673d48df0c143958216cd1690567f583") |
| 8 | 8 | ||
| 9 | # If you don't have access to the Internet, | 9 | # If you don't have access to the Internet, |
| @@ -214,8 +214,8 @@ end: | @@ -214,8 +214,8 @@ end: | ||
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | static void sherpa_decode_frame(const AVFrame *frame, | 216 | static void sherpa_decode_frame(const AVFrame *frame, |
| 217 | - SherpaOnnxOnlineRecognizer *recognizer, | ||
| 218 | - SherpaOnnxOnlineStream *stream, | 217 | + const SherpaOnnxOnlineRecognizer *recognizer, |
| 218 | + const SherpaOnnxOnlineStream *stream, | ||
| 219 | const SherpaOnnxDisplay *display, | 219 | const SherpaOnnxDisplay *display, |
| 220 | int32_t *segment_id) { | 220 | int32_t *segment_id) { |
| 221 | #define N 3200 // 100s. Sample rate is fixed to 16 kHz | 221 | #define N 3200 // 100s. Sample rate is fixed to 16 kHz |
| @@ -340,7 +340,7 @@ static Napi::External<SherpaOnnxOfflineStream> CreateOfflineStreamWrapper( | @@ -340,7 +340,7 @@ static Napi::External<SherpaOnnxOfflineStream> CreateOfflineStreamWrapper( | ||
| 340 | SherpaOnnxCreateOfflineStream(recognizer); | 340 | SherpaOnnxCreateOfflineStream(recognizer); |
| 341 | 341 | ||
| 342 | return Napi::External<SherpaOnnxOfflineStream>::New( | 342 | return Napi::External<SherpaOnnxOfflineStream>::New( |
| 343 | - env, const_cast<SherpaOnnxOfflineStream>(stream), | 343 | + env, const_cast<SherpaOnnxOfflineStream *>(stream), |
| 344 | [](Napi::Env env, SherpaOnnxOfflineStream *stream) { | 344 | [](Napi::Env env, SherpaOnnxOfflineStream *stream) { |
| 345 | SherpaOnnxDestroyOfflineStream(stream); | 345 | SherpaOnnxDestroyOfflineStream(stream); |
| 346 | }); | 346 | }); |
| @@ -312,10 +312,12 @@ static Napi::External<SherpaOnnxOnlineStream> CreateOnlineStreamWrapper( | @@ -312,10 +312,12 @@ static Napi::External<SherpaOnnxOnlineStream> CreateOnlineStreamWrapper( | ||
| 312 | SherpaOnnxOnlineRecognizer *recognizer = | 312 | SherpaOnnxOnlineRecognizer *recognizer = |
| 313 | info[0].As<Napi::External<SherpaOnnxOnlineRecognizer>>().Data(); | 313 | info[0].As<Napi::External<SherpaOnnxOnlineRecognizer>>().Data(); |
| 314 | 314 | ||
| 315 | - SherpaOnnxOnlineStream *stream = SherpaOnnxCreateOnlineStream(recognizer); | 315 | + const SherpaOnnxOnlineStream *stream = |
| 316 | + SherpaOnnxCreateOnlineStream(recognizer); | ||
| 316 | 317 | ||
| 317 | return Napi::External<SherpaOnnxOnlineStream>::New( | 318 | return Napi::External<SherpaOnnxOnlineStream>::New( |
| 318 | - env, stream, [](Napi::Env env, SherpaOnnxOnlineStream *stream) { | 319 | + env, const_cast<SherpaOnnxOnlineStream *>(stream), |
| 320 | + [](Napi::Env env, SherpaOnnxOnlineStream *stream) { | ||
| 319 | SherpaOnnxDestroyOnlineStream(stream); | 321 | SherpaOnnxDestroyOnlineStream(stream); |
| 320 | }); | 322 | }); |
| 321 | } | 323 | } |
| @@ -16,22 +16,22 @@ namespace sherpa_onnx::cxx { | @@ -16,22 +16,22 @@ namespace sherpa_onnx::cxx { | ||
| 16 | // ============================================================================ | 16 | // ============================================================================ |
| 17 | // Streaming ASR | 17 | // Streaming ASR |
| 18 | // ============================================================================ | 18 | // ============================================================================ |
| 19 | -struct SHERPA_ONNX_API OnlineTransducerModelConfig { | 19 | +struct OnlineTransducerModelConfig { |
| 20 | std::string encoder; | 20 | std::string encoder; |
| 21 | std::string decoder; | 21 | std::string decoder; |
| 22 | std::string joiner; | 22 | std::string joiner; |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | -struct SHERPA_ONNX_API OnlineParaformerModelConfig { | 25 | +struct OnlineParaformerModelConfig { |
| 26 | std::string encoder; | 26 | std::string encoder; |
| 27 | std::string decoder; | 27 | std::string decoder; |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| 30 | -struct SHERPA_ONNX_API OnlineZipformer2CtcModelConfig { | 30 | +struct OnlineZipformer2CtcModelConfig { |
| 31 | std::string model; | 31 | std::string model; |
| 32 | }; | 32 | }; |
| 33 | 33 | ||
| 34 | -struct SHERPA_ONNX_API OnlineModelConfig { | 34 | +struct OnlineModelConfig { |
| 35 | OnlineTransducerModelConfig transducer; | 35 | OnlineTransducerModelConfig transducer; |
| 36 | OnlineParaformerModelConfig paraformer; | 36 | OnlineParaformerModelConfig paraformer; |
| 37 | OnlineZipformer2CtcModelConfig zipformer2_ctc; | 37 | OnlineZipformer2CtcModelConfig zipformer2_ctc; |
| @@ -45,17 +45,17 @@ struct SHERPA_ONNX_API OnlineModelConfig { | @@ -45,17 +45,17 @@ struct SHERPA_ONNX_API OnlineModelConfig { | ||
| 45 | std::string tokens_buf; | 45 | std::string tokens_buf; |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | -struct SHERPA_ONNX_API FeatureConfig { | 48 | +struct FeatureConfig { |
| 49 | int32_t sample_rate = 16000; | 49 | int32_t sample_rate = 16000; |
| 50 | int32_t feature_dim = 80; | 50 | int32_t feature_dim = 80; |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | -struct SHERPA_ONNX_API OnlineCtcFstDecoderConfig { | 53 | +struct OnlineCtcFstDecoderConfig { |
| 54 | std::string graph; | 54 | std::string graph; |
| 55 | int32_t max_active = 3000; | 55 | int32_t max_active = 3000; |
| 56 | }; | 56 | }; |
| 57 | 57 | ||
| 58 | -struct SHERPA_ONNX_API OnlineRecognizerConfig { | 58 | +struct OnlineRecognizerConfig { |
| 59 | FeatureConfig feat_config; | 59 | FeatureConfig feat_config; |
| 60 | OnlineModelConfig model_config; | 60 | OnlineModelConfig model_config; |
| 61 | 61 | ||
| @@ -83,14 +83,14 @@ struct SHERPA_ONNX_API OnlineRecognizerConfig { | @@ -83,14 +83,14 @@ struct SHERPA_ONNX_API OnlineRecognizerConfig { | ||
| 83 | std::string hotwords_buf; | 83 | std::string hotwords_buf; |
| 84 | }; | 84 | }; |
| 85 | 85 | ||
| 86 | -struct SHERPA_ONNX_API OnlineRecognizerResult { | 86 | +struct OnlineRecognizerResult { |
| 87 | std::string text; | 87 | std::string text; |
| 88 | std::vector<std::string> tokens; | 88 | std::vector<std::string> tokens; |
| 89 | std::vector<float> timestamps; | 89 | std::vector<float> timestamps; |
| 90 | std::string json; | 90 | std::string json; |
| 91 | }; | 91 | }; |
| 92 | 92 | ||
| 93 | -struct SHERPA_ONNX_API Wave { | 93 | +struct Wave { |
| 94 | std::vector<float> samples; | 94 | std::vector<float> samples; |
| 95 | int32_t sample_rate; | 95 | int32_t sample_rate; |
| 96 | }; | 96 | }; |
| @@ -118,6 +118,8 @@ class SHERPA_ONNX_API MoveOnly { | @@ -118,6 +118,8 @@ class SHERPA_ONNX_API MoveOnly { | ||
| 118 | Destroy(); | 118 | Destroy(); |
| 119 | 119 | ||
| 120 | p_ = other.Release(); | 120 | p_ = other.Release(); |
| 121 | + | ||
| 122 | + return *this; | ||
| 121 | } | 123 | } |
| 122 | 124 | ||
| 123 | const T *Get() const { return p_; } | 125 | const T *Get() const { return p_; } |
| @@ -18,6 +18,7 @@ set(sources | @@ -18,6 +18,7 @@ set(sources | ||
| 18 | endpoint.cc | 18 | endpoint.cc |
| 19 | features.cc | 19 | features.cc |
| 20 | file-utils.cc | 20 | file-utils.cc |
| 21 | + fst-utils.cc | ||
| 21 | hypothesis.cc | 22 | hypothesis.cc |
| 22 | keyword-spotter-impl.cc | 23 | keyword-spotter-impl.cc |
| 23 | keyword-spotter.cc | 24 | keyword-spotter.cc |
sherpa-onnx/csrc/fst-utils.cc
0 → 100644
| 1 | +// sherpa-onnx/csrc/fst-utils.cc | ||
| 2 | +// | ||
| 3 | +// Copyright (c) 2024 Xiaomi Corporation | ||
| 4 | + | ||
| 5 | +#include "sherpa-onnx/csrc/fst-utils.h" | ||
| 6 | + | ||
| 7 | +#include "sherpa-onnx/csrc/macros.h" | ||
| 8 | + | ||
| 9 | +namespace sherpa_onnx { | ||
| 10 | + | ||
| 11 | +// This function is copied from kaldi. | ||
| 12 | +// | ||
| 13 | +// @param filename Path to a StdVectorFst or StdConstFst graph | ||
| 14 | +// @return The caller should free the returned pointer using `delete` to | ||
| 15 | +// avoid memory leak. | ||
| 16 | +fst::Fst<fst::StdArc> *ReadGraph(const std::string &filename) { | ||
| 17 | + // read decoding network FST | ||
| 18 | + std::ifstream is(filename, std::ios::binary); | ||
| 19 | + if (!is.good()) { | ||
| 20 | + SHERPA_ONNX_LOGE("Could not open decoding-graph FST %s", filename.c_str()); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + fst::FstHeader hdr; | ||
| 24 | + if (!hdr.Read(is, "<unknown>")) { | ||
| 25 | + SHERPA_ONNX_LOGE("Reading FST: error reading FST header."); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + if (hdr.ArcType() != fst::StdArc::Type()) { | ||
| 29 | + SHERPA_ONNX_LOGE("FST with arc type %s not supported", | ||
| 30 | + hdr.ArcType().c_str()); | ||
| 31 | + } | ||
| 32 | + fst::FstReadOptions ropts("<unspecified>", &hdr); | ||
| 33 | + | ||
| 34 | + fst::Fst<fst::StdArc> *decode_fst = nullptr; | ||
| 35 | + | ||
| 36 | + if (hdr.FstType() == "vector") { | ||
| 37 | + decode_fst = fst::VectorFst<fst::StdArc>::Read(is, ropts); | ||
| 38 | + } else if (hdr.FstType() == "const") { | ||
| 39 | + decode_fst = fst::ConstFst<fst::StdArc>::Read(is, ropts); | ||
| 40 | + } else { | ||
| 41 | + SHERPA_ONNX_LOGE("Reading FST: unsupported FST type: %s", | ||
| 42 | + hdr.FstType().c_str()); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + if (decode_fst == nullptr) { // fst code will warn. | ||
| 46 | + SHERPA_ONNX_LOGE("Error reading FST (after reading header)."); | ||
| 47 | + return nullptr; | ||
| 48 | + } else { | ||
| 49 | + return decode_fst; | ||
| 50 | + } | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +} // namespace sherpa_onnx |
sherpa-onnx/csrc/fst-utils.h
0 → 100644
| 1 | +// sherpa-onnx/csrc/fst-utils.h | ||
| 2 | +// | ||
| 3 | +// Copyright (c) 2024 Xiaomi Corporation | ||
| 4 | + | ||
| 5 | +#ifndef SHERPA_ONNX_CSRC_FST_UTILS_H_ | ||
| 6 | +#define SHERPA_ONNX_CSRC_FST_UTILS_H_ | ||
| 7 | + | ||
| 8 | +#include <string> | ||
| 9 | + | ||
| 10 | +#include "fst/fstlib.h" | ||
| 11 | + | ||
| 12 | +namespace sherpa_onnx { | ||
| 13 | + | ||
| 14 | +fst::Fst<fst::StdArc> *ReadGraph(const std::string &filename); | ||
| 15 | + | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +#endif // SHERPA_ONNX_CSRC_FST_UTILS_H_ |
| @@ -10,18 +10,12 @@ | @@ -10,18 +10,12 @@ | ||
| 10 | 10 | ||
| 11 | #include "cppjieba/Jieba.hpp" | 11 | #include "cppjieba/Jieba.hpp" |
| 12 | #include "sherpa-onnx/csrc/file-utils.h" | 12 | #include "sherpa-onnx/csrc/file-utils.h" |
| 13 | +#include "sherpa-onnx/csrc/lexicon.h" | ||
| 13 | #include "sherpa-onnx/csrc/macros.h" | 14 | #include "sherpa-onnx/csrc/macros.h" |
| 14 | #include "sherpa-onnx/csrc/text-utils.h" | 15 | #include "sherpa-onnx/csrc/text-utils.h" |
| 15 | 16 | ||
| 16 | namespace sherpa_onnx { | 17 | namespace sherpa_onnx { |
| 17 | 18 | ||
| 18 | -// implemented in ./lexicon.cc | ||
| 19 | -std::unordered_map<std::string, int32_t> ReadTokens(std::istream &is); | ||
| 20 | - | ||
| 21 | -std::vector<int32_t> ConvertTokensToIds( | ||
| 22 | - const std::unordered_map<std::string, int32_t> &token2id, | ||
| 23 | - const std::vector<std::string> &tokens); | ||
| 24 | - | ||
| 25 | class JiebaLexicon::Impl { | 19 | class JiebaLexicon::Impl { |
| 26 | public: | 20 | public: |
| 27 | Impl(const std::string &lexicon, const std::string &tokens, | 21 | Impl(const std::string &lexicon, const std::string &tokens, |
| @@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
| 6 | #define SHERPA_ONNX_CSRC_LEXICON_H_ | 6 | #define SHERPA_ONNX_CSRC_LEXICON_H_ |
| 7 | 7 | ||
| 8 | #include <cstdint> | 8 | #include <cstdint> |
| 9 | +#include <istream> | ||
| 9 | #include <memory> | 10 | #include <memory> |
| 10 | #include <string> | 11 | #include <string> |
| 11 | #include <unordered_map> | 12 | #include <unordered_map> |
| @@ -66,6 +67,12 @@ class Lexicon : public OfflineTtsFrontend { | @@ -66,6 +67,12 @@ class Lexicon : public OfflineTtsFrontend { | ||
| 66 | bool debug_ = false; | 67 | bool debug_ = false; |
| 67 | }; | 68 | }; |
| 68 | 69 | ||
| 70 | +std::unordered_map<std::string, int32_t> ReadTokens(std::istream &is); | ||
| 71 | + | ||
| 72 | +std::vector<int32_t> ConvertTokensToIds( | ||
| 73 | + const std::unordered_map<std::string, int32_t> &token2id, | ||
| 74 | + const std::vector<std::string> &tokens); | ||
| 75 | + | ||
| 69 | } // namespace sherpa_onnx | 76 | } // namespace sherpa_onnx |
| 70 | 77 | ||
| 71 | #endif // SHERPA_ONNX_CSRC_LEXICON_H_ | 78 | #endif // SHERPA_ONNX_CSRC_LEXICON_H_ |
| @@ -10,18 +10,12 @@ | @@ -10,18 +10,12 @@ | ||
| 10 | 10 | ||
| 11 | #include "cppjieba/Jieba.hpp" | 11 | #include "cppjieba/Jieba.hpp" |
| 12 | #include "sherpa-onnx/csrc/file-utils.h" | 12 | #include "sherpa-onnx/csrc/file-utils.h" |
| 13 | +#include "sherpa-onnx/csrc/lexicon.h" | ||
| 13 | #include "sherpa-onnx/csrc/macros.h" | 14 | #include "sherpa-onnx/csrc/macros.h" |
| 14 | #include "sherpa-onnx/csrc/text-utils.h" | 15 | #include "sherpa-onnx/csrc/text-utils.h" |
| 15 | 16 | ||
| 16 | namespace sherpa_onnx { | 17 | namespace sherpa_onnx { |
| 17 | 18 | ||
| 18 | -// implemented in ./lexicon.cc | ||
| 19 | -std::unordered_map<std::string, int32_t> ReadTokens(std::istream &is); | ||
| 20 | - | ||
| 21 | -std::vector<int32_t> ConvertTokensToIds( | ||
| 22 | - const std::unordered_map<std::string, int32_t> &token2id, | ||
| 23 | - const std::vector<std::string> &tokens); | ||
| 24 | - | ||
| 25 | class MeloTtsLexicon::Impl { | 19 | class MeloTtsLexicon::Impl { |
| 26 | public: | 20 | public: |
| 27 | Impl(const std::string &lexicon, const std::string &tokens, | 21 | Impl(const std::string &lexicon, const std::string &tokens, |
| @@ -11,52 +11,11 @@ | @@ -11,52 +11,11 @@ | ||
| 11 | #include "kaldi-decoder/csrc/decodable-ctc.h" | 11 | #include "kaldi-decoder/csrc/decodable-ctc.h" |
| 12 | #include "kaldi-decoder/csrc/eigen.h" | 12 | #include "kaldi-decoder/csrc/eigen.h" |
| 13 | #include "kaldi-decoder/csrc/faster-decoder.h" | 13 | #include "kaldi-decoder/csrc/faster-decoder.h" |
| 14 | +#include "sherpa-onnx/csrc/fst-utils.h" | ||
| 14 | #include "sherpa-onnx/csrc/macros.h" | 15 | #include "sherpa-onnx/csrc/macros.h" |
| 15 | 16 | ||
| 16 | namespace sherpa_onnx { | 17 | namespace sherpa_onnx { |
| 17 | 18 | ||
| 18 | -// This function is copied from kaldi. | ||
| 19 | -// | ||
| 20 | -// @param filename Path to a StdVectorFst or StdConstFst graph | ||
| 21 | -// @return The caller should free the returned pointer using `delete` to | ||
| 22 | -// avoid memory leak. | ||
| 23 | -fst::Fst<fst::StdArc> *ReadGraph(const std::string &filename) { | ||
| 24 | - // read decoding network FST | ||
| 25 | - std::ifstream is(filename, std::ios::binary); | ||
| 26 | - if (!is.good()) { | ||
| 27 | - SHERPA_ONNX_LOGE("Could not open decoding-graph FST %s", filename.c_str()); | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - fst::FstHeader hdr; | ||
| 31 | - if (!hdr.Read(is, "<unknown>")) { | ||
| 32 | - SHERPA_ONNX_LOGE("Reading FST: error reading FST header."); | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - if (hdr.ArcType() != fst::StdArc::Type()) { | ||
| 36 | - SHERPA_ONNX_LOGE("FST with arc type %s not supported", | ||
| 37 | - hdr.ArcType().c_str()); | ||
| 38 | - } | ||
| 39 | - fst::FstReadOptions ropts("<unspecified>", &hdr); | ||
| 40 | - | ||
| 41 | - fst::Fst<fst::StdArc> *decode_fst = nullptr; | ||
| 42 | - | ||
| 43 | - if (hdr.FstType() == "vector") { | ||
| 44 | - decode_fst = fst::VectorFst<fst::StdArc>::Read(is, ropts); | ||
| 45 | - } else if (hdr.FstType() == "const") { | ||
| 46 | - decode_fst = fst::ConstFst<fst::StdArc>::Read(is, ropts); | ||
| 47 | - } else { | ||
| 48 | - SHERPA_ONNX_LOGE("Reading FST: unsupported FST type: %s", | ||
| 49 | - hdr.FstType().c_str()); | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - if (decode_fst == nullptr) { // fst code will warn. | ||
| 53 | - SHERPA_ONNX_LOGE("Error reading FST (after reading header)."); | ||
| 54 | - return nullptr; | ||
| 55 | - } else { | ||
| 56 | - return decode_fst; | ||
| 57 | - } | ||
| 58 | -} | ||
| 59 | - | ||
| 60 | /** | 19 | /** |
| 61 | * @param decoder | 20 | * @param decoder |
| 62 | * @param p Pointer to a 2-d array of shape (num_frames, vocab_size) | 21 | * @param p Pointer to a 2-d array of shape (num_frames, vocab_size) |
| @@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
| 5 | #include "sherpa-onnx/csrc/offline-speaker-diarization-result.h" | 5 | #include "sherpa-onnx/csrc/offline-speaker-diarization-result.h" |
| 6 | 6 | ||
| 7 | #include <algorithm> | 7 | #include <algorithm> |
| 8 | +#include <array> | ||
| 8 | #include <sstream> | 9 | #include <sstream> |
| 9 | #include <string> | 10 | #include <string> |
| 10 | #include <unordered_set> | 11 | #include <unordered_set> |
| @@ -48,11 +49,13 @@ OfflineSpeakerDiarizationSegment::Merge( | @@ -48,11 +49,13 @@ OfflineSpeakerDiarizationSegment::Merge( | ||
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | std::string OfflineSpeakerDiarizationSegment::ToString() const { | 51 | std::string OfflineSpeakerDiarizationSegment::ToString() const { |
| 51 | - char s[128]; | ||
| 52 | - snprintf(s, sizeof(s), "%.3f -- %.3f speaker_%02d", start_, end_, speaker_); | 52 | + std::array<char, 128> s{}; |
| 53 | + | ||
| 54 | + snprintf(s.data(), s.size(), "%.3f -- %.3f speaker_%02d", start_, end_, | ||
| 55 | + speaker_); | ||
| 53 | 56 | ||
| 54 | std::ostringstream os; | 57 | std::ostringstream os; |
| 55 | - os << s; | 58 | + os << s.data(); |
| 56 | 59 | ||
| 57 | if (!text_.empty()) { | 60 | if (!text_.empty()) { |
| 58 | os << " " << text_; | 61 | os << " " << text_; |
| @@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
| 5 | #include "sherpa-onnx/csrc/offline-speaker-diarization.h" | 5 | #include "sherpa-onnx/csrc/offline-speaker-diarization.h" |
| 6 | 6 | ||
| 7 | #include <string> | 7 | #include <string> |
| 8 | +#include <utility> | ||
| 8 | 9 | ||
| 9 | #include "sherpa-onnx/csrc/offline-speaker-diarization-impl.h" | 10 | #include "sherpa-onnx/csrc/offline-speaker-diarization-impl.h" |
| 10 | 11 | ||
| @@ -94,7 +95,7 @@ OfflineSpeakerDiarizationResult OfflineSpeakerDiarization::Process( | @@ -94,7 +95,7 @@ OfflineSpeakerDiarizationResult OfflineSpeakerDiarization::Process( | ||
| 94 | const float *audio, int32_t n, | 95 | const float *audio, int32_t n, |
| 95 | OfflineSpeakerDiarizationProgressCallback callback /*= nullptr*/, | 96 | OfflineSpeakerDiarizationProgressCallback callback /*= nullptr*/, |
| 96 | void *callback_arg /*= nullptr*/) const { | 97 | void *callback_arg /*= nullptr*/) const { |
| 97 | - return impl_->Process(audio, n, callback, callback_arg); | 98 | + return impl_->Process(audio, n, std::move(callback), callback_arg); |
| 98 | } | 99 | } |
| 99 | 100 | ||
| 100 | } // namespace sherpa_onnx | 101 | } // namespace sherpa_onnx |
| @@ -13,14 +13,12 @@ | @@ -13,14 +13,12 @@ | ||
| 13 | #include "fst/fstlib.h" | 13 | #include "fst/fstlib.h" |
| 14 | #include "kaldi-decoder/csrc/decodable-ctc.h" | 14 | #include "kaldi-decoder/csrc/decodable-ctc.h" |
| 15 | #include "kaldifst/csrc/fstext-utils.h" | 15 | #include "kaldifst/csrc/fstext-utils.h" |
| 16 | +#include "sherpa-onnx/csrc/fst-utils.h" | ||
| 16 | #include "sherpa-onnx/csrc/macros.h" | 17 | #include "sherpa-onnx/csrc/macros.h" |
| 17 | #include "sherpa-onnx/csrc/online-stream.h" | 18 | #include "sherpa-onnx/csrc/online-stream.h" |
| 18 | 19 | ||
| 19 | namespace sherpa_onnx { | 20 | namespace sherpa_onnx { |
| 20 | 21 | ||
| 21 | -// defined in ./offline-ctc-fst-decoder.cc | ||
| 22 | -fst::Fst<fst::StdArc> *ReadGraph(const std::string &filename); | ||
| 23 | - | ||
| 24 | OnlineCtcFstDecoder::OnlineCtcFstDecoder( | 22 | OnlineCtcFstDecoder::OnlineCtcFstDecoder( |
| 25 | const OnlineCtcFstDecoderConfig &config, int32_t blank_id) | 23 | const OnlineCtcFstDecoderConfig &config, int32_t blank_id) |
| 26 | : config_(config), fst_(ReadGraph(config.graph)), blank_id_(blank_id) { | 24 | : config_(config), fst_(ReadGraph(config.graph)), blank_id_(blank_id) { |
| @@ -19,6 +19,8 @@ | @@ -19,6 +19,8 @@ | ||
| 19 | 19 | ||
| 20 | namespace sherpa_onnx { | 20 | namespace sherpa_onnx { |
| 21 | 21 | ||
| 22 | +namespace { | ||
| 23 | + | ||
| 22 | /// Helper for `OnlineRecognizerResult::AsJsonString()` | 24 | /// Helper for `OnlineRecognizerResult::AsJsonString()` |
| 23 | template <typename T> | 25 | template <typename T> |
| 24 | std::string VecToString(const std::vector<T> &vec, int32_t precision = 6) { | 26 | std::string VecToString(const std::vector<T> &vec, int32_t precision = 6) { |
| @@ -51,6 +53,8 @@ std::string VecToString<std::string>(const std::vector<std::string> &vec, | @@ -51,6 +53,8 @@ std::string VecToString<std::string>(const std::vector<std::string> &vec, | ||
| 51 | return oss.str(); | 53 | return oss.str(); |
| 52 | } | 54 | } |
| 53 | 55 | ||
| 56 | +} // namespace | ||
| 57 | + | ||
| 54 | std::string OnlineRecognizerResult::AsJsonString() const { | 58 | std::string OnlineRecognizerResult::AsJsonString() const { |
| 55 | std::ostringstream os; | 59 | std::ostringstream os; |
| 56 | os << "{ "; | 60 | os << "{ "; |
-
请 注册 或 登录 后发表评论