Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Fangjun Kuang
2024-10-24 11:15:08 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2024-10-24 11:15:08 +0800
Commit
b3e05f6dc42d52823d8dd99fe61e52643cb454f0
b3e05f6d
1 parent
ceb69ebd
Fix style issues (#1458)
隐藏空白字符变更
内嵌
并排对比
正在显示
55 个修改的文件
包含
155 行增加
和
117 行删除
cmake/asio.cmake
cmake/cargs.cmake
cmake/cppjieba.cmake
cmake/eigen.cmake
cmake/espeak-ng-for-piper.cmake
cmake/googletest.cmake
cmake/hclust-cpp.cmake
cmake/kaldi-decoder.cmake
cmake/kaldi-native-fbank.cmake
cmake/kaldifst.cmake
cmake/onnxruntime-linux-aarch64-static.cmake
cmake/onnxruntime-linux-aarch64.cmake
cmake/onnxruntime-linux-arm-static.cmake
cmake/onnxruntime-linux-arm.cmake
cmake/onnxruntime-linux-riscv64-static.cmake
cmake/onnxruntime-linux-riscv64.cmake
cmake/onnxruntime-linux-x86_64-gpu.cmake
cmake/onnxruntime-linux-x86_64-static.cmake
cmake/onnxruntime-linux-x86_64.cmake
cmake/onnxruntime-osx-arm64-static.cmake
cmake/onnxruntime-osx-arm64.cmake
cmake/onnxruntime-osx-universal-static.cmake
cmake/onnxruntime-osx-universal.cmake
cmake/onnxruntime-osx-x86_64-static.cmake
cmake/onnxruntime-osx-x86_64.cmake
cmake/onnxruntime-wasm-simd.cmake
cmake/onnxruntime-win-arm64.cmake
cmake/onnxruntime-win-x64-directml.cmake
cmake/onnxruntime-win-x64-gpu.cmake
cmake/onnxruntime-win-x64-static-debug.cmake
cmake/onnxruntime-win-x64-static.cmake
cmake/onnxruntime-win-x64.cmake
cmake/onnxruntime-win-x86-static-debug.cmake
cmake/onnxruntime-win-x86-static.cmake
cmake/onnxruntime-win-x86.cmake
cmake/openfst.cmake
cmake/piper-phonemize.cmake
cmake/pybind11.cmake
cmake/simple-sentencepiece.cmake
cmake/websocketpp.cmake
ffmpeg-examples/sherpa-onnx-ffmpeg.c
scripts/node-addon-api/src/non-streaming-asr.cc
scripts/node-addon-api/src/streaming-asr.cc
sherpa-onnx/c-api/cxx-api.h
sherpa-onnx/csrc/CMakeLists.txt
sherpa-onnx/csrc/fst-utils.cc
sherpa-onnx/csrc/fst-utils.h
sherpa-onnx/csrc/jieba-lexicon.cc
sherpa-onnx/csrc/lexicon.h
sherpa-onnx/csrc/melo-tts-lexicon.cc
sherpa-onnx/csrc/offline-ctc-fst-decoder.cc
sherpa-onnx/csrc/offline-speaker-diarization-result.cc
sherpa-onnx/csrc/offline-speaker-diarization.cc
sherpa-onnx/csrc/online-ctc-fst-decoder.cc
sherpa-onnx/csrc/online-recognizer.cc
cmake/asio.cmake
查看文件 @
b3e05f6
...
...
@@ -2,7 +2,7 @@ function(download_asio)
include
(
FetchContent
)
set
(
asio_URL
"https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-24-0.tar.gz"
)
set
(
asio_URL2
"https://h
ub.nuaa.cf/chriskohlhoff/asio/archive/refs/tags/
asio-1-24-0.tar.gz"
)
set
(
asio_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/asio-
asio-1-24-0.tar.gz"
)
set
(
asio_HASH
"SHA256=cbcaaba0f66722787b1a7c33afe1befb3a012b5af3ad7da7ff0f6b8c9b7a8a5b"
)
# If you don't have access to the Internet,
...
...
cmake/cargs.cmake
查看文件 @
b3e05f6
...
...
@@ -2,7 +2,7 @@ function(download_cargs)
include
(
FetchContent
)
set
(
cargs_URL
"https://github.com/likle/cargs/archive/refs/tags/v1.0.3.tar.gz"
)
set
(
cargs_URL2
"https://h
ub.nuaa.cf/likle/cargs/archive/refs/tags/v
1.0.3.tar.gz"
)
set
(
cargs_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/cargs-
1.0.3.tar.gz"
)
set
(
cargs_HASH
"SHA256=ddba25bd35e9c6c75bc706c126001b8ce8e084d40ef37050e6aa6963e836eb8b"
)
# If you don't have access to the Internet,
...
...
cmake/cppjieba.cmake
查看文件 @
b3e05f6
...
...
@@ -2,7 +2,7 @@ function(download_cppjieba)
include
(
FetchContent
)
set
(
cppjieba_URL
"https://github.com/csukuangfj/cppjieba/archive/refs/tags/sherpa-onnx-2024-04-19.tar.gz"
)
set
(
cppjieba_URL2
"https://h
ub.nuaa.cf/csukuangfj/cppjieba/archive/refs/tags/
sherpa-onnx-2024-04-19.tar.gz"
)
set
(
cppjieba_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/cppjieba-
sherpa-onnx-2024-04-19.tar.gz"
)
set
(
cppjieba_HASH
"SHA256=03e5264687f0efaef05487a07d49c3f4c0f743347bfbf825df4b30cc75ac5288"
)
# If you don't have access to the Internet,
...
...
cmake/eigen.cmake
查看文件 @
b3e05f6
...
...
@@ -2,7 +2,7 @@ function(download_eigen)
include
(
FetchContent
)
set
(
eigen_URL
"https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz"
)
set
(
eigen_URL2
"https://h
uggingface.co/csukuangfj/kaldi-hmm-gmm
-cmake-deps/resolve/main/eigen-3.4.0.tar.gz"
)
set
(
eigen_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx
-cmake-deps/resolve/main/eigen-3.4.0.tar.gz"
)
set
(
eigen_HASH
"SHA256=8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72"
)
# If you don't have access to the Internet,
...
...
cmake/espeak-ng-for-piper.cmake
查看文件 @
b3e05f6
...
...
@@ -2,7 +2,7 @@ function(download_espeak_ng_for_piper)
include
(
FetchContent
)
set
(
espeak_ng_URL
"https://github.com/csukuangfj/espeak-ng/archive/f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip"
)
set
(
espeak_ng_URL2
"https://h
ub.nuaa.cf/csukuangfj/espeak-ng/archive/
f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip"
)
set
(
espeak_ng_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/espeak-ng-
f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip"
)
set
(
espeak_ng_HASH
"SHA256=70cbf4050e7a014aae19140b05e57249da4720f56128459fbe3a93beaf971ae6"
)
set
(
BUILD_ESPEAK_NG_TESTS OFF CACHE BOOL
""
FORCE
)
...
...
cmake/googletest.cmake
查看文件 @
b3e05f6
...
...
@@ -2,7 +2,7 @@ function(download_googltest)
include
(
FetchContent
)
set
(
googletest_URL
"https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz"
)
set
(
googletest_URL2
"https://h
ub.nuaa.cf/google/googletest/archive/refs/tags/v
1.13.0.tar.gz"
)
set
(
googletest_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/googletest-
1.13.0.tar.gz"
)
set
(
googletest_HASH
"SHA256=ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363"
)
# If you don't have access to the Internet,
...
...
cmake/hclust-cpp.cmake
查看文件 @
b3e05f6
...
...
@@ -3,6 +3,7 @@ function(download_hclust_cpp)
# The latest commit as of 2024.09.29
set
(
hclust_cpp_URL
"https://github.com/csukuangfj/hclust-cpp/archive/refs/tags/2024-09-29.tar.gz"
)
set
(
hclust_cpp_URL2
"https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/hclust-cpp-2024-09-29.tar.gz"
)
set
(
hclust_cpp_HASH
"SHA256=abab51448a3cb54272aae07522970306e0b2cc6479d59d7b19e7aee4d6cedd33"
)
# If you don't have access to the Internet,
...
...
@@ -20,6 +21,7 @@ function(download_hclust_cpp)
set
(
hclust_cpp_URL
"
${
f
}
"
)
file
(
TO_CMAKE_PATH
"
${
hclust_cpp_URL
}
"
hclust_cpp_URL
)
message
(
STATUS
"Found local downloaded hclust_cpp:
${
hclust_cpp_URL
}
"
)
set
(
hclust_cpp_URL2
)
break
()
endif
()
endforeach
()
...
...
cmake/kaldi-decoder.cmake
查看文件 @
b3e05f6
...
...
@@ -2,7 +2,7 @@ function(download_kaldi_decoder)
include
(
FetchContent
)
set
(
kaldi_decoder_URL
"https://github.com/k2-fsa/kaldi-decoder/archive/refs/tags/v0.2.6.tar.gz"
)
set
(
kaldi_decoder_URL2
"https://h
ub.nuaa.cf/k2-fsa/kaldi-decoder/archive/refs/tags/v
0.2.6.tar.gz"
)
set
(
kaldi_decoder_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/kaldi-decoder-
0.2.6.tar.gz"
)
set
(
kaldi_decoder_HASH
"SHA256=b13c78b37495cafc6ef3f8a7b661b349c55a51abbd7f7f42f389408dcf86a463"
)
set
(
KALDI_DECODER_BUILD_PYTHON OFF CACHE BOOL
""
FORCE
)
...
...
cmake/kaldi-native-fbank.cmake
查看文件 @
b3e05f6
...
...
@@ -2,7 +2,7 @@ function(download_kaldi_native_fbank)
include
(
FetchContent
)
set
(
kaldi_native_fbank_URL
"https://github.com/csukuangfj/kaldi-native-fbank/archive/refs/tags/v1.20.0.tar.gz"
)
set
(
kaldi_native_fbank_URL2
"https://h
ub.nuaa.cf/csukuangfj/kaldi-native-fbank/archive/refs/tags/v
1.20.0.tar.gz"
)
set
(
kaldi_native_fbank_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/kaldi-native-fbank-
1.20.0.tar.gz"
)
set
(
kaldi_native_fbank_HASH
"SHA256=c6195b3cf374eef824644061d3c04f6b2a9267ae554169cbaa9865c89c1fe4f9"
)
set
(
KALDI_NATIVE_FBANK_BUILD_TESTS OFF CACHE BOOL
""
FORCE
)
...
...
cmake/kaldifst.cmake
查看文件 @
b3e05f6
...
...
@@ -2,7 +2,7 @@ function(download_kaldifst)
include
(
FetchContent
)
set
(
kaldifst_URL
"https://github.com/k2-fsa/kaldifst/archive/refs/tags/v1.7.11.tar.gz"
)
set
(
kaldifst_URL2
"https://h
ub.nuaa.cf/k2-fsa/kaldifst/archive/refs/tags/v
1.7.11.tar.gz"
)
set
(
kaldifst_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/kaldifst-
1.7.11.tar.gz"
)
set
(
kaldifst_HASH
"SHA256=b43b3332faa2961edc730e47995a58cd4e22ead21905d55b0c4a41375b4a525f"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-linux-aarch64-static.cmake
查看文件 @
b3e05f6
...
...
@@ -15,7 +15,7 @@ if(BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-aarch64-static_lib-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-linux-aarch64-static_lib-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-linux-aarch64-static_lib-1.17.1.zip"
)
set
(
onnxruntime_HASH
"SHA256=831b9a3869501040b4399de85f34c4f170e2bcbd41881edaeb553f8dc4080985"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-linux-aarch64.cmake
查看文件 @
b3e05f6
...
...
@@ -15,7 +15,7 @@ if(NOT BUILD_SHARED_LIBS)
endif
()
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"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-linux-aarch64-glibc2_17-Release-1.17.1-patched.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-linux-aarch64-glibc2_17-Release-1.17.1-patched.zip"
)
set
(
onnxruntime_HASH
"SHA256=6e0e68985f8dd1f643e5a4dbe7cd54c9e176a0cc62249c6bee0699b87fc6d4fb"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-linux-arm-static.cmake
查看文件 @
b3e05f6
...
...
@@ -15,7 +15,7 @@ if(BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-arm-static_lib-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-linux-arm-static_lib-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-linux-arm-static_lib-1.17.1.zip"
)
set
(
onnxruntime_HASH
"SHA256=3f2ba38156d2facfb732c0fe53bc1eaaf2791d9a91dd240380e3d53716798b09"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-linux-arm.cmake
查看文件 @
b3e05f6
...
...
@@ -15,7 +15,7 @@ if(NOT BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-arm-1.17.1-patched.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-linux-arm-1.17.1-patched.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-linux-arm-1.17.1-patched.zip"
)
set
(
onnxruntime_HASH
"SHA256=4ec00f7adc7341c068babea3d0f607349655e598222d4212115ae4f52619efdb"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-linux-riscv64-static.cmake
查看文件 @
b3e05f6
...
...
@@ -15,7 +15,7 @@ if(BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.18.0/onnxruntime-linux-riscv64-static_lib-1.18.0.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.18.0
/onnxruntime-linux-riscv64-static_lib-1.18.0.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-linux-riscv64-static_lib-1.18.0.zip"
)
set
(
onnxruntime_HASH
"SHA256=77ecc51d8caf0953755db6edcdec2fc03bce3f6d379bedd635be50bb95f88da5"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-linux-riscv64.cmake
查看文件 @
b3e05f6
...
...
@@ -15,7 +15,7 @@ if(NOT BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.14.1/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.14.1
/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip"
)
set
(
onnxruntime_HASH
"SHA256=c2cbc5af081ff82f46640befd85433811486daaf28e702163c6e4e75020fde81"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-linux-x86_64-gpu.cmake
查看文件 @
b3e05f6
...
...
@@ -20,7 +20,7 @@ endif()
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-linux-x64-gpu-1.17.1-patched.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-linux-x64-gpu-1.17.1-patched.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-linux-x64-gpu-1.17.1-patched.zip"
)
set
(
onnxruntime_HASH
"SHA256=1261de176e8d9d4d2019f8fa8c732c6d11494f3c6e73168ab6d2cc0903f22551"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-linux-x86_64-static.cmake
查看文件 @
b3e05f6
...
...
@@ -15,7 +15,7 @@ if(BUILD_SHARED_LIBS)
endif
()
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"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-linux-x64-static_lib-1.17.1-glibc2_17.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-linux-x64-static_lib-1.17.1-glibc2_17.zip"
)
set
(
onnxruntime_HASH
"SHA256=b646beeb983de843a267096d4457d832f93089f5e7264fd54b48cff207cb2068"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-linux-x86_64.cmake
查看文件 @
b3e05f6
...
...
@@ -15,7 +15,7 @@ if(NOT BUILD_SHARED_LIBS)
endif
()
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"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-linux-x64-glibc2_17-Release-1.17.1-patched.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-linux-x64-glibc2_17-Release-1.17.1-patched.zip"
)
set
(
onnxruntime_HASH
"SHA256=cb90c51a195bdd453aaf1582f3ef63b466dafbb15c4b8a552ca4dce3769e1d1e"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-osx-arm64-static.cmake
查看文件 @
b3e05f6
...
...
@@ -13,7 +13,7 @@ if(BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-osx-arm64-static_lib-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-osx-arm64-static_lib-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-osx-arm64-static_lib-1.17.1.zip"
)
set
(
onnxruntime_HASH
"SHA256=b88a4017251c159fea005aefe836bd0cf4d0bc7454e2810784f84a42143f17eb"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-osx-arm64.cmake
查看文件 @
b3e05f6
...
...
@@ -13,7 +13,7 @@ if(NOT BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-osx-arm64-1.17.1.tgz"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1
/onnxruntime-osx-arm64-1.17.1.tgz"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-osx-arm64-1.17.1.tgz"
)
set
(
onnxruntime_HASH
"SHA256=89566f424624a7ad9a7d9d5e413c44b9639a994d7171cf409901d125b16e2bb3"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-osx-universal-static.cmake
查看文件 @
b3e05f6
...
...
@@ -14,7 +14,7 @@ if(BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-osx-universal2-static_lib-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-osx-universal2-static_lib-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-osx-universal2-static_lib-1.17.1.zip"
)
set
(
onnxruntime_HASH
"SHA256=45599dbd2fb9dd52d6505930c0e82ca165391e222a68f5606b9ea9d4f3922e15"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-osx-universal.cmake
查看文件 @
b3e05f6
...
...
@@ -14,7 +14,7 @@ if(NOT BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-osx-universal2-1.17.1.tgz"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1
/onnxruntime-osx-universal2-1.17.1.tgz"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-osx-universal2-1.17.1.tgz"
)
set
(
onnxruntime_HASH
"SHA256=9fa57fa6f202a373599377ef75064ae568fda8da838632b26a86024c7378d306"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-osx-x86_64-static.cmake
查看文件 @
b3e05f6
...
...
@@ -13,7 +13,7 @@ if(BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-osx-x86_64-static_lib-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-osx-x86_64-static_lib-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-osx-x86_64-static_lib-1.17.1.zip"
)
set
(
onnxruntime_HASH
"SHA256=5ff8efb97e50e257943c6c588328d2c57b649278098d3b468036f02755b60903"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-osx-x86_64.cmake
查看文件 @
b3e05f6
...
...
@@ -13,7 +13,7 @@ if(NOT BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-osx-x86_64-1.17.1.tgz"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1
/onnxruntime-osx-x86_64-1.17.1.tgz"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-osx-x86_64-1.17.1.tgz"
)
set
(
onnxruntime_HASH
"SHA256=86c6b6896434084ff5086eebc4e9ea90be1ed4d46743f92864f46ee43e7b5059"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-wasm-simd.cmake
查看文件 @
b3e05f6
...
...
@@ -11,7 +11,7 @@ if(BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-wasm-static_lib-simd-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-wasm-static_lib-simd-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-wasm-static_lib-simd-1.17.1.zip"
)
set
(
onnxruntime_HASH
"SHA256=8f07778e4233cf5a61a9d0795d90c5497177fbe8a46b701fda2d8d4e2b11cef8"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-win-arm64.cmake
查看文件 @
b3e05f6
...
...
@@ -16,7 +16,7 @@ if(NOT BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-arm64-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1
/onnxruntime-win-arm64-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-win-arm64-1.17.1.zip"
)
set
(
onnxruntime_HASH
"SHA256=47782cebcab0fd7a1f0a3f0676b088c1bc0f4fbf21666f6fe57570dc362fa5a8"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-win-x64-directml.cmake
查看文件 @
b3e05f6
...
...
@@ -20,7 +20,7 @@ if(NOT SHERPA_ONNX_ENABLE_DIRECTML)
endif
()
set
(
onnxruntime_URL
"https://globalcdn.nuget.org/packages/microsoft.ml.onnxruntime.directml.1.14.1.nupkg"
)
set
(
onnxruntime_URL2
"https://h
uggingface.co
/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/microsoft.ml.onnxruntime.directml.1.14.1.nupkg"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com
/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/microsoft.ml.onnxruntime.directml.1.14.1.nupkg"
)
set
(
onnxruntime_HASH
"SHA256=c8ae7623385b19cd5de968d0df5383e13b97d1b3a6771c9177eac15b56013a5a"
)
# 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.*")
message
(
STATUS
"DirectML lib files:
${
directml_lib_files
}
"
)
install
(
FILES
${
directml_lib_files
}
DESTINATION lib
)
install
(
FILES
${
directml_lib_files
}
DESTINATION bin
)
\ No newline at end of file
install
(
FILES
${
directml_lib_files
}
DESTINATION bin
)
...
...
cmake/onnxruntime-win-x64-gpu.cmake
查看文件 @
b3e05f6
...
...
@@ -20,7 +20,7 @@ if(NOT SHERPA_ONNX_ENABLE_GPU)
endif
()
set
(
onnxruntime_URL
"https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-x64-gpu-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1
/onnxruntime-win-x64-gpu-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-win-x64-gpu-1.17.1.zip"
)
set
(
onnxruntime_HASH
"SHA256=b7a66f50ad146c2ccb43471d2d3b5ad78084c2d4ddbd3ea82d65f86c867408b2"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-win-x64-static-debug.cmake
查看文件 @
b3e05f6
...
...
@@ -16,7 +16,7 @@ if(BUILD_SHARED_LIBS)
endif
()
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"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-win-x64-static_lib-
${
CMAKE_BUILD_TYPE
}
-1.17.1.tar.bz2"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-win-x64-static_lib-
${
CMAKE_BUILD_TYPE
}
-1.17.1.tar.bz2"
)
if
(
CMAKE_BUILD_TYPE STREQUAL Debug
)
set
(
onnxruntime_HASH
"SHA256=ecc68d914541c3b6ebc36148af63fe2a6af0f4f955b35199d612698d23169fa5"
)
elseif
(
CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo
)
...
...
cmake/onnxruntime-win-x64-static.cmake
查看文件 @
b3e05f6
...
...
@@ -20,7 +20,7 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL Release)
endif
()
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x64-static_lib-1.17.1.tar.bz2"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-win-x64-static_lib-1.17.1.tar.bz2"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-win-x64-static_lib-1.17.1.tar.bz2"
)
set
(
onnxruntime_HASH
"SHA256=42a0c02fda945d1d72433b2a7cdb2187d51cb4d7f3af462c6ae07b25314d5fb3"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-win-x64.cmake
查看文件 @
b3e05f6
...
...
@@ -16,7 +16,7 @@ if(NOT BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-x64-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1
/onnxruntime-win-x64-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-win-x64-1.17.1.zip"
)
set
(
onnxruntime_HASH
"SHA256=4802af9598db02153d7da39432a48823ff69b2fb4b59155461937f20782aa91c"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-win-x86-static-debug.cmake
查看文件 @
b3e05f6
...
...
@@ -17,7 +17,7 @@ endif()
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"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-win-x86-static_lib-
${
CMAKE_BUILD_TYPE
}
-1.17.1.tar.bz2"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-win-x86-static_lib-
${
CMAKE_BUILD_TYPE
}
-1.17.1.tar.bz2"
)
if
(
CMAKE_BUILD_TYPE STREQUAL Debug
)
set
(
onnxruntime_HASH
"SHA256=b08b223fe09a5640472eec487ff42e4df6bf726e8aba9de40f443a1fabea3334"
)
elseif
(
CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo
)
...
...
cmake/onnxruntime-win-x86-static.cmake
查看文件 @
b3e05f6
...
...
@@ -20,7 +20,7 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL Release)
endif
()
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.1/onnxruntime-win-x86-static_lib-1.17.1.tar.bz2"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.17.1
/onnxruntime-win-x86-static_lib-1.17.1.tar.bz2"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-win-x86-static_lib-1.17.1.tar.bz2"
)
set
(
onnxruntime_HASH
"SHA256=52375d3fabc7b437c955a664bfeb9cb7a6391f5219c4b7d3b87ff690416d4b9e"
)
# If you don't have access to the Internet,
...
...
cmake/onnxruntime-win-x86.cmake
查看文件 @
b3e05f6
...
...
@@ -16,7 +16,7 @@ if(NOT BUILD_SHARED_LIBS)
endif
()
set
(
onnxruntime_URL
"https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-win-x86-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
ub.nuaa.cf/microsoft/onnxruntime/releases/download/v1.17.1
/onnxruntime-win-x86-1.17.1.zip"
)
set
(
onnxruntime_URL2
"https://h
f-mirror.com/csukuangfj/onnxruntime-libs/resolve/main
/onnxruntime-win-x86-1.17.1.zip"
)
set
(
onnxruntime_HASH
"SHA256=9404130825474bd36b2538ed925d6b5f2cf1fb6a443f3e125054ae3470019291"
)
# If you don't have access to the Internet,
...
...
cmake/openfst.cmake
查看文件 @
b3e05f6
...
...
@@ -4,7 +4,7 @@ function(download_openfst)
include
(
FetchContent
)
set
(
openfst_URL
"https://github.com/csukuangfj/openfst/archive/refs/tags/sherpa-onnx-2024-06-19.tar.gz"
)
set
(
openfst_URL2
"https://h
ub.nuaa.cf/csukuangfj/openfst/archive/refs/tags/
sherpa-onnx-2024-06-19.tar.gz"
)
set
(
openfst_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/openfst-
sherpa-onnx-2024-06-19.tar.gz"
)
set
(
openfst_HASH
"SHA256=5c98e82cc509c5618502dde4860b8ea04d843850ed57e6d6b590b644b268853d"
)
# If you don't have access to the Internet,
...
...
cmake/piper-phonemize.cmake
查看文件 @
b3e05f6
...
...
@@ -2,7 +2,7 @@ function(download_piper_phonemize)
include
(
FetchContent
)
set
(
piper_phonemize_URL
"https://github.com/csukuangfj/piper-phonemize/archive/dc6b5f4441bffe521047086930b0fc12686acd56.zip"
)
set
(
piper_phonemize_URL2
"https://h
ub.nuaa.cf/csukuangfj/piper-phonemize/archive/
dc6b5f4441bffe521047086930b0fc12686acd56.zip"
)
set
(
piper_phonemize_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/piper-phonemize-
dc6b5f4441bffe521047086930b0fc12686acd56.zip"
)
set
(
piper_phonemize_HASH
"SHA256=b9faa04204b1756fa455a962abb1f037041c040133d55be58d11f11ab9b3ce14"
)
# If you don't have access to the Internet,
...
...
cmake/pybind11.cmake
查看文件 @
b3e05f6
...
...
@@ -2,7 +2,7 @@ function(download_pybind11)
include
(
FetchContent
)
set
(
pybind11_URL
"https://github.com/pybind/pybind11/archive/refs/tags/v2.10.2.tar.gz"
)
set
(
pybind11_URL2
"https://h
ub.nuaa.cf/pybind/pybind11/archive/refs/tags/v
2.10.2.tar.gz"
)
set
(
pybind11_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/pybind11-
2.10.2.tar.gz"
)
set
(
pybind11_HASH
"SHA256=93bd1e625e43e03028a3ea7389bba5d3f9f2596abc074b068e70f4ef9b1314ae"
)
# If you don't have access to the Internet,
...
...
cmake/simple-sentencepiece.cmake
查看文件 @
b3e05f6
...
...
@@ -2,7 +2,7 @@ function(download_simple_sentencepiece)
include
(
FetchContent
)
set
(
simple-sentencepiece_URL
"https://github.com/pkufool/simple-sentencepiece/archive/refs/tags/v0.7.tar.gz"
)
set
(
simple-sentencepiece_URL2
"https://h
ub.nuaa.cf/pkufool/simple-sentencepiece/archive/refs/tags/v
0.7.tar.gz"
)
set
(
simple-sentencepiece_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/simple-sentencepiece-
0.7.tar.gz"
)
set
(
simple-sentencepiece_HASH
"SHA256=1748a822060a35baa9f6609f84efc8eb54dc0e74b9ece3d82367b7119fdc75af"
)
# If you don't have access to the Internet,
...
...
cmake/websocketpp.cmake
查看文件 @
b3e05f6
...
...
@@ -3,7 +3,7 @@ function(download_websocketpp)
# The latest commit on the develop branch os as 2022-10-22
set
(
websocketpp_URL
"https://github.com/zaphoyd/websocketpp/archive/b9aeec6eaf3d5610503439b4fae3581d9aff08e8.zip"
)
set
(
websocketpp_URL2
"https://h
ub.nuaa.cf/zaphoyd/websocketpp/archive/
b9aeec6eaf3d5610503439b4fae3581d9aff08e8.zip"
)
set
(
websocketpp_URL2
"https://h
f-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/websocketpp-
b9aeec6eaf3d5610503439b4fae3581d9aff08e8.zip"
)
set
(
websocketpp_HASH
"SHA256=1385135ede8191a7fbef9ec8099e3c5a673d48df0c143958216cd1690567f583"
)
# If you don't have access to the Internet,
...
...
ffmpeg-examples/sherpa-onnx-ffmpeg.c
查看文件 @
b3e05f6
...
...
@@ -214,8 +214,8 @@ end:
}
static
void
sherpa_decode_frame
(
const
AVFrame
*
frame
,
SherpaOnnxOnlineRecognizer
*
recognizer
,
SherpaOnnxOnlineStream
*
stream
,
const
SherpaOnnxOnlineRecognizer
*
recognizer
,
const
SherpaOnnxOnlineStream
*
stream
,
const
SherpaOnnxDisplay
*
display
,
int32_t
*
segment_id
)
{
#define N 3200 // 100s. Sample rate is fixed to 16 kHz
...
...
scripts/node-addon-api/src/non-streaming-asr.cc
查看文件 @
b3e05f6
...
...
@@ -340,7 +340,7 @@ static Napi::External<SherpaOnnxOfflineStream> CreateOfflineStreamWrapper(
SherpaOnnxCreateOfflineStream
(
recognizer
);
return
Napi
::
External
<
SherpaOnnxOfflineStream
>::
New
(
env
,
const_cast
<
SherpaOnnxOfflineStream
>
(
stream
),
env
,
const_cast
<
SherpaOnnxOfflineStream
*
>
(
stream
),
[](
Napi
::
Env
env
,
SherpaOnnxOfflineStream
*
stream
)
{
SherpaOnnxDestroyOfflineStream
(
stream
);
});
...
...
scripts/node-addon-api/src/streaming-asr.cc
查看文件 @
b3e05f6
...
...
@@ -312,10 +312,12 @@ static Napi::External<SherpaOnnxOnlineStream> CreateOnlineStreamWrapper(
SherpaOnnxOnlineRecognizer
*
recognizer
=
info
[
0
].
As
<
Napi
::
External
<
SherpaOnnxOnlineRecognizer
>>
().
Data
();
SherpaOnnxOnlineStream
*
stream
=
SherpaOnnxCreateOnlineStream
(
recognizer
);
const
SherpaOnnxOnlineStream
*
stream
=
SherpaOnnxCreateOnlineStream
(
recognizer
);
return
Napi
::
External
<
SherpaOnnxOnlineStream
>::
New
(
env
,
stream
,
[](
Napi
::
Env
env
,
SherpaOnnxOnlineStream
*
stream
)
{
env
,
const_cast
<
SherpaOnnxOnlineStream
*>
(
stream
),
[](
Napi
::
Env
env
,
SherpaOnnxOnlineStream
*
stream
)
{
SherpaOnnxDestroyOnlineStream
(
stream
);
});
}
...
...
sherpa-onnx/c-api/cxx-api.h
查看文件 @
b3e05f6
...
...
@@ -16,22 +16,22 @@ namespace sherpa_onnx::cxx {
// ============================================================================
// Streaming ASR
// ============================================================================
struct
SHERPA_ONNX_API
OnlineTransducerModelConfig
{
struct
OnlineTransducerModelConfig
{
std
::
string
encoder
;
std
::
string
decoder
;
std
::
string
joiner
;
};
struct
SHERPA_ONNX_API
OnlineParaformerModelConfig
{
struct
OnlineParaformerModelConfig
{
std
::
string
encoder
;
std
::
string
decoder
;
};
struct
SHERPA_ONNX_API
OnlineZipformer2CtcModelConfig
{
struct
OnlineZipformer2CtcModelConfig
{
std
::
string
model
;
};
struct
SHERPA_ONNX_API
OnlineModelConfig
{
struct
OnlineModelConfig
{
OnlineTransducerModelConfig
transducer
;
OnlineParaformerModelConfig
paraformer
;
OnlineZipformer2CtcModelConfig
zipformer2_ctc
;
...
...
@@ -45,17 +45,17 @@ struct SHERPA_ONNX_API OnlineModelConfig {
std
::
string
tokens_buf
;
};
struct
SHERPA_ONNX_API
FeatureConfig
{
struct
FeatureConfig
{
int32_t
sample_rate
=
16000
;
int32_t
feature_dim
=
80
;
};
struct
SHERPA_ONNX_API
OnlineCtcFstDecoderConfig
{
struct
OnlineCtcFstDecoderConfig
{
std
::
string
graph
;
int32_t
max_active
=
3000
;
};
struct
SHERPA_ONNX_API
OnlineRecognizerConfig
{
struct
OnlineRecognizerConfig
{
FeatureConfig
feat_config
;
OnlineModelConfig
model_config
;
...
...
@@ -83,14 +83,14 @@ struct SHERPA_ONNX_API OnlineRecognizerConfig {
std
::
string
hotwords_buf
;
};
struct
SHERPA_ONNX_API
OnlineRecognizerResult
{
struct
OnlineRecognizerResult
{
std
::
string
text
;
std
::
vector
<
std
::
string
>
tokens
;
std
::
vector
<
float
>
timestamps
;
std
::
string
json
;
};
struct
SHERPA_ONNX_API
Wave
{
struct
Wave
{
std
::
vector
<
float
>
samples
;
int32_t
sample_rate
;
};
...
...
@@ -118,6 +118,8 @@ class SHERPA_ONNX_API MoveOnly {
Destroy
();
p_
=
other
.
Release
();
return
*
this
;
}
const
T
*
Get
()
const
{
return
p_
;
}
...
...
sherpa-onnx/csrc/CMakeLists.txt
查看文件 @
b3e05f6
...
...
@@ -18,6 +18,7 @@ set(sources
endpoint.cc
features.cc
file-utils.cc
fst-utils.cc
hypothesis.cc
keyword-spotter-impl.cc
keyword-spotter.cc
...
...
sherpa-onnx/csrc/fst-utils.cc
0 → 100644
查看文件 @
b3e05f6
// sherpa-onnx/csrc/fst-utils.cc
//
// Copyright (c) 2024 Xiaomi Corporation
#include "sherpa-onnx/csrc/fst-utils.h"
#include "sherpa-onnx/csrc/macros.h"
namespace
sherpa_onnx
{
// This function is copied from kaldi.
//
// @param filename Path to a StdVectorFst or StdConstFst graph
// @return The caller should free the returned pointer using `delete` to
// avoid memory leak.
fst
::
Fst
<
fst
::
StdArc
>
*
ReadGraph
(
const
std
::
string
&
filename
)
{
// read decoding network FST
std
::
ifstream
is
(
filename
,
std
::
ios
::
binary
);
if
(
!
is
.
good
())
{
SHERPA_ONNX_LOGE
(
"Could not open decoding-graph FST %s"
,
filename
.
c_str
());
}
fst
::
FstHeader
hdr
;
if
(
!
hdr
.
Read
(
is
,
"<unknown>"
))
{
SHERPA_ONNX_LOGE
(
"Reading FST: error reading FST header."
);
}
if
(
hdr
.
ArcType
()
!=
fst
::
StdArc
::
Type
())
{
SHERPA_ONNX_LOGE
(
"FST with arc type %s not supported"
,
hdr
.
ArcType
().
c_str
());
}
fst
::
FstReadOptions
ropts
(
"<unspecified>"
,
&
hdr
);
fst
::
Fst
<
fst
::
StdArc
>
*
decode_fst
=
nullptr
;
if
(
hdr
.
FstType
()
==
"vector"
)
{
decode_fst
=
fst
::
VectorFst
<
fst
::
StdArc
>::
Read
(
is
,
ropts
);
}
else
if
(
hdr
.
FstType
()
==
"const"
)
{
decode_fst
=
fst
::
ConstFst
<
fst
::
StdArc
>::
Read
(
is
,
ropts
);
}
else
{
SHERPA_ONNX_LOGE
(
"Reading FST: unsupported FST type: %s"
,
hdr
.
FstType
().
c_str
());
}
if
(
decode_fst
==
nullptr
)
{
// fst code will warn.
SHERPA_ONNX_LOGE
(
"Error reading FST (after reading header)."
);
return
nullptr
;
}
else
{
return
decode_fst
;
}
}
}
// namespace sherpa_onnx
...
...
sherpa-onnx/csrc/fst-utils.h
0 → 100644
查看文件 @
b3e05f6
// sherpa-onnx/csrc/fst-utils.h
//
// Copyright (c) 2024 Xiaomi Corporation
#ifndef SHERPA_ONNX_CSRC_FST_UTILS_H_
#define SHERPA_ONNX_CSRC_FST_UTILS_H_
#include <string>
#include "fst/fstlib.h"
namespace
sherpa_onnx
{
fst
::
Fst
<
fst
::
StdArc
>
*
ReadGraph
(
const
std
::
string
&
filename
);
}
#endif // SHERPA_ONNX_CSRC_FST_UTILS_H_
...
...
sherpa-onnx/csrc/jieba-lexicon.cc
查看文件 @
b3e05f6
...
...
@@ -10,18 +10,12 @@
#include "cppjieba/Jieba.hpp"
#include "sherpa-onnx/csrc/file-utils.h"
#include "sherpa-onnx/csrc/lexicon.h"
#include "sherpa-onnx/csrc/macros.h"
#include "sherpa-onnx/csrc/text-utils.h"
namespace
sherpa_onnx
{
// implemented in ./lexicon.cc
std
::
unordered_map
<
std
::
string
,
int32_t
>
ReadTokens
(
std
::
istream
&
is
);
std
::
vector
<
int32_t
>
ConvertTokensToIds
(
const
std
::
unordered_map
<
std
::
string
,
int32_t
>
&
token2id
,
const
std
::
vector
<
std
::
string
>
&
tokens
);
class
JiebaLexicon
::
Impl
{
public
:
Impl
(
const
std
::
string
&
lexicon
,
const
std
::
string
&
tokens
,
...
...
sherpa-onnx/csrc/lexicon.h
查看文件 @
b3e05f6
...
...
@@ -6,6 +6,7 @@
#define SHERPA_ONNX_CSRC_LEXICON_H_
#include <cstdint>
#include <istream>
#include <memory>
#include <string>
#include <unordered_map>
...
...
@@ -66,6 +67,12 @@ class Lexicon : public OfflineTtsFrontend {
bool
debug_
=
false
;
};
std
::
unordered_map
<
std
::
string
,
int32_t
>
ReadTokens
(
std
::
istream
&
is
);
std
::
vector
<
int32_t
>
ConvertTokensToIds
(
const
std
::
unordered_map
<
std
::
string
,
int32_t
>
&
token2id
,
const
std
::
vector
<
std
::
string
>
&
tokens
);
}
// namespace sherpa_onnx
#endif // SHERPA_ONNX_CSRC_LEXICON_H_
...
...
sherpa-onnx/csrc/melo-tts-lexicon.cc
查看文件 @
b3e05f6
...
...
@@ -10,18 +10,12 @@
#include "cppjieba/Jieba.hpp"
#include "sherpa-onnx/csrc/file-utils.h"
#include "sherpa-onnx/csrc/lexicon.h"
#include "sherpa-onnx/csrc/macros.h"
#include "sherpa-onnx/csrc/text-utils.h"
namespace
sherpa_onnx
{
// implemented in ./lexicon.cc
std
::
unordered_map
<
std
::
string
,
int32_t
>
ReadTokens
(
std
::
istream
&
is
);
std
::
vector
<
int32_t
>
ConvertTokensToIds
(
const
std
::
unordered_map
<
std
::
string
,
int32_t
>
&
token2id
,
const
std
::
vector
<
std
::
string
>
&
tokens
);
class
MeloTtsLexicon
::
Impl
{
public
:
Impl
(
const
std
::
string
&
lexicon
,
const
std
::
string
&
tokens
,
...
...
sherpa-onnx/csrc/offline-ctc-fst-decoder.cc
查看文件 @
b3e05f6
...
...
@@ -11,52 +11,11 @@
#include "kaldi-decoder/csrc/decodable-ctc.h"
#include "kaldi-decoder/csrc/eigen.h"
#include "kaldi-decoder/csrc/faster-decoder.h"
#include "sherpa-onnx/csrc/fst-utils.h"
#include "sherpa-onnx/csrc/macros.h"
namespace
sherpa_onnx
{
// This function is copied from kaldi.
//
// @param filename Path to a StdVectorFst or StdConstFst graph
// @return The caller should free the returned pointer using `delete` to
// avoid memory leak.
fst
::
Fst
<
fst
::
StdArc
>
*
ReadGraph
(
const
std
::
string
&
filename
)
{
// read decoding network FST
std
::
ifstream
is
(
filename
,
std
::
ios
::
binary
);
if
(
!
is
.
good
())
{
SHERPA_ONNX_LOGE
(
"Could not open decoding-graph FST %s"
,
filename
.
c_str
());
}
fst
::
FstHeader
hdr
;
if
(
!
hdr
.
Read
(
is
,
"<unknown>"
))
{
SHERPA_ONNX_LOGE
(
"Reading FST: error reading FST header."
);
}
if
(
hdr
.
ArcType
()
!=
fst
::
StdArc
::
Type
())
{
SHERPA_ONNX_LOGE
(
"FST with arc type %s not supported"
,
hdr
.
ArcType
().
c_str
());
}
fst
::
FstReadOptions
ropts
(
"<unspecified>"
,
&
hdr
);
fst
::
Fst
<
fst
::
StdArc
>
*
decode_fst
=
nullptr
;
if
(
hdr
.
FstType
()
==
"vector"
)
{
decode_fst
=
fst
::
VectorFst
<
fst
::
StdArc
>::
Read
(
is
,
ropts
);
}
else
if
(
hdr
.
FstType
()
==
"const"
)
{
decode_fst
=
fst
::
ConstFst
<
fst
::
StdArc
>::
Read
(
is
,
ropts
);
}
else
{
SHERPA_ONNX_LOGE
(
"Reading FST: unsupported FST type: %s"
,
hdr
.
FstType
().
c_str
());
}
if
(
decode_fst
==
nullptr
)
{
// fst code will warn.
SHERPA_ONNX_LOGE
(
"Error reading FST (after reading header)."
);
return
nullptr
;
}
else
{
return
decode_fst
;
}
}
/**
* @param decoder
* @param p Pointer to a 2-d array of shape (num_frames, vocab_size)
...
...
sherpa-onnx/csrc/offline-speaker-diarization-result.cc
查看文件 @
b3e05f6
...
...
@@ -5,6 +5,7 @@
#include "sherpa-onnx/csrc/offline-speaker-diarization-result.h"
#include <algorithm>
#include <array>
#include <sstream>
#include <string>
#include <unordered_set>
...
...
@@ -48,11 +49,13 @@ OfflineSpeakerDiarizationSegment::Merge(
}
std
::
string
OfflineSpeakerDiarizationSegment
::
ToString
()
const
{
char
s
[
128
];
snprintf
(
s
,
sizeof
(
s
),
"%.3f -- %.3f speaker_%02d"
,
start_
,
end_
,
speaker_
);
std
::
array
<
char
,
128
>
s
{};
snprintf
(
s
.
data
(),
s
.
size
(),
"%.3f -- %.3f speaker_%02d"
,
start_
,
end_
,
speaker_
);
std
::
ostringstream
os
;
os
<<
s
;
os
<<
s
.
data
()
;
if
(
!
text_
.
empty
())
{
os
<<
" "
<<
text_
;
...
...
sherpa-onnx/csrc/offline-speaker-diarization.cc
查看文件 @
b3e05f6
...
...
@@ -5,6 +5,7 @@
#include "sherpa-onnx/csrc/offline-speaker-diarization.h"
#include <string>
#include <utility>
#include "sherpa-onnx/csrc/offline-speaker-diarization-impl.h"
...
...
@@ -94,7 +95,7 @@ OfflineSpeakerDiarizationResult OfflineSpeakerDiarization::Process(
const
float
*
audio
,
int32_t
n
,
OfflineSpeakerDiarizationProgressCallback
callback
/*= nullptr*/
,
void
*
callback_arg
/*= nullptr*/
)
const
{
return
impl_
->
Process
(
audio
,
n
,
callback
,
callback_arg
);
return
impl_
->
Process
(
audio
,
n
,
std
::
move
(
callback
)
,
callback_arg
);
}
}
// namespace sherpa_onnx
...
...
sherpa-onnx/csrc/online-ctc-fst-decoder.cc
查看文件 @
b3e05f6
...
...
@@ -13,14 +13,12 @@
#include "fst/fstlib.h"
#include "kaldi-decoder/csrc/decodable-ctc.h"
#include "kaldifst/csrc/fstext-utils.h"
#include "sherpa-onnx/csrc/fst-utils.h"
#include "sherpa-onnx/csrc/macros.h"
#include "sherpa-onnx/csrc/online-stream.h"
namespace
sherpa_onnx
{
// defined in ./offline-ctc-fst-decoder.cc
fst
::
Fst
<
fst
::
StdArc
>
*
ReadGraph
(
const
std
::
string
&
filename
);
OnlineCtcFstDecoder
::
OnlineCtcFstDecoder
(
const
OnlineCtcFstDecoderConfig
&
config
,
int32_t
blank_id
)
:
config_
(
config
),
fst_
(
ReadGraph
(
config
.
graph
)),
blank_id_
(
blank_id
)
{
...
...
sherpa-onnx/csrc/online-recognizer.cc
查看文件 @
b3e05f6
...
...
@@ -19,6 +19,8 @@
namespace
sherpa_onnx
{
namespace
{
/// Helper for `OnlineRecognizerResult::AsJsonString()`
template
<
typename
T
>
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,
return
oss
.
str
();
}
}
// namespace
std
::
string
OnlineRecognizerResult
::
AsJsonString
()
const
{
std
::
ostringstream
os
;
os
<<
"{ "
;
...
...
请
注册
或
登录
后发表评论