modelscope-funasr这个问题怎么解决?

modelscope-funasr这个问题怎么解决?新版funasr在利用automodel进行paraformer-streaming推理时遇到一个问题,但最终也解决了,不知道啥原因,大家有清楚的帮忙看看,有遇到这个问题的可以这样试试解决
在推理时funasr/models/paraformer_streaming/model.py函数426行,pre_token_length=pre_token_length.round().long()这里报错提示round not implemented for long。
最后我先把pre_token_length转为float类型,pre_token_length=torch.tensor(pre_token_length,dtype=torch.float),添加这一行转化为float类型后就没问题了

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

    这个问题可能是由于pre_token_length数据类型为long,而round()函数不支持long类型的数据。解决方法是将pre_token_length转换为float类型,然后再进行round()操作。

    具体来说,可以尝试将第426行的代码修改为:

    pre_token_length = torch.tensor(pre_token_length, dtype=torch.float)
    pre_token_length = pre_token_length.round().long()
    

    这样,先将pre_token_length转换为float类型,再进行round()操作,最后再将其转换回long类型。

    2024-03-27 19:20:54
    赞同 展开评论
  • 与torch版本有关系,应该1.13以上都可以。此回答整理自钉群“modelscope-funasr社区交流”

    2024-03-20 15:56:50
    赞同 1 展开评论

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

热门讨论

热门文章

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