Qwen3-TTS Documentation

Qwen3-TTS is an open-source series of TTS models developed by the Qwen team at Alibaba Cloud, supporting stable, expressive, and streaming speech...

14,786 stars Python Python 2 files ยท ~15,280 tokens
RAW Doc

File: finetuning/README.md

Fine Tuning Qwen3-TTS-12Hz-1.7B/0.6B-Base

The Qwen3-TTS-12Hz-1.7B/0.6B-Base model series currently supports single-speaker fine-tuning. Please run pip install qwen-tts first, then run the command below:

text
git clone https://github.com/QwenLM/Qwen3-TTS.git
cd Qwen3-TTS/finetuning

Then follow the steps below to complete the entire fine-tuning workflow. Multi-speaker fine-tuning and other advanced fine-tuning features will be supported in future releases.

1) Input JSONL format

Prepare your training file as a JSONL (one JSON object per line). Each line must contain:

  • audio: path to the target training audio (wav)
  • text: transcript corresponding to audio
  • ref_audio: path to the reference speaker audio (wav)

Example:

jsonl
{"audio":"./data/utt0001.wav","text":"ๅ…ถๅฎžๆˆ‘็œŸ็š„ๆœ‰ๅ‘็Žฐ๏ผŒๆˆ‘ๆ˜ฏไธ€ไธช็‰นๅˆซๅ–„ไบŽ่ง‚ๅฏŸๅˆซไบบๆƒ…็ปช็š„ไบบใ€‚","ref_audio":"./data/ref.wav"}
{"audio":"./data/utt0002.wav","text":"She said she would be here by noon.","ref_audio":"./data/ref.wav"}

ref_audio recommendation:

  • Strongly recommended: use the same ref_audio for all samples.
  • Keeping ref_audio identical across the dataset usually improves speaker consistency and stability during generation.

2) Prepare data (extract `audio_codes`)

Convert train_raw.jsonl into a training JSONL that includes audio_codes:

bash
python prepare_data.py \
  --device cuda:0 \
  --tokenizer_model_path Qwen/Qwen3-TTS-Tokenizer-12Hz \
  --input_jsonl train_raw.jsonl \
  --output_jsonl train_with_codes.jsonl

3) Fine-tune

Run SFT using the prepared JSONL:

bash
python sft_12hz.py \
  --init_model_path Qwen/Qwen3-TTS-12Hz-1.7B-Base \
  --output_model_path output \
  --train_jsonl train_with_codes.jsonl \
  --batch_size 32 \
  --lr 2e-6 \
  --num_epochs 10 \
  --speaker_name speaker_test

Checkpoints will be written to:

  • output/checkpoint-epoch-0
  • output/checkpoint-epoch-1
  • output/checkpoint-epoch-2
  • ...

4) Quick inference test

python
import torch
import soundfile as sf
from qwen_tts import Qwen3TTSModel

device = "cuda:0"
tts = Qwen3TTSModel.from_pretrained(
    "output/checkpoint-epoch-2",
    device_map=device,
    dtype=torch.bfloat16,
    attn_implementation="flash_attention_2",
)

wavs, sr = tts.generate_custom_voice(
    text="She said she would be here by noon.",
    speaker="speaker_test",
)
sf.write("output.wav", wavs[0], sr)

One-click shell script example

bash
#!/usr/bin/env bash
set -e

DEVICE="cuda:0"
TOKENIZER_MODEL_PATH="Qwen/Qwen3-TTS-Tokenizer-12Hz"
INIT_MODEL_PATH="Qwen/Qwen3-TTS-12Hz-1.7B-Base"

RAW_JSONL="train_raw.jsonl"
TRAIN_JSONL="train_with_codes.jsonl"
OUTPUT_DIR="output"

BATCH_SIZE=2
LR=2e-5
EPOCHS=3
SPEAKER_NAME="speaker_1"

python prepare_data.py \
  --device ${DEVICE} \
  --tokenizer_model_path ${TOKENIZER_MODEL_PATH} \
  --input_jsonl ${RAW_JSONL} \
  --output_jsonl ${TRAIN_JSONL}

