EveryVoice INDspeech (Indonesian)

A single-speaker Indonesian text-to-speech model trained with EveryVoice 0.3.1: a FastSpeech2 acoustic model trained from scratch for 250,000 steps on INDspeech (one female speaker, 1.89 hours of read speech), and a HiFi-GAN vocoder fine-tuned on its output for 100,000 steps. Output: 22,050 Hz mono.

Write numbers out in words. The training transcripts contain no digits, so the model has no symbol for them: write 5 persen as lima persen. The text is otherwise read as it is written (case kept, no other front end).

Files

File Contents
feature_prediction.ckpt FastSpeech2 (text -> mel spectrogram), EveryVoice checkpoint at step 250,000: weights and optimizer state
vocoder.ckpt HiFi-GAN (mel spectrogram -> waveform), EveryVoice checkpoint at step 100,000: generator, discriminators and optimizer state
config/ the EveryVoice project's configs (everyvoice-*.yaml), as trained; the data paths are those of the training cluster
code/prepare_data.py corpus -> EveryVoice training data (front end, filtering, wav + metadata.psv)
code/EveryVoice-Open-Bible-Indonesian.sh the Slurm job that trained the model (EveryVoice preprocess, both trainings, vocoder matching)

How to use

Install

pip install "everyvoice>=0.3.1,<0.5" huggingface_hub

Tested from a clean install (Linux, Python 3.11, everyvoice 0.4.1, torch 2.7.1, pyopenjtalk 0.4.1) and in the training environment (Python 3.10, everyvoice 0.3.1, torch 2.3.1), on GPU and CPU; they give the same audio (on CPU up to floating-point differences). everyvoice 0.4.1 needs torch 2.7.1 and Python 3.10-3.12; for a specific CUDA or CPU build of PyTorch, install torch 2.7.1 first.

Do not use everyvoice 0.5.0. The checkpoints were written by everyvoice 0.3.1 (FastSpeech2 model version 1.2), which puts 12 built-in symbols (padding, space, punctuation classes) at the start of the symbol table. When 0.5.0 converts a 1.2 checkpoint to its format, it rebuilds the old table without them, so every row of the embedding table is attributed to the wrong symbol: the Japanese and Korean models load without error but speak gibberish, and the Indonesian one fails to load. 0.4.1 reads the checkpoints as they are (no conversion) and gives the same audio as 0.3.1. The snippet below stops on 0.5.

Synthesize

import shutil
import tempfile
import unicodedata
from importlib.metadata import version
from pathlib import Path

import torch
from huggingface_hub import snapshot_download
from packaging.version import Version

# everyvoice 0.5 converts these checkpoints wrongly (see Install): stop rather than synthesize gibberish
assert Version(version("everyvoice")) < Version("0.5"), "this model needs everyvoice 0.3.1-0.4.1: pip install 'everyvoice<0.5'"

from everyvoice.config.type_definitions import DatasetTextRepresentation
from everyvoice.model.feature_prediction.FastSpeech2_lightning.fs2.cli.synthesize import get_global_step, synthesize_helper
from everyvoice.model.feature_prediction.FastSpeech2_lightning.fs2.model import FastSpeech2
from everyvoice.model.feature_prediction.FastSpeech2_lightning.fs2.type_definitions import SynthesizeOutputFormats
from everyvoice.model.vocoder.HiFiGAN_iSTFT_lightning.hfgl.utils import load_hifigan_from_checkpoint

def front_end(text):  # the training transcripts were used as they are: only whitespace is collapsed
    return " ".join(text.split())


repo_id = "davidguzmanr/EveryVoice-INDspeech-Indonesian"
local = Path(snapshot_download(repo_id, allow_patterns=["*.ckpt"]))
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = FastSpeech2.load_from_checkpoint(str(local / "feature_prediction.ckpt"), map_location=device).to(device).eval()
model_step = get_global_step(local / "feature_prediction.ckpt")
vocoder_ckpt = torch.load(str(local / "vocoder.ckpt"), map_location=device, weights_only=True)
vocoder, vocoder_config = load_hifigan_from_checkpoint(vocoder_ckpt, device)
vocoder_step = vocoder_ckpt["global_step"]

