CosyVoice icon indicating copy to clipboard operation
CosyVoice copied to clipboard

请问本地部署时遇到报错,求解决!

Open yangzhaoliu opened this issue 8 months ago • 6 comments

发生异常: ZeroDivisionError 0.0 cannot be raised to a negative power 解决办法: 修复CosyVoice2-0.5B目录下的cosyvoice2.yaml文件中 dropout: 0.0 -->dropout: 0.0001

解决后。紧接着又报一个错如下:

发生异常: ValueError only_cross_attention can only be set to True if added_kv_proj_dim is not None. Make sure to set either only_cross_attention=False or define added_kv_proj_dim.

是否我运行环境不对?求教!

yangzhaoliu avatar Apr 13 '25 14:04 yangzhaoliu

Also me facing same issue.

NOFOX avatar Apr 13 '25 20:04 NOFOX

File "D:\Software\CosyVoice\testcosyvoice.txt", line 8, in cosyvoice = CosyVoice2('pretrained_models/CosyVoice2-0.5B', load_jit=False, load_trt=False, fp16=False, use_flow_cache=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Software\CosyVoice\cosyvoice\cli\cosyvoice.py", line 143, in init configs = load_hyperpyyaml(f, overrides={'qwen_pretrain_path': os.path.join(model_dir, 'CosyVoice-BlankEN')}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\hyperpyyaml\core.py", line 188, in load_hyperpyyaml hparams = yaml.load(yaml_stream, Loader=loader) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\yaml_init_.py", line 81, in load return loader.get_single_data() ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 116, in get_single_data return self.construct_document(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 120, in construct_document data = self.construct_object(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 147, in construct_object data = self.construct_non_recursive_object(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 188, in construct_non_recursive_object for _dummy in generator: File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 633, in construct_yaml_map value = self.construct_mapping(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 429, in construct_mapping return BaseConstructor.construct_mapping(self, node, deep=deep) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 244, in construct_mapping value = self.construct_object(value_node, deep=deep) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 147, in construct_object data = self.construct_non_recursive_object(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 183, in construct_non_recursive_object data = constructor(self, tag_suffix, node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\hyperpyyaml\core.py", line 480, in _construct_object args, kwargs = _load_node(loader, node) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\hyperpyyaml\core.py", line 434, in _load_node kwargs = loader.construct_mapping(node, deep=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 429, in construct_mapping return BaseConstructor.construct_mapping(self, node, deep=deep) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 244, in construct_mapping value = self.construct_object(value_node, deep=deep) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 147, in construct_object data = self.construct_non_recursive_object(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 183, in construct_non_recursive_object data = constructor(self, tag_suffix, node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\hyperpyyaml\core.py", line 480, in _construct_object args, kwargs = _load_node(loader, node) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\hyperpyyaml\core.py", line 434, in _load_node kwargs = loader.construct_mapping(node, deep=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 429, in construct_mapping return BaseConstructor.construct_mapping(self, node, deep=deep) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 244, in construct_mapping value = self.construct_object(value_node, deep=deep) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 147, in construct_object data = self.construct_non_recursive_object(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 183, in construct_non_recursive_object data = constructor(self, tag_suffix, node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\hyperpyyaml\core.py", line 481, in construct_object return callable(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Software\CosyVoice\cosyvoice\flow\decoder.py", line 642, in init [ File "D:\Software\CosyVoice\cosyvoice\flow\decoder.py", line 643, in CausalBasicTransformerBlock( File "D:\Software\CosyVoice\cosyvoice\flow\decoder.py", line 306, in init self.attn1 = CausalAttention( ^^^^^^^^^^^^^^^^ File "D:\Software\CosyVoice\cosyvoice\flow\decoder.py", line 230, in init super(CausalAttention, self).init(query_dim, cross_attention_dim, heads, dim_head, dropout, bias, upcast_attention, upcast_softmax, File "C:\Program Files\Python311\Lib\site-packages\diffusers\models\attention_processor.py", line 166, in init self.scale = dim_head-0.5 if self.scale_qk else 1.0 ~~~~~~~~^^~~~~ ZeroDivisionError: 0.0 cannot be raised to a negative power

D:\Software\CosyVoice>python testcosyvoice.txt W0414 04:38:00.880000 42052 site-packages\torch\distributed\elastic\multiprocessing\redirects.py:29] NOTE: Redirects are currently not supported in Windows or MacOs. C:\Program Files\Python311\Lib\site-packages\diffusers\models\lora.py:393: FutureWarning: LoRACompatibleLinear is deprecated and will be removed in version 1.0.0. Use of LoRACompatibleLinear is deprecated. Please switch to PEFT backend by installing PEFT: pip install peft. deprecate("LoRACompatibleLinear", "1.0.0", deprecation_message) Traceback (most recent call last): File "D:\Software\CosyVoice\testcosyvoice.txt", line 8, in cosyvoice = CosyVoice2('pretrained_models/CosyVoice2-0.5B', load_jit=False, load_trt=False, fp16=False, use_flow_cache=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Software\CosyVoice\cosyvoice\cli\cosyvoice.py", line 143, in init configs = load_hyperpyyaml(f, overrides={'qwen_pretrain_path': os.path.join(model_dir, 'CosyVoice-BlankEN')}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\hyperpyyaml\core.py", line 188, in load_hyperpyyaml hparams = yaml.load(yaml_stream, Loader=loader) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\yaml_init_.py", line 81, in load return loader.get_single_data() ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 116, in get_single_data return self.construct_document(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 120, in construct_document data = self.construct_object(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 147, in construct_object data = self.construct_non_recursive_object(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 188, in construct_non_recursive_object for _dummy in generator: File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 633, in construct_yaml_map value = self.construct_mapping(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 429, in construct_mapping return BaseConstructor.construct_mapping(self, node, deep=deep) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 244, in construct_mapping value = self.construct_object(value_node, deep=deep) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 147, in construct_object data = self.construct_non_recursive_object(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 183, in construct_non_recursive_object data = constructor(self, tag_suffix, node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\hyperpyyaml\core.py", line 480, in _construct_object args, kwargs = _load_node(loader, node) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\hyperpyyaml\core.py", line 434, in _load_node kwargs = loader.construct_mapping(node, deep=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 429, in construct_mapping return BaseConstructor.construct_mapping(self, node, deep=deep) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 244, in construct_mapping value = self.construct_object(value_node, deep=deep) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 147, in construct_object data = self.construct_non_recursive_object(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 183, in construct_non_recursive_object data = constructor(self, tag_suffix, node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\hyperpyyaml\core.py", line 480, in _construct_object args, kwargs = _load_node(loader, node) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\hyperpyyaml\core.py", line 434, in _load_node kwargs = loader.construct_mapping(node, deep=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 429, in construct_mapping return BaseConstructor.construct_mapping(self, node, deep=deep) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 244, in construct_mapping value = self.construct_object(value_node, deep=deep) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 147, in construct_object data = self.construct_non_recursive_object(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\ruamel\yaml\constructor.py", line 183, in construct_non_recursive_object data = constructor(self, tag_suffix, node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\hyperpyyaml\core.py", line 481, in construct_object return callable(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Software\CosyVoice\cosyvoice\flow\decoder.py", line 642, in init [ File "D:\Software\CosyVoice\cosyvoice\flow\decoder.py", line 643, in CausalBasicTransformerBlock( File "D:\Software\CosyVoice\cosyvoice\flow\decoder.py", line 306, in init self.attn1 = CausalAttention( ^^^^^^^^^^^^^^^^ File "D:\Software\CosyVoice\cosyvoice\flow\decoder.py", line 230, in init super(CausalAttention, self).init(query_dim, cross_attention_dim, heads, dim_head, dropout, bias, upcast_attention, upcast_softmax, File "C:\Program Files\Python311\Lib\site-packages\diffusers\models\attention_processor.py", line 178, in init raise ValueError( ValueError: only_cross_attention can only be set to True if added_kv_proj_dim is not None. Make sure to set either only_cross_attention=False or define added_kv_proj_dim.

NOFOX avatar Apr 13 '25 20:04 NOFOX

same problem

GT-TOP avatar Apr 14 '25 12:04 GT-TOP

check your diffuision version, same with requirements.txt

aluminumbox avatar Apr 15 '25 02:04 aluminumbox

大于这个版本会报错

pip install diffusers==0.29.2 

xiesx123 avatar Apr 15 '25 10:04 xiesx123

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar May 16 '25 02:05 github-actions[bot]