Views
No views yet
config.json and selected automatically.
Sampling and streaming cadence options should be omitted.1import torch
2import soundfile as sf
3
4from dots_tts.runtime_double_streaming import DotsTtsRuntimeDoubleStreaming
5
6runtime = DotsTtsRuntimeDoubleStreaming.from_pretrained(
7 "dots-studio/dots.tts-mf-2steps-stts",
8 precision="bfloat16",
9 optimize=True,
10 max_generate_length=500,
11)
12
13text = "Hello from two-step double streaming."
14text_token_ids = runtime.model.tokenizer.encode(text, add_special_tokens=False)
15
16session = runtime.start_double_streaming(
17 prompt_audio_path="/path/to/reference.wav",
18 prompt_text="The exact transcript spoken in the reference audio.",
19)
20
21chunks = []
22for token_id in text_token_ids:
23 chunk = session.push_text_token(token_id)
24 if chunk is not None:
25 chunks.append(chunk.detach().cpu())
26
27for chunk in session.finish_text():
28 chunks.append(chunk.detach().cpu())
29
30audio = torch.cat(chunks, dim=-1).float().squeeze().numpy()
31sf.write("double_streaming.wav", audio, runtime.sample_rate)scripts/example_double_streaming.py.1@article{dotstts2026,
2 title = {dots.tts Technical Report},
3 author = {dots.tts Team},
4 year = {2026},
5 eprint = {2606.07080},
6 archivePrefix = {arXiv},
7 primaryClass = {cs.SD},
8}