# Symbols seen in training: the characters of the transcripts and the punctuation `,` `.` `?` `!` `-`
symbols = model.config.text.symbols.model_dump()
TRAINED = {s for name, values in symbols.items() if name.endswith("_characters") for s in values} | set(",.?!-")


def synthesize(text, wav_path, duration_control=1.0):
    # Write `text` to `wav_path` (22,050 Hz mono). duration_control > 1 makes speech slower, < 1 faster.
    model_text = front_end(text)
    unknown = "".join(sorted({ch for ch in model_text if ch not in TRAINED and ch != " "}))
    if unknown:
        print(f"not in the training transcripts, dropped: {unknown}")
        model_text = "".join(ch for ch in model_text if ch in TRAINED or ch == " ")
    with tempfile.TemporaryDirectory() as tmp:
        synthesize_helper(
            model=model, texts=None, style_reference=None, language=None, speaker=None,
            duration_control=duration_control, global_step=model_step,
            output_type=[SynthesizeOutputFormats.wav], text_representation=DatasetTextRepresentation.characters,
            accelerator="gpu" if device.type == "cuda" else "cpu", devices=1, device=device,
            batch_size=1, num_workers=0, filelist=None,
            filelist_data=[dict(basename="utt", characters=model_text, language="und", speaker="speaker_0",
                                duration_control=duration_control, is_last_input_chunk=True)],
            output_dir=Path(tmp), teacher_forcing_directory=None, vocoder_model=vocoder,
            vocoder_config=vocoder_config, vocoder_global_step=vocoder_step,
        )
        (wav,) = Path(tmp).glob("**/*.wav")  # EveryVoice names the file after the text; move it to wav_path
        shutil.move(wav, wav_path)
    return model_text


print(synthesize("Selamat pagi, apa kabar?", "output.wav"))  # Selamat pagi, apa kabar?

