CosyVoice 2: Scalable Streaming Speech Synthesis with Large Language Models
Paper • 2412.10117 • Published • 5
How to use taoyy/CosyVoice2-0.5B with CosyVoice:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
CosyVoice 2.0 是基于大语言模型(LLM)的可流式语音合成(TTS)系统,支持多语言、零样本语音复刻、跨语种复刻与自然语言控制。
需要配合 CosyVoice 官方代码使用。
git clone --recursive https://github.com/FunAudioLLM/CosyVoice.git
cd CosyVoice
pip install -r requirements.txt
下载本模型:
from modelscope import snapshot_download
snapshot_download('taoyy/CosyVoice2-0.5B', local_dir='pretrained_models/CosyVoice2-0.5B')
或使用 Hugging Face:
from huggingface_hub import snapshot_download
snapshot_download('taoyy/CosyVoice2-0.5B', local_dir='pretrained_models/CosyVoice2-0.5B')
推理示例:
import sys
sys.path.append('third_party/Matcha-TTS')
from cosyvoice.cli.cosyvoice import AutoModel
import torchaudio
cosyvoice = AutoModel(model_dir='pretrained_models/CosyVoice2-0.5B')
# 零样本复刻
for i, j in enumerate(cosyvoice.inference_zero_shot(
'收到好友从远方寄来的生日礼物,那份意外的惊喜与深深的祝福让我心中充满了甜蜜的快乐。',
'希望你以后能够做的比我还好呦。',
'./asset/zero_shot_prompt.wav')):
torchaudio.save('zero_shot_{}.wav'.format(i), j['tts_speech'], cosyvoice.sample_rate)
@article{du2024cosyvoice,
title={Cosyvoice 2: Scalable streaming speech synthesis with large language models},
author={Du, Zhihao and Wang, Yuxuan and Chen, Qian and Shi, Xian and Lv, Xiang and Zhao, Tianyu and Gao, Zhifu and Yang, Yexin and Gao, Changfeng and Wang, Hui and others},
journal={arXiv preprint arXiv:2412.10117},
year={2024}
}
本模型仅用于学术研究与技术演示。