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类型后就没问题了
这个问题可能是由于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
类型。