Skip to content

Commit

Permalink
Fix CI for JavaScript and Python APIs. (#901)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored May 22, 2024
1 parent b2f0249 commit 4f21aab
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 58 deletions.
5 changes: 5 additions & 0 deletions .github/scripts/test-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ if [[ x$OS != x'windows-latest' ]]; then
ls -lh

ls -lh $repo
popd

python3 ./python-api-examples/online-decode-files.py \
--tokens=$repo/tokens.txt \
Expand Down Expand Up @@ -297,6 +298,7 @@ if [[ x$OS != x'windows-latest' ]]; then
repo=$dir/sherpa-onnx-paraformer-zh-2023-03-28

ls -lh $repo
popd

python3 ./python-api-examples/offline-decode-files.py \
--tokens=$repo/tokens.txt \
Expand Down Expand Up @@ -331,6 +333,7 @@ log "Start testing ${repo_url}"
repo=$dir/sherpa-onnx-nemo-ctc-en-citrinet-512

ls -lh $repo
popd

python3 ./python-api-examples/offline-decode-files.py \
--tokens=$repo/tokens.txt \
Expand Down Expand Up @@ -376,6 +379,7 @@ log "Start testing ${repo}"
pushd $dir
curl -LS -O https://github.com/pkufool/keyword-spotting-models/releases/download/v0.1/sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01.tar.bz
tar xf sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01.tar.bz
rm sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01.tar.bz
popd

repo=$dir/$repo
Expand All @@ -401,6 +405,7 @@ if [[ x$OS != x'windows-latest' ]]; then
pushd $dir
curl -LS -O https://github.com/pkufool/keyword-spotting-models/releases/download/v0.1/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz
tar xf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz
rm sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz
popd

repo=$dir/$repo
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/arm-linux-gnueabihf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ jobs:
cp -a build-arm-linux-gnueabihf/install/lib $dst/
rm -v $dst/lib/libasound.so
rm -v $dst/lib/libonnxruntime.so
rm -v $dst/lib/libsherpa-onnx-fst.so
rm -v $dst/lib/libsherpa-onnx-fstfar.so
fi
tree $dst
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -296,41 +296,6 @@ jobs:
tar cjvf ${dst}.tar.bz2 $dst
du -h -d1 .
- name: Publish to huggingface
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && matrix.build_type == 'Release'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
shell: bash
command: |
du -h -d1 .
git config --global user.email "[email protected]"
git config --global user.name "Fangjun Kuang"
rm -rf huggingface
export GIT_CLONE_PROTECTION_ACTIVE=false
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
du -h -d1 .
cd huggingface
git lfs pull
mkdir -p linux-x64
cp -v ../sherpa-onnx-*.tar.bz2 ./linux-x64
git status
git lfs track "*.bz2"
git add .
git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}"
git push https://csukuangfj:[email protected]/csukuangfj/sherpa-onnx-libs main
du -h -d1 .
- name: Release pre-compiled binaries and libs for linux x64
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.build_type == 'Release'
uses: svenstaro/upload-release-action@v2
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/riscv64-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ jobs:
cp -a build-riscv64-linux-gnu/install/lib $dst/
rm -fv $dst/lib/libasound.so
rm -fv $dst/lib/libonnxruntime.so
rm -fv $dst/lib/libsherpa-onnx-fst.so
rm -fv $dst/lib/libsherpa-onnx-fstfar.so
fi
tree $dst
Expand Down
16 changes: 8 additions & 8 deletions cmake/openfst.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
function(download_openfst)
include(FetchContent)

set(openfst_URL "https://github.com/csukuangfj/openfst/archive/refs/tags/sherpa-onnx-2024-04-09.tar.gz")
set(openfst_URL2 "https://hub.nuaa.cf/csukuangfj/openfst/archive/refs/tags/sherpa-onnx-2024-04-09.tar.gz")
set(openfst_HASH "SHA256=d6bdb1700fa38938807184c69a5abe133e730af80822bb85c8f228768a969b92")
set(openfst_URL "https://github.com/csukuangfj/openfst/archive/refs/tags/sherpa-onnx-2024-05-22-2.tar.gz")
set(openfst_URL2 "https://hub.nuaa.cf/csukuangfj/openfst/archive/refs/tags/sherpa-onnx-2024-05-22-2.tar.gz")
set(openfst_HASH "SHA256=ec52d32ab46ac884d77c87918155ca9d0cae424095ce3bd7e3cc7eaab8235a39")

