Fangjun Kuang
Committed by GitHub

Add CI tests for online punctuation models (#1226)

  1 +#!/usr/bin/env bash
  2 +
  3 +set -ex
  4 +
  5 +log() {
  6 + # This function is from espnet
  7 + local fname=${BASH_SOURCE[1]##*/}
  8 + echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*"
  9 +}
  10 +
  11 +echo "EXE is $EXE"
  12 +echo "PATH: $PATH"
  13 +
  14 +which $EXE
  15 +
  16 +log "------------------------------------------------------------"
  17 +log "Download the punctuation model "
  18 +log "------------------------------------------------------------"
  19 +
  20 +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
  21 +
  22 +tar xvf sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
  23 +rm sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
  24 +repo=sherpa-onnx-online-punct-en-2024-08-06
  25 +ls -lh $repo
  26 +
  27 +for m in model.onnx model.int8.onnx; do
  28 + $EXE \
  29 + --debug=1 \
  30 + --cnn-bilstm=$repo/$m \
  31 + --bpe-vocab=$repo/bpe.vocab \
  32 + "How are you i am fine thank you"
  33 +
  34 + $EXE \
  35 + --debug=1 \
  36 + --cnn-bilstm=$repo/$m \
  37 + --bpe-vocab=$repo/bpe.vocab \
  38 + "The African blogosphere is rapidly expanding bringing more voices online in the form of commentaries opinions analyses rants and poetry"
  39 +done
  40 +
  41 +rm -rf $repo
@@ -17,6 +17,7 @@ on: @@ -17,6 +17,7 @@ on:
17 - '.github/scripts/test-offline-tts.sh' 17 - '.github/scripts/test-offline-tts.sh'
18 - '.github/scripts/test-audio-tagging.sh' 18 - '.github/scripts/test-audio-tagging.sh'
19 - '.github/scripts/test-offline-punctuation.sh' 19 - '.github/scripts/test-offline-punctuation.sh'
  20 + - '.github/scripts/test-online-punctuation.sh'
20 - 'CMakeLists.txt' 21 - 'CMakeLists.txt'
21 - 'cmake/**' 22 - 'cmake/**'
22 - 'sherpa-onnx/csrc/*' 23 - 'sherpa-onnx/csrc/*'
@@ -36,6 +37,7 @@ on: @@ -36,6 +37,7 @@ on:
36 - '.github/scripts/test-offline-tts.sh' 37 - '.github/scripts/test-offline-tts.sh'
37 - '.github/scripts/test-audio-tagging.sh' 38 - '.github/scripts/test-audio-tagging.sh'
38 - '.github/scripts/test-offline-punctuation.sh' 39 - '.github/scripts/test-offline-punctuation.sh'
  40 + - '.github/scripts/test-online-punctuation.sh'
39 - 'CMakeLists.txt' 41 - 'CMakeLists.txt'
40 - 'cmake/**' 42 - 'cmake/**'
41 - 'sherpa-onnx/csrc/*' 43 - 'sherpa-onnx/csrc/*'
@@ -141,6 +143,16 @@ jobs: @@ -141,6 +143,16 @@ jobs:
141 name: release-${{ matrix.build_type }}-with-shared-lib-${{ matrix.shared_lib }}-with-tts-${{ matrix.with_tts }} 143 name: release-${{ matrix.build_type }}-with-shared-lib-${{ matrix.shared_lib }}-with-tts-${{ matrix.with_tts }}
142 path: install/* 144 path: install/*
143 145
  146 + - name: Test online punctuation
  147 + shell: bash
  148 + run: |
  149 + du -h -d1 .
  150 + export PATH=$PWD/build/bin:$PATH
  151 + export EXE=sherpa-onnx-online-punctuation
  152 +
  153 + .github/scripts/test-online-punctuation.sh
  154 + du -h -d1 .
  155 +
144 - name: Test offline transducer 156 - name: Test offline transducer
145 shell: bash 157 shell: bash
146 run: | 158 run: |
@@ -17,6 +17,7 @@ on: @@ -17,6 +17,7 @@ on:
17 - '.github/scripts/test-online-ctc.sh' 17 - '.github/scripts/test-online-ctc.sh'
18 - '.github/scripts/test-audio-tagging.sh' 18 - '.github/scripts/test-audio-tagging.sh'
19 - '.github/scripts/test-offline-punctuation.sh' 19 - '.github/scripts/test-offline-punctuation.sh'
  20 + - '.github/scripts/test-online-punctuation.sh'
20 - 'CMakeLists.txt' 21 - 'CMakeLists.txt'
21 - 'cmake/**' 22 - 'cmake/**'
22 - 'sherpa-onnx/csrc/*' 23 - 'sherpa-onnx/csrc/*'
@@ -35,6 +36,7 @@ on: @@ -35,6 +36,7 @@ on:
35 - '.github/scripts/test-online-ctc.sh' 36 - '.github/scripts/test-online-ctc.sh'
36 - '.github/scripts/test-audio-tagging.sh' 37 - '.github/scripts/test-audio-tagging.sh'
37 - '.github/scripts/test-offline-punctuation.sh' 38 - '.github/scripts/test-offline-punctuation.sh'
  39 + - '.github/scripts/test-online-punctuation.sh'
38 - 'CMakeLists.txt' 40 - 'CMakeLists.txt'
39 - 'cmake/**' 41 - 'cmake/**'
40 - 'sherpa-onnx/csrc/*' 42 - 'sherpa-onnx/csrc/*'
@@ -113,6 +115,14 @@ jobs: @@ -113,6 +115,14 @@ jobs:
113 otool -L build/bin/sherpa-onnx 115 otool -L build/bin/sherpa-onnx
114 otool -l build/bin/sherpa-onnx 116 otool -l build/bin/sherpa-onnx
115 117
  118 + - name: Test online punctuation
  119 + shell: bash
  120 + run: |
  121 + export PATH=$PWD/build/bin:$PATH
  122 + export EXE=sherpa-onnx-online-punctuation
  123 +
  124 + .github/scripts/test-online-punctuation.sh
  125 +
116 - name: Test offline transducer 126 - name: Test offline transducer
117 shell: bash 127 shell: bash
118 run: | 128 run: |
@@ -76,6 +76,14 @@ jobs: @@ -76,6 +76,14 @@ jobs:
76 otool -L build/bin/sherpa-onnx 76 otool -L build/bin/sherpa-onnx
77 otool -l build/bin/sherpa-onnx 77 otool -l build/bin/sherpa-onnx
78 78
  79 + - name: Test online punctuation
  80 + shell: bash
  81 + run: |
  82 + export PATH=$PWD/build/bin:$PATH
  83 + export EXE=sherpa-onnx-online-punctuation
  84 +
  85 + .github/scripts/test-online-punctuation.sh
  86 +
79 - name: Test offline punctuation 87 - name: Test offline punctuation
80 shell: bash 88 shell: bash
81 run: | 89 run: |
@@ -16,6 +16,7 @@ on: @@ -16,6 +16,7 @@ on:
16 - '.github/scripts/test-offline-tts.sh' 16 - '.github/scripts/test-offline-tts.sh'
17 - '.github/scripts/test-audio-tagging.sh' 17 - '.github/scripts/test-audio-tagging.sh'
18 - '.github/scripts/test-offline-punctuation.sh' 18 - '.github/scripts/test-offline-punctuation.sh'
  19 + - '.github/scripts/test-online-punctuation.sh'
19 - 'CMakeLists.txt' 20 - 'CMakeLists.txt'
20 - 'cmake/**' 21 - 'cmake/**'
21 - 'sherpa-onnx/csrc/*' 22 - 'sherpa-onnx/csrc/*'
@@ -32,6 +33,7 @@ on: @@ -32,6 +33,7 @@ on:
32 - '.github/scripts/test-offline-tts.sh' 33 - '.github/scripts/test-offline-tts.sh'
33 - '.github/scripts/test-audio-tagging.sh' 34 - '.github/scripts/test-audio-tagging.sh'
34 - '.github/scripts/test-offline-punctuation.sh' 35 - '.github/scripts/test-offline-punctuation.sh'
  36 + - '.github/scripts/test-online-punctuation.sh'
35 - 'CMakeLists.txt' 37 - 'CMakeLists.txt'
36 - 'cmake/**' 38 - 'cmake/**'
37 - 'sherpa-onnx/csrc/*' 39 - 'sherpa-onnx/csrc/*'
@@ -85,6 +87,14 @@ jobs: @@ -85,6 +87,14 @@ jobs:
85 name: release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }} 87 name: release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }}
86 path: build/install/* 88 path: build/install/*
87 89
  90 + - name: Test online punctuation
  91 + shell: bash
  92 + run: |
  93 + export PATH=$PWD/build/bin/Release:$PATH
  94 + export EXE=sherpa-onnx-online-punctuation.exe
  95 +
  96 + .github/scripts/test-online-punctuation.sh
  97 +
88 - name: Test offline punctuation 98 - name: Test offline punctuation
89 shell: bash 99 shell: bash
90 run: | 100 run: |
@@ -16,6 +16,7 @@ on: @@ -16,6 +16,7 @@ on:
16 - '.github/scripts/test-online-ctc.sh' 16 - '.github/scripts/test-online-ctc.sh'
17 - '.github/scripts/test-audio-tagging.sh' 17 - '.github/scripts/test-audio-tagging.sh'
18 - '.github/scripts/test-offline-punctuation.sh' 18 - '.github/scripts/test-offline-punctuation.sh'
  19 + - '.github/scripts/test-online-punctuation.sh'
19 - 'CMakeLists.txt' 20 - 'CMakeLists.txt'
20 - 'cmake/**' 21 - 'cmake/**'
21 - 'sherpa-onnx/csrc/*' 22 - 'sherpa-onnx/csrc/*'
@@ -32,6 +33,7 @@ on: @@ -32,6 +33,7 @@ on:
32 - '.github/scripts/test-online-ctc.sh' 33 - '.github/scripts/test-online-ctc.sh'
33 - '.github/scripts/test-audio-tagging.sh' 34 - '.github/scripts/test-audio-tagging.sh'
34 - '.github/scripts/test-offline-punctuation.sh' 35 - '.github/scripts/test-offline-punctuation.sh'
  36 + - '.github/scripts/test-online-punctuation.sh'
35 - 'CMakeLists.txt' 37 - 'CMakeLists.txt'
36 - 'cmake/**' 38 - 'cmake/**'
37 - 'sherpa-onnx/csrc/*' 39 - 'sherpa-onnx/csrc/*'
@@ -85,6 +87,14 @@ jobs: @@ -85,6 +87,14 @@ jobs:
85 name: release-windows-x86-${{ matrix.shared_lib }}-${{ matrix.with_tts }} 87 name: release-windows-x86-${{ matrix.shared_lib }}-${{ matrix.with_tts }}
86 path: build/install/* 88 path: build/install/*
87 89
  90 + - name: Test online punctuation
  91 + shell: bash
  92 + run: |
  93 + export PATH=$PWD/build/bin/Release:$PATH
  94 + export EXE=sherpa-onnx-online-punctuation.exe
  95 +
  96 + .github/scripts/test-online-punctuation.sh
  97 +
88 - name: Test offline punctuation 98 - name: Test offline punctuation
89 shell: bash 99 shell: bash
90 run: | 100 run: |