Dia2
Streaming-based conversational text-to-speech (TTS) model.
Dia2, developed by Nari Labs, is a streaming-based conversational text-to-speech (TTS) model. Similar to how GPT generates text token by token, Dia2 adopts a streaming architecture that begins audio generation immediately upon receiving only the first few words of the input text. It is available in two parameter sizes, 1B and 2B, and is built on top of Kyutai's Mimi audio codec, utilizing a parallel decoding structure inspired by Google's SoundStorm research. Most existing TTS models require the entire text to be input before audio can be generated. In real-time conversational systems or interactive applications, this latency becomes a critical bottleneck. Dia2 overcomes this limitation through streaming generation. It can naturally script multi-speaker conversations using the [S1] and [S2] speaker tags and even generate non-verbal vocalizations such as laughter, coughing, sighs, and gasps. By providing an audio prefix as a condition, it can replicate the voice and emotional tone of a specific speaker, solving the problem of random voice variations in each generation. In the context of biotechnology research, Dia2 can be used to automatically generate audio guides for experimental protocols. For example, converting a cell culture protocol text into a two-speaker conversation format with [S1] as the instructor and [S2] as the confirmer allows for hands-free, step-by-step guidance during clean bench operations. Furthermore, it can be used to quickly prototype high-quality conversational voices in English for various research communication needs, such as patient education materials, podcast conversions of research papers, and rehearsals for multilingual research presentations. It generates up to 2 minutes of English audio, and its inference speed is continuously being improved through CUDA graph optimization and RotaryEmbedding caching.
๐ป System Requirements
NVIDIA GPU with CUDA 12.8+ is required. Estimated RAM requirement for the 2B model (bfloat16) is approximately 6-10GB, and for the 1B model, approximately 4-6GB (official figures not yet released; reference the original Dia 1.6B model, which requires ~4.4GB for bf16 and ~7.9GB for fp32).
The 2B model checkpoint requires approximately 4GB (based on fp32), and the 1B model requires approximately 2GB. Including dependencies, the total storage requirement is approximately 6-8GB.
โก Installation
### 4-1. Quick Start
```bash
# Install the uv package manager (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone the repository + synchronize dependencies
git clone https://github.com/nari-labs/dia2.git
cd dia2
uv sync
```
### 4-2. Basic Usage
```bash
# Generate speech using the CLI (2B model)
uv run -m dia2.cli \
--hf nari-labs/Dia2-2B \
--input input.txt \
--cfg 6.0 --temperature 0.8 \
--cuda-graph --verbose \
output.wav
```
```bash
# Voice cloning โ Prefix audio conditional generation
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
```
```python
# Python API
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
)
```๐งฌ Bio Use Cases
Audio Guide for Experimental Protocols
Convert experimental protocols, such as cell culture and reagent preparation, into a [S1] instructor / [S2] verifier dialogue. Enable hands-free listening during clean bench or fume hood operations. Generate clear speech with cfg_scale=6.0 and temperature=0.7, and maintain a familiar voice tone using an audio prefix.
Automatic Conversion of Research Papers into Podcasts
Script the abstract and discussion sections of research papers into a dialogue between two researchers, then convert it to Dia2. Generate a 2-minute audio clip for listening during commutes or workouts, allowing users to digest research papers. Incorporate non-verbal utterances (exclamations, acknowledgements) to create a natural conversational flow.
Voice Content for Patient Education
Convert explanations of genetic test results and summaries of clinical trial consent forms into patient-friendly conversational dialogue. Maintain the voice tone of the responsible medical staff using voice cloning, creating highly reliable educational materials. Rapidly prototype using a 1B model, then finalize the quality using a 2B model.
๐ Update Notes
No update notes yet.
๐งช Related Code of Life
No related Code of Life posts yet.