fix a bug for wenet streaming model. (#1054)

* fix a bug for wenet streaming model.

The chunk shift was wrong.
See
https://github.com/wenet-e2e/wenet/blob/main/runtime/core/decoder/asr_model.cc#L15
and
https://github.com/wenet-e2e/wenet/blob/main/runtime/core/decoder/asr_model.cc#L28
This commit is contained in:
Fangjun Kuang
2024-06-24 21:52:54 +08:00
committed by GitHub
parent 1f95bff719
commit a3bac19c54
4 changed files with 6 additions and 4 deletions

View File

@@ -132,7 +132,7 @@ jobs:
export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH
export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH
export PATH=/c/hostedtoolcache/windows/Python/3.11.9/x64/bin:$PATH
export PATH=/c/hostedtoolcache/windows/Python/3.12.3/x64/bin:$PATH
export PATH=/c/hostedtoolcache/windows/Python/3.12.4/x64/bin:$PATH
which sherpa-onnx
sherpa-onnx --help

View File

@@ -107,7 +107,7 @@ jobs:
export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH
export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH
export PATH=/c/hostedtoolcache/windows/Python/3.11.9/x64/bin:$PATH
export PATH=/c/hostedtoolcache/windows/Python/3.12.3/x64/bin:$PATH
export PATH=/c/hostedtoolcache/windows/Python/3.12.4/x64/bin:$PATH
sherpa-onnx --help
sherpa-onnx-keyword-spotter --help

View File

@@ -143,7 +143,7 @@ def main():
(model.chunk_size - 1) * model.subsampling_factor + model.right_context + 1
)
chunk_length = int(chunk_length)
chunk_shift = int(model.required_cache_size)
chunk_shift = int(model.chunk_size * model.subsampling_factor)
print(chunk_length, chunk_shift)
num_frames = x.shape[0]

View File

@@ -97,7 +97,9 @@ class OnlineWenetCtcModel::Impl {
right_context_ + 1;
}
int32_t ChunkShift() const { return required_cache_size_; }
int32_t ChunkShift() const {
return config_.wenet_ctc.chunk_size * subsampling_factor_;
}
OrtAllocator *Allocator() const { return allocator_; }