CosyVoice icon indicating copy to clipboard operation
CosyVoice copied to clipboard

添加新音色以后调用报错

Open Thunder-shadow opened this issue 7 months ago • 4 comments

Traceback (most recent call last): File "/opt/conda/lib/python3.10/site-packages/gradio/queueing.py", line 624, in process_events response = await route_utils.call_process_api( File "/opt/conda/lib/python3.10/site-packages/gradio/route_utils.py", line 323, in call_process_api output = await app.get_blocks().process_api( File "/opt/conda/lib/python3.10/site-packages/gradio/blocks.py", line 2018, in process_api result = await self.call_function( File "/opt/conda/lib/python3.10/site-packages/gradio/blocks.py", line 1579, in call_function prediction = await utils.async_iteration(iterator) File "/opt/conda/lib/python3.10/site-packages/gradio/utils.py", line 691, in async_iteration return await anext(iterator) File "/opt/conda/lib/python3.10/site-packages/gradio/utils.py", line 685, in anext return await anyio.to_thread.run_sync( File "/opt/conda/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( File "/opt/conda/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2470, in run_sync_in_worker_thread return await future File "/opt/conda/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 967, in run result = context.run(func, *args) File "/opt/conda/lib/python3.10/site-packages/gradio/utils.py", line 668, in run_sync_iterator_async return next(iterator) File "/opt/conda/lib/python3.10/site-packages/gradio/utils.py", line 829, in gen_wrapper response = next(iterator) File "/opt/CosyVoice/CosyVoice/webui.py", line 117, in generate_audio for i in cosyvoice.inference_sft(tts_text, sft_dropdown, stream=stream, speed=speed): File "/opt/CosyVoice/CosyVoice/cosyvoice/cli/cosyvoice.py", line 83, in inference_sft model_input = self.frontend.frontend_sft(i, spk_id) File "/opt/CosyVoice/CosyVoice/cosyvoice/cli/frontend.py", line 153, in frontend_sft embedding = self.spk2info[spk_id]['embedding'] KeyError: 'embedding' 以上是我根据readme中代码添加音色以后调用时的完整报错,求解答

Thunder-shadow avatar Jul 24 '25 08:07 Thunder-shadow

https://github.com/FunAudioLLM/CosyVoice/issues/1472

WLimin avatar Jul 24 '25 12:07 WLimin

新版本的save 没有embding 直接 包含2个

-        embedding = self.spk2info[spk_id]['embedding']
-        model_input = {'text': tts_text_token, 'text_len': tts_text_token_len, 'llm_embedding': embedding, 'flow_embedding': embedding}
+        model_input = {'text': tts_text_token, 'text_len': tts_text_token_len, 'llm_embedding': self.spk2info[spk_id]['llm_embedding'], 'flow_embedding': self.spk2info[spk_id]['flow_embedding']}

jerrytt avatar Jul 25 '25 10:07 jerrytt

尽量不要把zero shot和sft推理混用

aluminumbox avatar Jul 28 '25 03:07 aluminumbox

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

github-actions[bot] avatar Aug 28 '25 02:08 github-actions[bot]