Add timestamps and tokens for .Net's online models. (#690)
This commit is contained in:
@@ -179,7 +179,7 @@ jobs:
|
|||||||
|
|
||||||
# https://huggingface.co/docs/hub/spaces-github-actions
|
# https://huggingface.co/docs/hub/spaces-github-actions
|
||||||
- name: Publish to huggingface
|
- name: Publish to huggingface
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch')
|
||||||
env:
|
env:
|
||||||
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||||
uses: nick-fields/retry@v3
|
uses: nick-fields/retry@v3
|
||||||
@@ -210,7 +210,7 @@ jobs:
|
|||||||
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
|
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
|
||||||
|
|
||||||
- name: Release pre-compiled binaries and libs for aarch64 linux
|
- name: Release pre-compiled binaries and libs for aarch64 linux
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ jobs:
|
|||||||
|
|
||||||
# https://huggingface.co/docs/hub/spaces-github-actions
|
# https://huggingface.co/docs/hub/spaces-github-actions
|
||||||
- name: Publish to huggingface
|
- name: Publish to huggingface
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch')
|
||||||
env:
|
env:
|
||||||
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||||
uses: nick-fields/retry@v3
|
uses: nick-fields/retry@v3
|
||||||
@@ -201,7 +201,7 @@ jobs:
|
|||||||
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
|
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
|
||||||
|
|
||||||
- name: Release pre-compiled binaries and libs for aarch64 linux
|
- name: Release pre-compiled binaries and libs for aarch64 linux
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
|||||||
2
.github/workflows/android.yaml
vendored
2
.github/workflows/android.yaml
vendored
@@ -101,7 +101,7 @@ jobs:
|
|||||||
|
|
||||||
# https://huggingface.co/docs/hub/spaces-github-actions
|
# https://huggingface.co/docs/hub/spaces-github-actions
|
||||||
- name: Publish to huggingface
|
- name: Publish to huggingface
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch')
|
||||||
env:
|
env:
|
||||||
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
4
.github/workflows/arm-linux-gnueabihf.yaml
vendored
4
.github/workflows/arm-linux-gnueabihf.yaml
vendored
@@ -193,7 +193,7 @@ jobs:
|
|||||||
|
|
||||||
# https://huggingface.co/docs/hub/spaces-github-actions
|
# https://huggingface.co/docs/hub/spaces-github-actions
|
||||||
- name: Publish to huggingface
|
- name: Publish to huggingface
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch')
|
||||||
env:
|
env:
|
||||||
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||||
uses: nick-fields/retry@v3
|
uses: nick-fields/retry@v3
|
||||||
@@ -224,7 +224,7 @@ jobs:
|
|||||||
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
|
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
|
||||||
|
|
||||||
- name: Release pre-compiled binaries and libs for arm linux gnueabihf ${{ matrix.lib_type }}
|
- name: Release pre-compiled binaries and libs for arm linux gnueabihf ${{ matrix.lib_type }}
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
|||||||
2
.github/workflows/dot-net.yaml
vendored
2
.github/workflows/dot-net.yaml
vendored
@@ -24,7 +24,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: |
|
dotnet-version: |
|
||||||
6.0.x
|
6.0.x
|
||||||
|
|||||||
2
.github/workflows/linux-gpu.yaml
vendored
2
.github/workflows/linux-gpu.yaml
vendored
@@ -174,7 +174,7 @@ jobs:
|
|||||||
tar cjvf ${dst}.tar.bz2 $dst
|
tar cjvf ${dst}.tar.bz2 $dst
|
||||||
|
|
||||||
- name: Release pre-compiled binaries and libs for linux x64
|
- name: Release pre-compiled binaries and libs for linux x64
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
|||||||
3
.github/workflows/linux.yaml
vendored
3
.github/workflows/linux.yaml
vendored
@@ -210,7 +210,6 @@ jobs:
|
|||||||
.github/scripts/test-online-transducer.sh
|
.github/scripts/test-online-transducer.sh
|
||||||
|
|
||||||
- name: Copy files
|
- name: Copy files
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
||||||
@@ -227,7 +226,7 @@ jobs:
|
|||||||
tar cjvf ${dst}.tar.bz2 $dst
|
tar cjvf ${dst}.tar.bz2 $dst
|
||||||
|
|
||||||
- name: Release pre-compiled binaries and libs for linux x64
|
- name: Release pre-compiled binaries and libs for linux x64
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-20.04' && matrix.gcc_version == '7'
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-20.04' && matrix.gcc_version == '7'
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
|||||||
3
.github/workflows/macos.yaml
vendored
3
.github/workflows/macos.yaml
vendored
@@ -175,7 +175,6 @@ jobs:
|
|||||||
.github/scripts/test-online-transducer.sh
|
.github/scripts/test-online-transducer.sh
|
||||||
|
|
||||||
- name: Copy files
|
- name: Copy files
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
||||||
@@ -193,7 +192,7 @@ jobs:
|
|||||||
tar cjvf ${dst}.tar.bz2 $dst
|
tar cjvf ${dst}.tar.bz2 $dst
|
||||||
|
|
||||||
- name: Release pre-compiled binaries and libs for macOS
|
- name: Release pre-compiled binaries and libs for macOS
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
|||||||
4
.github/workflows/mfc.yaml
vendored
4
.github/workflows/mfc.yaml
vendored
@@ -124,7 +124,7 @@ jobs:
|
|||||||
path: ./mfc-examples/${{ matrix.arch }}/Release/sherpa-onnx-non-streaming-asr-*.exe
|
path: ./mfc-examples/${{ matrix.arch }}/Release/sherpa-onnx-non-streaming-asr-*.exe
|
||||||
|
|
||||||
- name: Release pre-compiled binaries and libs for Windows ${{ matrix.arch }}
|
- name: Release pre-compiled binaries and libs for Windows ${{ matrix.arch }}
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
@@ -132,7 +132,7 @@ jobs:
|
|||||||
file: ./mfc-examples/${{ matrix.arch }}/Release/sherpa-onnx-streaming-*.exe
|
file: ./mfc-examples/${{ matrix.arch }}/Release/sherpa-onnx-streaming-*.exe
|
||||||
|
|
||||||
- name: Release pre-compiled binaries and libs for Windows ${{ matrix.arch }}
|
- name: Release pre-compiled binaries and libs for Windows ${{ matrix.arch }}
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
|||||||
4
.github/workflows/release-go.yaml
vendored
4
.github/workflows/release-go.yaml
vendored
@@ -1,10 +1,6 @@
|
|||||||
name: release-go
|
name: release-go
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
|
|||||||
4
.github/workflows/riscv64-linux.yaml
vendored
4
.github/workflows/riscv64-linux.yaml
vendored
@@ -225,7 +225,7 @@ jobs:
|
|||||||
|
|
||||||
# https://huggingface.co/docs/hub/spaces-github-actions
|
# https://huggingface.co/docs/hub/spaces-github-actions
|
||||||
- name: Publish to huggingface
|
- name: Publish to huggingface
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch')
|
||||||
env:
|
env:
|
||||||
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||||
uses: nick-fields/retry@v3
|
uses: nick-fields/retry@v3
|
||||||
@@ -269,7 +269,7 @@ jobs:
|
|||||||
path: sherpa-onnx-*linux-riscv64-static.tar.bz2
|
path: sherpa-onnx-*linux-riscv64-static.tar.bz2
|
||||||
|
|
||||||
- name: Release pre-compiled binaries and libs for riscv64 linux ${{ matrix.lib_type }}
|
- name: Release pre-compiled binaries and libs for riscv64 linux ${{ matrix.lib_type }}
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
|||||||
2
.github/workflows/run-python-test.yaml
vendored
2
.github/workflows/run-python-test.yaml
vendored
@@ -63,7 +63,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Run sccache-cache
|
- name: Run sccache-cache
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
uses: mozilla-actions/sccache-action@v0.0.3
|
uses: mozilla-actions/sccache-action@v0.0.4
|
||||||
with:
|
with:
|
||||||
version: "v0.7.4"
|
version: "v0.7.4"
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/test-dot-net-nuget.yaml
vendored
2
.github/workflows/test-dot-net-nuget.yaml
vendored
@@ -33,7 +33,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup .NET 6.0
|
- name: Setup .NET 6.0
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: 6.0.x
|
dotnet-version: 6.0.x
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/test-dot-net.yaml
vendored
2
.github/workflows/test-dot-net.yaml
vendored
@@ -137,7 +137,7 @@ jobs:
|
|||||||
path: /tmp/windows-x86
|
path: /tmp/windows-x86
|
||||||
|
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: |
|
dotnet-version: |
|
||||||
6.0.x
|
6.0.x
|
||||||
|
|||||||
3
.github/workflows/windows-x64-cuda.yaml
vendored
3
.github/workflows/windows-x64-cuda.yaml
vendored
@@ -133,7 +133,6 @@ jobs:
|
|||||||
.github/scripts/test-online-transducer.sh
|
.github/scripts/test-online-transducer.sh
|
||||||
|
|
||||||
- name: Copy files
|
- name: Copy files
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
||||||
@@ -148,7 +147,7 @@ jobs:
|
|||||||
tar cjvf ${dst}.tar.bz2 $dst
|
tar cjvf ${dst}.tar.bz2 $dst
|
||||||
|
|
||||||
- name: Release pre-compiled binaries and libs for Windows x64 CUDA
|
- name: Release pre-compiled binaries and libs for Windows x64 CUDA
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
|||||||
4
.github/workflows/windows-x64.yaml
vendored
4
.github/workflows/windows-x64.yaml
vendored
@@ -154,7 +154,7 @@ jobs:
|
|||||||
|
|
||||||
# https://huggingface.co/docs/hub/spaces-github-actions
|
# https://huggingface.co/docs/hub/spaces-github-actions
|
||||||
- name: Publish to huggingface
|
- name: Publish to huggingface
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch')
|
||||||
env:
|
env:
|
||||||
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||||
uses: nick-fields/retry@v3
|
uses: nick-fields/retry@v3
|
||||||
@@ -185,7 +185,7 @@ jobs:
|
|||||||
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
|
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
|
||||||
|
|
||||||
- name: Release pre-compiled binaries and libs for Windows x64
|
- name: Release pre-compiled binaries and libs for Windows x64
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
|||||||
4
.github/workflows/windows-x86.yaml
vendored
4
.github/workflows/windows-x86.yaml
vendored
@@ -157,7 +157,7 @@ jobs:
|
|||||||
|
|
||||||
# https://huggingface.co/docs/hub/spaces-github-actions
|
# https://huggingface.co/docs/hub/spaces-github-actions
|
||||||
- name: Publish to huggingface
|
- name: Publish to huggingface
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch')
|
||||||
env:
|
env:
|
||||||
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||||
uses: nick-fields/retry@v3
|
uses: nick-fields/retry@v3
|
||||||
@@ -188,7 +188,7 @@ jobs:
|
|||||||
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
|
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
|
||||||
|
|
||||||
- name: Release pre-compiled binaries and libs for Windows x86
|
- name: Release pre-compiled binaries and libs for Windows x86
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ function(download_kaldi_native_fbank)
|
|||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
set(kaldi_native_fbank_URL "https://github.com/csukuangfj/kaldi-native-fbank/archive/refs/tags/v1.19.1.tar.gz")
|
set(kaldi_native_fbank_URL "https://github.com/csukuangfj/kaldi-native-fbank/archive/refs/tags/v1.19.1.tar.gz")
|
||||||
|
set(kaldi_native_fbank_URL2 "https://hub.nuaa.cf/csukuangfj/kaldi-native-fbank/archive/refs/tags/v1.19.1.tar.gz")
|
||||||
set(kaldi_native_fbank_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/kaldi-native-fbank-1.19.1.tar.gz")
|
set(kaldi_native_fbank_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/kaldi-native-fbank-1.19.1.tar.gz")
|
||||||
set(kaldi_native_fbank_HASH "SHA256=0cae8cbb9ea42916b214e088912f9e8f2f648f54756b305f93f552382f31f904")
|
set(kaldi_native_fbank_HASH "SHA256=0cae8cbb9ea42916b214e088912f9e8f2f648f54756b305f93f552382f31f904")
|
||||||
|
|
||||||
@@ -12,11 +13,11 @@ function(download_kaldi_native_fbank)
|
|||||||
# If you don't have access to the Internet,
|
# If you don't have access to the Internet,
|
||||||
# please pre-download kaldi-native-fbank
|
# please pre-download kaldi-native-fbank
|
||||||
set(possible_file_locations
|
set(possible_file_locations
|
||||||
$ENV{HOME}/Downloads/kaldi-native-fbank-1.18.7.tar.gz
|
$ENV{HOME}/Downloads/kaldi-native-fbank-1.19.1.tar.gz
|
||||||
${CMAKE_SOURCE_DIR}/kaldi-native-fbank-1.18.7.tar.gz
|
${CMAKE_SOURCE_DIR}/kaldi-native-fbank-1.19.1.tar.gz
|
||||||
${CMAKE_BINARY_DIR}/kaldi-native-fbank-1.18.7.tar.gz
|
${CMAKE_BINARY_DIR}/kaldi-native-fbank-1.19.1.tar.gz
|
||||||
/tmp/kaldi-native-fbank-1.18.7.tar.gz
|
/tmp/kaldi-native-fbank-1.19.1.tar.gz
|
||||||
/star-fj/fangjun/download/github/kaldi-native-fbank-1.18.7.tar.gz
|
/star-fj/fangjun/download/github/kaldi-native-fbank-1.19.1.tar.gz
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(f IN LISTS possible_file_locations)
|
foreach(f IN LISTS possible_file_locations)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
if [ ! -d ./sherpa-onnx-zipformer-en-2023-04-01 ]; then
|
if [ ! -d ./sherpa-onnx-zipformer-en-2023-04-01 ]; then
|
||||||
wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
||||||
tar xvf sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
tar xvf sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
||||||
rm sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
rm sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
if [ ! -d ./sherpa-onnx-zipformer-en-2023-04-01 ]; then
|
if [ ! -d ./sherpa-onnx-zipformer-en-2023-04-01 ]; then
|
||||||
wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
||||||
tar xvf sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
tar xvf sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
||||||
rm sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
rm sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -226,10 +226,16 @@ to download pre-trained streaming models.
|
|||||||
// display results
|
// display results
|
||||||
for (int i = 0; i != files.Length; ++i)
|
for (int i = 0; i != files.Length; ++i)
|
||||||
{
|
{
|
||||||
var text = recognizer.GetResult(streams[i]).Text;
|
OnlineRecognizerResult r = recognizer.GetResult(streams[i]);
|
||||||
|
var text = r.Text;
|
||||||
|
var tokens = r.Tokens;
|
||||||
Console.WriteLine("--------------------");
|
Console.WriteLine("--------------------");
|
||||||
Console.WriteLine(files[i]);
|
Console.WriteLine(files[i]);
|
||||||
Console.WriteLine(text);
|
Console.WriteLine("text: {0}", text);
|
||||||
|
Console.WriteLine("tokens: [{0}]", string.Join(", ", tokens));
|
||||||
|
Console.Write("timestamps: [");
|
||||||
|
r.Timestamps.ToList().ForEach(i => Console.Write(String.Format("{0:0.00}", i) + ", "));
|
||||||
|
Console.WriteLine("]");
|
||||||
}
|
}
|
||||||
Console.WriteLine("--------------------");
|
Console.WriteLine("--------------------");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,8 @@
|
|||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
if [ ! -d ./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 ]; then
|
if [ ! -d ./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 ]; then
|
||||||
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
|
wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2
|
||||||
cd sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
|
tar xvf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2
|
||||||
git lfs pull --include "*.onnx"
|
|
||||||
cd ..
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dotnet run -c Release \
|
dotnet run -c Release \
|
||||||
|
|||||||
@@ -185,23 +185,82 @@ namespace SherpaOnnx
|
|||||||
while (*buffer != 0)
|
while (*buffer != 0)
|
||||||
{
|
{
|
||||||
++buffer;
|
++buffer;
|
||||||
|
length += 1;
|
||||||
}
|
}
|
||||||
length = (int)(buffer - (byte*)impl.Text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] stringBuffer = new byte[length];
|
byte[] stringBuffer = new byte[length];
|
||||||
Marshal.Copy(impl.Text, stringBuffer, 0, length);
|
Marshal.Copy(impl.Text, stringBuffer, 0, length);
|
||||||
_text = Encoding.UTF8.GetString(stringBuffer);
|
_text = Encoding.UTF8.GetString(stringBuffer);
|
||||||
|
|
||||||
|
_tokens = new String[impl.Count];
|
||||||
|
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
byte* buf = (byte*)impl.Tokens;
|
||||||
|
for (int i = 0; i < impl.Count; i++)
|
||||||
|
{
|
||||||
|
length = 0;
|
||||||
|
byte* start = buf;
|
||||||
|
while (*buf != 0)
|
||||||
|
{
|
||||||
|
++buf;
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
|
++buf;
|
||||||
|
|
||||||
|
stringBuffer = new byte[length];
|
||||||
|
fixed (byte* pTarget = stringBuffer)
|
||||||
|
{
|
||||||
|
for (int k = 0; k < length; k++)
|
||||||
|
{
|
||||||
|
pTarget[k] = start[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_tokens[i] = Encoding.UTF8.GetString(stringBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
float* t = (float*)impl.Timestamps;
|
||||||
|
if (t != null)
|
||||||
|
{
|
||||||
|
_timestamps = new float[impl.Count];
|
||||||
|
fixed (float* pTarget = _timestamps)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < impl.Count; i++)
|
||||||
|
{
|
||||||
|
pTarget[i] = t[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_timestamps = Array.Empty<float>();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
struct Impl
|
struct Impl
|
||||||
{
|
{
|
||||||
public IntPtr Text;
|
public IntPtr Text;
|
||||||
|
public IntPtr Tokens;
|
||||||
|
public IntPtr TokensArr;
|
||||||
|
public IntPtr Timestamps;
|
||||||
|
public int Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String _text;
|
private String _text;
|
||||||
public String Text => _text;
|
public String Text => _text;
|
||||||
|
|
||||||
|
private String[] _tokens;
|
||||||
|
public String[] Tokens => _tokens;
|
||||||
|
|
||||||
|
private float[] _timestamps;
|
||||||
|
public float[] Timestamps => _timestamps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OnlineStream : IDisposable
|
public class OnlineStream : IDisposable
|
||||||
|
|||||||
@@ -162,15 +162,17 @@ const SherpaOnnxOnlineRecognizerResult *GetOnlineStreamResult(
|
|||||||
memset(r, 0, sizeof(SherpaOnnxOnlineRecognizerResult));
|
memset(r, 0, sizeof(SherpaOnnxOnlineRecognizerResult));
|
||||||
|
|
||||||
// copy text
|
// copy text
|
||||||
r->text = new char[text.size() + 1];
|
char *pText = new char[text.size() + 1];
|
||||||
std::copy(text.begin(), text.end(), const_cast<char *>(r->text));
|
std::copy(text.begin(), text.end(), pText);
|
||||||
const_cast<char *>(r->text)[text.size()] = 0;
|
pText[text.size()] = 0;
|
||||||
|
r->text = pText;
|
||||||
|
|
||||||
// copy json
|
// copy json
|
||||||
const auto &json = result.AsJsonString();
|
const auto &json = result.AsJsonString();
|
||||||
r->json = new char[json.size() + 1];
|
char *pJson = new char[json.size() + 1];
|
||||||
std::copy(json.begin(), json.end(), const_cast<char *>(r->json));
|
std::copy(json.begin(), json.end(), pJson);
|
||||||
const_cast<char *>(r->json)[json.size()] = 0;
|
pJson[json.size()] = 0;
|
||||||
|
r->json = pJson;
|
||||||
|
|
||||||
// copy tokens
|
// copy tokens
|
||||||
auto count = result.tokens.size();
|
auto count = result.tokens.size();
|
||||||
@@ -183,15 +185,12 @@ const SherpaOnnxOnlineRecognizerResult *GetOnlineStreamResult(
|
|||||||
|
|
||||||
r->count = count;
|
r->count = count;
|
||||||
// Each word ends with nullptr
|
// Each word ends with nullptr
|
||||||
r->tokens = new char[total_length];
|
char *tokens = new char[total_length]{};
|
||||||
memset(reinterpret_cast<void *>(const_cast<char *>(r->tokens)), 0,
|
|
||||||
total_length);
|
|
||||||
char **tokens_temp = new char *[r->count];
|
char **tokens_temp = new char *[r->count];
|
||||||
int32_t pos = 0;
|
int32_t pos = 0;
|
||||||
for (int32_t i = 0; i < r->count; ++i) {
|
for (int32_t i = 0; i < r->count; ++i) {
|
||||||
tokens_temp[i] = const_cast<char *>(r->tokens) + pos;
|
tokens_temp[i] = tokens + pos;
|
||||||
memcpy(reinterpret_cast<void *>(const_cast<char *>(r->tokens + pos)),
|
memcpy(tokens + pos, result.tokens[i].c_str(), result.tokens[i].size());
|
||||||
result.tokens[i].c_str(), result.tokens[i].size());
|
|
||||||
// +1 to move past the null character
|
// +1 to move past the null character
|
||||||
pos += result.tokens[i].size() + 1;
|
pos += result.tokens[i].size() + 1;
|
||||||
}
|
}
|
||||||
@@ -205,6 +204,7 @@ const SherpaOnnxOnlineRecognizerResult *GetOnlineStreamResult(
|
|||||||
r->timestamps = nullptr;
|
r->timestamps = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r->tokens = tokens;
|
||||||
} else {
|
} else {
|
||||||
r->count = 0;
|
r->count = 0;
|
||||||
r->timestamps = nullptr;
|
r->timestamps = nullptr;
|
||||||
@@ -391,9 +391,10 @@ const SherpaOnnxOfflineRecognizerResult *GetOfflineStreamResult(
|
|||||||
auto r = new SherpaOnnxOfflineRecognizerResult;
|
auto r = new SherpaOnnxOfflineRecognizerResult;
|
||||||
memset(r, 0, sizeof(SherpaOnnxOfflineRecognizerResult));
|
memset(r, 0, sizeof(SherpaOnnxOfflineRecognizerResult));
|
||||||
|
|
||||||
r->text = new char[text.size() + 1];
|
char *pText = new char[text.size() + 1];
|
||||||
std::copy(text.begin(), text.end(), const_cast<char *>(r->text));
|
std::copy(text.begin(), text.end(), pText);
|
||||||
const_cast<char *>(r->text)[text.size()] = 0;
|
pText[text.size()] = 0;
|
||||||
|
r->text = pText;
|
||||||
|
|
||||||
if (!result.timestamps.empty()) {
|
if (!result.timestamps.empty()) {
|
||||||
r->timestamps = new float[result.timestamps.size()];
|
r->timestamps = new float[result.timestamps.size()];
|
||||||
@@ -530,15 +531,17 @@ const SherpaOnnxKeywordResult *GetKeywordResult(
|
|||||||
r->start_time = result.start_time;
|
r->start_time = result.start_time;
|
||||||
|
|
||||||
// copy keyword
|
// copy keyword
|
||||||
r->keyword = new char[keyword.size() + 1];
|
char *pKeyword = new char[keyword.size() + 1];
|
||||||
std::copy(keyword.begin(), keyword.end(), const_cast<char *>(r->keyword));
|
std::copy(keyword.begin(), keyword.end(), pKeyword);
|
||||||
const_cast<char *>(r->keyword)[keyword.size()] = 0;
|
pKeyword[keyword.size()] = 0;
|
||||||
|
r->keyword = pKeyword;
|
||||||
|
|
||||||
// copy json
|
// copy json
|
||||||
const auto &json = result.AsJsonString();
|
const auto &json = result.AsJsonString();
|
||||||
r->json = new char[json.size() + 1];
|
char *pJson = new char[json.size() + 1];
|
||||||
std::copy(json.begin(), json.end(), const_cast<char *>(r->json));
|
std::copy(json.begin(), json.end(), pJson);
|
||||||
const_cast<char *>(r->json)[json.size()] = 0;
|
pJson[json.size()] = 0;
|
||||||
|
r->json = pJson;
|
||||||
|
|
||||||
// copy tokens
|
// copy tokens
|
||||||
auto count = result.tokens.size();
|
auto count = result.tokens.size();
|
||||||
@@ -551,18 +554,16 @@ const SherpaOnnxKeywordResult *GetKeywordResult(
|
|||||||
|
|
||||||
r->count = count;
|
r->count = count;
|
||||||
// Each word ends with nullptr
|
// Each word ends with nullptr
|
||||||
r->tokens = new char[total_length];
|
char *pTokens = new char[total_length]{};
|
||||||
memset(reinterpret_cast<void *>(const_cast<char *>(r->tokens)), 0,
|
|
||||||
total_length);
|
|
||||||
char **tokens_temp = new char *[r->count];
|
char **tokens_temp = new char *[r->count];
|
||||||
int32_t pos = 0;
|
int32_t pos = 0;
|
||||||
for (int32_t i = 0; i < r->count; ++i) {
|
for (int32_t i = 0; i < r->count; ++i) {
|
||||||
tokens_temp[i] = const_cast<char *>(r->tokens) + pos;
|
tokens_temp[i] = pTokens + pos;
|
||||||
memcpy(reinterpret_cast<void *>(const_cast<char *>(r->tokens + pos)),
|
memcpy(pTokens + pos, result.tokens[i].c_str(), result.tokens[i].size());
|
||||||
result.tokens[i].c_str(), result.tokens[i].size());
|
|
||||||
// +1 to move past the null character
|
// +1 to move past the null character
|
||||||
pos += result.tokens[i].size() + 1;
|
pos += result.tokens[i].size() + 1;
|
||||||
}
|
}
|
||||||
|
r->tokens = pTokens;
|
||||||
r->tokens_arr = tokens_temp;
|
r->tokens_arr = tokens_temp;
|
||||||
|
|
||||||
if (!result.timestamps.empty()) {
|
if (!result.timestamps.empty()) {
|
||||||
|
|||||||
@@ -145,6 +145,10 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOnlineRecognizerResult {
|
|||||||
const char *const *tokens_arr;
|
const char *const *tokens_arr;
|
||||||
|
|
||||||
// Pointer to continuous memory which holds timestamps
|
// Pointer to continuous memory which holds timestamps
|
||||||
|
//
|
||||||
|
// Caution: If timestamp information is not available, this pointer is NULL.
|
||||||
|
// Please check whether it is NULL before you access it; otherwise, you would
|
||||||
|
// get segmentation fault.
|
||||||
float *timestamps;
|
float *timestamps;
|
||||||
|
|
||||||
// The number of tokens/timestamps in above pointer
|
// The number of tokens/timestamps in above pointer
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class OnlineZipformer2TransducerModel : public OnlineTransducerModel {
|
|||||||
|
|
||||||
int32_t context_size_ = 0;
|
int32_t context_size_ = 0;
|
||||||
int32_t vocab_size_ = 0;
|
int32_t vocab_size_ = 0;
|
||||||
int32_t feature_dim_ = 0;
|
int32_t feature_dim_ = 80;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sherpa_onnx
|
} // namespace sherpa_onnx
|
||||||
|
|||||||
Reference in New Issue
Block a user