modelscope-funasr导出模型后onnx使用有问题,怎么解决?

modelscope-funasr导出模型后onnx使用有问题,怎么解决?speech_fsmn_vad_zh-cn-16k-common
E20240311 18:32:59.400003 5343 paraformer.cpp:97] Error when load am encoder model: Load model from /workspace/models/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online_onnx/model_quant.onnx failed:Type Error: Type parameter (Tind) of Optype (Slice) bound to different types (tensor(int64) and tensor(int32) in node (/encoder/make_pad_mask/Slice).

展开
收起
三分钟热度的鱼 2024-03-20 15:37:59 509 分享 版权
1 条回答
写回答
取消 提交回答
  • 阿里云大降价~

    这个问题可能是由于ONNX模型中的某些操作不支持int64类型的输入,而您的模型中使用了int64类型的输入。您可以尝试将模型中的int64类型的输入转换为int32类型,然后重新导出ONNX模型。具体操作如下:

    1. 打开modelscope-funasr的源代码,找到导出ONNX模型的部分。
    2. 在导出模型之前,将所有int64类型的输入转换为int32类型。可以使用torch.Tensor.to()方法进行转换,例如:
      input_tensor = input_tensor.to(torch.int32)
      
    3. 重新导出ONNX模型,并使用新的模型进行推理。

    如果问题仍然存在,建议您查看ONNX模型的文档,了解哪些操作支持哪些类型的输入,并根据需要对模型进行调整。

    2024-03-27 20:02:50
    赞同 展开评论

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

热门讨论

热门文章

还有其他疑问?
咨询AI助理