# Qwen3-TTS on Tenstorrent p150: Python API Alibaba Qwen's Qwen3-TTS (0.6B / 1.7B Base voice clone, 0.6B / 1.7B CustomVoice, 1.7B VoiceDesign) on one Tenstorrent Blackhole p150. The HTTP server of this package (`tt_qwen3_tts.server.app`) serves exactly this API: a request's fields are the keyword arguments below, validated by the same function. The weights are Qwen's (Apache-2.0) and are not part of this package: they are downloaded from `Qwen/Qwen3-TTS-12Hz-*` and `Qwen/Qwen3-TTS-Tokenizer-12Hz` at pinned commits ([`tt_qwen3_tts/licenses/NOTICE.md`](tt_qwen3_tts/licenses/NOTICE.md)). This package is a third-party port, not affiliated with or endorsed by Alibaba or the Qwen team. ## Install The container image has everything. Outside it you need a host build of tt-metal (`ttnn`) at the commit of the package's Provenance with the patches in `patches/` applied, then, from the root of the model repo: ```bash pip install -e . # numpy<2, safetensors, huggingface_hub, tokenizers, soundfile, soxr pip install -e ".[server,test]" # + fastapi, uvicorn, pytest, httpx ``` ## Quickstart ```python from tt_qwen3_tts import Qwen3TTS with Qwen3TTS.from_pretrained("1.7b-customvoice") as tts: # pinned weights -> chip (ETH, 12x10) -> warm-up out = tts.synthesize("Hello from a Tenstorrent p150.", speaker="ryan", language="English", seed=7) print(out.audio.shape, out.sample_rate, out.frames, out.stop_reason, out.timing_ms) run = tts.stream("A longer sentence, streamed as it is generated.", speaker="vivian", packet_frames=4) for packet in run: # float32 numpy, 24 kHz, 1 frame first then 4 play(packet.audio) print(run.summary) # frames, seed, stop reason, timing ``` `from_pretrained(variant, **overrides)` takes a serve profile (`0.6b-base`, `1.7b-base`, `0.6b-customvoice`, `1.7b-customvoice`, `1.7b-voicedesign`), an official name (`1.7B-CustomVoice`) or a repo id; the keyword overrides are the server-start settings of `config.ServeConfig` (`max_positions`, `prefill_buckets`, `chunk_max`, `k_max`, `engine`, `precision`, `codec_mode`, `weights_dir`, `codec_dir`, `dispatch`, `backend`, ...), which otherwise come from the `QWEN3TTS_*` environment. `backend="cpu"` runs the same API on the float32 CPU reference engines (real speech, no chip, about 0.6 s per 80 ms frame for 0.6B); `backend="fake"` on a deterministic stand-in for the device (no chip, no weights; tones instead of speech) for development and tests. The first `from_pretrained` of a checkpoint builds the device engines' caches (the projected text table, the talker's packed weights, the codec decoder's programs, the host build of the device sampler: about 1.3 GB per 0.6B and 2.6 GB per 1.7B checkpoint) under `QWEN3TTS_CACHE_DIR` (the `cache_dir` override), default `~/.cache/tt_qwen3_tts`; later calls reuse them. tt-metal keeps its compiled kernels in its own cache (`TT_METAL_CACHE`). ## Voice cloning (Base profiles) ```python with Qwen3TTS.from_pretrained("1.7b-base") as tts: voice = tts.create_voice(open("reference.wav", "rb").read(), # or (waveform, sample_rate) ref_text="exactly what the clip says", voice_id="me") out = tts.synthesize("Now in the cloned voice.", voice="me", language="English") # or inline, without registering: ref_audio=..., ref_text=... # x_vector_only_mode=True clones from the speaker embedding alone (no transcript; lower similarity) ``` A voice keeps the speaker embedding, the reference clip's codec codes and the transcript; the uploaded file itself is not kept. The codec codes are a compressed encoding of the clip (the codec decoder turns them back into an intelligible version of it: 12 dB SNR, the same transcript, speaker similarity 0.999 in an independent check), so a stored voice is as sensitive as the recording. `QWEN3TTS_VOICES=