CosyVoice安装配置体验 chattts被换下

亲民的 国产远程控制kkview

第一时间体验,非常惊艳,感谢。
安装流程

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

最后推荐亲民的 国产远程控制kkview

  • 4
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据提供的引用内容,本地压缩包转MultipartFile可以通过以下步骤实现: 1. 首先需要将本地压缩包读取为字节数组,可以使用Java IO流中的FileInputStream和ByteArrayOutputStream来实现。具体代码如下: ```java FileInputStream fis = new FileInputStream(new File("path/to/your/zip/file")); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int len; while ((len = fis.read(buffer)) != -1) { bos.write(buffer, 0, len); } byte[] bytes = bos.toByteArray(); ``` 2. 接下来需要将字节数组转换为MultipartFile类型,可以使用Spring框架中的MockMultipartFile类来实现。具体代码如下: ```java MockMultipartFile multipartFile = new MockMultipartFile("file", "filename.zip", "application/zip", bytes); ``` 其中,第一个参数是表单中文件上传的参数名,第二个参数是文件名,第三个参数是文件类型,第四个参数是文件的字节数组。 完整代码如下: ```java import org.springframework.mock.web.MockMultipartFile; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class ZipToMultipartFile { public static void main(String[] args) throws IOException { FileInputStream fis = new FileInputStream(new File("path/to/your/zip/file")); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int len; while ((len = fis.read(buffer)) != -1) { bos.write(buffer, 0, len); } byte[] bytes = bos.toByteArray(); MockMultipartFile multipartFile = new MockMultipartFile("file", "filename.zip", "application/zip", bytes); } } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值