Committed by
GitHub
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
正在显示
4 个修改的文件
包含
6 行增加
和
4 行删除
| @@ -132,7 +132,7 @@ jobs: | @@ -132,7 +132,7 @@ jobs: | ||
| 132 | export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH | 132 | export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH |
| 133 | export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH | 133 | export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH |
| 134 | export PATH=/c/hostedtoolcache/windows/Python/3.11.9/x64/bin:$PATH | 134 | export PATH=/c/hostedtoolcache/windows/Python/3.11.9/x64/bin:$PATH |
| 135 | - export PATH=/c/hostedtoolcache/windows/Python/3.12.3/x64/bin:$PATH | 135 | + export PATH=/c/hostedtoolcache/windows/Python/3.12.4/x64/bin:$PATH |
| 136 | 136 | ||
| 137 | which sherpa-onnx | 137 | which sherpa-onnx |
| 138 | sherpa-onnx --help | 138 | sherpa-onnx --help |
| @@ -107,7 +107,7 @@ jobs: | @@ -107,7 +107,7 @@ jobs: | ||
| 107 | export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH | 107 | export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH |
| 108 | export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH | 108 | export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH |
| 109 | export PATH=/c/hostedtoolcache/windows/Python/3.11.9/x64/bin:$PATH | 109 | export PATH=/c/hostedtoolcache/windows/Python/3.11.9/x64/bin:$PATH |
| 110 | - export PATH=/c/hostedtoolcache/windows/Python/3.12.3/x64/bin:$PATH | 110 | + export PATH=/c/hostedtoolcache/windows/Python/3.12.4/x64/bin:$PATH |
| 111 | 111 | ||
| 112 | sherpa-onnx --help | 112 | sherpa-onnx --help |
| 113 | sherpa-onnx-keyword-spotter --help | 113 | sherpa-onnx-keyword-spotter --help |
| @@ -143,7 +143,7 @@ def main(): | @@ -143,7 +143,7 @@ def main(): | ||
| 143 | (model.chunk_size - 1) * model.subsampling_factor + model.right_context + 1 | 143 | (model.chunk_size - 1) * model.subsampling_factor + model.right_context + 1 |
| 144 | ) | 144 | ) |
| 145 | chunk_length = int(chunk_length) | 145 | chunk_length = int(chunk_length) |
| 146 | - chunk_shift = int(model.required_cache_size) | 146 | + chunk_shift = int(model.chunk_size * model.subsampling_factor) |
| 147 | print(chunk_length, chunk_shift) | 147 | print(chunk_length, chunk_shift) |
| 148 | 148 | ||
| 149 | num_frames = x.shape[0] | 149 | num_frames = x.shape[0] |
| @@ -97,7 +97,9 @@ class OnlineWenetCtcModel::Impl { | @@ -97,7 +97,9 @@ class OnlineWenetCtcModel::Impl { | ||
| 97 | right_context_ + 1; | 97 | right_context_ + 1; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | - int32_t ChunkShift() const { return required_cache_size_; } | 100 | + int32_t ChunkShift() const { |
| 101 | + return config_.wenet_ctc.chunk_size * subsampling_factor_; | ||
| 102 | + } | ||
| 101 | 103 | ||
| 102 | OrtAllocator *Allocator() const { return allocator_; } | 104 | OrtAllocator *Allocator() const { return allocator_; } |
| 103 | 105 |
-
请 注册 或 登录 后发表评论