Fangjun Kuang
Committed by GitHub

Fix GitHub actions. (#1642)

@@ -61,7 +61,7 @@ jobs: @@ -61,7 +61,7 @@ jobs:
61 if: steps.cache-qemu.outputs.cache-hit != 'true' 61 if: steps.cache-qemu.outputs.cache-hit != 'true'
62 run: | 62 run: |
63 sudo apt-get update 63 sudo apt-get update
64 - sudo apt-get install autoconf automake autotools-dev ninja-build libglib2.0-dev. 64 + sudo apt-get install build-essential zlib1g-dev pkg-config libglib2.0-dev binutils-dev libboost-all-dev autoconf libtool libssl-dev libpixman-1-dev ninja-build
65 65
66 - name: checkout-qemu 66 - name: checkout-qemu
67 if: steps.cache-qemu.outputs.cache-hit != 'true' 67 if: steps.cache-qemu.outputs.cache-hit != 'true'
@@ -43,7 +43,7 @@ jobs: @@ -43,7 +43,7 @@ jobs:
43 strategy: 43 strategy:
44 fail-fast: false 44 fail-fast: false
45 matrix: 45 matrix:
46 - os: [ubuntu-20.04, macos-latest, macos-13, windows-latest] 46 + os: [ubuntu-22.04, macos-latest, macos-13, windows-latest]
47 47
48 steps: 48 steps:
49 - uses: actions/checkout@v4 49 - uses: actions/checkout@v4
@@ -59,7 +59,7 @@ jobs: @@ -59,7 +59,7 @@ jobs:
59 - uses: gcarreno/setup-lazarus@v3.3.1 59 - uses: gcarreno/setup-lazarus@v3.3.1
60 with: 60 with:
61 lazarus-version: "stable" 61 lazarus-version: "stable"
62 - with-cache: true 62 + with-cache: false
63 63
64 - name: Lazarus info 64 - name: Lazarus info
65 shell: bash 65 shell: bash
@@ -79,14 +79,14 @@ jobs: @@ -79,14 +79,14 @@ jobs:
79 uname -a 79 uname -a
80 80
81 - name: Install patchelf for ubuntu 81 - name: Install patchelf for ubuntu
82 - if: matrix.os == 'ubuntu-20.04' 82 + if: matrix.os == 'ubuntu-22.04'
83 shell: bash 83 shell: bash
84 run: | 84 run: |
85 sudo apt-get update -q 85 sudo apt-get update -q
86 sudo apt-get install -q -y patchelf 86 sudo apt-get install -q -y patchelf
87 87
88 - name: Show Patchelf version (ubuntu) 88 - name: Show Patchelf version (ubuntu)
89 - if: matrix.os == 'ubuntu-20.04' 89 + if: matrix.os == 'ubuntu-22.04'
90 shell: bash 90 shell: bash
91 run: | 91 run: |
92 patchelf --version 92 patchelf --version
@@ -104,7 +104,7 @@ jobs: @@ -104,7 +104,7 @@ jobs:
104 cd build 104 cd build
105 os=${{ matrix.os }} 105 os=${{ matrix.os }}
106 106
107 - if [[ $os == 'windows-latest' || $os == 'ubuntu-20.04' ]]; then 107 + if [[ $os == 'windows-latest' || $os == 'ubuntu-22.04' ]]; then
108 BUILD_SHARED_LIBS=ON 108 BUILD_SHARED_LIBS=ON
109 else 109 else
110 BUILD_SHARED_LIBS=OFF 110 BUILD_SHARED_LIBS=OFF
@@ -139,7 +139,7 @@ jobs: @@ -139,7 +139,7 @@ jobs:
139 lazbuild --verbose --build-mode=Release --widgetset=cocoa ./generate_subtitles.lpi 139 lazbuild --verbose --build-mode=Release --widgetset=cocoa ./generate_subtitles.lpi
140 elif [[ $os == macos-latest ]]; then 140 elif [[ $os == macos-latest ]]; then
141 lazbuild --verbose --build-mode=Release --widgetset=cocoa --cpu=aarch64 ./generate_subtitles.lpi 141 lazbuild --verbose --build-mode=Release --widgetset=cocoa --cpu=aarch64 ./generate_subtitles.lpi
142 - elif [[ $os == 'ubuntu-20.04' ]]; then 142 + elif [[ $os == 'ubuntu-22.04' ]]; then
143 lazbuild --verbose --build-mode=Release-Linux ./generate_subtitles.lpi 143 lazbuild --verbose --build-mode=Release-Linux ./generate_subtitles.lpi
144 else 144 else
145 lazbuild --verbose --build-mode=Release ./generate_subtitles.lpi 145 lazbuild --verbose --build-mode=Release ./generate_subtitles.lpi
@@ -152,7 +152,7 @@ jobs: @@ -152,7 +152,7 @@ jobs:
152 ls -lh 152 ls -lh
153 153
154 - name: Collect generating subtitles (Ubuntu) 154 - name: Collect generating subtitles (Ubuntu)
155 - if: matrix.os == 'ubuntu-20.04' 155 + if: matrix.os == 'ubuntu-22.04'
156 shell: bash 156 shell: bash
157 run: | 157 run: |
158 SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) 158 SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
@@ -223,7 +223,7 @@ jobs: @@ -223,7 +223,7 @@ jobs:
223 ls -lh /tmp/macos-* 223 ls -lh /tmp/macos-*
224 224
225 - uses: actions/upload-artifact@v4 225 - uses: actions/upload-artifact@v4
226 - if: matrix.os == 'ubuntu-20.04' 226 + if: matrix.os == 'ubuntu-22.04'
227 with: 227 with:
228 name: linux-x64 228 name: linux-x64
229 path: /tmp/linux-x64 229 path: /tmp/linux-x64
@@ -139,8 +139,8 @@ jobs: @@ -139,8 +139,8 @@ jobs:
139 export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH 139 export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH
140 export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH 140 export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH
141 export PATH=/c/hostedtoolcache/windows/Python/3.11.9/x64/bin:$PATH 141 export PATH=/c/hostedtoolcache/windows/Python/3.11.9/x64/bin:$PATH
142 - export PATH=/c/hostedtoolcache/windows/Python/3.12.7/x64/bin:$PATH  
143 - export PATH=/c/hostedtoolcache/windows/Python/3.13.0/x64/bin:$PATH 142 + export PATH=/c/hostedtoolcache/windows/Python/3.12.8/x64/bin:$PATH
  143 + export PATH=/c/hostedtoolcache/windows/Python/3.13.1/x64/bin:$PATH
