Skip to content

Commit

Permalink
Fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Oct 6, 2024
1 parent 81eed55 commit dd3b913
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/speaker-diarization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:
with:
fetch-depth: 0

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-speaker-diarization

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -35,11 +40,30 @@ jobs:
run: |
pip install pyannote.audio onnx onnxruntime
- name: Install sherpa-onnx from source
shell: bash
run: |
python3 -m pip install --upgrade pip
python3 -m pip install wheel twine setuptools
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cat sherpa-onnx/python/sherpa_onnx/__init__.py
python3 setup.py bdist_wheel
ls -lh dist
pip install ./dist/*.whl
- name: Run tests
shell: bash
run: |
pushd scripts/pyannote/segmentation
python3 -c "import sherpa_onnx; print(sherpa_onnx.__file__)"
python3 -c "import sherpa_onnx; print(sherpa_onnx.__version__)"
python3 -c "import sherpa_onnx; print(dir(sherpa_onnx))"
curl -SL -O https://huggingface.co/csukuangfj/pyannote-models/resolve/main/segmentation-3.0/pytorch_model.bin
test_wavs=(
Expand All @@ -53,6 +77,8 @@ jobs:
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-segmentation-models/$w
done
soxi *.wav
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-segmentation-models/sherpa-onnx-pyannote-segmentation-3-0.tar.bz2
tar xvf sherpa-onnx-pyannote-segmentation-3-0.tar.bz2
rm sherpa-onnx-pyannote-segmentation-3-0.tar.bz2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,4 @@ vits-melo-tts-zh_en
*.ppu
sherpa-onnx-online-punct-en-2024-08-06
*.mp4
*.mp3
7 changes: 5 additions & 2 deletions scripts/pyannote/segmentation/speaker-diarization-onnx.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/usr/bin/env python3
# Copyright 2024 Xiaomi Corp. (authors: Fangjun Kuang)

"""
Please refer to
https://github.com/k2-fsa/sherpa-onnx/blob/master/.github/workflows/speaker-diarization.yaml
for usages.
"""

import argparse
from datetime import timedelta
Expand Down Expand Up @@ -64,8 +69,6 @@ def merge_segment_list(in_out: List[Segment], min_duration_off: float):
changed = True
break

pass


def get_args():
parser = argparse.ArgumentParser()
Expand Down
6 changes: 6 additions & 0 deletions scripts/pyannote/segmentation/speaker-diarization-torch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env python3

"""
Please refer to
https://github.com/k2-fsa/sherpa-onnx/blob/master/.github/workflows/speaker-diarization.yaml
for usages.
"""

"""
1. Go to https://huggingface.co/hbredin/wespeaker-voxceleb-resnet34-LM/tree/main
wget https://huggingface.co/hbredin/wespeaker-voxceleb-resnet34-LM/resolve/main/speaker-embedding.onnx
Expand Down
2 changes: 1 addition & 1 deletion sherpa-onnx/csrc/fast-clustering.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class FastClustering::Impl {
std::vector<double> height(num_rows - 1);

fastclustercpp::hclust_fast(num_rows, distance.data(),
fastclustercpp::HCLUST_METHOD_SINGLE,
fastclustercpp::HCLUST_METHOD_COMPLETE,
merge.data(), height.data());

std::vector<int32_t> labels(num_rows);
Expand Down

0 comments on commit dd3b913

Please sign in to comment.