FunAudioLLM/CosyVoice

python3执行没反应,python执行报错

Closed this issue · 6 comments

python3执行没反应,python执行报错
根据提示用 pip install onnxruntime transformers matcha 安装完了,然后报下面的错误

(cosyvoice) E:\AI\CosyVoice>python webui.py --port 50000 --model_dir pretrained_models/CosyVoice-300M
2024-12-04 00:17:51,132 - modelscope - INFO - PyTorch version 2.0.1 Found.
2024-12-04 00:17:51,135 - modelscope - INFO - Loading ast index from C:\Users\HO\.cache\modelscope\ast_indexer
2024-12-04 00:17:51,339 - modelscope - INFO - Loading done! Current index file version is 1.15.0, with md5 db98cb36115bd16b09adbbf32ab84760 and a total number of 980 components indexed
failed to import ttsfrd, use WeTextProcessing instead
Traceback (most recent call last):
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\pydoc.py", line 343, in safeimport
    module = __import__(path)
  File "E:\AI\CosyVoice\cosyvoice\flow\flow_matching.py", line 16, in <module>
    from matcha.models.components.flow_matching import BASECFM
ModuleNotFoundError: No module named 'matcha.models'; 'matcha' is not a package

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "webui.py", line 184, in <module>
    cosyvoice = CosyVoice(args.model_dir)
  File "E:\AI\CosyVoice\cosyvoice\cli\cosyvoice.py", line 33, in __init__
    configs = load_hyperpyyaml(f)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\hyperpyyaml\core.py", line 188, in load_hyperpyyaml
    hparams = yaml.load(yaml_stream, Loader=loader)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\yaml\__init__.py", line 81, in load
    return loader.get_single_data()
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\ruamel\yaml\constructor.py", line 116, in get_single_data
    return self.construct_document(node)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\ruamel\yaml\constructor.py", line 120, in construct_document
    data = self.construct_object(node)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\ruamel\yaml\constructor.py", line 147, in construct_object
    data = self.construct_non_recursive_object(node)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\ruamel\yaml\constructor.py", line 188, in construct_non_recursive_object
    for _dummy in generator:
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\ruamel\yaml\constructor.py", line 633, in construct_yaml_map
    value = self.construct_mapping(node)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\ruamel\yaml\constructor.py", line 429, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\ruamel\yaml\constructor.py", line 244, in construct_mapping
    value = self.construct_object(value_node, deep=deep)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\ruamel\yaml\constructor.py", line 147, in construct_object
    data = self.construct_non_recursive_object(node)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\ruamel\yaml\constructor.py", line 183, in construct_non_recursive_object
    data = constructor(self, tag_suffix, node)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\hyperpyyaml\core.py", line 480, in _construct_object
    args, kwargs = _load_node(loader, node)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\hyperpyyaml\core.py", line 434, in _load_node
    kwargs = loader.construct_mapping(node, deep=True)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\ruamel\yaml\constructor.py", line 429, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\ruamel\yaml\constructor.py", line 244, in construct_mapping
    value = self.construct_object(value_node, deep=deep)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\ruamel\yaml\constructor.py", line 147, in construct_object
    data = self.construct_non_recursive_object(node)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\ruamel\yaml\constructor.py", line 183, in construct_non_recursive_object
    data = constructor(self, tag_suffix, node)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\site-packages\hyperpyyaml\core.py", line 470, in _construct_object
    callable_ = pydoc.locate(callable_string)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\pydoc.py", line 1626, in locate
    nextmodule = safeimport('.'.join(parts[:n+1]), forceload)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\lib\pydoc.py", line 358, in safeimport
    raise ErrorDuringImport(path, sys.exc_info())
pydoc.ErrorDuringImport: problem in cosyvoice.flow.flow_matching - ModuleNotFoundError: No module named 'matcha.models'; 'matcha' is not a package

看下目录“third_party/Matcha-TTS”下的子模块是否拉取了

看下目录“third_party/Matcha-TTS”下的子模块是否拉取了

拉取了,然后我卸载了python重装了本地的python改成了3.11 但是还是不能用

image

