█

AI/TLDR

Buy me a coffee
Buy me a coffee

Dia2

Streaming dialogue TTS that starts speaking before the script is finished

Audio, Music & VoiceOpen source
Language
Python
License
Apache-2.0
$git clone https://github.com/nari-labs/dia2.git
IN SHORT

What is Dia2?

Dia2 is a streaming dialogue text-to-speech model from Nari Labs, the team behind Dia. It sits in the Audio, Music & Voice category of the Multimodal Generation tools and is open-source, written in Python and licensed Apache-2.0. To get started: install dependencies.

Overview

Dia2 is a streaming dialogue text-to-speech model from Nari Labs, the team behind Dia. Unlike a TTS model that needs the whole script up front, Dia2 can start generating audio as soon as the first few words arrive, which makes it suited to realtime conversational systems. Scripts use the same [S1] and [S2] speaker tags as Dia to produce a back-and-forth between two voices.

The repository ships inference code alongside two checkpoints on Hugging Face, Dia2-1B and Dia2-2B. You run it through a command-line interface, a Gradio app, or a small Python API (Dia2, GenerationConfig, SamplingConfig). Generation is capped at about two minutes of English audio per run, and the result includes the waveform, the audio tokens, and word timestamps.

Voices are not fixed: the project notes that quality and voices vary from one generation to the next because the model is not fine-tuned on a specific speaker. For stable output you condition on prefix audio for each speaker, which the CLI transcribes with Whisper. That same mechanism lets you feed in prior conversational context, such as an assistant's voice and a user's spoken turn, and generate the reply. The code and weights are Apache-2.0, with third-party assets such as Kyutai's Mimi codec keeping their own licenses.

What it does

  • Streaming generation that can begin from the first few words of input rather than the full text
  • Two-speaker dialogue from transcripts tagged with [S1] and [S2]
  • Audio conditioning via --prefix-speaker-1 and --prefix-speaker-2, with Whisper transcribing each prefix
  • 1B and 2B checkpoints on Hugging Face (nari-labs/Dia2-1B, nari-labs/Dia2-2B)
  • CLI, Gradio app and Python API, with CUDA graph support and bfloat16 by default
  • Results include waveform, audio tokens and word timestamps at Mimi's ~12.5 Hz frame rate

Getting started

Dia2 runs through uv and expects CUDA 12.8+ drivers; the CLI falls back to CPU when no CUDA device is found. The first run downloads the weights, tokenizer and Mimi codec.

Install dependencies

Clone the repository and let uv set up the environment once.

bashbash
git clone https://github.com/nari-labs/dia2.git
cd dia2
uv sync

Write a script

Edit input.txt using [S1] and [S2] speaker tags for each turn. The bundled file opens like this:

texttext
[S1] Um, like, I don't know, I've never actually, like, been on a real vacation, you know? [S2] Oh, seriously? That's wild. I've, uh, only been on, like, one trip myself, and it was kinda stressful.

Generate audio from the CLI

Point the CLI at a checkpoint on Hugging Face and an output WAV path. Override the device or precision with --device / --dtype if needed.

bashbash
uv run -m dia2.cli \
  --hf nari-labs/Dia2-2B \
  --input input.txt \
  --cfg 6.0 --temperature 0.8 \
  --cuda-graph --verbose \
  output.wav

Condition on speaker prefixes

The README recommends prefix audio for stable voices. The repo includes example_prefix1.wav and example_prefix2.wav to try it.

bashbash
uv run -m dia2.cli \
  --hf nari-labs/Dia2-2B \
  --input input.txt \
  --prefix-speaker-1 example_prefix1.wav \
  --prefix-speaker-2 example_prefix2.wav \
  --cuda-graph --verbose \
  output_conditioned.wav

Use it from Python or Gradio

Call the Python API directly, or launch the bundled web UI with `uv run gradio_app.py`.

pythonpython
from dia2 import Dia2, GenerationConfig, SamplingConfig

dia = Dia2.from_repo("nari-labs/Dia2-2B", device="cuda", dtype="bfloat16")
config = GenerationConfig(
    cfg_scale=2.0,
    audio=SamplingConfig(temperature=0.8, top_k=50),
    use_cuda_graph=True,
)
result = dia.generate("[S1] Hello Dia2!", config=config, output_wav="hello.wav", verbose=True)

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Building the speaking half of a realtime voice assistant that starts talking before the full reply text is ready
  • Generating a spoken response conditioned on the previous turns of a conversation in a speech-to-speech pipeline
  • Producing short two-speaker English dialogue clips from a tagged script
  • Researching open streaming TTS with 1B and 2B checkpoints you can run locally

How Dia2 compares

Dia2 alongside other open-source audio, music & voice tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
VoiceStudio★ 121kA local-first desktop voice studio that clones and designs voices, dubs video, and handles dictation, running 16 text-to-speech and 11 speech-recognition engines on your own hardware.
Whisper★ 114kOpenAI's speech recognition model that transcribes and translates audio across many languages.
GPT-SoVITS★ 64.3kAn open-source WebUI that clones a voice from a short audio sample and turns text into speech, with zero-shot and few-shot fine-tuning.
Voicebox★ 61.6kLocal-first voice studio that clones a voice from a short sample, generates speech across seven TTS engines and 23 languages, handles system-wide dictation, and speaks for agents over MCP.
VibeVoice★ 57.6kMicrosoft's text-to-speech model for generating long, expressive multi-speaker audio like podcasts.
whisper.cpp★ 55.7kA dependency-free C/C++ port of Whisper built on ggml, running speech recognition on CPU, Metal, CUDA, Vulkan and NPUs from phones to servers.
Coqui TTS★ 46.3kA library of text-to-speech models including the multilingual XTTS voice-cloning model.
Dia2★ 1.2kStreaming dialogue TTS that starts speaking before the script is finished