Committed by
GitHub
Test go inside sherpa-onnx (#374)
Previously, we only test the go api examples with pre-built packages. This PR tests go API examples against the latest source code of sherpa-onnx.
正在显示
26 个修改的文件
包含
255 行增加
和
12 行删除
| 1 | -name: test-go | 1 | +name: test-go-package |
| 2 | 2 | ||
| 3 | on: | 3 | on: |
| 4 | - push: | ||
| 5 | - branches: | ||
| 6 | - - master | ||
| 7 | - tags: | ||
| 8 | - - '*' | ||
| 9 | - pull_request: | ||
| 10 | - branches: | ||
| 11 | - - master | 4 | + schedule: |
| 5 | + # minute (0-59) | ||
| 6 | + # hour (0-23) | ||
| 7 | + # day of the month (1-31) | ||
| 8 | + # month (1-12) | ||
| 9 | + # day of the week (0-6) | ||
| 10 | + # nightly build at 15:50 UTC time every day | ||
| 11 | + - cron: "50 15 * * *" | ||
| 12 | 12 | ||
| 13 | workflow_dispatch: | 13 | workflow_dispatch: |
| 14 | 14 | ||
| 15 | concurrency: | 15 | concurrency: |
| 16 | - group: go-${{ github.ref }} | 16 | + group: test-go-package-${{ github.ref }} |
| 17 | cancel-in-progress: true | 17 | cancel-in-progress: true |
| 18 | 18 | ||
| 19 | jobs: | 19 | jobs: |
| 20 | - go: | ||
| 21 | - name: go ${{ matrix.os }} ${{matrix.arch }} | 20 | + test-go-package: |
| 21 | + name: ${{ matrix.os }} ${{matrix.arch }} | ||
| 22 | runs-on: ${{ matrix.os }} | 22 | runs-on: ${{ matrix.os }} |
| 23 | strategy: | 23 | strategy: |
| 24 | fail-fast: false | 24 | fail-fast: false |
.github/workflows/test-go.yaml
0 → 100644
| 1 | +name: test-go | ||
| 2 | + | ||
| 3 | +on: | ||
| 4 | + push: | ||
| 5 | + branches: | ||
| 6 | + - master | ||
| 7 | + pull_request: | ||
| 8 | + branches: | ||
| 9 | + - master | ||
| 10 | + | ||
| 11 | + workflow_dispatch: | ||
| 12 | + | ||
| 13 | +concurrency: | ||
| 14 | + group: test-go-${{ github.ref }} | ||
| 15 | + cancel-in-progress: true | ||
| 16 | + | ||
| 17 | +jobs: | ||
| 18 | + test-go: | ||
| 19 | + name: ${{ matrix.os }} ${{matrix.arch }} | ||
| 20 | + runs-on: ${{ matrix.os }} | ||
| 21 | + strategy: | ||
| 22 | + fail-fast: false | ||
| 23 | + matrix: | ||
| 24 | + include: | ||
| 25 | + - os: macos-latest | ||
| 26 | + arch: amd64 | ||
| 27 | + | ||
| 28 | + steps: | ||
| 29 | + - uses: actions/checkout@v3 | ||
| 30 | + with: | ||
| 31 | + fetch-depth: 0 | ||
| 32 | + | ||
| 33 | + - name: ccache | ||
| 34 | + uses: hendrikmuhs/ccache-action@v1.2 | ||
| 35 | + with: | ||
| 36 | + key: ${{ matrix.os }}-${{ matrix.arch }} | ||
| 37 | + | ||
| 38 | + - uses: actions/setup-go@v4 | ||
| 39 | + with: | ||
| 40 | + go-version: '>=1.12' | ||
| 41 | + | ||
| 42 | + - name: Display go version | ||
| 43 | + shell: bash | ||
| 44 | + run: | | ||
| 45 | + go version | ||
| 46 | + go env GOPATH | ||
| 47 | + go env GOARCH | ||
| 48 | + | ||
| 49 | + - name: Build sherpa-onnx | ||
| 50 | + shell: bash | ||
| 51 | + run: | | ||
| 52 | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | ||
| 53 | + mkdir build | ||
| 54 | + cd build | ||
| 55 | + cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_SHARED_LIBS=ON -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF .. | ||
| 56 | + make -j | ||
| 57 | + cp -v _deps/onnxruntime-src/lib/libonnxruntime*dylib ./lib/ | ||
| 58 | + | ||
| 59 | + cd ../scripts/go/_internal/ | ||
| 60 | + go mod tidy | ||
| 61 | + go build | ||
| 62 | + | ||
| 63 | + - name: Test non-streaming decoding files (macOS) | ||
| 64 | + shell: bash | ||
| 65 | + run: | | ||
| 66 | + cd scripts/go/_internal/non-streaming-decode-files/ | ||
| 67 | + ls -lh | ||
| 68 | + go mod tidy | ||
| 69 | + cat go.mod | ||
| 70 | + go build | ||
| 71 | + ls -lh | ||
| 72 | + | ||
| 73 | + git lfs install | ||
| 74 | + | ||
| 75 | + echo "Test transducer" | ||
| 76 | + git clone https://huggingface.co/csukuangfj/sherpa-onnx-zipformer-en-2023-06-26 | ||
| 77 | + ./run-transducer.sh | ||
| 78 | + rm -rf sherpa-onnx-zipformer-en-2023-06-26 | ||
| 79 | + | ||
| 80 | + echo "Test paraformer" | ||
| 81 | + git clone https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28 | ||
| 82 | + ./run-paraformer.sh | ||
| 83 | + rm -rf sherpa-onnx-paraformer-zh-2023-03-28 | ||
| 84 | + | ||
| 85 | + echo "Test NeMo CTC" | ||
| 86 | + git clone https://huggingface.co/csukuangfj/sherpa-onnx-nemo-ctc-en-conformer-medium | ||
| 87 | + ./run-nemo-ctc.sh | ||
| 88 | + rm -rf sherpa-onnx-nemo-ctc-en-conformer-medium | ||
| 89 | + | ||
| 90 | + echo "Test Whisper tiny.en" | ||
| 91 | + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-whisper-tiny.en | ||
| 92 | + cd sherpa-onnx-whisper-tiny.en | ||
| 93 | + git lfs pull --include "*.onnx" | ||
| 94 | + cd .. | ||
| 95 | + ./run-whisper.sh | ||
| 96 | + rm -rf sherpa-onnx-whisper-tiny.en | ||
| 97 | + | ||
| 98 | + echo "Test Tdnn yesno" | ||
| 99 | + git clone https://huggingface.co/csukuangfj/sherpa-onnx-tdnn-yesno | ||
| 100 | + ./run-tdnn-yesno.sh | ||
| 101 | + rm -rf sherpa-onnx-tdnn-yesno | ||
| 102 | + | ||
| 103 | + - name: Test streaming decoding files | ||
| 104 | + shell: bash | ||
| 105 | + run: | | ||
| 106 | + cd scripts/go/_internal/streaming-decode-files | ||
| 107 | + ls -lh | ||
| 108 | + go mod tidy | ||
| 109 | + cat go.mod | ||
| 110 | + go build | ||
| 111 | + ls -lh | ||
| 112 | + | ||
| 113 | + git lfs install | ||
| 114 | + | ||
| 115 | + echo "Test transducer" | ||
| 116 | + git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-en-2023-06-26 | ||
| 117 | + ./run-transducer.sh | ||
| 118 | + rm -rf sherpa-onnx-streaming-zipformer-en-2023-06-26 | ||
| 119 | + | ||
| 120 | + echo "Test paraformer" | ||
| 121 | + git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-paraformer-bilingual-zh-en | ||
| 122 | + ./run-paraformer.sh | ||
| 123 | + rm -rf sherpa-onnx-streaming-paraformer-bilingual-zh-en |
scripts/go/README.md
0 → 100644
scripts/go/_internal/build_darwin_amd64.go
0 → 100644
scripts/go/_internal/c-api.h
0 → 120000
| 1 | +../../../sherpa-onnx/c-api/c-api.h |
scripts/go/_internal/go.mod
0 → 100644
scripts/go/_internal/lib/x86_64-apple-darwin
0 → 120000
| 1 | +../../../../build/lib |
| 1 | +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | ||
| 2 | +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
| 3 | +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= | ||
| 4 | +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= | ||
| 5 | +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= | ||
| 6 | +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||
| 7 | +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
| 8 | +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
| 9 | +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= | ||
| 10 | +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= | ||
| 11 | +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
| 12 | +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= | ||
| 13 | +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
| 14 | +github.com/youpy/go-riff v0.1.0 h1:vZO/37nI4tIET8tQI0Qn0Y79qQh99aEpponTPiPut7k= | ||
| 15 | +github.com/youpy/go-riff v0.1.0/go.mod h1:83nxdDV4Z9RzrTut9losK7ve4hUnxUR8ASSz4BsKXwQ= | ||
| 16 | +github.com/youpy/go-wav v0.3.2 h1:NLM8L/7yZ0Bntadw/0h95OyUsen+DQIVf9gay+SUsMU= | ||
| 17 | +github.com/youpy/go-wav v0.3.2/go.mod h1:0FCieAXAeSdcxFfwLpRuEo0PFmAoc+8NU34h7TUvk50= | ||
| 18 | +github.com/zaf/g711 v0.0.0-20190814101024-76a4a538f52b h1:QqixIpc5WFIqTLxB3Hq8qs0qImAgBdq0p6rq2Qdl634= | ||
| 19 | +github.com/zaf/g711 v0.0.0-20190814101024-76a4a538f52b/go.mod h1:T2h1zV50R/q0CVYnsQOQ6L7P4a2ZxH47ixWcMXFGyx8= | ||
| 20 | +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= | ||
| 21 | +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||
| 22 | +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
| 23 | +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
| 24 | +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= | ||
| 25 | +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||
| 26 | +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= | ||
| 27 | +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= |
| 1 | +../../../../go-api-examples/non-streaming-decode-files/main.go |
| 1 | +../../../../go-api-examples/non-streaming-decode-files/run-nemo-ctc.sh |
| 1 | +../../../../go-api-examples/non-streaming-decode-files/run-paraformer.sh |
| 1 | +../../../../go-api-examples/non-streaming-decode-files/run-tdnn-yesno.sh |
| 1 | +../../../../go-api-examples/non-streaming-decode-files/run-transducer.sh |
| 1 | +../../../../go-api-examples/non-streaming-decode-files/run-whisper.sh |
| 1 | +real-time-speech-recognition-from-microphone |
| 1 | +module real-time-speech-recognition-from-microphone | ||
| 2 | + | ||
| 3 | +go 1.12 | ||
| 4 | + | ||
| 5 | +replace github.com/k2-fsa/sherpa-onnx-go/sherpa_onnx => ../ | ||
| 6 | + | ||
| 7 | +require ( | ||
| 8 | + github.com/gordonklaus/portaudio v0.0.0-20230709114228-aafa478834f5 | ||
| 9 | + github.com/k2-fsa/sherpa-onnx-go/sherpa_onnx v0.0.0-00010101000000-000000000000 | ||
| 10 | + github.com/spf13/pflag v1.0.5 | ||
| 11 | +) |
| 1 | +github.com/gordonklaus/portaudio v0.0.0-20230709114228-aafa478834f5 h1:5AlozfqaVjGYGhms2OsdUyfdJME76E6rx5MdGpjzZpc= | ||
| 2 | +github.com/gordonklaus/portaudio v0.0.0-20230709114228-aafa478834f5/go.mod h1:WY8R6YKlI2ZI3UyzFk7P6yGSuS+hFwNtEzrexRyD7Es= | ||
| 3 | +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= | ||
| 4 | +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= |
| 1 | +../../../../go-api-examples/real-time-speech-recognition-from-microphone/main.go |
| 1 | +../../../../go-api-examples/real-time-speech-recognition-from-microphone/run.sh |
scripts/go/_internal/sherpa_onnx.go
0 → 120000
| 1 | +../sherpa_onnx.go |
| 1 | +streaming-decode-files |
| 1 | +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | ||
| 2 | +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
| 3 | +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= | ||
| 4 | +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= | ||
| 5 | +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= | ||
| 6 | +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||
| 7 | +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
| 8 | +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
| 9 | +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= | ||
| 10 | +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= | ||
| 11 | +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
| 12 | +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= | ||
| 13 | +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
| 14 | +github.com/youpy/go-riff v0.1.0 h1:vZO/37nI4tIET8tQI0Qn0Y79qQh99aEpponTPiPut7k= | ||
| 15 | +github.com/youpy/go-riff v0.1.0/go.mod h1:83nxdDV4Z9RzrTut9losK7ve4hUnxUR8ASSz4BsKXwQ= | ||
| 16 | +github.com/youpy/go-wav v0.3.2 h1:NLM8L/7yZ0Bntadw/0h95OyUsen+DQIVf9gay+SUsMU= | ||
| 17 | +github.com/youpy/go-wav v0.3.2/go.mod h1:0FCieAXAeSdcxFfwLpRuEo0PFmAoc+8NU34h7TUvk50= | ||
| 18 | +github.com/zaf/g711 v0.0.0-20190814101024-76a4a538f52b h1:QqixIpc5WFIqTLxB3Hq8qs0qImAgBdq0p6rq2Qdl634= | ||
| 19 | +github.com/zaf/g711 v0.0.0-20190814101024-76a4a538f52b/go.mod h1:T2h1zV50R/q0CVYnsQOQ6L7P4a2ZxH47ixWcMXFGyx8= | ||
| 20 | +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= | ||
| 21 | +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||
| 22 | +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
| 23 | +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
| 24 | +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= | ||
| 25 | +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||
| 26 | +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= | ||
| 27 | +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= |
| 1 | +../../../../go-api-examples/streaming-decode-files/main.go |
-
请 注册 或 登录 后发表评论