(cosyvoice) PS E:\AI\CosyVoice> python webui.py --port 50000 --model_dir pretrained_models/CosyVoice-300M
2024-12-04 11:13:22,509 - modelscope - INFO - PyTorch version 2.0.1 Found.
2024-12-04 11:13:22,511 - modelscope - INFO - Loading ast index from C:\Users\HO\.cache\modelscope\ast_indexer
2024-12-04 11:13:22,722 - modelscope - INFO - Updating the files for the changes of local files, first time updating will take longer time! Please wait till updating done!
2024-12-04 11:13:22,742 - modelscope - INFO - AST-Scanning the path "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope" with the following sub folders ['models', 'metrics', 'pipelines', 'preprocessors', 'trainers', 'msdatasets', 'exporters']
Traceback (most recent call last):
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\ast_utils.py", line 467, in _get_single_file_scan_result
    output = self.astScaner.generate_ast(file)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\ast_utils.py", line 366, in generate_ast
    output = self.scan_import(node, show_offsets=False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\ast_utils.py", line 165, in scan_import
    local_out = _scan_import(el, type(el).__name__)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\ast_utils.py", line 134, in _scan_import
    return self.scan_import(
           ^^^^^^^^^^^^^^^^^
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\ast_utils.py", line 152, in scan_import
    attr = getattr(node, field)
           ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ClassDef' object has no attribute 'type_params'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\AI\CosyVoice\webui.py", line 25, in <module>
    from cosyvoice.cli.cosyvoice import CosyVoice
  File "E:\AI\CosyVoice\cosyvoice\cli\cosyvoice.py", line 18, in <module>
    from modelscope import snapshot_download
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\__init__.py", line 4, in <module>
    from modelscope.utils.import_utils import (LazyImportModule,
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\__init__.py", line 1, in <module>
    from .hub import create_model_if_not_exist, read_config
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\hub.py", line 12, in <module>
    from modelscope.utils.config import Config
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\config.py", line 22, in <module>
    from modelscope.utils.import_utils import import_modules_from_file
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\import_utils.py", line 380, in <module>
    class LazyImportModule(ModuleType):
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\import_utils.py", line 383, in LazyImportModule
    AST_INDEX = load_index()
                ^^^^^^^^^^^^
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\ast_utils.py", line 723, in load_index
    _update_index(index, files_mtime)
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\ast_utils.py", line 639, in _update_index
    updated_index = file_scanner.get_files_scan_results(updated_files)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\ast_utils.py", line 533, in get_files_scan_results
    decorator_list, import_list = self._get_single_file_scan_result(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\utils\ast_utils.py", line 470, in _get_single_file_scan_result
    raise Exception(
Exception: During ast indexing the file C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\models\audio\aec\layers\activations.py, a related error excepted in the file C:\Users\HO\miniconda3\envs\cosyvoice\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 C:\Users\HO\miniconda3\envs\cosyvoice\Lib\site-packages\modelscope\models\audio\aec\layers\activations.py to see whether the file is correctly edited.

为什么要重装python,这和python没关系吧,还是回到3.8上来解决问题吧

看下目录“third_party/Matcha-TTS”下的子模块是否拉取了

删除 ~/.cache/modelscope/ast_indexer 之后运行报错:

(cosyvoice) PS E:\AI\CosyVoice> python webui.py --port 50000 --model_dir pretrained_models/CosyVoice-300M
2024-12-04 11:19:14,441 - modelscope - INFO - PyTorch version 2.0.1 Found.
2024-12-04 11:19:14,444 - modelscope - INFO - Loading ast index from C:\Users\HO\.cache\modelscope\ast_indexer
2024-12-04 11:19:14,444 - modelscope - INFO - No valid ast index found from C:\Users\HO\.cache\modelscope\ast_indexer, generating ast index from prebuilt!
2024-12-04 11:19:14,666 - modelscope - INFO - Loading done! Current index file version is 1.15.0, with md5 04287af5a289a6a80ed40cf792882a0f and a total number of 980 components indexed
transformer is not installed, please install it if you want to use related modules
Traceback (most recent call last):
  File "E:\AI\CosyVoice\webui.py", line 25, in <module>
    from cosyvoice.cli.cosyvoice import CosyVoice
  File "E:\AI\CosyVoice\cosyvoice\cli\cosyvoice.py", line 20, in <module>
    from cosyvoice.cli.frontend import CosyVoiceFrontEnd
  File "E:\AI\CosyVoice\cosyvoice\cli\frontend.py", line 15, in <module>
    import onnxruntime
ModuleNotFoundError: No module named 'onnxruntime'

为什么要重装python,这和python没关系吧,还是回到3.8上来解决问题吧

11是因为有一些性能优化,3.8就是第一张图的运行报错。

重装了 ok了