python系列&deep_study系列:CosyVoice安装配置体验 chattts被换下
CosyVoice安装配置体验 chattts被换下
CosyVoice安装配置体验 chattts被换下
git clone --recursive https://github.com/FunAudioLLM/CosyVoice.git
# If you failed to clone submodule due to network failures, please run following command until success
cd CosyVoice
git submodule update --init --recursive
conda create -n cosyvoice python=3.8
conda activate cosyvoice
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
# If you encounter sox compatibility issues
# ubuntu
sudo apt-get install sox libsox-dev
# centos
sudo yum install sox sox-devel
# git模型下载,请确保已安装git lfs
mkdir -p pretrained_models
git clone https://www.modelscope.cn/speech_tts/CosyVoice-300M.git pretrained_models/CosyVoice-300M
git clone https://www.modelscope.cn/speech_tts/CosyVoice-300M-SFT.git pretrained_models/CosyVoice-300M-SFT
git clone https://www.modelscope.cn/speech_tts/CosyVoice-300M-Instruct.git pretrained_models/CosyVoice-300M-Instruct
git clone https://www.modelscope.cn/speech_tts/speech_kantts_ttsfrd.git pretrained_models/speech_kantts_ttsfrd
Unzip ttsfrd resouce and install ttsfrd package
cd pretrained_models/speech_kantts_ttsfrd/
unzip resource.zip -d .
pip install ttsfrd-0.3.6-cp38-cp38-linux_x86_64.whl
如果上面步骤安装不上,看看python 版本是不是3.8.别的版本不行。:
下面这种能安装但代码还是无法加载:
pip install ttsfrd -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
export PYTHONPATH=third_party/AcademiCodec:third_party/Matcha-TTS
出现这个错误:
Traceback (most recent call last):
File "/home/leon/work/top_ai/CosyVoice/test.py", line 1, in <module>
from cosyvoice.cli.cosyvoice import CosyVoice
File "/home/leon/work/top_ai/CosyVoice/cosyvoice/cli/cosyvoice.py", line 18, in <module>
from cosyvoice.cli.frontend import CosyVoiceFrontEnd
File "/home/leon/work/top_ai/CosyVoice/cosyvoice/cli/frontend.py", line 23, in <module>
import inflect
File "/home/leon/miniconda3/envs/autovideo/lib/python3.10/site-packages/inflect/__init__.py", line 77, in <module>
from pydantic.typing import Annotated
ImportError: cannot import name 'Annotated' from 'pydantic.typing'
解决方法:
对报错文件进行修改,改为下面的方式导入即可
vi /home/leon/miniconda3/envs/cosyvoice/lib/python3.8/site-packages/inflect/__init__.py
第77行,注释掉原来的,添加新行:
#from pydantic.typing import Annotated
from typing_extensions import Annotated