开发者社区 > ModelScope模型即服务 > 自然语言处理 > 正文

FunASR 语音识别报错,会的帮忙回答下

下面两种方法有什么区别,为什么我第一个报错,第二个可以
1
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

inference_pipeline = pipeline(
task=Tasks.auto_speech_recognition,
model='iic/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch',
model_revision="v2.0.4")

rec_result = inference_pipeline('https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_vad_punc_example.wav')
print(rec_result)

2
from funasr import AutoModel
model = AutoModel(model="paraformer-zh", model_revision="v2.0.4",
vad_model="fsmn-vad", vad_model_revision="v2.0.4",
punc_model="ct-punc-c", punc_model_revision="v2.0.4",

              # spk_model="cam++", spk_model_revision="v2.0.2",
              )

res = model.generate(input=f"{model.model_path}/example/asr_example.wav",
batch_size_s=300,
hotword='魔搭')
print(res)

第一种方法错误信息如下:

C:>python D:\python3\url.py
2024-02-04 14:37:40,405 - modelscope - INFO - PyTorch version 2.2.0 Found.
2024-02-04 14:37:40,415 - modelscope - INFO - Loading ast index from C:\Users\man.cache\modelscope\ast_indexer
2024-02-04 14:37:40,698 - modelscope - INFO - Loading done! Current index file version is 1.11.1, with md5 86717728ed73cdfdb006bab07ba66d92 and a total number of 956 components indexed
2024-02-04 14:37:43,685 - modelscope - INFO - Use user-specified model revision: v2.0.4
2024-02-04 14:37:44,070 - modelscope - INFO - initiate model from C:\Users\man.cache\modelscope\hub\iic\speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch
2024-02-04 14:37:44,070 - modelscope - INFO - initiate model from location C:\Users\man.cache\modelscope\hub\iic\speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch.
2024-02-04 14:37:44,070 - modelscope - INFO - initialize model from C:\Users\man.cache\modelscope\hub\iic\speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch
2024-02-04 14:37:52,524 - modelscope - WARNING - Model revision not specified, use revision: v2.0.0
Traceback (most recent call last):
File "D:\Python38\lib\site-packages\modelscope\utils\registry.py", line 210, in build_from_cfg
return obj_cls._instantiate(args)
File "D:\Python38\lib\site-packages\modelscope\models\base\base_model.py", line 67, in _instantiate
return cls(kwargs)
File "D:\Python38\lib\site-packages\modelscope\models\audio\funasr\model.py", line 55, in init
self.model = AutoModel(model=model_dir, kwargs)
File "D:\Python38\lib\site-packages\funasr\auto\auto_model.py", line 102, in init
vad_model, vad_kwargs = self.build_model(vad_kwargs)
File "D:\Python38\lib\site-packages\funasr\auto\auto_model.py", line 176, in build_model
model = model_class(kwargs, kwargs["model_conf"], vocab_size=vocab_size)
TypeError: 'NoneType' object is not callable

展开
收起
游客g2vt7trarl4y2 2024-02-06 16:01:49 493 0
0 条回答
写回答
取消 提交回答

包含命名实体识别、文本分类、分词、关系抽取、问答、推理、文本摘要、情感分析、机器翻译等多个领域

热门讨论

热门文章

相关电子书

更多
阿里云总监课第二期——Neural Network Language Model在语音识别中的应用 立即下载
阿里云总监课第二期——Latency Controlled-BLSTM模型在语音识别中的应用 立即下载
智能语音交互:阿里巴巴的研究与实践 立即下载