How to use this model in python script

#1
by afeezaziz - opened

Hey, sorry for the stupid question, but how do I use this model within a python script, like the example from the original Dia repo.

from dia.model import Dia

model = Dia.from_pretrained("nari-labs/Dia-1.6B", compute_dtype="float16")

text = "[S1] Dia is an open weights text to dialogue model. [S2] You get full control over scripts and voices. [S1] Wow. Amazing. (laughs) [S2] Try it now on Git hub or Hugging Face."

output = model.generate(text, use_torch_compile=True, verbose=True)

model.save_audio("simple.mp3", output)

nari-labs/Dia-1.6B-0626 released

MLX Community org
β€’
edited Aug 13, 2025

Hey, sorry for the stupid question, but how do I use this model within a python script, like the example from the original Dia repo.

I would guess about like this:

from mlx_audio.tts.generate import generate_audio

generate_audio(
    text=(
        "[S1] Dia is an open weights text to dialogue model. "
        "[S2] You get full control over scripts and voices. "
        "[S1] Wow. Amazing. (laughs) "
        "[S2] Try it now on Git hub or Hugging Face."
    ),
    model_path="mlx-community/Dia-1.6B",  
    speed=1.0,         # range 0.5–2.0
    file_prefix="dia_output",
    audio_format="wav",  # or "mp3"
    sample_rate=24000,
    join_audio=True,
    verbose=True
)

Thank you!

afeezaziz changed discussion status to closed

Sign up or log in to comment