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

关于seaco_paraformer模型,python版本可以输出时间戳,onnx不能输出时间戳的问题 #1693

Open
MyWestCity opened this issue May 6, 2024 · 3 comments
Labels
question Further information is requested

Comments

@MyWestCity
Copy link

python版本的输出

from funasr import AutoModel

model = AutoModel(model="iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch",
                  model_revision="v2.0.4",
                  # vad_model="damo/speech_fsmn_vad_zh-cn-16k-common-pytorch",
                  # vad_model_revision="v2.0.4",
                  # punc_model="damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch",
                  # punc_model_revision="v2.0.4",
                  )
wav_path = 'https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav'

res = model.generate(input=wav_path,
                     hotword='达摩院',
                     batch_size_s=300)
print(res)


rtf_avg: 0.176: 100%|██████████| 1/1 [00:00<00:00,  1.02it/s]
[{'key': 'rand_key_2yW4Acq9GFz6Y', 'text': '欢 迎 大 家 来 体 验 达 摩 院 推 出 的 语 音 识 别 模 型', 'timestamp': [[870, 1110], [1110, 1350], [1370, 1530], [1530, 1770], [1770, 2010], [2010, 2170], [2170, 2410], [2490, 2650], [2650, 2830], [2830, 3030], [3030, 3230], [3230, 3470], [3470, 3710], [3710, 3950], [3950, 4190], [4210, 4410], [4410, 4610], [4610, 4830], [4830, 5245]]}]

onnx版本的输出

from funasr_onnx import SeacoParaformer
from pathlib import Path


model_dir = "iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
model = SeacoParaformer(model_dir, quantize=True, batch_size=1)

wav_path = ['{}/.cache/modelscope/hub/{}/example/asr_example.wav'.format(Path.home(), model_dir)]


hotwords = '魔搭'

result = model(wav_path, hotwords)
print(result)


[{'preds': ('欢迎大家来到魔搭社区进行体验', ['欢', '迎', '大', '家', '来', '到', '魔', '搭', '社', '区', '进', '行', '体', '验'])}]

如上所述,python版本的输出是携带时间戳的,onnx版本的是没有时间戳的。

Before asking:

跟踪源码,发现前者在这里会处理时间戳
image
但是后者在执行完推理之后,没有更多的操作
image

请问有什么方式可以让onnx也可以输出时间戳吗?

@MyWestCity MyWestCity added the question Further information is requested label May 6, 2024
@coolEphemeroptera
Copy link

coolEphemeroptera commented May 10, 2024

+1, 请问现在解决了吗,之前用vad_paraformer_onnx 的时间戳不太准,现在想用seaco_paraformer_onnx

@coolEphemeroptera
Copy link

问题已解决,我做了些修改,参考这个 https://github.com/coolEphemeroptera/funasr_seaco_paraformer_onnx_with_timestamp

@MyWestCity
Copy link
Author

问题已解决,我做了些修改,参考这个 https://github.com/coolEphemeroptera/funasr_seaco_paraformer_onnx_with_timestamp

好的,非常感谢!!!我试一下。

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

No branches or pull requests

2 participants