Skip to main content

Environment Setup

The easiest way to use Qwen3-TTS is to install the qwen-tts Python package from PyPI. We recommend using a fresh, isolated environment to avoid dependency conflicts with existing packages.
Recommended: Python 3.12 for optimal compatibility and performance.Supported versions: Python 3.9, 3.10, 3.11, 3.12, 3.13 (see pyproject.toml:13-17)

Create a Clean Environment

Create a new conda environment with Python 3.12:

Installation Methods

We strongly recommend installing FlashAttention 2 to reduce GPU memory usage and improve inference speed.
1

Standard Installation

For most systems:
2

For Limited RAM Systems

If your machine has less than 96GB of RAM and many CPU cores:
This limits the number of parallel compilation jobs to prevent out-of-memory errors during installation.
Hardware Requirements:
  • FlashAttention 2 requires compatible GPUs (see FlashAttention repository)
  • Can only be used when models are loaded in torch.float16 or torch.bfloat16

Model Download

During model loading, weights are automatically downloaded based on the model name. However, if your runtime environment doesn’t support automatic downloads, you can manually download models to a local directory.
Recommended for users in Mainland China:
When using locally downloaded models, pass the local directory path instead of the model name when loading:

System Requirements

Software

  • Python 3.9 or later (3.12 recommended)
  • PyTorch with CUDA support
  • 96GB+ RAM (for FlashAttention 2 compilation)

Hardware

  • NVIDIA GPU with CUDA support
  • Compatible with FlashAttention 2 (Ampere or newer recommended)
  • Sufficient VRAM for model size (varies by model)

Verify Installation

Test your installation by importing the package:

Next Steps

Quickstart Guide

Generate your first speech with complete working examples