BgTTS-40M-Engram-Loop

Try the model in your browser · Пробвай модела на живо — Enter Bulgarian or English text, choose one of four voices or use your own recording, and download a WAV. The demo shows how numbers and abbreviations will be read.

Български — пълно описание и инструкции · English

Bulgarian and English text to speech with a reference voice. BgTTS predicts speech content from ordinary written text. A separate MioCodec model gives that content the timbre of the reference speaker and renders a 44.1 kHz mono waveform. The final text-to-code model has 40,181,218 parameters and occupies about 153 MiB in FP32 SafeTensors. The codec is a separate download. Base model · MioCodec v2

Тази версия е епоха 3, стъпка 30129. Моделът чете обикновен български или английски текст. Гласовата референция се подава само на MioCodec. Основната версия е епоха 3. Инструкции на български

Listen to the dub

The opening 29 seconds of Dark Matter, season 2, episode 5, dubbed into Bulgarian with epoch 3. Each actor's original line supplies the voice reference for that line. The clip includes the episode's music and effects and the fitted synthesized dialogue. It contains one Bulgarian audio track.

Play or download the 29-second MP4

Try it

Use Python 3.12 or 3.13 and Git. Start in a fresh virtual environment. For NVIDIA acceleration, install a matching CUDA build of PyTorch and torchaudio before installing the requirements. CPU synthesis also works. Choose a clean recording of one speaker, for example 3–8 seconds of continuous speech, and save it as reference.wav. The reference may be in a different language from the requested text. PyTorch installation

python -m pip install "huggingface_hub>=1.0"
hf download beleata74/BgTTS-40M-Engram-Loop --revision epoch-3 --local-dir bgtts
cd bgtts
python -m pip install -r requirements.txt
python synthesize.py --text "Добро утро. Вече сме в ефир." --reference reference.wav --output bulgarian.wav --seed 43
python synthesize.py --text "Good morning. We are on the air." --reference reference.wav --output english.wav --seed 43

Put reference.wav in the bgtts directory or pass its full path. The first synthesis downloads the pinned MioCodec weights. Use --device cpu or --device cuda to choose the device. To reuse one voice for several lines, run this from the downloaded directory.

import soundfile as sf
from synthesize import RATE, load_models, reference_voice, synthesize

model, codec = load_models(".", "cpu")
voice = reference_voice(codec, "reference.wav")
audio = synthesize(model, codec, "Чуваме ви добре. Продължавайте.", voice, seed=43)
sf.write("reply.wav", audio, RATE, subtype="PCM_16")

Write numbers and abbreviations as they should sound. Punctuation helps phrasing. The command splits longer input into chunks and inserts a short pause between them. Training segments were at most 12 seconds. Set a different --seed for an alternative reading. In a dubbing application, fit the generated speech to the scene after synthesis. The model predicts its own duration.

What changed during training

  1. Starting point. We initialized from the published BgTTS-38M-V2 weights at step 258,680 and removed its speaker-conditioning projection. A character-level bilingual encoder with four bidirectional Transformer blocks feeds an eight-block causal decoder through cross-attention. Both use width 384, six heads and feed-forward width 1,536. The decoder predicts one of 12,800 MioCodec codes every 40 ms or an end-of-speech symbol. Voice enters only at the codec, via a 128-dimensional vector extracted from the reference. Original checkpoint
  2. Epochs 1 and 2. After encoder block two, the model looks up trainable representations of a whole word and its local three- and five-character sequences. A gate uses the surrounding text to weigh this information at each letter. The lookup module adds 2,004,704 parameters. Its output projection started at zero. The model learned from paired text and audio with ordinary spelling. The aim was better contextual pronunciation, including Bulgarian stress. Engram research
  3. Epoch 3. We ran encoder block three twice with shared weights and added two scalar gates per text position, 770 trainable parameters in total. On conversion, the second update started at zero. Before continuing training, the converted model reproduced epoch 2's logits exactly on the checked examples and produced the same sampled codes for a fixed prompt and seed. We continued its AdamW state and learning-rate schedule. The implementation is a small adaptation of the shared-layer idea. Z.ai research

The fine-tuning split contained 1,285,440 utterances, with 648,813 Bulgarian segments (1,336.4 hours) and 636,627 English segments (679.4 hours). The English sources were LibriTTS-R and Hi-Fi TTS. Transcripts with digits were excluded and duplicate audio hashes were removed during dataset assembly. Each epoch took 10,043 optimizer steps. We used next-code and end-of-speech cross-entropy, BF16 autocast with FP32 weights, AdamW (β₁ 0.9, β₂ 0.95, weight decay 0.01), microbatches of 32 and an effective batch of 128. The learning rate warmed up for 500 steps to 0.00007 and followed a cosine schedule to 0.000007.

Results and version selection

Download revision Architecture Parameters Train loss BG dev EN dev Mean dev
epoch-1 Engram 40,180,448 5.8700 5.4794 6.4232 5.9513
epoch-2 Engram 40,180,448 5.6896 5.4277 6.3739 5.9008
epoch-3 · main Engram + shared block 40,181,218 5.6274 5.4074 6.3564 5.8819

This download is epoch 3, step 30129. Change --revision in the command to select another row. Every version includes its matching configuration, FP32 weights, inference code and evaluation summary. Full development loss gives equal weight to the two language means, evaluated on 1,324 BG and 9,913 EN segments. In an epoch-3 check on those BG segments, disabling the second update raised loss from 5.407410 to 5.407635. The epoch-to-epoch improvement also includes another full epoch of training. The listening examples are informal. Bulgarian word-stress accuracy and listener-rated naturalness have yet to be measured systematically.

Speed. On a local RTX 5090 benchmark, batch size one, five texts, three repetitions and seed 43, the measured real-time factor was 0.253 for epoch 3 and 0.251 for epoch 2. An RTF of 0.253 corresponds to approximately four seconds of generated audio per second of measured runtime. Startup and voice-reference preparation are separate costs. Hardware, text and sampling affect these figures.

Film test. Across the 43-minute episode, 623 of 631 lines were accepted for the epoch-3 dub under duration and Bulgarian ASR checks. Eight retained the original sound after up to four attempts. The earlier Higgs dub accepted 629 lines with the same translation, timing and source voice clips. Median reference length was 1.26 s. All eight fallbacks had references shorter than one second, and another 227 sub-second references produced accepted lines. Ten accepted lines required more than 1.6× speed-up to fit the scene. An accepted line may still contain a wrong vowel, stress or syllable. ASR acceptance measures pipeline coverage, and a direct listening comparison is needed to judge timbre and pronunciation.

License and credits

BgTTS model weights and the inference code in this release follow the base model's Apache License 2.0. The separate MioCodec weights have their own MIT license. The television excerpt illustrates the dubbing experiment. The model license applies to the weights and code, and no rights to the underlying television footage or soundtrack are granted here. Use speaker recordings you have permission to use. Model license · MioCodec model card

Downloads last month
-
Safetensors
Model size
40.2M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for beleata74/BgTTS-40M-Engram-Loop

Finetuned
(2)
this model

Space using beleata74/BgTTS-40M-Engram-Loop 1