# If you don't have access to the Internet,
# please pre-download it
set(possible_file_locations
$ENV{HOME}/Downloads/openfst-sherpa-onnx-2024-04-09.tar.gz
${CMAKE_SOURCE_DIR}/openfst-sherpa-onnx-2024-04-09.tar.gz
${CMAKE_BINARY_DIR}/openfst-sherpa-onnx-2024-04-09.tar.gz
/tmp/openfst-sherpa-onnx-2024-04-09.tar.gz
/star-fj/fangjun/download/github/openfst-sherpa-onnx-2024-04-09.tar.gz
$ENV{HOME}/Downloads/openfst-sherpa-onnx-2024-05-22-2.tar.gz
${CMAKE_SOURCE_DIR}/openfst-sherpa-onnx-2024-05-22-2.tar.gz
${CMAKE_BINARY_DIR}/openfst-sherpa-onnx-2024-05-22-2.tar.gz
/tmp/openfst-sherpa-onnx-2024-05-22-2.tar.gz
/star-fj/fangjun/download/github/openfst-sherpa-onnx-2024-05-22-2.tar.gz
)

foreach(f IN LISTS possible_file_locations)
Expand Down
8 changes: 4 additions & 4 deletions scripts/dotnet/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def process_linux(s):
"libpiper_phonemize.so.1",
"libsherpa-onnx-c-api.so",
"libsherpa-onnx-core.so",
"libsherpa-onnx-fstfar.so.7",
"libsherpa-onnx-fst.so.6",
"libsherpa-onnx-fstfar.so",
"libsherpa-onnx-fst.so",
"libsherpa-onnx-kaldifst-core.so",
"libucd.so",
]
Expand Down Expand Up @@ -72,8 +72,8 @@ def process_macos(s):
"libpiper_phonemize.1.dylib",
"libsherpa-onnx-c-api.dylib",
"libsherpa-onnx-core.dylib",
"libsherpa-onnx-fstfar.7.dylib",
"libsherpa-onnx-fst.6.dylib",
"libsherpa-onnx-fstfar.dylib",
"libsherpa-onnx-fst.dylib",
"libsherpa-onnx-kaldifst-core.dylib",
"libucd.dylib",
]
Expand Down
4 changes: 0 additions & 4 deletions scripts/dotnet/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ if [ ! -f $src_dir/linux/libsherpa-onnx-core.so ]; then
cp -v sherpa_onnx/lib/*.so* ../
cd ..
rm -v libpiper_phonemize.so libpiper_phonemize.so.1.2.0
rm -v libsherpa-onnx-fst.so
rm -v libsherpa-onnx-fstfar.so
rm -v libonnxruntime.so
rm -v libcargs.so
rm -rf wheel
Expand All @@ -80,8 +78,6 @@ if [ ! -f $src_dir/macos/libsherpa-onnx-core.dylib ]; then
rm -v libcargs.dylib
rm -v libonnxruntime.dylib
rm -v libpiper_phonemize.1.2.0.dylib libpiper_phonemize.dylib
rm -v libsherpa-onnx-fst.dylib
rm -v libsherpa-onnx-fstfar.dylib
rm -rf wheel
ls -lh
cd ..
Expand Down
2 changes: 1 addition & 1 deletion sherpa-onnx/python/tests/test_speaker_recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def test_wespeaker_models(self):
test_zh_models(filename)
test_en_and_zh_models(filename)

def test_3dpeaker_models(self):
def _test_3dpeaker_models(self):
model_dir = Path(d) / "3dspeaker"
if not model_dir.is_dir():
print(f"{model_dir} does not exist - skip it")
Expand Down
2 changes: 1 addition & 1 deletion wasm/asr/sherpa-onnx-asr.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ function initSherpaOnnxOfflineWhisperModelConfig(config, Module) {
const n = encoderLen + decoderLen + languageLen + taskLen;
const buffer = Module._malloc(n);

const len = 4 * 4; // 4 pointers
const len = 5 * 4; // 4 pointers
const ptr = Module._malloc(len);

let offset = 0;
Expand Down
2 changes: 1 addition & 1 deletion wasm/tts/sherpa-onnx-tts.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function initSherpaOnnxOfflineTtsVitsModelConfig(config, Module) {

const buffer = Module._malloc(n);

const len = 7 * 4;
const len = 8 * 4;
const ptr = Module._malloc(len);

let offset = 0;
Expand Down

0 comments on commit 4f21aab

Please sign in to comment.