Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions .github/workflows/test-kws-output.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ on:
- "funasr/models/fsmn_kws_mt/**"
- "funasr/models/sanm_kws/**"
- "funasr/models/sanm_kws_streaming/**"
- "funasr/frontends/wav_frontend.py"
- "funasr/auto/auto_model.py"
- "funasr/utils/datadir_writer.py"
- "funasr/utils/kws_utils.py"
- "tests/test_kws_optional_output.py"
- "tests/test_kws_streaming_continuity.py"
- "tests/test_kws_utils.py"
- "tests/test_fsmn_vad_streaming_buffers.py"
- "tests/test_dynamic_streaming_vad.py"
- "tests/test_fsmn_vad_dynamic_silence.py"
- ".github/workflows/test-kws-output.yml"
push:
branches: [main]
Expand All @@ -18,9 +25,16 @@ on:
- "funasr/models/fsmn_kws_mt/**"
- "funasr/models/sanm_kws/**"
- "funasr/models/sanm_kws_streaming/**"
- "funasr/frontends/wav_frontend.py"
- "funasr/auto/auto_model.py"
- "funasr/utils/datadir_writer.py"
- "funasr/utils/kws_utils.py"
- "tests/test_kws_optional_output.py"
- "tests/test_kws_streaming_continuity.py"
- "tests/test_kws_utils.py"
- "tests/test_fsmn_vad_streaming_buffers.py"
- "tests/test_dynamic_streaming_vad.py"
- "tests/test_fsmn_vad_dynamic_silence.py"
- ".github/workflows/test-kws-output.yml"

permissions:
Expand All @@ -30,6 +44,9 @@ jobs:
kws-output:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
OMP_NUM_THREADS: "1"
MKL_NUM_THREADS: "1"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -38,7 +55,14 @@ jobs:
cache: pip
- name: Install CPU test dependencies
run: |
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
python -m pip install "numpy<2" "kaldiio>=2.17.0" librosa "rapidfuzz>=3.0.0" six
- name: Check KWS results and optional file output without model weights
run: python -m unittest discover -s tests -p test_kws_optional_output.py -v
python -m pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu
python -m pip install "numpy<2" "kaldiio>=2.17.0" librosa "rapidfuzz>=3.0.0" six pytest omegaconf hydra-core pyyaml tqdm
- name: Check KWS continuity and related frontend contracts without model weights
run: |
python -m pytest -q \
tests/test_kws_optional_output.py \
tests/test_kws_streaming_continuity.py \
tests/test_kws_utils.py \
tests/test_fsmn_vad_streaming_buffers.py \
tests/test_dynamic_streaming_vad.py \
tests/test_fsmn_vad_dynamic_silence.py
4 changes: 2 additions & 2 deletions funasr/frontends/wav_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ def forward(self, input: torch.Tensor, input_lengths: torch.Tensor, **kwargs):
feats[i][0, :].unsqueeze(dim=0).repeat((self.lfr_m - 1) // 2, 1)
)
# need the number of the input frames + self.lfr_splice_cache[0].shape[0] is greater than self.lfr_m
if feats_lengths[0] + cache["lfr_splice_cache"][0].shape[0] >= self.lfr_m:
if is_final or feats_lengths[0] + cache["lfr_splice_cache"][0].shape[0] >= self.lfr_m:
lfr_splice_cache_tensor = torch.stack(cache["lfr_splice_cache"]) # B T D
feats = torch.cat((lfr_splice_cache_tensor, feats), dim=1)
feats_lengths += lfr_splice_cache_tensor[0].shape[0]
Expand Down Expand Up @@ -591,7 +591,7 @@ def forward(self, input: torch.Tensor, input_lengths: torch.Tensor, **kwargs):
)
return torch.empty(0), feats_lengths
else:
if is_final:
if is_final and cache["lfr_splice_cache"]:
cache["waveforms"] = (
waveforms
if cache["reserve_waveforms"].numel() == 0
Expand Down
Loading
Loading