mirror of
https://github.com/k2-fsa/sherpa-onnx.git
synced 2026-11-10 21:11:03 +08:00
Fix CI tests (#3940)
This commit is contained in:
1 parent
1b8b06b770
commit
a4d0341b42
9 files changed
+101
-28
No files matched your search
@@ -20,13 +20,11 @@ jobs:
|
||||
nightly-wheel-arm:
|
||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
|
||||
name: ${{ matrix.python-version }}
|
||||
# see https://github.com/actions/virtual-environments/blob/win19/20210525.0/images/win/Windows2019-Readme.md
|
||||
runs-on: ${{ matrix.os}}
|
||||
runs-on: ubuntu-22.04-arm
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
|
||||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -39,33 +37,54 @@ jobs:
|
||||
./new-release.sh
|
||||
git diff .
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
with:
|
||||
platforms: arm
|
||||
|
||||
- name: Run docker
|
||||
shell: bash
|
||||
run: |
|
||||
docker run --rm \
|
||||
--platform linux/arm/v7 \
|
||||
--volume ${{ github.workspace }}/:/workspace \
|
||||
balenalib/raspberrypi3-python:${{ matrix.python-version }}-bullseye-build \
|
||||
--volume ${{ github.workspace }}/:/home/runner/work/sherpa-onnx/sherpa-onnx \
|
||||
quay.io/pypa/manylinux_2_35_armv7l${{ matrix.python-version == '3.8' && ':2025.11.29-1' || '' }} \
|
||||
bash -c '
|
||||
uname -a
|
||||
cd /workspace
|
||||
ls -lh
|
||||
|
||||
v=${{ matrix.python-version }}
|
||||
PYTHON_VERSION=${v/./}
|
||||
echo PYTHON_VERSION=$PYTHON_VERSION >> $GITHUB_ENV
|
||||
extra=""
|
||||
if [[ ${PYTHON_VERSION} == "37" ]]; then
|
||||
extra="m"
|
||||
python_version=${{ matrix.python-version }}
|
||||
|
||||
cd /home/runner/work/sherpa-onnx/sherpa-onnx
|
||||
|
||||
echo "--------------------"
|
||||
PY_GLOB="/opt/_internal/cpython-${python_version}*/bin"
|
||||
|
||||
shopt -s nullglob
|
||||
matches=($PY_GLOB)
|
||||
shopt -u nullglob
|
||||
|
||||
if [[ ${#matches[@]} -eq 0 ]]; then
|
||||
echo "No Python installation found for version $python_version"
|
||||
exit 1
|
||||
elif [[ ${#matches[@]} -gt 1 ]]; then
|
||||
echo "Multiple Python installations found for version $python_version:"
|
||||
printf " %s\n" "${matches[@]}"
|
||||
echo "Using the first one: ${matches[0]}"
|
||||
fi
|
||||
|
||||
# pip install -i https://www.piwheels.org/simple numpy sentencepiece click
|
||||
pip install https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/sentencepiece-0.2.0-cp${PYTHON_VERSION}-cp${PYTHON_VERSION}${extra}-linux_armv7l.whl
|
||||
PY_PATH="${matches[0]}"
|
||||
|
||||
echo "$PY_PATH"
|
||||
export PATH="$PY_PATH:$PATH"
|
||||
which python3
|
||||
python3 --version
|
||||
|
||||
python3 -m venv my
|
||||
|
||||
source ./my/bin/activate
|
||||
|
||||
git clone --depth 1 --branch v1.2.12 https://github.com/alsa-project/alsa-lib
|
||||
pushd alsa-lib
|
||||
./gitcompile
|
||||
popd
|
||||
|
||||
export LD_LIBRARY_PATH=$PWD/alsa-lib/src/.libs:$LD_LIBRARY_PATH
|
||||
|
||||
pip install --no-deps sherpa-onnx
|
||||
python3 -c "import sherpa_onnx; print(sherpa_onnx.__file__, sherpa_onnx.__version__); print(dir(sherpa_onnx)); print(help(sherpa_onnx))"
|
||||
'
|
||||
@@ -196,6 +196,17 @@ jobs:
|
||||
run: |
|
||||
cp -v scripts/dotnet/examples/Common.csproj dotnet-examples/Common/
|
||||
|
||||
# RestoreSources in Common.csproj doesn't propagate to parent
|
||||
# projects. Add it via Directory.Build.props so every .csproj
|
||||
# in dotnet-examples/ picks up /tmp/packages as a source.
|
||||
cat > dotnet-examples/Directory.Build.props << 'EOF'
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
EOF
|
||||
|
||||
ls -lh /tmp
|
||||
|
||||
df -h
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"mic": "^2.1.2",
|
||||
"naudiodon2": "^2.4.0",
|
||||
"sherpa-onnx": "^1.13.7",
|
||||
"wav": "^1.0.2"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang)
|
||||
//
|
||||
const portAudio = require('naudiodon2');
|
||||
let portAudio;
|
||||
try {
|
||||
portAudio = require('naudiodon2');
|
||||
} catch (e) {
|
||||
console.error(
|
||||
'Error: naudiodon2 is not installed. Please install it with:\n' +
|
||||
' npm install naudiodon2');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(portAudio.getDevices());
|
||||
|
||||
const sherpa_onnx = require('sherpa-onnx');
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang)
|
||||
//
|
||||
const portAudio = require('naudiodon2');
|
||||
let portAudio;
|
||||
try {
|
||||
portAudio = require('naudiodon2');
|
||||
} catch (e) {
|
||||
console.error(
|
||||
'Error: naudiodon2 is not installed. Please install it with:\n' +
|
||||
' npm install naudiodon2');
|
||||
process.exit(1);
|
||||
}
|
||||
// console.log(portAudio.getDevices());
|
||||
|
||||
const sherpa_onnx = require('sherpa-onnx');
|
||||
|
||||
@@ -583,8 +583,7 @@ class OfflineSpeakerDiarizationPyannoteImpl
|
||||
}
|
||||
|
||||
if (k != cur_row_index) {
|
||||
auto seq = Eigen::seqN(0, cur_row_index);
|
||||
ans = ans(seq, Eigen::placeholders::all);
|
||||
ans.conservativeResize(cur_row_index, ans.cols());
|
||||
}
|
||||
|
||||
return ans;
|
||||
|
||||
@@ -719,10 +719,10 @@ fn copy_dir_recursively(src: &Path, dst: &Path) -> Result<(), DynError> {
|
||||
if ty.is_dir() {
|
||||
copy_dir_recursively(&entry.path(), &dest_path)?;
|
||||
} else if ty.is_symlink() {
|
||||
let target = fs::read_link(entry.path())?;
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::symlink;
|
||||
let target = fs::read_link(entry.path())?;
|
||||
symlink(&target, &dest_path)?;
|
||||
}
|
||||
#[cfg(not(unix))]
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
//! Raw FFI bindings for [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx).
|
||||
//!
|
||||
//! # Environment variables
|
||||
//!
|
||||
//! The build script (`build.rs`) recognises the following environment
|
||||
//! variables, all of which are optional:
|
||||
//!
|
||||
//! | Variable | Purpose |
|
||||
//! |---|---|
|
||||
//! | `SHERPA_ONNX_LIB_DIR` | Path to a directory that already contains the |
|
||||
//! | | pre-built native libraries (`.so` / `.dylib` / `.dll` / `.a`). |
|
||||
//! | | When set, the build script skips downloading and uses these |
|
||||
//! | | libraries directly. |
|
||||
//! | `SHERPA_ONNX_ARCHIVE_DIR` | Path to a directory that contains |
|
||||
//! | | pre-downloaded archive files (`.tar.bz2` or `.xcframework.zip`). |
|
||||
//! | | When set, the build script copies the archive from this directory |
|
||||
//! | | instead of downloading it from the internet. The archive must have |
|
||||
//! | | the same filename that would normally be downloaded (e.g. |
|
||||
//! | | `sherpa-onnx-v1.13.7-linux-x64-shared-lib.tar.bz2`). |
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
|
||||
@@ -42,6 +42,16 @@
|
||||
//!
|
||||
//! That override works for both static and shared builds.
|
||||
//!
|
||||
//! Alternatively, set `SHERPA_ONNX_ARCHIVE_DIR` to a directory that contains
|
||||
//! pre-downloaded archive files (`.tar.bz2` or `.xcframework.zip`). The build
|
||||
//! script copies the archive from this directory instead of downloading it from
|
||||
//! the internet. The archive must have the same filename that would normally be
|
||||
//! downloaded (e.g. `sherpa-onnx-v1.13.7-linux-x64-shared-lib.tar.bz2`).
|
||||
//!
|
||||
//! ```bash
|
||||
//! export SHERPA_ONNX_ARCHIVE_DIR=/path/to/downloaded/archives
|
||||
//! ```
|
||||
//!
|
||||
//! Shared mode is also intended to work out of the box for normal users:
|
||||
//!
|
||||
//! - Linux and macOS: the build script adds both absolute and relative rpath
|
||||
|
||||
Reference in new issue
Block a user