Views
No views yet
1pip install -U mlx-audio
2mlx_audio.tts.generate --model Marvis-AI/marvis-tts-250m-v0.2 --stream \
3 --text "Marvis TTS is a new text-to-speech model that provides fast streaming on edge devices."1mlx_audio.tts.generate --model Marvis-AI/marvis-tts-250m-v0.2 --stream \
2 --text "Marvis TTS is a new text-to-speech model that provides fast streaming on edge devices." --ref_audio ./conversational_a.wav1from huggingface_hub import snapshot_download
2from pathlib import Path
3import soundfile as sf
4from transformers import AutoProcessor, CsmForConditionalGeneration, infer_device
5
6model_id = "Marvis-AI/marvis-tts-250m-v0.2-transformers"
7device = infer_device()
8processor = AutoProcessor.from_pretrained(model_id)
9model = CsmForConditionalGeneration.from_pretrained(model_id, device_map=device)
10prompts_path = snapshot_download(model_id, allow_patterns=["prompts/*.txt", "prompts/*.wav"])
11
12voice = "conversational_a"
13generation_text = "With its pristine jungles and small towns, this Hawaiian island retains the unmanicured charm of Old Polynesia with few modern intrusions."
14
15prompt_text = (prompts_path / Path(f"prompts/{voice}.txt")).read_text()
16prompt_audio, _ = sf.read(prompts_path / Path(f"prompts/{voice}.wav"))
17context = [
18 {"role": "0", "content": [{"type": "text", "text": prompt_text}, {"type": "audio", "path": prompt_audio}]},
19 {"role": "0", "content": [{"type": "text", "text": generation_text}]},
20]
21inputs = processor.apply_chat_template(
22 context,
23 tokenize=True,
24 return_dict=True,
25)
26inputs.pop("token_type_ids")
27
28audio = model.generate(**inputs, output_audio=True)
29sf.write("marvis-example.wav", audio[0].cpu(), samplerate=24_000, subtype="PCM_16")1@misc{marvis-tts-2025,
2 title={Marvis-TTS: Efficient Real-time Voice Cloning with Streaming Speech Synthesis},
3 author={Prince Canuma and Lucas Newman},
4 year={2025}
5}