Fixed the problem that the duplicated characters would be merged as o… #252
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2022 Xiaomi Corp. (author: Fangjun Kuang) | |
# See ../../LICENSE for clarification regarding multiple authors | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
name: Run C++ tests | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- '.github/workflows/run-cpp-test.yaml' | |
- '.github/scripts/run-offline-transducer.sh' | |
- '.github/scripts/run-online-transducer.sh' | |
- '.github/scripts/run-offline-ctc.sh' | |
- 'CMakeLists.txt' | |
- 'cmake/**' | |
- 'sherpa/csrc/**' | |
- 'sherpa/cpp_api/**' | |
pull_request: | |
types: [labeled] | |
paths: | |
- '.github/workflows/run-cpp-test.yaml' | |
- '.github/scripts/run-offline-transducer.sh' | |
- '.github/scripts/run-online-transducer.sh' | |
- '.github/scripts/run-offline-ctc.sh' | |
- 'CMakeLists.txt' | |
- 'cmake/**' | |
- 'sherpa/csrc/**' | |
- 'sherpa/cpp_api/**' | |
concurrency: | |
group: run_cpp_tests-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
run_cpp_tests: | |
if: github.event.label.name == 'ready' || github.event.label.name == 'cpp' || github.event_name == 'push' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
torch: ["2.1.2"] | |
python-version: ["3.8"] | |
build_type: ["Release", "Debug"] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: ccache | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: ${{ matrix.os }}-${{ matrix.torch }}-${{ matrix.python-version }}-${{ matrix.build_type }} | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Display gcc version | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
gcc --version | |
- name: Display clang version | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
clang --version | |
- name: Install PyTorch ${{ matrix.torch }} | |
shell: bash | |
run: | | |
sudo apt-get -qq install git-lfs tree sox | |
sox --version | |
sudo apt-get -qq install -y libsnappy-dev libzzip-dev zlib1g-dev libboost-all-dev | |
python3 -m pip install --upgrade pip kaldi_native_io sentencepiece>=0.1.96 | |
python3 -m pip install wheel twine typing_extensions | |
python3 -m pip install torch==${{ matrix.torch }} numpy -f https://download.pytorch.org/whl/cpu/torch_stable.html | |
python3 -m pip install k2==1.24.4.dev20231220+cpu.torch${{ matrix.torch }} -f https://k2-fsa.github.io/k2/cpu.html | |
python3 -m pip install kaldifeat==1.25.3.dev20231221+cpu.torch${{ matrix.torch }} -f https://csukuangfj.github.io/kaldifeat/cpu.html | |
python3 -m torch.utils.collect_env | |
- name: Build sherpa | |
shell: bash | |
env: | |
BUILD_TYPE: ${{ matrix.build_type }} | |
run: | | |
echo "Build type: $BUILD_TYPE" | |
mkdir build | |
cd build | |
cmake \ | |
-DCMAKE_CXX_STANDARD=17 \ | |
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \ | |
-DSHERPA_ENABLE_TESTS=ON .. | |
make -j4 VERBOSE=1 | |
ls -lh lib | |
ls -lh bin | |
- name: Display dependencies | |
if: startsWith(matrix.os, 'ubuntu') | |
shell: bash | |
run: | | |
cd build | |
ldd lib/libsherpa_core.so | |
ldd bin/sherpa-offline | |
readelf -d lib/libsherpa_core.so | |
readelf -d bin/sherpa-offline | |
readelf -d bin/sherpa-online | |
- name: Display dependencies | |
if: startsWith(matrix.os, 'macos') | |
shell: bash | |
run: | | |
cd build | |
otool -L lib/libsherpa_core.dylib | |
otool -l lib/libsherpa_core.dylib | |
otool -L bin/sherpa-offline | |
otool -l bin/sherpa-offline | |
otool -L bin/sherpa-online | |
otool -l bin/sherpa-online | |
- name: Test sherpa | |
shell: bash | |
run: | | |
cd build | |
# test_log | |
SHERPA_LOG_LEVEL=TRACE ./bin/test-log | |
SHERPA_LOG_LEVEL=DEBUG ./bin/test-log | |
SHERPA_LOG_LEVEL=INFO ./bin/test-log | |
SHERPA_LOG_LEVEL=WARNING ./bin/test-log | |
SHERPA_LOG_LEVEL=ERROR ./bin/test-log | |
ctest --verbose --output-on-failure -E py # exclude Python tests | |
- name: Display sherpa version | |
shell: bash | |
run: | | |
cd build | |
./bin/sherpa-version | |
./bin/sherpa-offline --help | |
- name: Run online transducer | |
shell: bash | |
run: | | |
.github/scripts/run-online-transducer.sh | |
- name: Run offline transducer | |
shell: bash | |
run: | | |
.github/scripts/run-offline-transducer.sh | |
- name: Run offline CTC | |
shell: bash | |
run: | | |
.github/scripts/run-offline-ctc.sh |