今天在调试cosyvoice的时候发生报错:部分错误信息如下:
Exception: During ast indexing the file F:\gongxiang\CosyVoice\myenv\Lib\site-packages\modelscope\models\audio\aec\layers\activations.py, a related error excepted in the file F:\gongxiang\CosyVoice\myenv\lib\site-packages\modelscope\utils\ast_utils.py at line: 152: “attr = getattr(node, field)” with error msg: “AttributeError: ‘ClassDef’ object has no attribute ‘type_params'”, please double check the origin file F:\gongxiang\CosyVoice\myenv\Lib\site-packages\modelscope\models\audio\aec\layers\activations.py to see whether the file is correctly edited.
错误内容是AST 工具异常,ClassDef 类型的节点不支持访问属性 type_params,应该是缓存问题,因为我之前用过不同版本的cosyvoice,更新了不同版本之后属性发生变化modelscope还是使用的不同版本的缓存文件,所以才导致错误的,解决方法:
打开如下路径:C:\Users\你的电脑用户名\.cache\modelscope,将文件夹内的ast_indexer文件删除,然后再启动软件,问题消失。