CosyVoice

QwenAudioApache-2.0更新放缓

多语言大语音生成模型,覆盖推理、训练到部署全流程,支持中英日粤语及跨语种合成,适合做语音克隆和对话机器人。

Multi-lingual large voice generation model, providing inference, training and deployment full-stack ability.

暂无版本24,356star +28 / 7 天2,777fork同步于 2026-11-10 17:23 UTC

怎么上手

由 README 提炼,执行前请确认
git clone --recursive https://github.com/FunAudioLLM/CosyVoice.git
conda create -n cosyvoice -y python=3.10
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
硬件要求按 README 说明

README 未说明显存要求;部署示例使用 --runtime=nvidia 的 Docker 容器,说明需要 NVIDIA GPU,并可选 TensorRT-LLM 加速

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

基于大语言模型的多语言零样本语音合成工具,支持推理、训练与部署全流程

多语言大语音生成模型,覆盖推理、训练到部署全流程,支持中英日粤语及跨语种合成,适合做语音克隆和对话机器人。

核心能力

  • 覆盖9种语言与18种以上中文方言的零样本语音克隆
  • 支持文本流入与音频流出的双流式合成,延迟低至150ms
  • 支持中文拼音与英文CMU音素的发音修复控制
  • 无需传统前端模块即可完成数字与特殊符号的文本正则化
  • 支持语言、方言、情感、语速、音量等指令控制

容易踩的坑

仓库含子模块,网络失败时需反复执行 git submodule update --init --recursive;需先用 modelscope 或 huggingface_hub 单独下载预训练模型到 pretrained_models 目录;遇到 sox 兼容问题需另装 sox 与 libsox-dev(或 sox-devel)

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    SVG Banners

    👉🏻 CosyVoice 👈🏻

    Fun-CosyVoice 3.0: Demos; Paper; Modelscope; Huggingface; CV3-Eval

    CosyVoice 2.0: Demos; Paper; Modelscope; HuggingFace

    CosyVoice 1.0: Demos; Paper; Modelscope; HuggingFace

    Highlight🔥

    Fun-CosyVoice 3.0 is an advanced text-to-speech (TTS) system based on large language models (LLM), surpassing its predecessor (CosyVoice 2.0) in content consistency, speaker similarity, and prosody naturalness. It is designed for zero-shot multilingual speech synthesis in the wild.

    Key Features

    • Language Coverage: Covers 9 common languages (Chinese, English, Japanese, Korean, German, Spanish, French, Italian, Russian), 18+ Chinese dialects/accents (Guangdong, Minnan, Sichuan, Dongbei, Shan3xi, Shan1xi, Shanghai, Tianjin, Shandong, Ningxia, Gansu, etc.) and meanwhile supports both multi-lingual/cross-lingual zero-shot voice cloning.
    • Content Consistency & Naturalness: Achieves state-of-the-art performance in content consistency, speaker similarity, and prosody naturalness.
    • Pronunciation Inpainting: Supports pronunciation inpainting of Chinese Pinyin and English CMU phonemes, providing more controllability and thus suitable for production use.
    • Text Normalization: Supports reading of numbers, special symbols and various text formats without a traditional frontend module.
    • Bi-Streaming: Support both text-in streaming and audio-out streaming, and achieves latency as low as 150ms while maintaining high-quality audio output.
    • Instruct Support: Supports various instructions such as languages, dialects, emotions, speed, volume, etc.

    Roadmap

    • 2025/12

      • release Fun-CosyVoice3-0.5B-2512 base model, rl model and its training/inference script
      • release Fun-CosyVoice3-0.5B modelscope gradio space
    • 2025/08

      • Thanks to the contribution from NVIDIA Yuekai Zhang, add triton trtllm runtime support and cosyvoice2 grpo training support
    • 2025/07

      • release Fun-CosyVoice 3.0 eval set
    • 2025/05

      • add CosyVoice2-0.5B vllm support
    • 2024/12

      • 25hz CosyVoice2-0.5B released
    • 2024/09

      • 25hz CosyVoice-300M base model
      • 25hz CosyVoice-300M voice conversion function
    • 2024/08

      • Repetition Aware Sampling(RAS) inference for llm stability
      • Streaming inference mode support, including kv cache and sdpa for rtf optimization
    • 2024/07

      • Flow matching training support
      • WeTextProcessing support when ttsfrd is not available
      • Fastapi server and client

    Evaluation

    ModelOpen-SourceModel Sizetest-zhCER (%) ↓test-zhSS (%) ↑test-enWER (%) ↓test-enSS (%) ↑test-hardCER (%) ↓test-hardSS (%) ↑
    Human--1.2675.52.1473.4--
    Seed-TTS❌-1.1279.62.2576.27.5977.6
    MiniMax-Speech❌-0.8378.31.6569.2--
    F5-TTS✅0.3B1.5274.12.0064.78.6771.3
    Spark TTS✅0.5B1.266.01.9857.3--
    CosyVoice2✅0.5B1.4575.72.5765.96.8372.4
    FireRedTTS2✅1.5B1.1473.21.9566.5--
    Index-TTS2✅1.5B1.0376.52.2370.67.1275.5
    VibeVoice-1.5B✅1.5B1.1674.43.0468.9--
    VibeVoice-Realtime✅0.5B--2.0563.3--
    HiggsAudio-v2✅3B1.5074.02.4467.7--
    VoxCPM✅0.5B0.9377.21.8572.98.8773.0
    GLM-TTS✅1.5B1.0376.1----
    GLM-TTS RL✅1.5B0.8976.4----
    Fun-CosyVoice3-0.5B-2512✅0.5B1.2178.02.2471.86.7175.8
    Fun-CosyVoice3-0.5B-2512_RL✅0.5B0.8177.41.6869.55.4475.0

    Install

    Clone and install

    • Clone the repo

      git clone --recursive https://github.com/FunAudioLLM/CosyVoice.git
      # If you failed to clone the submodule due to network failures, please run the following command until success
      cd CosyVoice
      git submodule update --init --recursive
      
    • Install Conda: please see https://docs.conda.io/en/latest/miniconda.html

    • Create Conda env:

      conda create -n cosyvoice -y python=3.10
      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
      

    Model download

    We strongly recommend that you download our pretrained Fun-CosyVoice3-0.5B CosyVoice2-0.5B CosyVoice-300M CosyVoice-300M-SFT CosyVoice-300M-Instruct model and CosyVoice-ttsfrd resource.

    # modelscope SDK model download
    from modelscope import snapshot_download
    snapshot_download('FunAudioLLM/Fun-CosyVoice3-0.5B-2512', local_dir='pretrained_models/Fun-CosyVoice3-0.5B')
    snapshot_download('iic/CosyVoice2-0.5B', local_dir='pretrained_models/CosyVoice2-0.5B')
    snapshot_download('iic/CosyVoice-300M', local_dir='pretrained_models/CosyVoice-300M')
    snapshot_download('iic/CosyVoice-300M-SFT', local_dir='pretrained_models/CosyVoice-300M-SFT')
    snapshot_download('iic/CosyVoice-300M-Instruct', local_dir='pretrained_models/CosyVoice-300M-Instruct')
    snapshot_download('iic/CosyVoice-ttsfrd', local_dir='pretrained_models/CosyVoice-ttsfrd')
    
    # for oversea users, huggingface SDK model download
    from huggingface_hub import snapshot_download
    snapshot_download('FunAudioLLM/Fun-CosyVoice3-0.5B-2512', local_dir='pretrained_models/Fun-CosyVoice3-0.5B')
    snapshot_download('FunAudioLLM/CosyVoice2-0.5B', local_dir='pretrained_models/CosyVoice2-0.5B')
    snapshot_download('FunAudioLLM/CosyVoice-300M', local_dir='pretrained_models/CosyVoice-300M')
    snapshot_download('FunAudioLLM/CosyVoice-300M-SFT', local_dir='pretrained_models/CosyVoice-300M-SFT')
    snapshot_download('FunAudioLLM/CosyVoice-300M-Instruct', local_dir='pretrained_models/CosyVoice-300M-Instruct')
    snapshot_download('FunAudioLLM/CosyVoice-ttsfrd', local_dir='pretrained_models/CosyVoice-ttsfrd')
    

    Optionally, you can unzip ttsfrd resource and install ttsfrd package for better text normalization performance.

    Notice that this step is not necessary. If you do not install ttsfrd package, we will use wetext by default.

    cd pretrained_models/CosyVoice-ttsfrd/
    unzip resource.zip -d .
    pip install ttsfrd_dependency-0.1-py3-none-any.whl
    pip install ttsfrd-0.4.2-cp310-cp310-linux_x86_64.whl
    

    Basic Usage

    We strongly recommend using Fun-CosyVoice3-0.5B for better performance. Follow the code in example.py for detailed usage of each model.

    python example.py
    
    vLLM Usage

    CosyVoice2/3 now supports vLLM 0.11.x+ (V1 engine) and vLLM 0.9.0 (legacy). Older vllm version(<0.9.0) do not support CosyVoice inference, and versions in between (e.g., 0.10.x) are not tested.

    Notice that vllm has a lot of specific requirements. You can create a new env to in case your hardward do not support vllm and old env is corrupted.

    conda create -n cosyvoice_vllm --clone cosyvoice
    conda activate cosyvoice_vllm
    # for vllm==0.9.0
    pip install vllm==v0.9.0 transformers==4.51.3 numpy==1.26.4 -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
    # for vllm>=0.11.0
    pip install vllm==v0.11.0 transformers==4.57.1 numpy==1.26.4 -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
    python vllm_example.py
    
    Start web demo

    You can use our web demo page to get familiar with CosyVoice quickly.

    Please see the demo website for details.

    # change iic/CosyVoice-300M-SFT for sft inference, or iic/CosyVoice-300M-Instruct for instruct inference
    python3 webui.py --port 50000 --model_dir pretrained_models/CosyVoice-300M
    
    Advanced Usage

    For advanced users, we have provided training and inference scripts in examples/libritts.

    Build for deployment

    Optionally, if you want service deployment, You can run the following steps.

    cd runtime/python
    docker build -t cosyvoice:v1.0 .
    # change iic/CosyVoice-300M to iic/CosyVoice-300M-Instruct if you want to use instruct inference
    # for grpc usage
    docker run -d --runtime=nvidia -p 50000:50000 cosyvoice:v1.0 /bin/bash -c "cd /opt/CosyVoice/CosyVoice/runtime/python/grpc && python3 server.py --port 50000 --max_conc 4 --model_dir iic/CosyVoice-300M && sleep infinity"
    cd grpc && python3 client.py --port 50000 --mode <sft|zero_shot|cross_lingual|instruct>
    # for fastapi usage
    docker run -d --runtime=nvidia -p 50000:50000 cosyvoice:v1.0 /bin/bash -c "cd /opt/CosyVoice/CosyVoice/runtime/python/fastapi && python3 server.py --port 50000 --model_dir iic/CosyVoice-300M && sleep infinity"
    cd fastapi && python3 client.py --port 50000 --mode <sft|zero_shot|cross_lingual|instruct>
    
    Using Nvidia TensorRT-LLM for deployment

    Using TensorRT-LLM to accelerate cosyvoice2 llm could give 4x acceleration comparing with huggingface transformers implementation. To quick start:

    cd runtime/triton_trtllm
    docker compose up -d
    

    For more details, you could check here

    Discussion & Communication

    You can directly discuss on Github Issues.

    You can also scan the QR code to join our official Dingding chat group.

    Acknowledge

    1. We borrowed a lot of code from FunASR.
    2. We borrowed a lot of code from FunCodec.
    3. We borrowed a lot of code from Matcha-TTS.
    4. We borrowed a lot of code from AcademiCodec.
    5. We borrowed a lot of code from WeNet.

    Citations

    @article{du2024cosyvoice,
      title={Cosyvoice: A scalable multilingual zero-shot text-to-speech synthesizer based on supervised semantic tokens},
      author={Du, Zhihao and Chen, Qian and Zhang, Shiliang and Hu, Kai and Lu, Heng and Yang, Yexin and Hu, Hangrui and Zheng, Siqi and Gu, Yue and Ma, Ziyang and others},
      journal={arXiv preprint arXiv:2407.05407},
      year={2024}
    }
    
    @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}
    }
    
    @article{du2025cosyvoice,
      title={CosyVoice 3: Towards In-the-wild Speech Generation via Scaling-up and Post-training},
      author={Du, Zhihao and Gao, Changfeng and Wang, Yuxuan and Yu, Fan and Zhao, Tianyu and Wang, Hao and Lv, Xiang and Wang, Hui and Shi, Xian and An, Keyu and others},
      journal={arXiv preprint arXiv:2505.17589},
      year={2025}
    }
    
    @inproceedings{lyu2025build,
      title={Build LLM-Based Zero-Shot Streaming TTS System with Cosyvoice},
      author={Lyu, Xiang and Wang, Yuxuan and Zhao, Tianyu and Wang, Hao and Liu, Huadai and Du, Zhihao},
      booktitle={ICASSP 2025-2025 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
      pages={1--2},
      year={2025},
      organization={IEEE}
    }
    

    Ecosystem

    CosyVoice is part of the FunAudioLLM family — a complete speech AI toolkit:

    ProjectDescriptionStars
    FunASRIndustrial speech recognition — 50+ languages, speaker diarization, streaming
    Fun-ASR-NanoEnd-to-end LLM-based ASR — 31 languages, hotwords, vLLM streaming
    SenseVoiceUltra-fast ASR + emotion + audio event detection
    FunClipAI video clipping powered by speech recognition

    Disclaimer

    The content provided above is for academic purposes only and is intended to demonstrate technical capabilities. Some examples are sourced from the internet. If any content infringes on your rights, please contact us to request its removal.