CosyVoice icon indicating copy to clipboard operation
CosyVoice copied to clipboard

分享一下pypi包,一键运行cosyvoice

Open lucasjinreal opened this issue 1 year ago • 10 comments

感觉CosyVoice依赖比较多,尤其是还是有third party,这对于python来讲实在是太不pythonic了。

为了不劳烦仓库原作者们再辛苦添加pypi,我动手创建了一个,可以一键安装:

pip install cosyvoice

同时textnormalize的库也很烦人,为了方便,可以直接用:WeTextProcessing,这个库也容易踩坑,好在依赖都有conda forge的库版本。

conda install -c conda-forge pynini==2.1.6
pip install WeTextProcessing
pip install cosyvoice -U

这样便可以用几行代码推理了。不用安装matcha-tts。剩余的依赖pip会自动处理。

from cosyvoice.api import CosyVoiceTTS

def test_tts():
    tts = CosyVoiceTTS()
    a = tts.tts(
        "今天我很想学习一下,不知道大模型能否帮我解决这个问题,日本語は話せますか?"
    )
    print(a)

lucasjinreal avatar Aug 30 '24 16:08 lucasjinreal

我在使用3.11的python环境时,直接pip install cosyvoice,运行上述的demo时依旧会有没有导入的依赖库,并且我还没有完整的跑完,可能还有未导入的依赖,或者是我使用的方式有问题 image image

YangYu8510 avatar Sep 02 '24 06:09 YangYu8510

Oh, please run pip install cosyvoice>=0.0.6, just added these dependencies to pypi. Meanwhile, one can try run:

cosyvoice-server --port 8888

To any devices without even download anything, the model will download automatically from modelscope. I have made a TTS server cli just like openai, with streaming support out of box. (Different from official repo does, which only supports non-stream)

lucasjinreal avatar Sep 02 '24 12:09 lucasjinreal

你好,感谢你做的一切,但是我发现包中缺少一些文件,这代表使用它还需要克隆这个项目吗?

xipingL avatar Sep 04 '24 02:09 xipingL

@xipingL Hi, can u point out which file were lacked of?

lucasjinreal avatar Sep 05 '24 02:09 lucasjinreal

Traceback (most recent call last): File "/opt/miniconda3/envs/cosyvoice/bin/cosyvoice-server", line 5, in from cosyvoice.server import main File "/opt/miniconda3/envs/cosyvoice/lib/python3.10/site-packages/cosyvoice/server.py", line 24, in from .api import CosyVoiceTTS File "/opt/miniconda3/envs/cosyvoice/lib/python3.10/site-packages/cosyvoice/api.py", line 3, in from .utils.file_utils import load_wav ModuleNotFoundError: No module named 'cosyvoice.utils'

我这里也少了呢,辛苦您看下 @lucasjinreal

Ccccx avatar Sep 05 '24 09:09 Ccccx

@xipingL Hi, can u point out which file were lacked of?

就是下面给出的问题,感谢。貌似包里缺少了util cli文件

xipingL avatar Sep 05 '24 09:09 xipingL

@xipingL @Ccccx

Hi, I have upgrade to 0.0.7, can u check if this works?

from cosyvoice.api import CosyVoiceTTS

a = CosyVoiceTTS()

on my side it seems can work

lucasjinreal avatar Sep 05 '24 12:09 lucasjinreal

感谢回复,确认已升级,依旧报错,@lucasjinreal。 conda包: ` ...... 省略其他 cosyvoice 0.0.7 pypi_0 pypi ...... 省略其他

启动: cosyvoice-server --port 8888 (cosyvoice) cjz@iZ0jlf:/data/git$ Traceback (most recent call last): File "/opt/miniconda3/envs/cosyvoice/bin/cosyvoice-server", line 5, in <module> from cosyvoice.server import main File "/opt/miniconda3/envs/cosyvoice/lib/python3.10/site-packages/cosyvoice/server.py", line 24, in <module> from cosyvoice.api import CosyVoiceTTS File "/opt/miniconda3/envs/cosyvoice/lib/python3.10/site-packages/cosyvoice/api.py", line 3, in <module> from cosyvoice.utils.file_utils import load_wav ModuleNotFoundError: No module named 'cosyvoice.utils'

Ccccx avatar Sep 06 '24 00:09 Ccccx

Oh, it seems that there are certain oversight on my part. Apologies for the issue. I will rectify it this evening!

lucasjinreal avatar Sep 06 '24 02:09 lucasjinreal

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

github-actions[bot] avatar Oct 06 '24 02:10 github-actions[bot]

我这边是错误无效参数/Who-register,可惜了

ChillRainQ avatar Nov 27 '24 08:11 ChillRainQ

i think it can be used for now.

lucasjinreal avatar Nov 27 '24 13:11 lucasjinreal

ModuleNotFoundError: No module named 'cosyvoice.utils' I also meet this error

MIKL2077 avatar Jan 11 '25 00:01 MIKL2077