Comment on: The inference speed is very slow
Repo: rednote-hilab/dots.tts by xlians555
```python
from dots_tts.runtime import DotsTtsRuntime
import soundfile as sf
import torch
runtime = DotsTtsRuntime.from_pretrained(
"/path/to/dots_tts_model",
precision="bfloat16",
optimize=True,
)
# generate_stream yields audio chunks (torch.Tensor, shape (1, samples)) as they
# are produced — useful for low-latency playback or piping to a client.
stream = runtime.generate_stream(
text="Hello, this is a streaming speech synthesis test.",
prompt_audio_path="/path/to/reference.wav",
prompt_text="The exact transcript of the reference audio.",
num_steps=10,
guidance_scale=1.0,
)
# Option A: consume chunk-by-chunk (e.g. push to a player / websocket).
chunks = []
for chunk in stream:
chunks.append(chunk.detach().float().cpu())
# handle_chunk(chunk) # your real-time consumer here
# Option B: concatenate and write the full waveform to disk.
audio = torch.cat(chunks, dim=-1).squeeze().numpy()
sf.writ...
GitHub Issue
SaaS Metrics