Views
No views yet
1pip install -U qwen-tts
2# Optional: for optimized performance
3pip install -U flash-attn --no-build-isolation1import torch
2import soundfile as sf
3from qwen_tts import Qwen3TTSModel
4
5# Load the model
6model = Qwen3TTSModel.from_pretrained(
7 "Qwen/Qwen3-TTS-12Hz-0.6B-Base",
8 device_map="cuda:0",
9 dtype=torch.bfloat16,
10 attn_implementation="flash_attention_2",
11)
12
13# Reference audio for cloning
14ref_audio = "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen3-TTS-Repo/clone.wav"
15ref_text = "Okay. Yeah. I resent you. I love you. I respect you. But you know what? You blew it! And thanks to you."
16
17# Generate speech
18wavs, sr = model.generate_voice_clone(
19 text="I am solving the equation: x = [-b ± √(b²-4ac)] / 2a? Nobody can — it's a disaster (◍•͈⌔•͈◍), very sad!",
20 language="English",
21 ref_audio=ref_audio,
22 ref_text=ref_text,
23)
24
25# Save the resulting audio
26sf.write("output_voice_clone.wav", wavs[0], sr)

1@article{Qwen3-TTS,
2 title={Qwen3-TTS Technical Report},
3 author={Hangrui Hu and Xinfa Zhu and Ting He and Dake Guo and Bin Zhang and Xiong Wang and Zhifang Guo and Ziyue Jiang and Hongkun Hao and Zishan Guo and Xinyu Zhang and Pei Zhang and Baosong Yang and Jin Xu and Jingren Zhou and Junyang Lin},
4 journal={arXiv preprint arXiv:2601.15621},
5 year={2026}
6}