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
SilverSulfide
2024-06-19 11:29:37 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2024-06-19 16:29:37 +0800
Commit
656b9fa1c89c678c89b9e8f6fc2404be1d7ba685
656b9fa1
1 parent
167bc76d
Add Python API support for Offline LM rescoring (#1033)
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
15 行增加
和
0 行删除
sherpa-onnx/python/sherpa_onnx/offline_recognizer.py
sherpa-onnx/python/sherpa_onnx/offline_recognizer.py
查看文件 @
656b9fa
...
...
@@ -6,6 +6,7 @@ from typing import List, Optional
from
_sherpa_onnx
import
(
FeatureExtractorConfig
,
OfflineCtcFstDecoderConfig
,
OfflineLMConfig
,
OfflineModelConfig
,
OfflineNemoEncDecCtcModelConfig
,
OfflineParaformerModelConfig
,
...
...
@@ -56,6 +57,8 @@ class OfflineRecognizer(object):
model_type
:
str
=
"transducer"
,
rule_fsts
:
str
=
""
,
rule_fars
:
str
=
""
,
lm
:
str
=
""
,
lm_scale
:
float
=
0.1
,
):
"""
Please refer to
...
...
@@ -143,9 +146,21 @@ class OfflineRecognizer(object):
f
"--hotwords-file. Currently given: {decoding_method}"
)
if
lm
and
decoding_method
!=
"modified_beam_search"
:
raise
ValueError
(
"Please use --decoding-method=modified_beam_search when using "
f
"--lm. Currently given: {decoding_method}"
)
lm_config
=
OfflineLMConfig
(
model
=
lm
,
scale
=
lm_scale
,
)
recognizer_config
=
OfflineRecognizerConfig
(
feat_config
=
feat_config
,
model_config
=
model_config
,
lm_config
=
lm_config
,
decoding_method
=
decoding_method
,
max_active_paths
=
max_active_paths
,
hotwords_file
=
hotwords_file
,
...
...
请
注册
或
登录
后发表评论