144 144
145 which sherpa-onnx 145 which sherpa-onnx
146 sherpa-onnx --help 146 sherpa-onnx --help
@@ -110,8 +110,8 @@ jobs: @@ -110,8 +110,8 @@ jobs:
110 export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH 110 export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH
111 export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH 111 export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH
112 export PATH=/c/hostedtoolcache/windows/Python/3.11.9/x64/bin:$PATH 112 export PATH=/c/hostedtoolcache/windows/Python/3.11.9/x64/bin:$PATH
113 - export PATH=/c/hostedtoolcache/windows/Python/3.12.7/x64/bin:$PATH  
114 - export PATH=/c/hostedtoolcache/windows/Python/3.13.0/x64/bin:$PATH 113 + export PATH=/c/hostedtoolcache/windows/Python/3.12.8/x64/bin:$PATH
  114 + export PATH=/c/hostedtoolcache/windows/Python/3.13.1/x64/bin:$PATH
115 115
116 sherpa-onnx --help 116 sherpa-onnx --help
117 sherpa-onnx-keyword-spotter --help 117 sherpa-onnx-keyword-spotter --help
@@ -73,9 +73,15 @@ OfflineMoonshineGreedySearchDecoder::Decode(Ort::Value encoder_out) { @@ -73,9 +73,15 @@ OfflineMoonshineGreedySearchDecoder::Decode(Ort::Value encoder_out) {
73 seq_len_tensor = 73 seq_len_tensor =
74 Ort::Value::CreateTensor(memory_info, &seq_len, 1, &seq_len_shape, 1); 74 Ort::Value::CreateTensor(memory_info, &seq_len, 1, &seq_len_shape, 1);
75 75
  76 + // To fix the false alarm of clang-tidy
  77 + // error: 'states' used after it was moved
  78 + // [bugprone-use-after-move,-warnings-as-errors]
  79 + // we use a tmp_states here
  80 + std::vector<Ort::Value> tmp_states{std::move(states)};
  81 +
76 std::tie(logits, states) = model_->ForwardCachedDecoder( 82 std::tie(logits, states) = model_->ForwardCachedDecoder(
77 std::move(token_tensor), std::move(seq_len_tensor), View(&encoder_out), 83 std::move(token_tensor), std::move(seq_len_tensor), View(&encoder_out),
78 - std::move(states)); 84 + std::move(tmp_states));
79 } 85 }
80 86
81 OfflineMoonshineDecoderResult ans; 87 OfflineMoonshineDecoderResult ans;
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 4
5 #include "sherpa-onnx/csrc/symbol-table.h" 5 #include "sherpa-onnx/csrc/symbol-table.h"
6 6
  7 +#include <algorithm>
7 #include <cassert> 8 #include <cassert>
8 #include <cctype> 9 #include <cctype>
9 #include <fstream> 10 #include <fstream>