Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Fangjun Kuang
2024-08-07 18:35:38 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2024-08-07 18:35:38 +0800
Commit
8a5f5c1999981e6362a530f00b16adf3109686b5
8a5f5c19
1 parent
1da75ee3
Fix python two pass ASR examples (#1230)
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
11 行增加
和
6 行删除
python-api-examples/two-pass-speech-recognition-from-microphone.py
sherpa-onnx/csrc/sherpa-onnx-online-punctuation.cc
python-api-examples/two-pass-speech-recognition-from-microphone.py
查看文件 @
8a5f5c1
...
...
@@ -335,11 +335,10 @@ def create_second_pass_recognizer(args) -> sherpa_onnx.OfflineRecognizer:
def
run_second_pass
(
recognizer
:
sherpa_onnx
.
OfflineRecognizer
,
sample
_buffers
:
List
[
np
.
ndarray
]
,
sample
s
:
np
.
ndarray
,
sample_rate
:
int
,
):
stream
=
recognizer
.
create_stream
()
samples
=
np
.
concatenate
(
sample_buffers
)
stream
.
accept_waveform
(
sample_rate
,
samples
)
recognizer
.
decode_stream
(
stream
)
...
...
@@ -407,14 +406,20 @@ def main():
if
is_endpoint
:
if
result
:
samples
=
np
.
concatenate
(
sample_buffers
)
# There are internal sample buffers inside the streaming
# feature extractor, so we cannot send all samples to
# the 2nd pass. Here 8000 is just an empirical value
# that should work for most streaming models in sherpa-onnx
sample_buffers
=
[
samples
[
-
8000
:]]
samples
=
samples
[:
-
8000
]
result
=
run_second_pass
(
recognizer
=
second_recognizer
,
sample
_buffers
=
sample_buffer
s
,
sample
s
=
sample
s
,
sample_rate
=
sample_rate
,
)
result
=
result
.
lower
()
.
strip
()
sample_buffers
=
[]
print
(
"
\r
{}:{}"
.
format
(
segment_id
,
" "
*
len
(
last_result
)),
end
=
""
,
...
...
sherpa-onnx/csrc/sherpa-onnx-online-punctuation.cc
查看文件 @
8a5f5c1
...
...
@@ -18,8 +18,8 @@ The input text can contain English words.
Usage:
Please download the model from:
https://huggingface.co/frankyoujian/Edge-Punct-Casing/resolve/main/sherpa-onnx-cnn-bilstm-unigram-bpe-en.7z
Please download the model from:
https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2
./bin/Release/sherpa-onnx-online-punctuation \
--cnn-bilstm=/path/to/model.onnx \
...
...
请
注册
或
登录
后发表评论