python sft_12hz.py \
  --init_model_path ${INIT_MODEL_PATH} \
  --output_model_path ${OUTPUT_DIR} \
  --train_jsonl ${TRAIN_JSONL} \
  --batch_size ${BATCH_SIZE} \
  --lr ${LR} \
  --num_epochs ${EPOCHS} \
  --speaker_name ${SPEAKER_NAME}

File: .github/ISSUE_TEMPLATE/bug_report.yml

name: ๐Ÿž Bug Report
body:

  • type: markdown
    attributes:
    value: |
    We appreciate your time and effort in filing this report. โค

    Issues are a vital part of open-source collaboration. They help identify and resolve real-world problems, improve the project for everyone, and create a transparent, well-documented knowledge base that benefits the entire community. By reporting an issue, you're not just solving a problem for yourself --- you're helping others who may encounter the same challenge.

    To ensure your issue is addressed efficiently and effectively, please follow these guidelines when submitting:

    1. Use English
    Please write your issue in English. This ensures the widest possible audience can understand and contribute. Most translation tools also work best with English, making your report more accessible globally.

    2. Choose a clear and descriptive title
    Your title should summarize the issue clearly and include relevant details such as the model ID (e.g., Qwen3-TTS-12Hz-1.7B-CustomVoice/) and the framework or environment (e.g., qwen-tts, vllm-omni).
    Example: Qwen3-TTS-12Hz-1.7B-CustomVoice generates errors with vllm-omni under CUDA 12.8

    3. Provide reproducible steps
    Help us help you: include a minimal, self-contained code snippet and clear instructions to reproduce the issue. Be sure to specify:
    - Your environment (OS, Python version, package versions)
    - The exact commands or code used; the prompts and the sampling parameters in terms of badcases
    - Expected vs. actual behavior

    4. Be precise and concise
    - Focus on one issue per report. If you have multiple bugs, please open separate issues.
    - Include only the context and code necessary to understand and reproduce the problem.
    - Think of your issue as a future reference for others --- aim to make it a helpful documentation entry.


    Also keep in mind that this repository is dedicated to the open-weight versions of the Qwen Omni.
    - For Qwen API services or closed-source variants, please contact Alibaba Cloud support directly.

  • type: textarea
    attributes:
    label: Description
    Please describe the problem you have encountered.

    validations:
    required: true

  • type: textarea
    attributes:
    label: Reproduction
    Please provide minimal reproducible code.

    validations:
    required: true

  • type: textarea
    attributes:
    label: Logs
    Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
    If the log is too long, feel free to put it in a public gist and link it in the issue: https://gist.github.com.

    render: shell
    validations:
    required: false

  • type: textarea
    attributes:
    label: Environment Information
    Please provide information about you environment, e.g., the software versions and the information on the OS, GPUs, CUDA, and NVIDIA Driver if GPUs are used.

    validations:
    required: true

  • type: checkboxes
    attributes:
    label: Known Issue
    options:
    - label: The issue hasn't been already addressed in Documentation, Issues, and Discussions.


File: .github/ISSUE_TEMPLATE/config.yml

blank_issues_enabled: false
contact_links:


File: .github/workflows/inactive.yaml

name: Close and lock inactive threads
on:
schedule:
- cron: "0 8 * * *"
jobs:
manage-inactive:
runs-on: ubuntu-latest
permissions:
actions: write
issues: write
pull-requests: write
steps:
- uses: actions/stale@v9
with:
days-before-issue-stale: 45
days-before-issue-close: 30
stale-issue-label: inactive
stale-issue-message: >
This issue has been automatically marked as inactive
due to lack of recent activity.
Should you believe it remains unresolved and warrants attention,
kindly leave a comment on this thread.
exempt-issue-labels: enhancement,discussion
days-before-pr-stale: -1
days-before-pr-close: -1
operations-per-run: 128
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: dessant/lock-threads@v5
with:
issue-inactive-days: 60
issue-comment: >
This issue has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.
pr-inactive-days: 90
pr-comment: >
This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.
repo-token: ${{ secrets.GITHUB_TOKEN }}


File: .github/workflows/translate.yaml

name: 'translator'
on:
issues:
types: [opened, edited]
issue_comment:
types: [created, edited]
discussion:
types: [created, edited]
discussion_comment:
types: [created, edited]

jobs:
translate:
permissions:
issues: write
discussions: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: lizheming/github-translate-action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
IS_MODIFY_TITLE: true
APPEND_TRANSLATION: true