From cf199ad4664569529912b4a082ca8bdc2224adf6 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Thu, 21 Sep 2023 20:39:24 +0800 Subject: [PATCH] Support onnxruntime 1.16.0 (#330) --- .github/workflows/apk.yaml | 1 + .github/workflows/arm-linux-gnueabihf.yaml | 10 +++++----- .github/workflows/export-whisper-to-onnx.yaml | 2 +- CMakeLists.txt | 2 +- build-android-arm64-v8a.sh | 2 +- build-android-armv7-eabi.sh | 2 +- build-android-x86-64.sh | 2 +- build-android-x86.sh | 2 +- build-arm-linux-gnueabihf.sh | 6 ++++++ build-ios.sh | 11 ++++++++--- cmake/onnxruntime-linux-aarch64.cmake | 16 ++++++++-------- cmake/onnxruntime-linux-arm.cmake | 16 ++++++++-------- cmake/onnxruntime-linux-x86_64-gpu.cmake | 16 ++++++++-------- cmake/onnxruntime-linux-x86_64-static.cmake | 19 ++++++++----------- cmake/onnxruntime-linux-x86_64.cmake | 16 ++++++++-------- cmake/onnxruntime-osx-arm64.cmake | 14 +++++++------- cmake/onnxruntime-osx-universal.cmake | 14 +++++++------- cmake/onnxruntime-osx-x86_64.cmake | 14 +++++++------- cmake/onnxruntime-win-x64-gpu.cmake | 14 +++++++------- cmake/onnxruntime-win-x64-static.cmake | 12 ++++++------ cmake/onnxruntime-win-x64.cmake | 14 +++++++------- cmake/onnxruntime-win-x86-static.cmake | 12 ++++++------ cmake/onnxruntime-win-x86.cmake | 14 +++++++------- .../SherpaOnnx.xcodeproj/project.pbxproj | 2 +- .../SherpaOnnx2Pass.xcodeproj/project.pbxproj | 2 +- scripts/dotnet/generate.py | 4 ++-- sherpa-onnx/c-api/c-api.h | 19 +++++++++++++++---- 27 files changed, 139 insertions(+), 119 deletions(-) diff --git a/.github/workflows/apk.yaml b/.github/workflows/apk.yaml index 197d03fde..a03420bc2 100644 --- a/.github/workflows/apk.yaml +++ b/.github/workflows/apk.yaml @@ -55,3 +55,4 @@ jobs: with: file_glob: true file: apks/*.apk + overwrite: true diff --git a/.github/workflows/arm-linux-gnueabihf.yaml b/.github/workflows/arm-linux-gnueabihf.yaml index 6d6834c25..ff74f8bcd 100644 --- a/.github/workflows/arm-linux-gnueabihf.yaml +++ b/.github/workflows/arm-linux-gnueabihf.yaml @@ -76,7 +76,7 @@ jobs: uses: actions/cache@v3 with: path: toolchain - key: gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf + key: gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf - name: Download toolchain if: steps.cache-toolchain.outputs.cache-hit != 'true' @@ -87,19 +87,19 @@ jobs: ls -lh arm-linux-gcc mkdir $GITHUB_WORKSPACE/toolchain - tar xvf ./arm-linux-gcc/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz --strip-components 1 -C $GITHUB_WORKSPACE/toolchain + tar xvf ./arm-linux-gcc/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz --strip-components 1 -C $GITHUB_WORKSPACE/toolchain - name: Display toolchain info shell: bash run: | export PATH=$GITHUB_WORKSPACE/toolchain/bin:$PATH - arm-linux-gnueabihf-gcc --version + arm-none-linux-gnueabihf-gcc --version - name: Display qemu-arm -h shell: bash run: | export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH - export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/arm-linux-gnueabihf/libc + export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/arm-none-linux-gnueabihf/libc qemu-arm -h - name: build arm-linux-gnueabihf @@ -119,7 +119,7 @@ jobs: run: | export PATH=$GITHUB_WORKSPACE/toolchain/bin:$PATH export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH - export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/arm-linux-gnueabihf/libc + export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/arm-none-linux-gnueabihf/libc ls -lh ./build-arm-linux-gnueabihf/bin diff --git a/.github/workflows/export-whisper-to-onnx.yaml b/.github/workflows/export-whisper-to-onnx.yaml index 6b7664d53..4d6f9531d 100644 --- a/.github/workflows/export-whisper-to-onnx.yaml +++ b/.github/workflows/export-whisper-to-onnx.yaml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies shell: bash run: | - python3 -m pip install openai-whisper torch onnxruntime==1.15.1 onnx + python3 -m pip install openai-whisper torch onnxruntime onnx - name: export ${{ matrix.model }} shell: bash diff --git a/CMakeLists.txt b/CMakeLists.txt index 833e5c206..86f0a29d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) project(sherpa-onnx) -set(SHERPA_ONNX_VERSION "1.7.16") +set(SHERPA_ONNX_VERSION "1.7.17") # Disable warning about # diff --git a/build-android-arm64-v8a.sh b/build-android-arm64-v8a.sh index 5cb071cdf..567405ad4 100755 --- a/build-android-arm64-v8a.sh +++ b/build-android-arm64-v8a.sh @@ -42,7 +42,7 @@ fi echo "ANDROID_NDK: $ANDROID_NDK" sleep 1 -onnxruntime_version=v1.15.1 +onnxruntime_version=v1.16.0 if [ ! -f ./android-onnxruntime-libs/$onnxruntime_version/jni/arm64-v8a/libonnxruntime.so ]; then GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/android-onnxruntime-libs diff --git a/build-android-armv7-eabi.sh b/build-android-armv7-eabi.sh index 6b712f45e..b20168fed 100755 --- a/build-android-armv7-eabi.sh +++ b/build-android-armv7-eabi.sh @@ -43,7 +43,7 @@ fi echo "ANDROID_NDK: $ANDROID_NDK" sleep 1 -onnxruntime_version=v1.15.1 +onnxruntime_version=v1.16.0 if [ ! -f ./android-onnxruntime-libs/$onnxruntime_version/jni/armeabi-v7a/libonnxruntime.so ]; then GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/android-onnxruntime-libs diff --git a/build-android-x86-64.sh b/build-android-x86-64.sh index a2aea0694..dbb545f00 100755 --- a/build-android-x86-64.sh +++ b/build-android-x86-64.sh @@ -43,7 +43,7 @@ fi echo "ANDROID_NDK: $ANDROID_NDK" sleep 1 -onnxruntime_version=v1.15.1 +onnxruntime_version=v1.16.0 if [ ! -f ./android-onnxruntime-libs/$onnxruntime_version/jni/x86_64/libonnxruntime.so ]; then GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/android-onnxruntime-libs diff --git a/build-android-x86.sh b/build-android-x86.sh index 620786423..7fc126d92 100755 --- a/build-android-x86.sh +++ b/build-android-x86.sh @@ -43,7 +43,7 @@ fi echo "ANDROID_NDK: $ANDROID_NDK" sleep 1 -onnxruntime_version=v1.15.1 +onnxruntime_version=v1.16.0 if [ ! -f ./android-onnxruntime-libs/$onnxruntime_version/jni/x86/libonnxruntime.so ]; then GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/android-onnxruntime-libs diff --git a/build-arm-linux-gnueabihf.sh b/build-arm-linux-gnueabihf.sh index 305cf3cea..544253b55 100755 --- a/build-arm-linux-gnueabihf.sh +++ b/build-arm-linux-gnueabihf.sh @@ -1,5 +1,11 @@ #!/usr/bin/env bash +if command -v arm-none-linux-gnueabihf-gcc &> /dev/null; then + ln -svf $(which arm-none-linux-gnueabihf-gcc) ./arm-linux-gnueabihf-gcc + ln -svf $(which arm-none-linux-gnueabihf-g++) ./arm-linux-gnueabihf-g++ + export PATH=$PWD:$PATH +fi + if ! command -v arm-linux-gnueabihf-gcc &> /dev/null; then echo "Please install a toolchain for cross-compiling." echo "You can refer to: " diff --git a/build-ios.sh b/build-ios.sh index d5dd2515a..855b92dd6 100755 --- a/build-ios.sh +++ b/build-ios.sh @@ -5,12 +5,17 @@ set -e dir=build-ios mkdir -p $dir cd $dir -onnxruntime_version=1.15.1 +onnxruntime_version=1.16.0 if [ ! -f ios-onnxruntime/$onnxruntime_version/onnxruntime.xcframework/ios-arm64/onnxruntime.a ]; then - GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/ios-onnxruntime + if [ ! -d ios-onnxruntime ]; then + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/ios-onnxruntime + fi + pushd ios-onnxruntime - ln -s $onnxruntime_version/onnxruntime.xcframework . + git pull + + ln -sf $onnxruntime_version/onnxruntime.xcframework . git lfs pull --include $onnxruntime_version/onnxruntime.xcframework/ios-arm64/onnxruntime.a git lfs pull --include $onnxruntime_version/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.a popd diff --git a/cmake/onnxruntime-linux-aarch64.cmake b/cmake/onnxruntime-linux-aarch64.cmake index 5911af45d..d721a77fe 100644 --- a/cmake/onnxruntime-linux-aarch64.cmake +++ b/cmake/onnxruntime-linux-aarch64.cmake @@ -10,19 +10,19 @@ if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64) message(FATAL_ERROR "This file is for aarch64 only. Given: ${CMAKE_SYSTEM_PROCESSOR}") endif() -set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.15.1/onnxruntime-linux-aarch64-1.15.1.tgz") -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-linux-aarch64-1.15.1.tgz") -set(onnxruntime_HASH "SHA256=85272e75d8dd841138de4b774a9672ea93c1be108d96038c6c34a62d7f976aee") +set(onnxruntime_URL "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-linux-aarch64-1.16.0.tgz") +set(onnxruntime_URL2 ) +set(onnxruntime_HASH "SHA256=8b15781d974803203c09df7d52c84d8c9f1ac7d949a97f515e4d2f5dc978d8af") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-linux-aarch64-1.15.1.tgz - ${PROJECT_SOURCE_DIR}/onnxruntime-linux-aarch64-1.15.1.tgz - ${PROJECT_BINARY_DIR}/onnxruntime-linux-aarch64-1.15.1.tgz - /tmp/onnxruntime-linux-aarch64-1.15.1.tgz - /star-fj/fangjun/download/github/onnxruntime-linux-aarch64-1.15.1.tgz + $ENV{HOME}/Downloads/onnxruntime-linux-aarch64-1.16.0.tgz + ${PROJECT_SOURCE_DIR}/onnxruntime-linux-aarch64-1.16.0.tgz + ${PROJECT_BINARY_DIR}/onnxruntime-linux-aarch64-1.16.0.tgz + /tmp/onnxruntime-linux-aarch64-1.16.0.tgz + /star-fj/fangjun/download/github/onnxruntime-linux-aarch64-1.16.0.tgz ) foreach(f IN LISTS possible_file_locations) diff --git a/cmake/onnxruntime-linux-arm.cmake b/cmake/onnxruntime-linux-arm.cmake index 81d903d96..9c4f70bc1 100644 --- a/cmake/onnxruntime-linux-arm.cmake +++ b/cmake/onnxruntime-linux-arm.cmake @@ -10,19 +10,19 @@ if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL arm) message(FATAL_ERROR "This file is for arm only. Given: ${CMAKE_SYSTEM_PROCESSOR}") endif() -set(onnxruntime_URL "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-linux-arm-1.15.1.zip") -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-linux-arm-1.15.1.zip") -set(onnxruntime_HASH "SHA256=867b96210a347e4b1bb949e7c9a3f222371ea0c00c9deaaba9fdd66c689f7fb7") +set(onnxruntime_URL "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-linux-arm-1.16.0.zip") +set(onnxruntime_URL2 ) +set(onnxruntime_HASH "SHA256=0a63ea99fbba3ee399d6626c36752844ae93ae19bab30e4bf00d45cc8a13da02") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-linux-arm-1.15.1.zip - ${PROJECT_SOURCE_DIR}/onnxruntime-linux-arm-1.15.1.zip - ${PROJECT_BINARY_DIR}/onnxruntime-linux-arm-1.15.1.zip - /tmp/onnxruntime-linux-arm-1.15.1.zip - /star-fj/fangjun/download/github/onnxruntime-linux-arm-1.15.1.zip + $ENV{HOME}/Downloads/onnxruntime-linux-arm-1.16.0.zip + ${PROJECT_SOURCE_DIR}/onnxruntime-linux-arm-1.16.0.zip + ${PROJECT_BINARY_DIR}/onnxruntime-linux-arm-1.16.0.zip + /tmp/onnxruntime-linux-arm-1.16.0.zip + /star-fj/fangjun/download/github/onnxruntime-linux-arm-1.16.0.zip ) foreach(f IN LISTS possible_file_locations) diff --git a/cmake/onnxruntime-linux-x86_64-gpu.cmake b/cmake/onnxruntime-linux-x86_64-gpu.cmake index 9039e2873..540e8a48e 100644 --- a/cmake/onnxruntime-linux-x86_64-gpu.cmake +++ b/cmake/onnxruntime-linux-x86_64-gpu.cmake @@ -18,19 +18,19 @@ if(NOT SHERPA_ONNX_ENABLE_GPU) message(FATAL_ERROR "This file is for NVIDIA GPU only. Given SHERPA_ONNX_ENABLE_GPU: ${SHERPA_ONNX_ENABLE_GPU}") endif() -set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.15.1/onnxruntime-linux-x64-gpu-1.15.1.tgz") -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-linux-x64-gpu-1.15.1.tgz") -set(onnxruntime_HASH "SHA256=eab891393025edd5818d1aa26a42860e5739fcc49e3ca3f876110ec8736fe7f1") +set(onnxruntime_URL "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-linux-x64-gpu-1.16.0.tgz") +set(onnxruntime_URL2 ) +set(onnxruntime_HASH "SHA256=f9cbf3d711f46d7e03ea43746ee9d1c7d8e82c171a4655f6591dd4d1ba1b9ec7") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-linux-x64-gpu-1.15.1.tgz - ${PROJECT_SOURCE_DIR}/onnxruntime-linux-x64-gpu-1.15.1.tgz - ${PROJECT_BINARY_DIR}/onnxruntime-linux-x64-gpu-1.15.1.tgz - /tmp/onnxruntime-linux-x64-gpu-1.15.1.tgz - /star-fj/fangjun/download/github/onnxruntime-linux-x64-gpu-1.15.1.tgz + $ENV{HOME}/Downloads/onnxruntime-linux-x64-gpu-1.16.0.tgz + ${PROJECT_SOURCE_DIR}/onnxruntime-linux-x64-gpu-1.16.0.tgz + ${PROJECT_BINARY_DIR}/onnxruntime-linux-x64-gpu-1.16.0.tgz + /tmp/onnxruntime-linux-x64-gpu-1.16.0.tgz + /star-fj/fangjun/download/github/onnxruntime-linux-x64-gpu-1.16.0.tgz ) foreach(f IN LISTS possible_file_locations) diff --git a/cmake/onnxruntime-linux-x86_64-static.cmake b/cmake/onnxruntime-linux-x86_64-static.cmake index 90045ad46..56012f1fb 100644 --- a/cmake/onnxruntime-linux-x86_64-static.cmake +++ b/cmake/onnxruntime-linux-x86_64-static.cmake @@ -14,22 +14,19 @@ if(BUILD_SHARED_LIBS) message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") endif() -# TODO(fangjun): update the URL -set(onnxruntime_URL "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-linux-x64-static_lib-1.15.1.tgz") -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-linux-x64-static_lib-1.15.1.tgz") -set(onnxruntime_HASH "SHA256=b64fcf4115e3d02193c7406461d582703ccc1f0c24ad320ef74b07e5f71681c6") +set(onnxruntime_URL "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-linux-x64-static_lib-1.16.0.tgz") +set(onnxruntime_URL2 ) +set(onnxruntime_HASH "SHA256=a36e989c9a07f12bf16f63acb2217b02a0cf4ac75aa7bc27de76ae08706a5c1f") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - ${PROJECT_SOURCE_DIR}/onnxruntime-linux-x64-static_lib-1.15.1.tgz - - $ENV{HOME}/Downloads/onnxruntime-linux-x64-static_lib-1.15.1.tgz - ${PROJECT_SOURCE_DIR}/onnxruntime-linux-x64-static_lib-1.15.1.tgz - ${PROJECT_BINARY_DIR}/onnxruntime-linux-x64-static_lib-1.15.1.tgz - /tmp/onnxruntime-linux-x64-static_lib-1.15.1.tgz - /star-fj/fangjun/download/github/onnxruntime-linux-x64-static_lib-1.15.1.tgz + $ENV{HOME}/Downloads/onnxruntime-linux-x64-static_lib-1.16.0.tgz + ${PROJECT_SOURCE_DIR}/onnxruntime-linux-x64-static_lib-1.16.0.tgz + ${PROJECT_BINARY_DIR}/onnxruntime-linux-x64-static_lib-1.16.0.tgz + /tmp/onnxruntime-linux-x64-static_lib-1.16.0.tgz + /star-fj/fangjun/download/github/onnxruntime-linux-x64-static_lib-1.16.0.tgz ) foreach(f IN LISTS possible_file_locations) diff --git a/cmake/onnxruntime-linux-x86_64.cmake b/cmake/onnxruntime-linux-x86_64.cmake index 9f34e06fe..e8a5abb5e 100644 --- a/cmake/onnxruntime-linux-x86_64.cmake +++ b/cmake/onnxruntime-linux-x86_64.cmake @@ -14,19 +14,19 @@ if(NOT BUILD_SHARED_LIBS) message(FATAL_ERROR "This file is for building shared libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") endif() -set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.15.1/onnxruntime-linux-x64-1.15.1.tgz") -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-linux-x64-1.15.1.tgz") -set(onnxruntime_HASH "SHA256=5492f9065f87538a286fb04c8542e9ff7950abb2ea6f8c24993a940006787d87") +set(onnxruntime_URL "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-linux-x64-1.16.0.tgz") +set(onnxruntime_URL2 ) +set(onnxruntime_HASH "SHA256=02bcd1e4fef295dacc3b232774efeaa0a83527f439f29147c3badade4df1f6dc") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-linux-x64-1.15.1.tgz - ${PROJECT_SOURCE_DIR}/onnxruntime-linux-x64-1.15.1.tgz - ${PROJECT_BINARY_DIR}/onnxruntime-linux-x64-1.15.1.tgz - /tmp/onnxruntime-linux-x64-1.15.1.tgz - /star-fj/fangjun/download/github/onnxruntime-linux-x64-1.15.1.tgz + $ENV{HOME}/Downloads/onnxruntime-linux-x64-1.16.0.tgz + ${PROJECT_SOURCE_DIR}/onnxruntime-linux-x64-1.16.0.tgz + ${PROJECT_BINARY_DIR}/onnxruntime-linux-x64-1.16.0.tgz + /tmp/onnxruntime-linux-x64-1.16.0.tgz + /star-fj/fangjun/download/github/onnxruntime-linux-x64-1.16.0.tgz ) foreach(f IN LISTS possible_file_locations) diff --git a/cmake/onnxruntime-osx-arm64.cmake b/cmake/onnxruntime-osx-arm64.cmake index 90c4f1190..689815c8c 100644 --- a/cmake/onnxruntime-osx-arm64.cmake +++ b/cmake/onnxruntime-osx-arm64.cmake @@ -8,18 +8,18 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) message(FATAL_ERROR "This file is for macOS only. Given: ${CMAKE_SYSTEM_NAME}") endif() -set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.15.1/onnxruntime-osx-arm64-1.15.1.tgz") -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-osx-arm64-1.15.1.tgz") -set(onnxruntime_HASH "SHA256=df97832fc7907c6677a6da437f92339d84a462becb74b1d65217fcb859ee9460") +set(onnxruntime_URL "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-osx-arm64-1.16.0.tgz") +set(onnxruntime_URL2 ) +set(onnxruntime_HASH "SHA256=fec3b70ca4f642a5c6d5c3a6f3a4eddd4c1b9281893fe2c7ae03a3086e20c316") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-osx-arm64-1.15.1.tgz - ${PROJECT_SOURCE_DIR}/onnxruntime-osx-arm64-1.15.1.tgz - ${PROJECT_BINARY_DIR}/onnxruntime-osx-arm64-1.15.1.tgz - /tmp/onnxruntime-osx-arm64-1.15.1.tgz + $ENV{HOME}/Downloads/onnxruntime-osx-arm64-1.16.0.tgz + ${PROJECT_SOURCE_DIR}/onnxruntime-osx-arm64-1.16.0.tgz + ${PROJECT_BINARY_DIR}/onnxruntime-osx-arm64-1.16.0.tgz + /tmp/onnxruntime-osx-arm64-1.16.0.tgz ) foreach(f IN LISTS possible_file_locations) diff --git a/cmake/onnxruntime-osx-universal.cmake b/cmake/onnxruntime-osx-universal.cmake index c3cfb6800..3dfb8b6d2 100644 --- a/cmake/onnxruntime-osx-universal.cmake +++ b/cmake/onnxruntime-osx-universal.cmake @@ -9,18 +9,18 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) message(FATAL_ERROR "This file is for macOS only. Given: ${CMAKE_SYSTEM_NAME}") endif() -set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.15.1/onnxruntime-osx-universal2-1.15.1.tgz") -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-osx-universal2-1.15.1.tgz") -set(onnxruntime_HASH "SHA256=ecb7651c216fe6ffaf4c578e135d98341bc5bc944c5dc6b725ef85b0d7747be0") +set(onnxruntime_URL "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-osx-universal2-1.16.0.tgz") +set(onnxruntime_URL2 ) +set(onnxruntime_HASH "SHA256=e5b69ece634cf1cd5cf4b45ab478417199a5e8ab5775f6f12560e09dc5ef7749") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-osx-universal2-1.15.1.tgz - ${PROJECT_SOURCE_DIR}/onnxruntime-osx-universal2-1.15.1.tgz - ${PROJECT_BINARY_DIR}/onnxruntime-osx-universal2-1.15.1.tgz - /tmp/onnxruntime-osx-universal2-1.15.1.tgz + $ENV{HOME}/Downloads/onnxruntime-osx-universal2-1.16.0.tgz + ${PROJECT_SOURCE_DIR}/onnxruntime-osx-universal2-1.16.0.tgz + ${PROJECT_BINARY_DIR}/onnxruntime-osx-universal2-1.16.0.tgz + /tmp/onnxruntime-osx-universal2-1.16.0.tgz ) foreach(f IN LISTS possible_file_locations) diff --git a/cmake/onnxruntime-osx-x86_64.cmake b/cmake/onnxruntime-osx-x86_64.cmake index ba707ceb9..9ff3a726a 100644 --- a/cmake/onnxruntime-osx-x86_64.cmake +++ b/cmake/onnxruntime-osx-x86_64.cmake @@ -8,18 +8,18 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) message(FATAL_ERROR "This file is for macOS only. Given: ${CMAKE_SYSTEM_NAME}") endif() -set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.15.1/onnxruntime-osx-x86_64-1.15.1.tgz") -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-osx-x86_64-1.15.1.tgz") -set(onnxruntime_HASH "SHA256=4b66ebbca24b8b96f6b74655fee3610a7e529b4e01f6790632f24ee82b778e5a") +set(onnxruntime_URL "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-osx-x86_64-1.16.0.tgz") +set(onnxruntime_URL2 ) +set(onnxruntime_HASH "SHA256=3d639a269af4e97a455f23cff363a709ef3a5f3e086162e65e3395c339122285") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-osx-x86_64-1.15.1.tgz - ${PROJECT_SOURCE_DIR}/onnxruntime-osx-x86_64-1.15.1.tgz - ${PROJECT_BINARY_DIR}/onnxruntime-osx-x86_64-1.15.1.tgz - /tmp/onnxruntime-osx-x86_64-1.15.1.tgz + $ENV{HOME}/Downloads/onnxruntime-osx-x86_64-1.16.0.tgz + ${PROJECT_SOURCE_DIR}/onnxruntime-osx-x86_64-1.16.0.tgz + ${PROJECT_BINARY_DIR}/onnxruntime-osx-x86_64-1.16.0.tgz + /tmp/onnxruntime-osx-x86_64-1.16.0.tgz ) foreach(f IN LISTS possible_file_locations) diff --git a/cmake/onnxruntime-win-x64-gpu.cmake b/cmake/onnxruntime-win-x64-gpu.cmake index 6353222e4..5fc7af2b5 100644 --- a/cmake/onnxruntime-win-x64-gpu.cmake +++ b/cmake/onnxruntime-win-x64-gpu.cmake @@ -19,18 +19,18 @@ if(NOT SHERPA_ONNX_ENABLE_GPU) message(FATAL_ERROR "This file is for NVIDIA GPU only. Given SHERPA_ONNX_ENABLE_GPU: ${SHERPA_ONNX_ENABLE_GPU}") endif() -set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.15.1/onnxruntime-win-x64-gpu-1.15.1.zip") -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-win-x64-gpu-1.15.1.zip") -set(onnxruntime_HASH "SHA256=dcc3a385b415dd2e4a813018b71da5085d9b97774552edf17947826a255a3732") +set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.16.0/onnxruntime-win-x64-gpu-1.16.0.zip") +set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-win-x64-gpu-1.16.0.zip") +set(onnxruntime_HASH "SHA256=2a824d2a98fe7328980fcd27016fe797137f7050b047eecf3a3f6b82a24f63c1") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-win-x64-gpu-1.15.1.zip - ${PROJECT_SOURCE_DIR}/onnxruntime-win-x64-gpu-1.15.1.zip - ${PROJECT_BINARY_DIR}/onnxruntime-win-x64-gpu-1.15.1.zip - /tmp/onnxruntime-win-x64-gpu-1.15.1.zip + $ENV{HOME}/Downloads/onnxruntime-win-x64-gpu-1.16.0.zip + ${PROJECT_SOURCE_DIR}/onnxruntime-win-x64-gpu-1.16.0.zip + ${PROJECT_BINARY_DIR}/onnxruntime-win-x64-gpu-1.16.0.zip + /tmp/onnxruntime-win-x64-gpu-1.16.0.zip ) foreach(f IN LISTS possible_file_locations) diff --git a/cmake/onnxruntime-win-x64-static.cmake b/cmake/onnxruntime-win-x64-static.cmake index 1943a2a09..8bae3afa8 100644 --- a/cmake/onnxruntime-win-x64-static.cmake +++ b/cmake/onnxruntime-win-x64-static.cmake @@ -15,18 +15,18 @@ if(BUILD_SHARED_LIBS) message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") endif() -set(onnxruntime_URL "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x64-static-1.15.1.tar.bz2") +set(onnxruntime_URL "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x64-static-1.16.0.tar.bz2") set(onnxruntime_URL2 "") -set(onnxruntime_HASH "SHA256=c809a8510a89b8b37ae7d563c39229db22bac8fbefcbfe5c81a60b367d065b1b") +set(onnxruntime_HASH "SHA256=d1b87e8a438a7e31b46bf13a194c5ac38fdf60ebeefef82692008e42e3242776") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-win-x64-static-1.15.1.tar.bz2 - ${PROJECT_SOURCE_DIR}/onnxruntime-win-x64-static-1.15.1.tar.bz2 - ${PROJECT_BINARY_DIR}/onnxruntime-win-x64-static-1.15.1.tar.bz2 - /tmp/onnxruntime-win-x64-static-1.15.1.tar.bz2 + $ENV{HOME}/Downloads/onnxruntime-win-x64-static-1.16.0.tar.bz2 + ${PROJECT_SOURCE_DIR}/onnxruntime-win-x64-static-1.16.0.tar.bz2 + ${PROJECT_BINARY_DIR}/onnxruntime-win-x64-static-1.16.0.tar.bz2 + /tmp/onnxruntime-win-x64-static-1.16.0.tar.bz2 ) foreach(f IN LISTS possible_file_locations) diff --git a/cmake/onnxruntime-win-x64.cmake b/cmake/onnxruntime-win-x64.cmake index e31d4f79f..c88e45fa4 100644 --- a/cmake/onnxruntime-win-x64.cmake +++ b/cmake/onnxruntime-win-x64.cmake @@ -15,18 +15,18 @@ if(NOT BUILD_SHARED_LIBS) message(FATAL_ERROR "This file is for building shared libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") endif() -set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.15.1/onnxruntime-win-x64-1.15.1.zip") -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-win-x64-1.15.1.zip") -set(onnxruntime_HASH "SHA256=261308ee5526dfd3f405ce8863e43d624a2e0bcd16b2d33cdea8c120ab3534d3") +set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.16.0/onnxruntime-win-x64-1.16.0.zip") +set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-win-x64-1.16.0.zip") +set(onnxruntime_HASH "SHA256=ce6777ecde7d4a6c9d4eab9774089fe04be1bad979323ae502e667b95222e08f") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-win-x64-1.15.1.zip - ${PROJECT_SOURCE_DIR}/onnxruntime-win-x64-1.15.1.zip - ${PROJECT_BINARY_DIR}/onnxruntime-win-x64-1.15.1.zip - /tmp/onnxruntime-win-x64-1.15.1.zip + $ENV{HOME}/Downloads/onnxruntime-win-x64-1.16.0.zip + ${PROJECT_SOURCE_DIR}/onnxruntime-win-x64-1.16.0.zip + ${PROJECT_BINARY_DIR}/onnxruntime-win-x64-1.16.0.zip + /tmp/onnxruntime-win-x64-1.16.0.zip ) foreach(f IN LISTS possible_file_locations) diff --git a/cmake/onnxruntime-win-x86-static.cmake b/cmake/onnxruntime-win-x86-static.cmake index c8ff5b438..16eb0f820 100644 --- a/cmake/onnxruntime-win-x86-static.cmake +++ b/cmake/onnxruntime-win-x86-static.cmake @@ -15,18 +15,18 @@ if(BUILD_SHARED_LIBS) message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") endif() -set(onnxruntime_URL "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x86-static-1.15.1.tar.bz2") +set(onnxruntime_URL "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x86-static-1.16.0.tar.bz2") set(onnxruntime_URL2 "") -set(onnxruntime_HASH "SHA256=94d9a30976b5c4a5dff7508d00f141835916e5a36315d5f53be9b3edb85148b5") +set(onnxruntime_HASH "SHA256=aedb6b5275f7832ac5117db8e40328a0842ae8ce6749a0c99bcb4218c53fdc60") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-win-x86-static-1.15.1.tar.bz2 - ${PROJECT_SOURCE_DIR}/onnxruntime-win-x86-static-1.15.1.tar.bz2 - ${PROJECT_BINARY_DIR}/onnxruntime-win-x86-static-1.15.1.tar.bz2 - /tmp/onnxruntime-win-x86-static-1.15.1.tar.bz2 + $ENV{HOME}/Downloads/onnxruntime-win-x86-static-1.16.0.tar.bz2 + ${PROJECT_SOURCE_DIR}/onnxruntime-win-x86-static-1.16.0.tar.bz2 + ${PROJECT_BINARY_DIR}/onnxruntime-win-x86-static-1.16.0.tar.bz2 + /tmp/onnxruntime-win-x86-static-1.16.0.tar.bz2 ) foreach(f IN LISTS possible_file_locations) diff --git a/cmake/onnxruntime-win-x86.cmake b/cmake/onnxruntime-win-x86.cmake index e10d19077..b8eba7ddb 100644 --- a/cmake/onnxruntime-win-x86.cmake +++ b/cmake/onnxruntime-win-x86.cmake @@ -15,18 +15,18 @@ if(NOT BUILD_SHARED_LIBS) message(FATAL_ERROR "This file is for building shared libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") endif() -set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.15.1/onnxruntime-win-x86-1.15.1.zip") -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-win-x86-1.15.1.zip") -set(onnxruntime_HASH "SHA256=8de18fdf274a8adcd95272fcf58beda0fe2fb37f0cd62c02bc4bb6200429e4e2") +set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.16.0/onnxruntime-win-x86-1.16.0.zip") +set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-win-x86-1.16.0.zip") +set(onnxruntime_HASH "SHA256=a1da9e0739336c826c04ab7cb63a3e7bf6ab0dda5fb8bbba17bba4cf8c7d4e20") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-win-x86-1.15.1.zip - ${PROJECT_SOURCE_DIR}/onnxruntime-win-x86-1.15.1.zip - ${PROJECT_BINARY_DIR}/onnxruntime-win-x86-1.15.1.zip - /tmp/onnxruntime-win-x86-1.15.1.zip + $ENV{HOME}/Downloads/onnxruntime-win-x86-1.16.0.zip + ${PROJECT_SOURCE_DIR}/onnxruntime-win-x86-1.16.0.zip + ${PROJECT_BINARY_DIR}/onnxruntime-win-x86-1.16.0.zip + /tmp/onnxruntime-win-x86-1.16.0.zip ) foreach(f IN LISTS possible_file_locations) diff --git a/ios-swift/SherpaOnnx/SherpaOnnx.xcodeproj/project.pbxproj b/ios-swift/SherpaOnnx/SherpaOnnx.xcodeproj/project.pbxproj index a7d3c3c3e..f74b87f45 100644 --- a/ios-swift/SherpaOnnx/SherpaOnnx.xcodeproj/project.pbxproj +++ b/ios-swift/SherpaOnnx/SherpaOnnx.xcodeproj/project.pbxproj @@ -40,7 +40,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - C93989AF2A89FE33009AB859 /* onnxruntime.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = onnxruntime.xcframework; path = "../../build-ios/ios-onnxruntime/1.15.1/onnxruntime.xcframework"; sourceTree = ""; }; + C93989AF2A89FE33009AB859 /* onnxruntime.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = onnxruntime.xcframework; path = "../../build-ios/ios-onnxruntime/1.16.0/onnxruntime.xcframework"; sourceTree = ""; }; C93989B12A89FF78009AB859 /* decoder.int8.onnx */ = {isa = PBXFileReference; lastKnownFileType = file; name = decoder.int8.onnx; path = "../../../icefall-models/sherpa-onnx-streaming-paraformer-bilingual-zh-en/decoder.int8.onnx"; sourceTree = ""; }; C93989B22A89FF78009AB859 /* encoder.int8.onnx */ = {isa = PBXFileReference; lastKnownFileType = file; name = encoder.int8.onnx; path = "../../../icefall-models/sherpa-onnx-streaming-paraformer-bilingual-zh-en/encoder.int8.onnx"; sourceTree = ""; }; C93989B32A89FF78009AB859 /* tokens.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = tokens.txt; path = "../../../icefall-models/sherpa-onnx-streaming-paraformer-bilingual-zh-en/tokens.txt"; sourceTree = ""; }; diff --git a/ios-swiftui/SherpaOnnx2Pass/SherpaOnnx2Pass.xcodeproj/project.pbxproj b/ios-swiftui/SherpaOnnx2Pass/SherpaOnnx2Pass.xcodeproj/project.pbxproj index 3945190de..61e855633 100644 --- a/ios-swiftui/SherpaOnnx2Pass/SherpaOnnx2Pass.xcodeproj/project.pbxproj +++ b/ios-swiftui/SherpaOnnx2Pass/SherpaOnnx2Pass.xcodeproj/project.pbxproj @@ -30,7 +30,7 @@ C9A2588D2AAF039D00E555CA /* Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extension.swift; sourceTree = ""; }; C9A258922AAF057E00E555CA /* SherpaOnnx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SherpaOnnx.swift; path = "../../../swift-api-examples/SherpaOnnx.swift"; sourceTree = ""; }; C9A258952AAF05D100E555CA /* sherpa-onnx.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = "sherpa-onnx.xcframework"; path = "../../build-ios/sherpa-onnx.xcframework"; sourceTree = ""; }; - C9A258972AAF05E400E555CA /* onnxruntime.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = onnxruntime.xcframework; path = "../../build-ios/ios-onnxruntime/1.15.1/onnxruntime.xcframework"; sourceTree = ""; }; + C9A258972AAF05E400E555CA /* onnxruntime.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = onnxruntime.xcframework; path = "../../build-ios/ios-onnxruntime/1.16.0/onnxruntime.xcframework"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ diff --git a/scripts/dotnet/generate.py b/scripts/dotnet/generate.py index 6718ff1ff..8ced8ae84 100755 --- a/scripts/dotnet/generate.py +++ b/scripts/dotnet/generate.py @@ -34,7 +34,7 @@ def get_dict(): def process_linux(s): libs = [ "libkaldi-native-fbank-core.so", - "libonnxruntime.so.1.15.1", + "libonnxruntime.so.1.16.0", "libsherpa-onnx-c-api.so", "libsherpa-onnx-core.so", ] @@ -56,7 +56,7 @@ def process_linux(s): def process_macos(s): libs = [ "libkaldi-native-fbank-core.dylib", - "libonnxruntime.1.15.1.dylib", + "libonnxruntime.1.16.0.dylib", "libsherpa-onnx-c-api.dylib", "libsherpa-onnx-core.dylib", ] diff --git a/sherpa-onnx/c-api/c-api.h b/sherpa-onnx/c-api/c-api.h index ff8f73da0..a5a341d27 100644 --- a/sherpa-onnx/c-api/c-api.h +++ b/sherpa-onnx/c-api/c-api.h @@ -31,9 +31,18 @@ extern "C" { #define SHERPA_ONNX_IMPORT #endif #else // WIN32 -#define SHERPA_ONNX_EXPORT __attribute__((visibility("default"))) +#if __APPLE__ +// it throws a warning on macOS when using +// __attribute__((visibility("default"))) +// +// warning: 'visibility' attribute ignored [-Wignored-attributes] +#define SHERPA_ONNX_EXPORT +#else +#define SHERPA_ONNX_EXPORT __attribute__((visibility("default"))) +#endif // __APPLE__ + #define SHERPA_ONNX_IMPORT SHERPA_ONNX_EXPORT -#endif +#endif // WIN32 #if defined(SHERPA_ONNX_BUILD_MAIN_LIB) #define SHERPA_ONNX_API SHERPA_ONNX_EXPORT @@ -178,12 +187,14 @@ SHERPA_ONNX_API void DestroyOnlineRecognizer( SHERPA_ONNX_API SherpaOnnxOnlineStream *CreateOnlineStream( const SherpaOnnxOnlineRecognizer *recognizer); -/// Create an online stream for accepting wave samples with the specified hot words. +/// Create an online stream for accepting wave samples with the specified hot +/// words. /// /// @param recognizer A pointer returned by CreateOnlineRecognizer() /// @return Return a pointer to an OnlineStream. The user has to invoke /// DestroyOnlineStream() to free it to avoid memory leak. -SHERPA_ONNX_API SherpaOnnxOnlineStream *CreateOnlineStreamWithHotwords(const SherpaOnnxOnlineRecognizer *recognizer, const char *hotwords); +SHERPA_ONNX_API SherpaOnnxOnlineStream *CreateOnlineStreamWithHotwords( + const SherpaOnnxOnlineRecognizer *recognizer, const char *hotwords); /// Destroy an online stream. ///