The model has one speaker (speaker_0) and one language (und, EveryVoice's "undetermined"); both are fixed in filelist_data. Call synthesize once per sentence: the models are loaded once, and each call writes one wav. EveryVoice prints a progress bar and some logs on every call. Synthesis is deterministic: the same text gives the same audio.

The text front end

front_end turns the text into the symbols the model was trained on:

Input Model input
Selamat pagi, apa kabar? Selamat pagi, apa kabar?
Pemerintah akan membangun jalan tol baru di Jakarta tahun depan. Pemerintah akan membangun jalan tol baru di Jakarta tahun depan.
Harga beras naik 5 persen. Harga beras naik 5 persen. (synthesize drops 5)
  • Case is kept, as in the training transcripts (both cases are in the vocabulary).
  • Digits and symbols such as % or / are not in the vocabulary: write them out (5% -> lima persen). synthesize drops them with a warning otherwise.
  • The model's vocabulary is 51 characters: ABCDEFGHIJKLMNOPQRSTUVWYZabcdefghijklmnopqrstuvwxyz, plus the punctuation ,.?!- and the space. synthesize drops anything else, with a warning.

Training data

INDspeech_NEWS_TTS (Sakti et al., 2008, 2010), as distributed by SEACrowd: phonetically balanced Indonesian news and travel sentences read by one female speaker of standard Indonesian, 16 kHz. The training list is the corpus' own TTS setup, the train split of config indspeech_news_tts_120_MOS (the 120-minute list): 1,972 utterances (1.89 h, 0.5-10.9 s), all used, text as it is (no digits). The corpus' 40-sentence MOS test list was not used. The ZeroSpeech configs of the same corpus were avoided because their training split contains 38 of those 40 test sentences.

EveryVoice's preprocessing resampled the audio to 22,050 Hz. No sentence of the Multilingual-MOS listening test is in the training data. The audio and the training filelists are not included here.

Training procedure

  • EveryVoice 0.3.1 with the recipe of the Open Bible EveryVoice models (open-bible-models, jobs/FastSpeech/): character input, all utterances for training (train_split 1.0), validation on the first 511 training utterances. Changes: the corpus and its text front end, max_epochs 10,000 (so that the step budget, not the epoch limit, ends training) and a checkpoint every 5,000 steps.
  • Audio features: 22,050 Hz, 80 mel bands up to 8 kHz, FFT and window 1,024, hop 256; utterances of 0.4-15 s.
  • FastSpeech2 with Conformer encoder and decoder (4 layers each, dimension 256, 2 heads), duration, pitch and energy predictors (pitch and energy averaged per input symbol), alignment learned jointly (no external aligner), and a postnet; 18.2 M parameters. Trained 250,000 steps (8,333 epochs), batch 32 on each of 2 NVIDIA L40S (DDP, global batch 64), Noam schedule with learning rate 1e-3 and 1,000 warm-up steps.
  • Vocoder: HiFi-GAN V1 (512 initial channels, upsampling 8 x 8 x 2 x 2), initialized from EveryVoice's universal checkpoint (hifigan_universal_v1_everyvoice.ckpt) and fine-tuned 100,000 steps (1,666 epochs) on the mel spectrograms this FastSpeech2 predicts for the training utterances with their true durations (teacher forcing), so the vocoder learns the acoustic model's output. Batch 32 on each of 2 GPUs, AdamW with learning rate 1e-5.
  • The whole job (preprocessing, both trainings, spectrogram generation) took 13 h 34 min on 2 NVIDIA L40S.

To retrain (source: everyvoice-tts/ in Multilingual-MOS):

python code/prepare_data.py --language Indonesian  # writes data/EveryVoice/Indonesian/ (wavs/, metadata.psv)
everyvoice new-project                             # wavs/ and metadata.psv: psv, characters, no text transformation
sbatch code/EveryVoice-Open-Bible-Indonesian.sh    # preprocess, text-to-spec, vocoder matching, vocoder

Evaluation

An intelligibility check, not a listening test: the 34 Indonesian sentences of the Multilingual-MOS listening test (from Common Voice, FLEURS and INDspeech's MOS test list; none is in the training data) were synthesized with the snippet above and transcribed with Whisper (openai/whisper-large-v3-turbo, language set). Character error rate on letters: median 1.7% (mean 7.7%). Most of the larger errors are Whisper writing spelled-out numbers as digits (sembilan -> 9); without the 5 transcripts that contain digits: median 0.9% (mean 3.3%).

Limitations

  • One voice and one style: neutral read speech. No control of emotion or speaking style; duration_control sets the speed.
  • Trained on under 2 hours of speech recorded at 16 kHz: less robust than models trained on 10+ hours, and the output has no content above 8 kHz although it is written at 22,050 Hz.
  • The voice is a real person's: do not use it to impersonate her or to pass synthetic speech off as hers.

License

CC BY-NC-SA 4.0, the licence set by the INDspeech_NEWS_TTS authors: non-commercial use, with citation of their papers (below), and adaptations shared under the same licence. The corpus itself is not included here; its authors do not allow public copies of it. The scripts in code/ come from Multilingual-MOS (Apache 2.0); the Slurm job follows open-bible-models (MIT).

Citation

@inproceedings{sakti-tts-cocosda-2008,
  title     = {Development of {HMM}-based {Indonesian} Speech Synthesis},
  author    = {Sakti, Sakriani and Maia, Ranniery and Sakai, Shinsuke and Nakamura, Satoshi},
  booktitle = {Proc. Oriental COCOSDA},
  pages     = {215--220},
  year      = {2008}
}

@inproceedings{sakti-tts-malindo-2010,
  title     = {Quality and Intelligibility Assessment of {Indonesian} {HMM}-Based Speech Synthesis System},
  author    = {Sakti, Sakriani and Sakai, Shinsuke and Isotani, Ryosuke and Kawai, Hisashi and Nakamura, Satoshi},
  booktitle = {Proc. MALINDO},
  year      = {2010}
}

@inproceedings{ren2021fastspeech2,
  title     = {{FastSpeech} 2: Fast and High-Quality End-to-End Text to Speech},
  author    = {Ren, Yi and Hu, Chenxu and Tan, Xu and Qin, Tao and Zhao, Sheng and Zhao, Zhou and Liu, Tie-Yan},
  booktitle = {International Conference on Learning Representations},
  year      = {2021}
}

@inproceedings{kong2020hifigan,
  title     = {{HiFi-GAN}: Generative Adversarial Networks for Efficient and High Fidelity Speech Synthesis},
  author    = {Kong, Jungil and Kim, Jaehyeon and Bae, Jaekyoung},
  booktitle = {Advances in Neural Information Processing Systems},
  volume    = {33},
  pages     = {17022--17033},
  year      = {2020}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Papers for davidguzmanr/EveryVoice-INDspeech-Indonesian