Skip to content

Commit

Permalink
First working version for ctc decoding with H/HL/HLG (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Sep 30, 2023
1 parent b54298d commit bfd778e
Show file tree
Hide file tree
Showing 46 changed files with 3,819 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
BasedOnStyle: Google
---
Language: Cpp
Cpp11BracedListStyle: true
Standard: Cpp11
DerivePointerAlignment: false
PointerAlignment: Right
---
64 changes: 64 additions & 0 deletions .github/workflows/build-wheels-aarch64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: build-wheels-aarch64

on:
push:
branches:
- wheel
tags:
- '*'

workflow_dispatch:

env:
KALDI_DECODER_IS_FOR_PYPI: 1

concurrency:
group: build-wheels-aarch64-${{ github.ref }}
cancel-in-progress: true

jobs:
build_wheels_aarch64:
name: ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"]

steps:
- uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all

# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
# for a list of versions
- name: Build wheels
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_BUILD: "${{ matrix.python-version}}-* "
CIBW_SKIP: "cp27-* cp35-* cp36-* *-win32 pp* *-musllinux* *-manylinux_i686"
CIBW_BUILD_VERBOSITY: 3
CIBW_ARCHS_LINUX: aarch64
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH='/project/build/lib.linux-aarch64-cpython-37/kaldi_decoder/lib:/project/build/lib.linux-aarch64-cpython-38/kaldi_decoder/lib:/project/build/lib.linux-aarch64-cpython-39/kaldi_decoder/lib:/project/build/lib.linux-aarch64-cpython-310/kaldi_decoder/lib:/project/build/lib.linux-aarch64-cpython-311/kaldi_decoder/lib:/project/build/lib.linux-aarch64-cpython-312/kaldi_decoder/lib'

- name: Display wheels
shell: bash
run: |
ls -lh ./wheelhouse/
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

- name: Publish wheels to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m pip install --upgrade pip
python3 -m pip install wheel twine setuptools
twine upload ./wheelhouse/*.whl
71 changes: 71 additions & 0 deletions .github/workflows/build-wheels-linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: build-wheels-linux

on:
push:
branches:
- wheel
tags:
- '*'

workflow_dispatch:

concurrency:
group: build-wheels-linux-${{ github.ref }}
cancel-in-progress: true

jobs:
build_wheels_linux:
name: ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"]

steps:
- uses: actions/checkout@v2

# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
# for a list of versions
- name: Build wheels
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_BUILD: "${{ matrix.python-version}}-* "
CIBW_SKIP: "cp27-* cp35-* cp36-* pp* *-musllinux* *-win32 "
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH='/project/build/lib.linux-x86_64-cpython-37/kaldi_decoder/lib:/project/build/lib.linux-i686-cpython-37/kaldi_decoder/lib:/project/build/lib.linux-x86_64-cpython-38/kaldi_decoder/lib:/project/build/lib.linux-i686-cpython-38/kaldi_decoder/lib:/project/build/lib.linux-x86_64-cpython-39/kaldi_decoder/lib:/project/build/lib.linux-i686-cpython-39/kaldi_decoder/lib:/project/build/lib.linux-x86_64-cpython-310/kaldi_decoder/lib:/project/build/lib.linux-i686-cpython-310/kaldi_decoder/lib:/project/build/lib.linux-x86_64-cpython-311/kaldi_decoder/lib:/project/build/lib.linux-i686-cpython-311/kaldi_decoder/lib:/project/build/lib.linux-x86_64-cpython-312/kaldi_decoder/lib:/project/build/lib.linux-i686-cpython-312/kaldi_decoder/lib'

- name: Display wheels
shell: bash
run: |
ls -lh ./wheelhouse/
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

- name: Publish wheels to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m pip install --upgrade pip
python3 -m pip install wheel twine setuptools
twine upload ./wheelhouse/*.whl
- name: Build sdist
if: matrix.python-version == 'cp38'
shell: bash
run: |
python3 setup.py sdist
ls -lh dist/*
- name: Publish sdist to PyPI
if: matrix.python-version == 'cp38'
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/kaldi-decoder-*.tar.gz
62 changes: 62 additions & 0 deletions .github/workflows/build-wheels-macos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: build-wheels-macos

on:
push:
branches:
- wheel
tags:
- '*'

workflow_dispatch:

env:
KALDI_DECODER_IS_FOR_PYPI: 1

concurrency:
group: build-wheels-macos-${{ github.ref }}
cancel-in-progress: true

jobs:
build_wheels:
name: ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
python-version: ["cp38", "cp39", "cp310", "cp311", "cp312"]

steps:
- uses: actions/checkout@v2

# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
# for a list of versions
- name: Build wheels
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_BUILD: "${{ matrix.python-version}}-* "
CIBW_ENVIRONMENT: KALDI_DECODER_CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES='arm64;x86_64'"
CIBW_ARCHS: "universal2"
CIBW_BUILD_VERBOSITY: 3

# Don't repair macOS wheels
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""

- name: Display wheels
shell: bash
run: |
ls -lh ./wheelhouse/
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

- name: Publish wheels to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m pip install --upgrade pip
python3 -m pip install wheel twine setuptools
twine upload ./wheelhouse/*.whl
56 changes: 56 additions & 0 deletions .github/workflows/build-wheels-win32.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: build-wheels-win32

on:
push:
branches:
- wheel
tags:
- '*'

workflow_dispatch:

concurrency:
group: build-wheels-win32-${{ github.ref }}
cancel-in-progress: true

jobs:
build_wheels_win32:
name: ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
python-version: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"]

steps:
- uses: actions/checkout@v2

# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
# for a list of versions
- name: Build wheels
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_ENVIRONMENT: KALDI_DECODER_CMAKE_ARGS="-A Win32"
CIBW_BUILD: "${{ matrix.python-version}}-* "
CIBW_SKIP: "*-win_amd64"
CIBW_BUILD_VERBOSITY: 3

- name: Display wheels
shell: bash
run: |
ls -lh ./wheelhouse/
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

- name: Publish wheels to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m pip install --upgrade pip
python3 -m pip install wheel twine setuptools
twine upload ./wheelhouse/*.whl
55 changes: 55 additions & 0 deletions .github/workflows/build-wheels-win64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: build-wheels-win64

on:
push:
branches:
- wheel
tags:
- '*'

workflow_dispatch:

concurrency:
group: build-wheels-win64-${{ github.ref }}
cancel-in-progress: true

jobs:
build_wheels_win64:
name: ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
python-version: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"]

steps:
- uses: actions/checkout@v2

# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
# for a list of versions
- name: Build wheels
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_BUILD: "${{ matrix.python-version}}-* "
CIBW_SKIP: "cp27-* cp35-* cp36-* pp* *-musllinux* *-win32 "
CIBW_BUILD_VERBOSITY: 3

- name: Display wheels
shell: bash
run: |
ls -lh ./wheelhouse/
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

- name: Publish wheels to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m pip install --upgrade pip
python3 -m pip install wheel twine setuptools
twine upload ./wheelhouse/*.whl
60 changes: 60 additions & 0 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: linux

on:
push:
branches:
- master
pull_request:
branches:
- master

workflow_dispatch:

concurrency:
group: linux-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
linux:
name: ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Configure CMake
shell: bash
run: |
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -DKALDI_DECODER_ENABLE_TESTS=ON ..
- name: Build
run: |
cd build
make -j2
ls -lh lib
- name: Test
run: |
cd build
ctest --output-on-failure
Loading

0 comments on commit bfd778e

Please sign in to comment.