Add Python API (#31)
This commit is contained in:
33
.github/scripts/test-python.sh
vendored
Executable file
33
.github/scripts/test-python.sh
vendored
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
log() {
|
||||
# This function is from espnet
|
||||
local fname=${BASH_SOURCE[1]##*/}
|
||||
echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*"
|
||||
}
|
||||
|
||||
|
||||
repo_url=https://huggingface.co/csukuangfj/sherpa-onnx-lstm-en-2023-02-17
|
||||
|
||||
log "Start testing ${repo_url}"
|
||||
repo=$(basename $repo_url)
|
||||
log "Download pretrained model and test-data from $repo_url"
|
||||
|
||||
GIT_LFS_SKIP_SMUDGE=1 git clone $repo_url
|
||||
pushd $repo
|
||||
git lfs pull --include "*.onnx"
|
||||
popd
|
||||
|
||||
python3 -c "import sherpa_onnx; print(sherpa_onnx.__file__)"
|
||||
sherpa_onnx_version=$(python3 -c "import sherpa_onnx; print(sherpa_onnx.__version__)")
|
||||
|
||||
echo "sherpa_onnx version: $sherpa_onnx_version"
|
||||
|
||||
pwd
|
||||
ls -lh
|
||||
|
||||
ls -lh $repo
|
||||
|
||||
python3 python-api-examples/decode-file.py
|
||||
2
.github/workflows/macos.yaml
vendored
2
.github/workflows/macos.yaml
vendored
@@ -47,7 +47,7 @@ jobs:
|
||||
cd build
|
||||
cmake -D CMAKE_BUILD_TYPE=Release ..
|
||||
|
||||
- name: Build sherpa for macos
|
||||
- name: Build sherpa-onnx for macos
|
||||
shell: bash
|
||||
run: |
|
||||
cd build
|
||||
|
||||
62
.github/workflows/run-python-test.yaml
vendored
Normal file
62
.github/workflows/run-python-test.yaml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: run-python-test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- '.github/workflows/run-python-test.yaml'
|
||||
- '.github/scripts/test-python.sh'
|
||||
- 'CMakeLists.txt'
|
||||
- 'cmake/**'
|
||||
- 'sherpa-onnx/csrc/*'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- '.github/workflows/run-python-test.yaml'
|
||||
- '.github/scripts/test-python.sh'
|
||||
- 'CMakeLists.txt'
|
||||
- 'cmake/**'
|
||||
- 'sherpa-onnx/csrc/*'
|
||||
|
||||
concurrency:
|
||||
group: run-python-test-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
run-python-test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install Python dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
python3 -m pip install --upgrade pip numpy
|
||||
|
||||
- name: Install sherpa-onnx
|
||||
shell: bash
|
||||
run: |
|
||||
python3 setup.py install
|
||||
|
||||
- name: Test sherpa-onnx
|
||||
shell: bash
|
||||
run: |
|
||||
.github/scripts/test-python.sh
|
||||
Reference in New Issue
Block a user