Registry / ai-ml / qwen-tts

qwen-tts

JSON →
library0.1.1pypypiunverified

Qwen-TTS is a powerful text-to-speech (TTS) synthesis library developed by the Qwen team (Alibaba Cloud). It enables high-quality speech generation from text, supporting various languages and speaking styles. The library is currently at version 0.1.1 and is under active development, with updates typically coinciding with major model releases or feature improvements.

pip install qwen-tts
INSTALL
IMPORT
SIG · QWEN-TTS
Q
qwen-tts
ai-mlpythonv0.1.1
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ timeout
4/8 runs
py 3.11
✕ timeout
4/8 runs
py 3.12
✕ build_error
4/8 runs
py 3.13
✕ build_error
4/8 runs
py 3.9
✕ timeout
4/8 runs
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

QwenTTS
from qwen_tts.models import QwenTTS
from qwen_tts import QwenTTS
The main model class is nested within the `models` submodule.
get_frontend
from qwen_tts.frontend import get_frontend
from qwen_tts.utils import get_frontend
The text processing frontend is found in the `frontend` submodule.

This quickstart demonstrates how to load the Qwen-TTS model, prepare text with its frontend, synthesize speech, and save the output to a WAV file. It includes robust device selection (GPU/CPU) and handles common initialization steps.

import torch import soundfile as sf from qwen_tts.frontend import get_frontend from qwen_tts.models import QwenTTS # Define text and style for synthesis text = "Hello, this is a test from Qwen TTS, demonstrating speech synthesis." language = "en" style_name = "neutral" # Other options: 'happy', 'sad', etc. # Determine device for model loading (GPU if available, else CPU) device = 'cuda' if torch.cuda.is_available() else 'cpu' print(f"Attempting to load model on: {device}") # Load the QwenTTS model from Hugging Face Hub try: model = QwenTTS.from_pretrained('Qwen/Qwen3-TTS', device=device) except Exception as e: print(f"Failed to load model on {device}: {e}. Retrying with 'cpu'.") device = 'cpu' model = QwenTTS.from_pretrained('Qwen/Qwen3-TTS', device=device) # Initialize the frontend for text processing # The exp_name is retrieved from the loaded model's hyperparameters frontend = get_frontend(model.hparams.data.exp_name) # Get text and style tokens from the frontend text_token, style_token = frontend.get_text_token_and_style_token( text=text, language=language, style_name=style_name ) # Synthesize speech using the model output = model.synthesize(text_token, style_token) wav = output['wav'][0].cpu().numpy() # Extract waveform and move to CPU sampling_rate = model.hparams.data.sampling_rate # Save the synthesized audio to a WAV file output_filename = "qwen_tts_output.wav" sf.write(output_filename, wav, sampling_rate) print(f"Speech synthesized and saved to {output_filename}")
Debug
Known issues
gotchaQwen-TTS relies heavily on PyTorch and other deep learning dependencies. Ensuring correct installation, especially for GPU (CUDA) acceleration, is crucial. Mismatched CUDA versions between your system, PyTorch, and other libraries can lead to runtime errors or poor performance.
fix
Follow PyTorch's official installation instructions for your specific CUDA version and OS. Check the `transformers` and `accelerate` package documentation for any specific environment requirements. Often, installing PyTorch *before* `qwen-tts` is recommended.
affects: 0.1.x
gotchaThe `QwenTTS.from_pretrained()` method downloads model weights from Hugging Face Hub. This requires an active internet connection and significant disk space (several GBs for the model). Slow connections or network issues can cause downloads to fail or be very slow.
fix
Ensure a stable internet connection. If behind a proxy, configure environment variables like `HTTP_PROXY` and `HTTPS_PROXY`. If downloads are consistently failing, check your disk space and consider clearing the Hugging Face cache (`~/.cache/huggingface/hub/`) if corruption is suspected.
affects: 0.1.x
gotchaThe `frontend.get_text_token_and_style_token()` method requires valid `language` and `style_name` parameters. Using unsupported languages or style names (e.g., 'happy' for a language that only supports 'neutral') will result in errors.
fix
Consult the Qwen-TTS documentation or the model's configuration for a list of supported languages and available styles for each language. Start with 'en' and 'neutral' to ensure basic functionality before exploring other options.
affects: 0.1.x
Upgrade
Version history
0.1.1latest on PyPI · released Feb 6, 2026
Audit
Dependencies
torchrequiredDeep learning framework for model operations; requires specific CUDA setup for GPU acceleration.
transformersrequiredUsed for tokenizer and model loading infrastructure from Hugging Face.
soundfilerequiredRequired for saving synthesized audio to WAV files.
acceleraterequiredUsed for efficient model loading and inference, especially on different devices.
sentencepiecerequiredA dependency for some text processing components, particularly tokenization.
Agent activity
13 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
qwen-tts — pip install qwen-tts · libregistry