Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sensevoice如何动态指定语言? #1659

Open
DeoLeung opened this issue Dec 30, 2024 · 3 comments
Open

sensevoice如何动态指定语言? #1659

DeoLeung opened this issue Dec 30, 2024 · 3 comments

Comments

@DeoLeung
Copy link

如何实例化一个OfflineRecognizer, 然后动态改变language?
例如

model = sherpa_onnx.OfflineRecognizer.from_sense_voice(
    'model.int8.onnx',
    'tokens.txt',
    language='zh',
    use_itn=True,
    debug=False,
)
# 这里是zh的model
stream = model.create_stream()
stream.accept_waveform(16000, decode_audio(data))
model.decode_stream(stream)

# 这里想切换为yue, 而不想重新load一个model, 如何正确改变language?
# 例如
model.config.model_config.sense_voice.language = 'yue'

上面的代码看起来没问题, 不过不确定是否正确改变了设置

@csukuangfj
Copy link
Collaborator

目前只有初始化的时候才能指定语言。

你可以帮忙实现下动态指定语言?

(个人经验,你指定是 en, 也可以识别粤语的. 指不指定语言,关系不大, 用 auto 就行).

@DeoLeung
Copy link
Author

了解, 我晚点看看代码是如何传递的

@csukuangfj
Copy link
Collaborator

可以实现那个 SetConfig() 方法.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants