breeze-tts README

项目的 README,来自 github.com/breezeblue-ai/breeze-tts。合并为一个 markdown 文件:README.md。

BreezeBlue

Hugging Face Blog Website Discord X

[!IMPORTANT] Source code is licensed under Apache 2.0. Breeze TTS 2 model weights, derivative models, and self-hosted outputs are for research and non-commercial use only. See License.

📰 News

📖 Introduction

Breeze TTS 2 is an open-weight text-to-speech model built for real-time interaction. It ranks #1 among open-weight models on the Artificial Analysis TTS leaderboard, while outperforming frontier proprietary systems. Its open-ended natural-language instruction-following capability supports reference-free voice design and reference-guided voice direction, while ultra-low-latency streaming enables responsive, expressive interaction.

Text-to-speech models ranked by Artificial Analysis Elo score

✨ Highlights

🚀 Quick Start

Requirements

Installation

Download the inference code:

git clone https://github.com/breezeblue-ai/breeze-tts.git
cd breeze-tts

Install the dependencies:

python -m pip install -r requirements.txt

All required model components are included in the Breeze TTS 2 checkpoint.

For the tested CUDA environment, build the included Docker image:

bash docker/build.sh

The default image targets H100/Hopper (sm90). For A100:

FLASH_ATTN_CUDA_ARCHS=80 bash docker/build.sh

🎙️ Voice Clone

Clone a speaker from clean reference audio and its exact transcript.

English

python infer.py ../breeze-tts-2 \
  --ref-audio reference_en.wav \
  --ref-text "This is the exact transcript of the English reference audio." \
  --text "(sigh) It is good to hear your voice again after all this time." \
  --output outputs/voice_clone_en.wav

Chinese

python infer.py ../breeze-tts-2 \
  --ref-audio reference_zh.wav \
  --ref-text "这是中文参考音频的准确文字稿。" \
  --text "[叹气] 没想到过了这么久,你还记得我的声音。" \
  --output outputs/voice_clone_zh.wav

Reference audio should contain clean, non-looping speech with minimal background noise. --ref-text should match the complete spoken content of the reference audio; if speech is repeated in the audio, include those repetitions in the transcript. Voice Clone does not use an instruction. Adding --instruction selects Voice Direction instead.

🎨 Voice Design

Create a voice from a natural-language description without reference audio. Match the instruction language to the target text. Use --cfg-scale 4 to strengthen instruction-following.

English

python infer.py ../breeze-tts-2 \
  --text "(sigh) Welcome aboard. Your journey begins now." \
  --instruction "A warm, thoughtful young woman with a clear voice and a calm, reflective delivery." \
  --cfg-scale 4 \
  --output outputs/voice_design_en.wav

Chinese

python infer.py ../breeze-tts-2 \
  --text "[笑] 欢迎来到今晚的故事时间,让我们一起开始吧。" \
  --instruction "一位温柔自信的年轻女性,声音清晰,语气亲切,表达轻快而富有感染力。" \
  --cfg-scale 4 \
  --output outputs/voice_design_zh.wav

🎛️ Voice Direction

Keep the identity of a reference speaker while directing tone, emotion, pace, and delivery. Use --cfg-scale 4 to strengthen instruction-following.

python infer.py ../breeze-tts-2 \
  --ref-audio reference.wav \
  --ref-text "This is the exact transcript of the reference audio." \
  --text "(clears throat) We need to discuss what happened last night." \
  --instruction "Speak slowly with a restrained, serious tone." \
  --cfg-scale 4 \
  --output outputs/voice_direction.wav

🌐 Streaming API

Start the single-concurrency streaming API. It uses the same PyTorch runtime and eager execution by default:

python -m breeze_infer.api ../breeze-tts-2 --host 0.0.0.0 --port 7860

Send a Voice Direction request with reference audio and CFG 4:

curl -X POST http://127.0.0.1:7860/v1/audio/speech \
  -F "cfg_scale=4" \
  -F "[email protected]" \
  -F "ref_text=This is the exact transcript of the reference audio." \
  -F "text=(clears throat) We need to discuss what happened last night." \
  -F "instruction=Speak slowly with a restrained, serious tone." \
  -F "seed=42" \
  --output voice_direction.pcm

The response is streaming mono 24 kHz signed 16-bit little-endian PCM. Start the API with --fast-all to enable the fast path.

The model argument is either a local checkpoint directory or a Hugging Face repo id. Repo ids are downloaded into the standard Hugging Face cache; pass --revision to pin a branch, tag, or commit (ignored for local directories):

python -m breeze_infer.api BreezeBlue/breeze-tts-2 --revision main --host 0.0.0.0 --port 7860

📦 Batch API

For offline synthesis, send many texts in one request. Decoding one sequence at a time is memory-bandwidth bound, so a batch finishes much faster than the same texts sent one by one:

curl -X POST http://127.0.0.1:7860/v1/audio/speech/batch \
  -F 'texts=["The first sentence.", "The second sentence."]' \
  -F "instruction=A calm, clear narrator." \
  -F "cfg_scale=4" \
  -F "seed=42" \
  -F "max_new_tokens=600" \
  --dump-header headers.txt \
  --output batch.pcm

texts is a JSON array of up to 128 non-empty strings. instruction, cfg_scale, ref_audio with ref_text, and seed behave as in /v1/audio/speech and apply to every text. max_new_tokens is clamped to the server limit of 1500.

Batch inference is opt-in: its GPU memory grows with batch size and sequence length, so start with a small batch and increase it to fit your GPU. The 7.7 GiB / 12 GB recommendation above describes single-request eager inference, not a 128-text batch. Batch support keeps its backup weights on CPU and does not add GPU allocations to single-request inference.

Batches use eager text encoding and backbone generation; CFG batches (cfg_scale != 1) accelerate depth decoding with CUDA Graphs. A graph is captured lazily for the active batch-size bucket and reused; switching buckets replaces it rather than retaining all sizes. The first request in a bucket includes capture overhead. Plain cloning with cfg_scale=1 does not create a batch graph. Batch graph memory is allocated only after requesting CFG batch synthesis and remains cached for reuse.

Batches share the single inference slot with streaming requests; a request made while another is running returns 409.

The response body is the mono 24 kHz s16le PCM of every segment concatenated in request order. X-Segment-Bytes lists each segment's byte length, comma separated, so the body can be split back into segments.

GET /v1/model reports the loaded checkpoint and the server limits:

{"frame_rate": 12.5, "model_digest": "<sha256>", "max_new_tokens": 1500, "max_batch_texts": 128}

frame_rate is the codec frame rate (tokens per second of audio), useful for sizing max_new_tokens. model_digest is a SHA-256 over the checkpoint config, safetensors index (if present), and all referenced model weight files. It is computed once at startup using bounded-memory reads, distinguishes changed weights, and is independent of the checkpoint directory.

Direct model generation

When calling model.generate() with inputs from prepare_inputs(), pass the bundled audio_tokenizer returned by load_runtime() to decode audio:

audio = model.generate(
    **inputs,
    output_audio=True,
    audio_tokenizer=audio_tokenizer,
    repetition_penalty=1.1,
)

repetition_penalty can also be set in GenerationConfig; it penalizes generated first-codebook audio tokens, not the text prompt. An explicit GeneratedTokenRepetitionPenaltyLogitsProcessor remains supported. If both forms enable a penalty, equal values are applied once; conflicting values raise an error.

output_audio=True requires audio_tokenizer; omitting it raises an error before sampling. Use output_audio=False to obtain codec tokens without a decoder. Hugging Face generation options are not all compatible with Breeze's mixed text/audio history: no_repeat_ngram_size and encoder_no_repeat_ngram_size are unsupported and must remain 0. Repetition penalty discourages repeated audio tokens; it does not guarantee that spoken phrases never repeat.

⚡ Fast Inference Options

Both the CLI and API use eager streaming by default and skip graph warmup. Pass --fast-all to enable the best configuration for every inference stage when the additional cold-start time is acceptable. Each stage can also be controlled independently:

Stage Fast parameter Disabled Enabled
Text encoder --[no-]fast-text-encoder Native eager forward Static CUDA Graph selected by CFG shape and text-length bucket
Backbone prefill --[no-]fast-backbone-prefill Native eager prefill CUDA Graph selected by CFG shape and prompt-length bucket
Backbone decode --[no-]fast-backbone-decode Native eager token step StaticCache-backed graph selected by CFG shape
Depth decoder --[no-]fast-depth-decoder Native eager depth loop Full-graph compilation with CFG-shape CUDA Graphs
Codec --[no-]fast-codec Eager streaming decode Single-request streaming CUDA Graph with one-frame chunks

Individual stage flags are intended for profiling and debugging.

License and Responsible Use

The source code is licensed under the Apache License, Version 2.0. The audio tokenizer is based on Qwen3-TTS by the Alibaba Qwen Team and is licensed under the Apache License, Version 2.0. Model weights, checkpoints, adapters, derivative models, and self-hosted outputs are governed separately by the BreezeBlue Research and Non-Commercial License. The Apache License does not grant rights to use the model commercially.

If you have an active paid subscription, outputs you generate through BreezeBlue's hosted platform or API at breezeblue.ai can be used commercially, subject to our Terms of Service. A paid subscription does not grant commercial rights to the open-weight model or self-hosted outputs.

You are responsible for complying with applicable laws and obtaining all necessary rights and consents for inputs, reference audio, voices, and outputs. Unauthorized voice cloning, impersonation, fraud, and other unlawful or harmful uses are prohibited.

The code and Model Materials are provided "AS IS," without warranties or liability to the maximum extent permitted by law. Third-party components remain subject to their respective licenses.

breeze-tts (breezeblue-ai/breeze-tts)

正在搜索数据库…

这是什么?Breeze TTS 2 是一个为实时交互打造的开源权重文本转语音模型,本仓库是它的官方 PyTorch 推理代码。它在 Artificial Analysis TTS 排行榜上位列开源权重模型第一,并超越了一些专有系统。
这是一个我导入的库,还是独立的 CLI/服务器?两者都是:一个用于 Voice Clone、Voice Design 和 Voice Direction 的命令行工具,外加一个使用相同 PyTorch 运行时的流式推理 API 服务器。
怎么让它跑起来?下载推理代码,安装依赖,然后下载 Breeze TTS 2 检查点(其中打包了所有必需的模型组件)。项目还提供面向已测试 CUDA 环境的 Docker 镜像,分别有针对 H100/Hopper 和 A100 的构建。
我需要什么硬件和软件?需要 Linux、Python 3.10+ 和一块支持 CUDA 的 NVIDIA GPU。普通(eager)推理约需 7.7 GiB 显存(GPU 最低 12 GB),快速路径约需 14.4 GiB(建议 24 GB GPU)。
我可以把生成的语音用于商业产品吗?默认不行:代码是 Apache 2.0,但模型权重以及任何自托管产生的输出都受另一份研究与非商业许可约束。输出的商业使用只能通过 BreezeBlue 托管平台的付费订阅进行。
它也能在 Windows 或 macOS 上运行吗?不能,README 明确要求 Linux 和 Python 3.10+,没有提及对 Windows/macOS 的支持。
我需要特定的 GPU 才能运行吗?是的,必须有一块支持 CUDA 的 NVIDIA GPU;eager 模式大约需要 7.7 GiB 显存(显卡最低 12 GB),CUDA 图快速路径大约需要 14.4 GiB(建议 24 GB 显卡)。
Voice Clone、Voice Design 和 Voice Direction 有什么区别?Voice Clone 根据音频及其文字稿复现参考说话者确切的音色和风格。Voice Design 仅凭一段自然语言描述就能生成全新的声音,无需参考音频。Voice Direction 会克隆参考声音,但允许你用一条指令调控语气、情感、节奏和表达方式。
语音生成速度有多快?在预热过的 NVIDIA H100 上使用快速路径,从请求到首个音频的时间低于 40 毫秒,实时率为 0.32,也就是说它的音频生成速度约为实时播放的 3.1 倍。
我可以在语音中加入笑声或叹气之类的元素吗?可以,Vocal Events 功能允许你在文本中内联插入表达性提示,英文用圆括号(例如 '(laugh)'、'(cough)'),中文用方括号(例如 '[笑]'、'[叹气]')。
它支持哪些语言?Breeze TTS 2 是双语的,用一个模型就能生成自然的英文和中文语音。
大小
0.2 MB
星标
1.8K
更新
提交Nov 17
时长
3个月
提交 · 90 天