v2.0: Duo fine-tune on Studio 92 + DailyTalk man (was TTS-English-Duo)
Browse filesFiles changed (23)
- .gitattributes+2-21
- README.md+36-385
- app.py+27-20
- config.json+242-1056
- evaluation.jsonAdded+333
- fast_decoder.safetensorsDeleted-3
- infer.pyDeleted-21
- model.safetensors+2-2
- requirements.txtAdded+8
- samples/story_8051.wav → samples/dailytalk-man.wavRenamed+2-2
- samples/fast_story_92.wavDeleted-3
- samples/numbers_92.wavDeleted-3
- samples/story_92.wavDeleted-3
- samples/story_11697.wav → samples/studio-92.wavRenamed+2-2
- samples/talk_11697_conversational.wavDeleted-3
- samples/talk_11697_reading.wavDeleted-3
- samples/talk_92_conversational.wavDeleted-3
- samples/talk_92_reading.wavDeleted-3
- tts_english/__init__.py+18-19
- tts_english/__main__.py+2-7
- vocoder/bigvgan_config.jsonAdded+46
- vocoder/vocos.safetensorsDeleted-3
- voice_encoder.safetensorsDeleted-3
32 unmodified lines333435363738394041424344454647484950515253545556363732 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textsamples/en_100_s00.wav filter=lfs diff=lfs merge=lfs -textsamples/en_100_s13.wav filter=lfs diff=lfs merge=lfs -textsamples/en_100_s17.wav filter=lfs diff=lfs merge=lfs -textsamples/en_3922_s00.wav filter=lfs diff=lfs merge=lfs -textsamples/en_3922_s13.wav filter=lfs diff=lfs merge=lfs -textsamples/en_3922_s17.wav filter=lfs diff=lfs merge=lfs -textsamples/studio11697_s00.wav filter=lfs diff=lfs merge=lfs -textsamples/studio11697_s13.wav filter=lfs diff=lfs merge=lfs -textsamples/studio11697_s17.wav filter=lfs diff=lfs merge=lfs -textsamples/studio92_s00.wav filter=lfs diff=lfs merge=lfs -textsamples/studio92_s13.wav filter=lfs diff=lfs merge=lfs -textsamples/studio92_s17.wav filter=lfs diff=lfs merge=lfs -textsamples/story_11697.wav filter=lfs diff=lfs merge=lfs -textsamples/story_8051.wav filter=lfs diff=lfs merge=lfs -textsamples/story_92.wav filter=lfs diff=lfs merge=lfs -textsamples/talk_11697_conversational.wav filter=lfs diff=lfs merge=lfs -textsamples/talk_11697_reading.wav filter=lfs diff=lfs merge=lfs -textsamples/talk_92_conversational.wav filter=lfs diff=lfs merge=lfs -textsamples/talk_92_reading.wav filter=lfs diff=lfs merge=lfs -textsamples/fast_story_92.wav filter=lfs diff=lfs merge=lfs -textsamples/numbers_92.wav filter=lfs diff=lfs merge=lfs -textsamples/dailytalk-man.wav filter=lfs diff=lfs merge=lfs -textsamples/studio-92.wav filter=lfs diff=lfs merge=lfs -text123445678910111261415161778910111213141520161718195 unmodified lines2526273233343536373839404142434445464748495051525328295530573132596061626364656667683334703536723738747539404177424379808182838444454687888990919293949596979899100101102103104474849505152535455565710710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721858592206061222223224225626322764652292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014026667684044054064074084096970411717241341441541641741841942042142273---license: cc-by-sa-4.0language:- en - enpipeline_tag: text-to-speechlibrary_name: pytorchtags:- text-to-speech- tts- flow-matching- diffusion-transformer- multi-speakerdatasets:- mythicinfinity/libritts_r- MikhailT/hifi-tts- eustlb/dailytalk- mmmhusto/sktts-en-features - mythicinfinity/libritts_r - MikhailT/hifi-tts - eustlb/dailytalktags: - audio - pytorch - bigvgan---
# mmmhusto TTS English# TTS English Duo
## Versions
5 unmodified lines| v2.0 | Fine-tune of v1.0 on two voices: Studio 92 (Cori Samuel) and DailyTalk man | `hf download mmmhusto/TTS-husto --revision v2.0` || v3.0 | Fine-tune of v2.0 that adds Slovak: 5 voices (2 English, 3 Slovak), browser ONNX. Slovak is experimental. | `hf download mmmhusto/TTS-husto --revision v3.0` |
**This page describes v1.0.**
**A 56 M-parameter English text-to-speech model that reads and talks.** Written and trained from scratch, smallenough to read in an afternoon, fast enough for a laptop GPU, and open about everything: code, data, training runs andthe experiments that failed.
- **Two speaking styles in every voice:** audiobook reading and everyday conversation, with a strength knob.- **Three featured audiobook narrators** (all female, 26 to 30 hours each) plus 589 more voices, including the male DailyTalk actor.- **Small:** 42 M acoustic model + 14 M vocoder, the vocoder fine-tuned on this model's own output. The whole model is one file of plain PyTorch (~414 lines).- **Fast mode:** a distilled decoder needs 2 passes instead of 20 and sounded the same in a blind test. With the built-in Vocos vocoder it runs 6x faster than real time on a 2017 dual-core i3 and 9 to 18x on an M1 Pro CPU on a laptop CPU and needs nothing but `pip install`.- **Reads what people write:** numbers, money, times, dates, units and abbreviations ("Dr. Smith, $45.50, 9:30 a.m., 2.5 km") are written out before the phonemes.- **Voice cloning (experimental):** a voice from 5 to 15 s of someone's speech, in a tenth of a second.- **Any length:** `tts.long(text)` and `tts.stream(text)` read a whole article sentence by sentence.- **Controllable:** pace, comma pauses, the gap between sentences, style strength, seed.- **Cheap to adapt:** the conversational style was added in 30 minutes on one RTX 3080 (12 GB).- **Try it in your browser, nothing to install:** [the demo](https://huggingface.co/spaces/mmmhusto/TTS-English-demo) runs the model on your own device (WebGPU or WebAssembly; 210 MB on the first visit, then cached).- **A local web page** to try it: `python app.py`.**This page describes v2.0.**
## Listen
The two-voice edition fine-tunes Studio 92 (Cori Samuel) and DailyTalk man. Listen to both voices or download the weights on the [English Duo model card](https://huggingface.co/mmmhusto/TTS-husto/tree/v2.0).English Duo synthesizes 24 kHz speech with two voices. Studio 92 is audiobook reader Cori Samuel. DailyTalk man is the male dialogue actor in DailyTalk. Both samples use the full acoustic decoder and the fine-tuned BigVGAN included in this release.
| | Voice 92 (female, default) | Voice 11697 (female) | Voice 8051 (female) ||---|---|---|---|| Reading a story | <audio controls preload="none" src="https://huggingface.co/mmmhusto/TTS-husto/resolve/v1.0/samples/story_92.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/mmmhusto/TTS-husto/resolve/v1.0/samples/story_11697.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/mmmhusto/TTS-husto/resolve/v1.0/samples/story_8051.wav"></audio> |
The same text in both styles ("Are you kidding me? We missed the train again? Okay, okay, I get it."):
| | Reading | Conversational ||---|---|---|| Voice 92 | <audio controls preload="none" src="https://huggingface.co/mmmhusto/TTS-husto/resolve/v1.0/samples/talk_92_reading.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/mmmhusto/TTS-husto/resolve/v1.0/samples/talk_92_conversational.wav"></audio> || Voice 11697 | <audio controls preload="none" src="https://huggingface.co/mmmhusto/TTS-husto/resolve/v1.0/samples/talk_11697_reading.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/mmmhusto/TTS-husto/resolve/v1.0/samples/talk_11697_conversational.wav"></audio> |[Try both voices in the browser demo](https://huggingface.co/spaces/mmmhusto/TTS-English-demo). Select **Male narration** to read your own text with DailyTalk man at style strength 0.75.
Numbers and fast mode (voice 92):*The rain has stopped. Shall we take the long way home?*
| | || Studio 92 · reading | DailyTalk man · conversation ||---|---|| "Dr. Smith will see you at 9:30 on March 3rd; the visit costs $45.50, and the clinic is 2.5 km away." | <audio controls preload="none" src="https://huggingface.co/mmmhusto/TTS-husto/resolve/v1.0/samples/numbers_92.wav"></audio> || The story above in fast mode (`fast=True`, 2 decoder passes instead of 20) | <audio controls preload="none" src="https://huggingface.co/mmmhusto/TTS-husto/resolve/v1.0/samples/fast_story_92.wav"></audio> || <audio controls preload="none" src="https://huggingface.co/mmmhusto/TTS-husto/resolve/v2.0/samples/studio-92.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/mmmhusto/TTS-husto/resolve/v2.0/samples/dailytalk-man.wav"></audio> || [Studio 92 WAV](samples/studio-92.wav) | [DailyTalk man WAV](samples/dailytalk-man.wav) |
All clips are exactly what the code below produces with BigVGAN (voice 11697 conversational at `style_scale=1.0`).## Generate speech locally
**Status, honestly.** On automatic measures (intelligibility, signal quality) the model scores like larger openmodels. By ear it is not there yet: the author's listening puts it somewhat below the best open English TTS, mostly innaturalness. The numbers below are a floor, not a verdict; listen to the samples and judge for yourself. What we areworking on next is at the end of this page.
## Quick startDownload the model, its Python runtime, and NVIDIA's BigVGAN implementation. The following commands run from the same working directory. The tested Python version was 3.11.
```bashpip install torch numpy soundfile huggingface_hub safetensors g2p_enpython -c "from g2p_en import G2p; G2p()" # fetches g2p_en's NLTK data once# for the best quality also the BigVGAN vocoder's code (MIT):git clone https://github.com/NVIDIA/BigVGAN && pip install librosa matplotlib # BigVGAN imports the last two```
```pythonfrom huggingface_hub import snapshot_downloadimport sys, soundfile as sf
path = snapshot_download("mmmhusto/TTS-husto", revision="v1.0")sys.path.insert(0, path)from tts_english import TTS, SAMPLE_RATE
tts = TTS.from_pretrained(path, bigvgan_dir="BigVGAN") # best quality# tts = TTS.from_pretrained(path, fast=True) # no BigVGAN clone: Vocos + 2-pass decoder, fast on a CPUwav = tts("It was not the answer she expected; still, she thanked him and left the room.")sf.write("out.wav", wav, SAMPLE_RATE)python -m pip install huggingface_hubhf download mmmhusto/TTS-husto --revision v2.0 --local-dir english-duogit clone https://github.com/NVIDIA/BigVGAN.git BigVGANgit -C BigVGAN checkout 7d2b454564a6c7d014227f635b7423881f14bdaccd english-duopython -m pip install -r requirements.txtpython -m nltk.downloader cmudict averaged_perceptron_tagger averaged_perceptron_tagger_engpython -m tts_english "Shall we take the long way home?" studio.wav --repo . --bigvgan ../BigVGAN --voice en_hifi_92_cleanpython -m tts_english "Shall we take the long way home?" conversation.wav --repo . --bigvgan ../BigVGAN --voice en_dt_0```
or `python infer.py "Text to speak." out.wav` (`--fast`, `--vocoder vocos`).
**Try it in the browser.** `python app.py --bigvgan BigVGAN` (or `python app.py --vocoder vocos --fast`) starts a local page at http://localhost:8790: type anyEnglish text, pick a voice and set the gap between sentences, the comma pause, the pace, the timbre smoothing and theseed. It uses an NVIDIA GPU or the Apple GPU (MPS) when there is one, else the CPU; on an Apple M-series GPU 8 s ofspeech take about 5 s.
**Which voice.** The three featured narrators are Cori Samuel (`en_hifi_92_clean`, default), Maria Kasper(`en_hifi_8051_other`) and Celine Major (`en_hifi_11697_other`). The model heard 26 to 30 hours from each.For a male dialogue voice, select **DailyTalk man** in the demo or pass `voice="en_dt_0"` in Python. The Python modelalso includes the male audiobook reader Mike Pelton (`en_hifi_6670_other`). [Hi-Fi TTS speaker table, p. 3](https://www.isca-archive.org/interspeech_2021/bakhturina21_interspeech.pdf#page=3)
`tts.voices` lists all 592 voices. The 585 LibriTTS-R readers have 0.1 to 0.5 hours each and sound duller and lesssteady (see "One steady voice" below). Keyword arguments override the delivery in `config.json`(`guidance`, `length_scale`, `pause_scale`, `temperature`, `dur_temperature`, `n_timesteps`); `seed=None` gives adifferent rendition every call.
**Styles.** `tts(text, style="conversational")` speaks the text as a reply in a conversation instead of reading italoud; `style_scale` (default 1.5) sets how strongly. Every voice can use either style; without `style` a voice keepsthe style it was recorded in (reading for all but `en_dt_0` and `en_dt_1`). See "Speaking styles" below.
**Pauses.** `pause_scale` (default 2.5) stretches the pauses at commas, semicolons and colons. The pause after asentence end (`. ! ?`) is not stretched: it is capped at `sentence_gap` seconds (default 0.35). The audiobooks taughtthe model about a second of silence between sentences, which the stretch used to make even longer; in a 3-sentencetest the gaps went from 0.85 s to about 0.45 s, including the decay of the last word. `sentence_gap=None` restoresthe earlier behaviour (sentence ends stretched by `pause_scale` like commas).
**Fast mode.** `TTS.from_pretrained(..., fast=True)` swaps in a distilled decoder (`fast_decoder.safetensors`) thatmakes 2 passes instead of 20 (10 steps with classifier-free guidance); the acoustic model gets about 10x faster. In ablind test of 18 pairs (same text, voice and noise) the listener preferred fast mode 5 times, the default 6 times andheard no difference 7 times. Over 90 sentences in 3 voices PESQ is 3.83 against 3.89 and word errors 1.5 % against1.6 %; the one measured loss is a slightly flatter melody in the conversational style (2.77 against 2.88 st onaverage). See "Fewer steps" below.
**Vocoders.** The default vocoder is BigVGAN, fine-tuned on this model's mels. `vocoder="vocos"` uses a Vocos vocoderbuilt into the package instead: no BigVGAN clone, and 25 to 170x faster on a CPU, at a cost in sound. See "Thevocoder" below; on a GPU keep BigVGAN.
## Hardware and speed
Measured on 5 sentences (21 s of speech), voice 92; "x real time" is seconds of speech per second of computing (above 1is faster than real time). Fast mode is the distilled 2-pass decoder (`fast=True`).
| Hardware | Default | Fast mode | Fast mode + Vocos | Memory ||---|---|---|---|---|| NVIDIA RTX 3080 (12 GB) | **9.9x** real time | **29.5x** | 57x | 0.36 GB VRAM (0.23 with Vocos), 1.7 GB RAM || Apple M1 Pro GPU (MPS) | 2.2x | 3.7x | 36x | 1.3 GB GPU memory, 0.7 GB RAM || Apple M1 Pro CPU, 8 threads | 0.5x | 0.6x | 9.4x (18x on 1 thread) | 1.3 GB RAM || Intel Core i3-7100 CPU (2 cores, 2017) | 0.3x | 0.6x | **6.0x** | 1.3 GB RAM |
On a GPU use BigVGAN (the first two columns): it sounds cleaner and is fast enough. On a CPU BigVGAN is the slow part(about 45 of 50 s on the M1 Pro), so there only Vocos runs faster than real time. Vocos is also faster with fewerthreads (`torch.set_num_threads(1)`).
**Minimum:** any machine that runs PyTorch, with 2 GB of free RAM; on a GPU 1 GB of VRAM is enough. Disk: 168 MB model,140 MB fast decoder, 56 MB BigVGAN, 54 MB Vocos and 17 MB voice encoder, plus PyTorch itself.
## One steady voice
The first samples of this model used LibriTTS-R voices and sounded dull and unsteady. Measuring what a listenerhears, over 30 sentences per voice, showed why, and none of the fixes needed training:
| | Highs above 6 kHz | Colour drift between sentences | Pitch drift | Start of the clip ||---|---|---|---|---|| LibriTTS-R voices (0.5 h each) | −22 dB | ±140 Hz | ±8 to 20 Hz | 80 ms || Studio voice 92, raw | −16 dB | ±183 Hz | ±9 Hz | 80 ms || **Studio voice 92, default pipeline** | −16 dB | **±113 Hz** | ±9 Hz | 150 ms of silence |
- **The voice.** LibriTTS-R itself has about 10 dB less energy above 10 kHz than the HiFi-TTS studio readers, even as real recordings through the vocoder, and its pauses are about 25 dB noisier.- **The colour.** The flow model draws a slightly different "recording" of the voice for every sentence. `match_timbre` (in `tts_english/post.py`) pulls each sentence's long-term spectrum towards the voice's average profile, stored in `config.json` for the three studio voices. On held-out sentences the drift fell from ±183 to ±101 Hz with PESQ unchanged (3.95 to 3.98). Real recordings of the same reader drift too (±178 Hz within one book), because a sentence full of "s" is simply brighter: part of this "drift" is the text, not the model.- **The clip.** `finish` cuts the speech to its edges, fades it, adds clean silence and brings every sentence to one loudness. `tts(text, raw=True)` returns the untouched vocoder output.- **What did not help:** lower temperature and stronger guidance left the drift unchanged; a fixed noise seed helped a little (it is the default: `seed=0`).
## Speaking styles
The audiobook voices only ever heard reading, so the model could only read. A style vector, added to the voice vectorlike a second voice, now carries how a sentence is said; the reading vector is fixed at zero, so reading is exactly themodel as it was. The conversational vector was learned from [DailyTalk](https://github.com/keonlee9420/DailyTalk)(2 actors, 21.5 h of acted everyday dialogue, 2 541 conversations) alongside the three studio voices, on one RTX 3080in 0.5 h.
Measured over 60 everyday replies per voice, with the package's default pipeline (melody = spread of the pitch,range = 5th to 95th percentile, both in semitones; pitch = median, pYIN):
| | Reading | Conversational ×1.0 | Conversational ×1.5 ||---|---|---|---|| **Voice 92** (female): melody / range | 2.60 / 7.8 st | 3.26 / 9.8 st | 3.33 / 10.3 st || pitch, PESQ | 215 Hz, 3.81 | 230 Hz, 3.86 | 223 Hz, 3.78 || **Voice 11697** (female): melody / range | 2.95 / 9.4 st | 3.77 / 11.5 st | 4.13 / 12.5 st || pitch, PESQ | 173 Hz, 3.91 | 170 Hz, 3.77 | 156 Hz, 3.79 || **Voice 8051** (female): melody / range | 2.12 / 6.5 st | 2.29 / 7.3 st | 2.38 / 7.8 st || pitch, PESQ | 234 Hz, 4.02 | 237 Hz, 4.02 | 235 Hz, 3.99 |
Word errors (Whisper small.en) stay between 0.6 and 1.8 % everywhere. Real DailyTalk recordings have a melody of 3.4to 4.2 st and a range of 11 to 13 st. Voice 8051 barely changes: the style works much better on some voices than onothers. Reading quality is unchanged on the 30-sentence bench (PESQ 3.81 before, 3.82 after; word errors 1.8 % both),with a slightly flatter melody (2.75 → 2.56 st).
**What did not work.** The first try kept the new voices' vectors almost fixed (a tenth of the learning rate). The stylethen also learned who was speaking. Voice 11697 fell from 170 to 126 Hz, the pitch of the DailyTalk man, andPESQ dropped to 3.60. Letting the voice vectors learn at full speed kept each voice itself. The style came out weaker,and at strength 1.0 voice 11697 stayed within 3 Hz of its reading pitch. At 1.5 the melody grows a little more andvoice 11697 speaks 1.5 semitones lower. At 2.0 it drops 3 semitones. Without post-processing the style also brightens the voices (15 to30 % higher spectral centroid), the sound of the DailyTalk studio; with `match_timbre` (on by default) the change staysunder 8 %.Add `--device cuda` to synthesize on an NVIDIA GPU. For a local browser demo run `python app.py --bigvgan ../BigVGAN --open-browser`.
## The vocoder## Training and evaluation
BigVGAN learned to turn mels of real recordings into sound; the mels this model draws are slightly different. Werendered 12.3 h of the training audio through the model itself (each clip's own text, voice and alignment, the noisepartly kept from the real mel) and fine-tuned the 14 M BigVGAN base on those mels against the real audio, with 30 %real mels mixed in, for 22 500 steps (2.2 h on one RTX 3080).The acoustic model has 41.8 million parameters. It started from TTS-husto v1.0 with the two original speaker embeddings and received 600 further updates on an RTX 3080. The training subset contained 1,024 recordings per voice. We compared this model with the starting checkpoint, a 48.4-million-parameter decoder variant, and a run with twice as many recordings. The three training runs each received 600 updates. We selected checkpoints using 24 validation utterances per voice and synthesized the same eight held-out test utterances per voice using the same vocoder.
| Over 90 sentences in 3 voices | Published BigVGAN | **Fine-tuned BigVGAN (default)** | Fine-tuned Vocos || Voice | Estimated PESQ, base → Duo | Speaker similarity, base → Duo | Whisper word errors, base → Duo ||---|---|---|---|| PESQ (SQUIM) | 3.89 | **3.96** | 3.19 (BigVGAN 3.95 on the same clips) || Word errors (Whisper small.en) | same | same | same || Blind test, 18 pairs: preferred : other : no difference | | 10 : 0 : 8 against the published one | 0 : 9 : 9 against fine-tuned BigVGAN || CPU time for 22 s of speech (M1 Pro) | 33 to 46 s | 33 to 46 s | 0.3 to 1.3 s |
**Vocos** (Siuzdak 2023) predicts a short-time spectrum per frame and makes the sound with one inverse FFT instead ofupsampling sample by sample. We started from `charactr/vocos-mel-24khz` (13.5 M, MIT) and fine-tuned it on the samepairs in our mel format (30 000 steps, 3.3 h on the RTX 3080). It keeps every word, the melody and the colour of thevoice, but it sounds less clean (PESQ 0.6 to 1.0 lower in every voice and style, and the listener never preferred it).It is there for CPUs, where BigVGAN cannot keep up with real time; on a GPU use BigVGAN. Its code is in`tts_english/vocos.py` (no `vocos` package needed).
## Fewer steps
The default decoder makes 20 passes per sentence: 10 flow steps, each twice for classifier-free guidance. Reflowdistillation (Liu et al., 2022) teaches a copy of the decoder the straight path from noise to the teacher's result:the teacher (this model, default settings) rendered 27 000 sentences (32.4 h of mel) from fixed noise, and the studentdecoder learned to reach the same mel from the same noise in a few steps without guidance (20 000 steps, 2.25 h on oneRTX 3080; the text encoder and durations are untouched).
| Over 90 sentences in 3 voices | Passes | PESQ | Word errors | Melody ||---|---|---|---|---|| Default | 20 | 3.89 | 1.6 % | 2.88 st || Default settings with 4 steps, no guidance | 4 | 3.89 | 1.4 % | 2.86 st || **Fast mode (distilled, 2 steps)** | **2** | 3.83 | 1.5 % | 2.77 st || Distilled, 1 step | 1 | 3.74 | 1.5 % | 2.70 st |
In a blind test of 18 pairs fast mode won 5 times, the default 6 times, and 7 times there was no difference.
## Voice cloning (experimental)
```pythonvoice = tts.clone_voice(wav, sample_rate) # instantvoice = tts.clone_voice(wav, sample_rate, text="what it says") # closer; 40 to 60 s on a laptop CPUtts("Any text.", voice=voice, style="conversational")```
A 4.3 M voice encoder (`voice_encoder.safetensors`) turns the mel of a recording into a voice vector in the place ofthe model's voice table; the acoustic model is unchanged. It was trained through the frozen model: the vector madefrom one clip of a speaker must let the model reproduce another clip of that speaker (LibriTTS-R, about 460 speakers,0.2 h on one RTX 3080). With `text`, the vector is then refined against the recording itself for 200 steps.
Speaker similarity (SpeechBrain ECAPA, cosine to the speaker's real clips; 20 speakers the model never heard and 20 itdid, 3 sentences each):
| | Unheard speakers | Heard speakers ||---|---|---|| Another real clip of the same person (ceiling) | 0.68 | 0.65 || Real clips of other people (chance) | 0.18 | 0.18 || The model's average voice | 0.15 | 0.15 || **Cloned, instant** | **0.34** | 0.34 || **Cloned and refined with the transcript** | **0.43** | 0.43 || The speaker's own row of the voice table | – | 0.37 |
So: a voice in the direction of the speaker, not a copy. It varies a lot between people (0.05 to 0.6) and works beston clean read speech. The ceiling today is the frozen acoustic model, whose voices were learned from 6 to 30 minuteseach. **Only clone a voice you have the right to use, and never to deceive.** The output is not watermarked.
## Text normalization
g2p_en reads digits on its own, and badly: "45" becomes the single unknown word "forty-five" and comes out as"fortivwid", "1,234" as "twelve thirty-four". `tts_english/normalize.py` writes out every number before the phonemes,with plain rules: money ("$45.50" → "forty-five dollars and fifty cents", "$1.5 million"), times ("9:30 p.m."),dates ("March 3rd", "12/03/1985"), years and decades ("1968", "the '90s"), ordinals, decimals, ranges, percent andunits ("2.5 km", "37°C"), abbreviations ("Dr.", "St.", "Apt."), Roman numerals after names and keywords ("HenryVIII", "Chapter IV") and acronyms ("FBI" spelled, "NASA" said). Over 60 number-heavy sentences Whisper's word errorsfell from 8.6 % to 5.9 %; most of the rest are the scorer writing "Dr" or "12.30".
## Architecture
All of it is in `tts_english/model.py`, ~414 lines of plain PyTorch, no vendored code.
- **Text encoder.** Six pre-norm transformer layers (256 wide) with rotary positions over ARPAbet phonemes from g2p_en. It also predicts a coarse mel per phoneme, which drives the alignment.- **Alignment.** Monotonic alignment search during training, so no external aligner is needed.- **Durations (v2.1).** A small flow-matching head samples the length of every phoneme and pause. It replaces the log-domain regression, which predicts the geometric mean: on held-out clips that made speech 14 % shorter than the data and sentence-final pauses 36 % shorter. The regression head stays as a deterministic fallback (`dur_temperature=None`).- **Decoder.** A diffusion transformer: 10 layers, 512 wide, adaptive layer norm on time and speaker. It is trained with conditional flow matching and reads the full encoder states, not the blurry per-phoneme mel.- **Decoder input (v2.1).** Every frame also gets its position inside its phoneme and the phoneme's length.- **Guidance.** The text is dropped for 10 % of the training clips, so the sampler can use classifier-free guidance (1.5 by default). This makes speech clearer and pronunciation more exact.- **Vocoder.** BigVGAN base, 14 M, the same 100-band 24 kHz mel format as the 112 M BigVGAN-v2 we computed the features with, fine-tuned on this model's mels; or Vocos for CPUs (see "The vocoder").- **Fast decoder.** A reflow-distilled copy of the decoder for 2 steps without guidance (see "Fewer steps").- **Weights.** The exported weights are an exponential moving average of the training weights.
## Data
- **Sources:** - [LibriTTS-R](https://huggingface.co/datasets/mythicinfinity/libritts_r): audiobook speech, restored, 24 kHz. - [HiFi-TTS](https://huggingface.co/datasets/MikhailT/hifi-tts): studio audiobooks from 10 readers, resampled to 24 kHz. - Both are CC BY 4.0. - [DailyTalk](https://github.com/keonlee9420/DailyTalk) (copy on the Hub: `eustlb/dailytalk`): acted everyday dialogue, 2 speakers, 21.5 h, 24 kHz, CC BY-SA 4.0. Used only for the conversational style (v2.2); its two speakers are the voices `en_dt_0` (male) and `en_dt_1` (female).- **Features:** mels, phonemes and a quality score for every 12th clip. They are public as [mmmhusto/sktts-en-features](https://huggingface.co/datasets/mmmhusto/sktts-en-features): 455 183 clips, 525 hours.- **Training subset:** the best-sounding 60 % of the speakers by the SQUIM SI-SDR estimate, which leaves 590 voices and 219 832 clips.- **Loudness:** every clip is levelled to the same loudness before the mel.- **No other data:** the model saw no other data, and no data in any other language.
## Training
| Run | Steps | Start | What changed | Hardware, time ||---|---|---|---|---|| v2-en | 25 000 | from scratch | the v2 architecture | 1x AMD MI300X || v2-en-long | +50 000 | v2-en | cosine schedule, EMA 0.9999, 160 k frames per batch | MI300X, 6.3 h || v2.1 | +20 000 | v2-en-long, step 50 000 | phone position, sampled durations, 20 % uniform flow times | MI300X, 2.7 h || **v2.2 (this model)** | +6 000 | v2.1 | speaking styles: studio voices 92, 8051, 11697 + DailyTalk (twice), voice vectors at full learning rate, lr 1e-4 | 1x RTX 3080 12 GB, 0.5 h || v2.3: vocoder | 22 500 | BigVGAN base | fine-tuned on the model's mels (12.3 h) | RTX 3080, 2.2 h || v2.3: Vocos | 30 000 | charactr/vocos-mel-24khz | the same pairs, our mel format | RTX 3080, 3.3 h || v2.3: fast decoder | 20 000 | v2.2 decoder | reflow on 32.4 h of the model's own output | RTX 3080, 2.25 h || v2.3: voice encoder | 3 000 | from zero, model frozen | LibriTTS-R, 50 k clips, 460 speakers (40 held out) | RTX 3080, 0.2 h |
Common settings: Adam, bf16, length-bucketed batches with fixed shapes (MIOpen re-plans every new shape),learning-rate warm-up, and gradient clipping at 5. The last v2-en-long run was stopped at 50 000 of 55 000 steps,because the validation loss had stopped moving (1.5717 at 40 k, 1.5685 at 50 k). The new v2.1 parts start from zero,so the model loads the 50 k weights and sounds exactly the same at step 0 (checked: identical output).
## Evaluation
Each figure is over the same 30 English sentences in 3 voices (90 clips), with the default delivery of each system:
- **Real word errors:** Whisper small.en reads the audio back, and we leave out what the scorer gets wrong for every system ("seashells" for "sea shells", "14" for "14th").- **PESQ, SI-SDR:** no-reference estimates from torchaudio SQUIM (higher is better).- **Pace, pauses, pitch spread:** pace is with leading and trailing silence trimmed; pauses are the share of the speech under the silence threshold; pitch spread is the standard deviation of the pitch in semitones.
| System | Real word errors | PESQ | SI-SDR | s / word | Pauses | Pitch spread ||---|---|---|---|---|---|---|| **v2.1, studio voice 92, default pipeline** (30 clips) | 2 / 420 | **3.90** | **27.2** | 0.360 | 16.5 % | 2.54 st || v2.1, three studio voices, no post-processing | 4 / 1 260 | 3.85 | 24.8 | 0.347 | 12.2 % | 2.74 st || v2.1, LibriTTS-R voices (pace +4 %, pauses x2.5) | **2 / 1 260** | 3.81 | 25.9 | 0.336 | 7.7 % | 2.63 st || v2.1, untouched durations | 5 / 1 260 | 3.82 | 25.6 | 0.306 | 5.5 % | 2.66 st || v2, 50 k steps, hand-set pace | 5 / 1 260 | 3.79 | 25.8 | 0.328 | 8.4 % | 2.89 st || v2, 25 k steps, 112 M BigVGAN-v2 | – | 2.41 | 14.2 | – | – | – |
The figures above were measured before the `sentence_gap` cap (sentence ends were stretched like commas then), sothe pace and pause share of the current default are a little faster and lower. The default studio voice reads slowlyon its own; `pause_scale=1.4` shortens the pauses (13 % pause share) and `length_scale=0.95` speeds it up.
## What we learned on the way
- **The big vocoder was the noise.** On real mels the 112 M BigVGAN-v2 is the more faithful one (PESQ 4.08 against 3.80). On the mels the model generates it reproduces their fine jitter as hiss. The 14 M BigVGAN base, with no retraining, raised PESQ from 2.41 to 3.76 and is 8x smaller.- **Use the averaged weights.** Benchmarks and demos must load the EMA weights, not the raw ones. The raw weights were measurably noisier.- **Regressed durations run short.** Predicting log-durations biases speech fast and pauses short (see Architecture); sampled durations fix the bias at its source.- **Not every measured flaw needed fixing.** The decoder is barely trained at flow time 0, where sampling starts (loss 0.172 against 0.129 at t = 0.01). Starting the solver at 0.01 changed nothing measurable, so the fix stays in training only.- **Per-band normalization is not free.** Rewriting the 50 k weights for per-band mel normalization (exact for the prior and the output layer) still dropped PESQ from 3.79 to 2.95 before any fine-tuning. It needs its own run, and this model does not use it.- **Automatic scores saturate.** Most remaining "word errors" were the scorer's, and PESQ cannot hear what a listener hears, as the status note above says.
## What is next
- **Emotions**, as more style vectors next to "conversational".- **More conversational data** from many speakers, so the style is less one pair of actors.- **A CPU vocoder that sounds as clean as BigVGAN** (a larger or longer-trained Vocos).- **`pip install`** (the package is built, not yet published) and a smaller model for the browser demo.- **Closer voice cloning**: training the acoustic model together with the voice encoder.- **Other languages**, starting with Slovak.
## Limitations| Studio 92 | 3.852 → 3.928 | 0.724 → 0.730 | 0/78 → 0/78 || DailyTalk man | 3.868 → 3.950 | 0.608 → 0.622 | 7/85 → 7/85 |
- English only. Two styles, reading and conversation; no emotions yet. The conversational style comes from two actors, so it is one particular way of talking, not conversation in general.- g2p_en handles common words well; rare names and words it does not know can come out wrong. The number rules are American English and read a bare four-digit number from 1100 to 2099 as a year ("1500 people" is "fifteen hundred").- The voices belong to real LibriTTS-R and HiFi-TTS readers. Do not use them to impersonate anyone or to deceive.- Speech is not watermarked.PESQ is estimated by SQUIM. Speaker similarity is the ECAPA cosine similarity to the centroid of seven other recordings of the same speaker. The short pilot measures signal quality and voice similarity. Listener preferences for naturalness are still open. [Results for all variants](evaluation.json)
## Licenses and attribution## Credits
- **This model** (weights and code in this repo): CC BY-SA 4.0, because v2.2 learned from DailyTalk, which is CC BY-SA 4.0. Version v2.1 (in this repo's history, without styles) was trained only on CC BY data and stays CC BY 4.0.- **Training data:** LibriTTS-R (Koizumi et al., 2023; derived from LibriTTS and LibriSpeech, CC BY 4.0), HiFi-TTS (Bakhturina et al., 2021, CC BY 4.0) and DailyTalk (Lee et al., "DailyTalk: Spoken Dialogue Dataset for Conversational Text-to-Speech", ICASSP 2023, CC BY-SA 4.0).- **Vocoders:** NVIDIA BigVGAN (Lee et al., 2023), MIT: the code comes from its repository, and `vocoder/bigvgan_finetuned.pt` is `nvidia/bigvgan_base_24khz_100band` fine-tuned here. Vocos (Siuzdak, "Vocos: Closing the gap between time-domain and Fourier-based neural vocoders", 2023), MIT: `vocoder/vocos.safetensors` is `charactr/vocos-mel-24khz` fine-tuned here; `tts_english/vocos.py` re-implements its forward pass.- **G2P:** g2p_en (Kyubyong Park), Apache-2.0, with the CMU Pronouncing Dictionary.The weights and synthesis code derive from mmmhusto/TTS-husto and are released under CC BY-SA 4.0. The source corpora are LibriTTS-R (Koizumi et al.), Hi-Fi TTS (Bakhturina et al.) and DailyTalk (Lee et al.). The included vocoder weights are fine-tuned from NVIDIA BigVGAN base 24 kHz, published under MIT. English pronunciation uses g2p_en and the CMU Pronouncing Dictionary. [Base model and attributions](https://huggingface.co/mmmhusto/TTS-husto/tree/v1.0) · [BigVGAN base](https://huggingface.co/nvidia/bigvgan_base_24khz_100band) · [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)123456123456789101137 unmodified lines49505156525354551 unmodified line575859606162636465666768697018 unmodified lines89909188899293949596976 unmodified lines1041051061021031041051061071071081091101111121131141121151161171181 unmodified line12012112212012312412512612712812912713013112913213313413536 unmodified lines172173174172175176177178179180181182"""Local page to try the model: type any English text, pick a voice, tune pace and pauses, listen.
python app.py --bigvgan BigVGAN | --vocoder vocos [--fast] [--repo mmmhusto/TTS-husto] [--port 8790] [--device auto|mps|cuda|cpu]
Open http://localhost:8790. Only the Python standard library is needed on top of the model's own requirements.""""""Run the local two-voice demo with python app.py --bigvgan BigVGAN."""
from __future__ import annotations
import argparseimport ioimport jsonfrom pathlib import Pathimport threadingimport timefrom http.server import BaseHTTPRequestHandler, ThreadingHTTPServer37 unmodified lines<label>Jednotná farba hlasu <b><span id=uni_v></span></b><input id=uni type=range min=0 max=1 step=0.1 value=0.7></label><label>Variant (seed) <b><span id=seed_v></span></b><input id=seed type=range min=0 max=20 step=1 value=0></label></div><div class=row><button id=go>Vygenerovať</button><button class="ghost" id=reset>Predvolené</button><span id=status></span></div><div class=row><button id=go>Vygenerovať</button><button class="ghost" id=narration>Mužský prednes</button><button class="ghost" id=reset>Predvolené</button><span id=status></span></div></div><div id=out></div></main>1 unmodified lineconst $=id=>document.getElementById(id);const sliders=["gap","comma","pace","uni","seed"].concat($("sscale")?["sscale"]:[]);const defaults={};sliders.forEach(s=>{defaults[s]=$(s).value;const f=()=>$(s+"_v").textContent=$(s).value;$(s).oninput=f;f()});const narration=$("narration");if(narration){ narration.hidden=!$("style") || !Array.from($("voice").options).some(o=>o.value==="en_dt_0"); narration.onclick=()=>{ $("voice").value="en_dt_0"; $("style").value="conversational"; $("sscale").value="0.75"; $("sscale").oninput(); };}$("reset").onclick=()=>sliders.forEach(s=>{$(s).value=defaults[s];$(s).oninput()});async function go(){ const text=$("text").value.trim();if(!text)return;18 unmodified lines</script>"""
VOICE_NAMES = {"en_hifi_92_clean": "Studio 92 (žena, odporúčaný)", "en_hifi_8051_other": "Studio 8051 (žena)", "en_hifi_11697_other": "Studio 11697 (muž)"}VOICE_NAMES = {"en_hifi_92_clean": "Studio 92 · Cori Samuel", "en_hifi_8051_other": "Studio 8051 (žena)", "en_hifi_11697_other": "Studio 11697 (žena)", "en_dt_0": "DailyTalk man · rozhovor", "en_hifi_6670_other": "Studio 6670 (muž, čítanie)"}
def pick_device(want: str) -> str:6 unmodified lines
def main() -> int: ap = argparse.ArgumentParser(description=__doc__.split("\n\n")[0]) ap.add_argument("--bigvgan", default="BigVGAN", help="clone of github.com/NVIDIA/BigVGAN") ap.add_argument("--fast", action="store_true", help="distilled 2-step decoder, ~10x faster acoustic model") ap.add_argument("--vocoder", default="bigvgan", choices=["bigvgan", "vocos"], help="vocos: fast on a CPU and needs no BigVGAN clone") ap.add_argument("--repo", default="mmmhusto/TTS-husto", help="Hub repo or local folder with the weights") ap.add_argument("--port", type=int, default=8790) ap.add_argument("--bigvgan", default=None, help="clone of github.com/NVIDIA/BigVGAN") ap.add_argument("--repo", default=str(Path(__file__).resolve().parent), help="Folder with the two-voice model") ap.add_argument("--port", type=int, default=8794) ap.add_argument("--device", default="auto", help="auto picks cuda, then mps (Apple GPU), then cpu") ap.add_argument("--open-browser", action="store_true", help="Open the local demo when it is ready") a = ap.parse_args()
device = pick_device(a.device) tts = TTS.from_pretrained(a.repo, a.bigvgan, device=device, vocoder=a.vocoder, fast=a.fast) tts = TTS.from_pretrained(a.repo, a.bigvgan, device=device, vocoder="bigvgan") try: # MPS lacks a few ops on some torch versions: fall back to the CPU rather than fail on the first request tts("Test.") except Exception as e: # noqa: BLE0011 unmodified line raise print(f"[app] {device} failed ({e.__class__.__name__}: {e}); using cpu", flush=True) device = "cpu" tts = TTS.from_pretrained(a.repo, a.bigvgan, device=device, vocoder=a.vocoder, fast=a.fast) tts = TTS.from_pretrained(a.repo, a.bigvgan, device=device, vocoder="bigvgan") lock = threading.Lock() # one synthesis at a time
shown = list(VOICE_NAMES) + [v for v in tts.config.get("recommended_voices", []) if v not in VOICE_NAMES] options = "".join(f'<option value="{v}">{VOICE_NAMES.get(v, v)}</option>' for v in shown if v in tts.voices) names = {"reading": "čítanie", "conversational": "rozhovor"} style = "" if not tts.styles else ( "<label>Štýl<select id=style>" + "".join(f'<option value="{s}">{names.get(s, s)}</option>' for s in tts.styles) '<label>Štýl<select id=style><option value="">Podľa hlasu</option>' + "".join(f'<option value="{s}">{names.get(s, s)}</option>' for s in tts.styles) + "</select></label>\n<label>Sila štýlu <b>×<span id=sscale_v></span></b>" f"<input id=sscale type=range min=0 max=2 step=0.1 value={tts.config['delivery'].get('style_scale', 1)}></label>") f"<input id=sscale type=range min=0 max=2 step=0.05 value={tts.config['delivery'].get('style_scale', 1)}></label>") page = PAGE.replace("__STYLE__", style).replace("__VOICES__", options).replace("__DEVICE__", {"mps": "grafika Apple", "cuda": "NVIDIA GPU", "cpu": "procesor"}[device]).encode()
36 unmodified lines pass
print(f"[app] {device} http://localhost:{a.port}", flush=True) ThreadingHTTPServer(("127.0.0.1", a.port), Handler).serve_forever() with ThreadingHTTPServer(("127.0.0.1", a.port), Handler) as server: if a.open_browser: import webbrowser webbrowser.open(f"http://127.0.0.1:{a.port}") server.serve_forever() return 0
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182223456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924101102103104926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461051061071048104910810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723810511052105310541055105610571058105910601061239240241242243244245246247{ "model": { "n_feats": 100, "spk_dim": 256, "enc_dim": 256, "enc_layers": 6, "enc_heads": 4, "dec_dim": 512, "dec_layers": 10, "dec_heads": 8, "dropout": 0.1, "dec_dropout": 0.0, "p_uncond": 0.1, "phone_pos": true, "dur_flow": true, "dur_dim": 192, "dur_layers": 3, "t_uniform": 0.2, "n_styles": 2 }, "symbols": [ "<pad>", "<bos>", "<eos>", "<unk>", "▁", ",", ".", "!", "?", "AA0", "AA1", "AA2", "AE0", "AE1", "AE2", "AH0", "AH1", "AH2", "AO0", "AO1", "AO2", "AW0", "AW1", "AW2", "AY0", "AY1", "AY2", "EH0", "EH1", "EH2", "ER0", "ER1", "ER2", "EY0", "EY1", "EY2", "IH0", "IH1", "IH2", "IY0", "IY1", "IY2", "OW0", "OW1", "OW2", "OY0", "OY1", "OY2", "UH0", "UH1", "UH2", "UW0", "UW1", "UW2", "B", "CH", "D", "DH", "F", "G", "HH", "JH", "K", "L", "M", "N", "NG", "P", "R", "S", "SH", "T", "TH", "V", "W", "Y", "Z", "ZH" ], "voices": [ "en_100", "en_1012", "en_1025", "en_1027", "en_1034", "en_1050", "en_1052", "en_1061", "en_1079", "en_1098", "en_1100", "en_1112", "en_1116", "en_1121", "en_114", "en_115", "en_118", "en_1183", "en_1195", "en_1212", "en_1222", "en_1226", "en_1241", "en_1246", "en_125", "en_126", "en_1264", "en_1265", "en_1283", "en_1289", "en_1313", "en_1322", "en_1335", "en_1355", "en_1363", "en_1379", "en_1382", "en_1387", "en_1392", "en_14", "en_1401", "en_1413", "en_1422", "en_1425", "en_1446", "en_1447", "en_1460", "en_1463", "en_1482", "en_1498", "en_1502", "en_1509", "en_1513", "en_1553", "en_1578", "en_1603", "en_1641", "en_1649", "en_166", "en_1678", "en_1731", "en_1743", "en_1752", "en_176", "en_1769", "en_1776", "en_1779", "en_1789", "en_1827", "en_1841", "en_1849", "en_1859", "en_1867", "en_1874", "en_188", "en_1885", "en_1903", "en_1913", "en_192", "en_1923", "en_1926", "en_1963", "en_1970", "en_1987", "en_2004", "en_201", "en_2010", "en_2012", "en_203", "en_2045", "en_205", "en_2060", "en_2061", "en_207", "en_2092", "en_2093", "en_2113", "en_2136", "en_2156", "en_216", "en_2182", "en_2194", "en_2196", "en_22", "en_2204", "en_2230", "en_2240", "en_226", "en_2269", "en_227", "en_2285", "en_229", "en_2294", "en_2299", "en_231", "en_2319", "en_233", "en_2368", "en_2393", "en_240", "en_2401", "en_2404", "en_2416", "en_242", "en_2427", "en_246", "en_2481", "en_249", "en_2512", "en_2517", "en_2531", "en_2573", "en_2582", "en_2592", "en_2598", "en_2618", "en_2628", "en_2652", "en_2654", "en_2673", "en_2691", "en_2709", "en_272", "en_2741", "en_2751", "en_2758", "en_2769", "en_2774", "en_278", "en_2790", "en_2823", "en_2827", "en_2836", "en_2843", "en_288", "en_2882", "en_2893", "en_2910", "en_2929", "en_2952", "en_296", "en_298", "en_2989", "en_2992", "en_2999", "en_30", "en_3003", "en_3009", "en_302", "en_303", "en_3032", "en_3046", "en_3072", "en_3119", "en_3157", "en_3168", "en_318", "en_32", "en_3221", "en_3224", "en_3228", "en_3242", "en_3274", "en_3294", "en_3330", "en_335", "en_3357", "en_3361", "en_337", "en_3380", "en_3389", "en_3448", "en_345", "en_3483", "en_3490", "en_3513", "en_3521", "en_3526", "en_353", "en_3540", "en_3549", "en_3584", "en_359", "en_3607", "en_3630", "en_3638", "en_3645", "en_3654", "en_3728", "en_3733", "en_374", "en_3781", "en_3790", "en_3816", "en_3864", "en_3866", "en_3876", "en_3879", "en_3889", "en_3922", "en_3972", "en_3977", "en_398", "en_3982", "en_3983", "en_3994", "en_4018", "en_4044", "en_405", "en_4054", "en_4057", "en_4064", "en_4088", "en_4108", "en_4110", "en_4111", "en_4116", "en_4137", "en_4138", "en_4145", "en_4148", "en_4160", "en_4195", "en_4214", "en_4222", "en_4226", "en_4243", "en_4257", "en_4267", "en_4278", "en_4289", "en_4290", "en_4297", "en_4331", "en_4340", "en_4362", "en_4381", "en_439", "en_4406", "en_4425", "en_4427", "en_4434", "en_4441", "en_446", "en_4490", "en_451", "en_4535", "en_459", "en_4595", "en_460", "en_4640", "en_4680", "en_4719", "en_4731", "en_475", "en_4788", "en_479", "en_4813", "en_4830", "en_4837", "en_4839", "en_4848", "en_4856", "en_4859", "en_4860", "en_4898", "en_4899", "en_4957", "en_4967", "en_5007", "en_5012", "en_5039", "en_5054", "en_5093", "en_5104", "en_511", "en_5123", "en_5133", "en_5154", "en_5163", "en_5190", "en_5239", "en_5242", "en_5246", "en_5261", "en_5266", "en_5290", "en_5304", "en_5322", "en_5333", "en_5337", "en_534", "en_5393", "en_5400", "en_5448", "en_5456", "en_5489", "en_5514", "en_5519", "en_5538", "en_5561", "en_5570", "en_5583", "en_5604", "en_5606", "en_5652", "en_5655", "en_5656", "en_5660", "en_5672", "en_5684", "en_5712", "en_5717", "en_5724", "en_5731", "en_5740", "en_5776", "en_5778", "en_5789", "en_580", "en_5867", "en_5876", "en_589", "en_5909", "en_5914", "en_5935", "en_594", "en_5968", "en_5975", "en_598", "en_6000", "en_6006", "en_6014", "en_6019", "en_6054", "en_606", "en_6060", "en_6064", "en_6078", "en_6080", "en_6081", "en_6082", "en_6098", "en_6099", "en_6104", "en_6115", "en_612", "en_6120", "en_6139", "en_6147", "en_6167", "en_6188", "en_6206", "en_6215", "en_6235", "en_6258", "en_6272", "en_6286", "en_6294", "en_6300", "en_6308", "en_6341", "en_6352", "en_637", "en_6371", "en_6385", "en_6388", "en_639", "en_6395", "en_64", "en_6406", "en_6426", "en_6446", "en_6454", "en_6458", "en_6476", "en_6492", "en_6497", "en_6499", "en_6510", "en_6519", "en_6529", "en_6538", "en_6544", "en_6550", "en_6553", "en_6637", "en_664", "en_6643", "en_6683", "en_6686", "en_6696", "en_6701", "en_6727", "en_6763", "en_6788", "en_6818", "en_6828", "en_6848", "en_6877", "en_6895", "en_6956", "en_696", "en_6965", "en_70", "en_7000", "en_7030", "en_7051", "en_7059", "en_7061", "en_707", "en_7085", "en_7095", "en_7117", "en_7128", "en_7140", "en_7145", "en_716", "en_7178", "en_718", "en_7190", "en_7241", "en_7245", "en_7247", "en_7264", "en_7276", "en_7278", "en_7285", "en_7294", "en_7297", "en_731", "en_7312", "en_7314", "en_7316", "en_7318", "en_7335", "en_7383", "en_7384", "en_7395", "en_7416", "en_7434", "en_7460", "en_7481", "en_7484", "en_7498", "en_7505", "en_7511", "en_7515", "en_7525", "en_7553", "en_7558", "en_7594", "en_764", "en_7647", "en_7688", "en_770", "en_7705", "en_7717", "en_7720", "en_7730", "en_7732", "en_7739", "en_7752", "en_7789", "en_7794", "en_7800", "en_781", "en_7816", "en_783", "en_7837", "en_7859", "en_7868", "en_7881", "en_79", "en_7909", "en_7910", "en_7926", "en_7939", "en_7945", "en_7957", "en_7959", "en_7962", "en_7967", "en_7981", "en_7982", "en_7994", "en_8006", "en_8008", "en_8014", "en_806", "en_8063", "en_8066", "en_8075", "en_8080", "en_8095", "en_8097", "en_8098", "en_8108", "en_8113", "en_8138", "en_8142", "en_816", "en_8163", "en_8176", "en_8183", "en_8190", "en_8193", "en_8195", "en_8222", "en_8238", "en_8266", "en_829", "en_83", "en_831", "en_8312", "en_8324", "en_8329", "en_8347", "en_8388", "en_839", "en_8404", "en_8410", "en_8459", "en_8465", "en_8479", "en_8490", "en_8534", "en_8545", "en_8573", "en_8591", "en_8619", "en_8629", "en_8630", "en_8677", "en_868", "en_87", "en_8713", "en_8718", "en_8725", "en_8758", "en_8770", "en_8772", "en_8776", "en_8786", "en_8797", "en_882", "en_8820", "en_8825", "en_8838", "en_8887", "en_8975", "en_9022", "en_9023", "en_909", "en_911", "en_920", "en_925", "en_93", "en_948", "en_953", "en_954", "en_968", "en_979", "en_98", "en_984", "en_hifi_11697_other", "en_hifi_6670_other", "en_hifi_8051_other", "en_hifi_9136_other", "en_hifi_92_clean", "en_dt_0", "en_dt_1" ], "mel_mean": -5.9344089481310744, "mel_std": 2.3695238543771113, "delivery": { "guidance": 1.5, "length_scale": 1.04, "pause_scale": 2.5, "n_timesteps": 10, "temperature": 0.667, "sentence_gap": 0.35, "style_scale": 1.5 }, "vocoder": "nvidia/bigvgan_base_24khz_100band", "sample_rate": 24000, "training_step": 20000, "parameters": { "acoustic_model": 41965708, "vocoder": 14020000, "vocos": 13531650, "voice_encoder": 4300096 }, "default_voice": "en_hifi_92_clean", "recommended_voices": [ "en_hifi_92_clean", "en_hifi_8051_other", "en_hifi_11697_other" ], "profiles": { "en_hifi_92_clean": [ -4.5528, -4.8893, -5.2367, -4.5505, -3.4233, -2.8618, -3.097, -4.2703, -4.2467, -4.0435, -3.4204, -3.3618, -3.6058, -3.8797, -4.2246, -3.9774, -4.0689, -3.85, -4.0776, -3.9829, -3.9574, -3.9879, -3.9235, -4.1083, -3.9021, -4.1646, -4.0601, -4.3304, -4.4415, -4.5864, -4.6558, -4.7651, -4.7194, -4.8787, -4.914, -5.0016, -5.1144, -5.1995, -5.2957, -5.383, -5.3533, -5.3153, -5.2753, -5.3689, -5.3588, -5.4987, -5.4719, -5.439, -5.4255, -5.4821, -5.6054, -5.661, -5.7136, -5.7257, -5.7577, -5.7937, -5.7881, -5.7086, -5.6496, -5.5307, -5.432, -5.3035, -5.195, -5.2011, -5.2987, -5.4264, -5.4868, -5.4925, -5.4033, -5.3616, -5.3443, -5.3643, -5.4964, -5.6871, -5.7945, -5.8009, -5.7339, -5.6264, -5.5396, -5.5173, -5.5787, -5.7013, -5.9112, -6.1813, -6.4441, -6.6154, -6.6782, -6.6212, -6.5478, -6.4835, -6.3629, -6.2702, -6.2736, -6.3551, -6.5393, -6.5878, -6.5743, -6.6207, -6.6606, -7.6826 "model": { "n_feats": 100, "spk_dim": 256, "enc_dim": 256, "enc_layers": 6, "enc_heads": 4, "dec_dim": 512, "dec_layers": 10, "dec_heads": 8, "dropout": 0.1, "dec_dropout": 0.0, "p_uncond": 0.1, "phone_pos": true, "dur_flow": true, "dur_dim": 192, "dur_layers": 3, "t_uniform": 0.2, "n_styles": 2 }, "symbols": [ "<pad>", "<bos>", "<eos>", "<unk>", "\u2581", ",", ".", "!", "?", "AA0", "AA1", "AA2", "AE0", "AE1", "AE2", "AH0", "AH1", "AH2", "AO0", "AO1", "AO2", "AW0", "AW1", "AW2", "AY0", "AY1", "AY2", "EH0", "EH1", "EH2", "ER0", "ER1", "ER2", "EY0", "EY1", "EY2", "IH0", "IH1", "IH2", "IY0", "IY1", "IY2", "OW0", "OW1", "OW2", "OY0", "OY1", "OY2", "UH0", "UH1", "UH2", "UW0", "UW1", "UW2", "B", "CH", "D", "DH", "F", "G", "HH", "JH", "K", "L", "M", "N", "NG", "P", "R", "S", "SH", "T", "TH", "V", "W", "Y", "Z", "ZH" ], "en_hifi_8051_other": [ -5.5157, -6.0392, -6.1349, -5.1417, -3.934, -3.1781, -2.9445, -3.6151, -3.6699, -3.8389, -3.4228, -3.2342, -3.0758, -2.9845, -3.1808, -3.1442, -3.5348, -3.4907, -3.7715, -3.7633, -3.8851, -4.0104, -4.0141, -4.2671, -4.0829, -4.3634, -4.2428, -4.3968, -4.3498, -4.3702, -4.4104, -4.5307, -4.4765, -4.6281, -4.6161, -4.6451, -4.7166, -4.7446, -4.6804, -4.5995, -4.5578, -4.6027, -4.598, -4.7045, -4.6654, -4.7484, -4.7672, -4.8293, -4.934, -4.995, -5.0342, -5.0272, -5.0333, -5.0599, -5.0503, -5.0252, -4.9874, -4.9201, -4.914, -4.9577, -5.0798, -5.2802, -5.4586, -5.5143, -5.5091, -5.4864, -5.4404, -5.4518, -5.521, -5.8094, -6.2403, -6.6353, -6.9023, -7.0068, -7.0506, -7.0704, -7.0023, -6.9181, -6.8441, -6.7606, -6.619, -6.3625, -6.2382, -6.2927, -6.4533, -6.7382, -7.0157, -7.282, -7.5075, -7.5354, -7.5966, -7.6929, -7.694, -7.7014, -7.8256, -7.9272, -8.0775, -8.3442, -8.7171, -9.8908 "voices": [ "en_hifi_92_clean", "en_dt_0" ], "en_hifi_11697_other": [ -4.3645, -4.584, -3.7181, -2.3602, -2.0809, -2.8246, -3.0412, -3.1834, -2.7838, -3.0464, -2.8624, -2.8126, -2.7868, -2.8293, -3.1208, -2.9968, -3.2828, -3.164, -3.4165, -3.4967, -3.6794, -3.8211, -3.7939, -4.0597, -3.8742, -4.143, -4.0058, -4.1556, -4.1143, -4.1494, -4.2541, -4.3771, -4.2667, -4.3927, -4.4097, -4.4497, -4.5102, -4.4978, -4.3898, -4.2385, -4.2307, -4.301, -4.2479, -4.3343, -4.3199, -4.4189, -4.4192, -4.4065, -4.4508, -4.534, -4.6232, -4.5759, -4.5716, -4.6519, -4.6957, -4.6927, -4.6477, -4.5867, -4.5484, -4.4029, -4.3251, -4.4004, -4.6249, -4.9409, -5.1907, -5.3485, -5.3964, -5.394, -5.3668, -5.3666, -5.4105, -5.5044, -5.6065, -5.7134, -5.8603, -5.9722, -6.0074, -6.0253, -6.0957, -6.1554, -6.1288, -5.9714, -5.7576, -5.8099, -5.987, -6.0439, -5.9184, -5.6403, -5.4889, -5.6255, -5.7759, -5.9742, -6.3315, -6.6505, -7.0337, -7.2759, -7.1837, -7.0226, -7.1776, -8.5237 ] }, "styles": [ "reading", "conversational" ], "voice_styles": { "en_dt_1": "conversational", "en_dt_0": "conversational" }, "style_finetune": { "from_step": 20000, "steps": 6000, "data": "HiFi-TTS voices 92, 8051, 11697 + DailyTalk (CC BY-SA 4.0)", "gpu": "RTX 3080" }, "vocoder_weights": "vocoder/bigvgan_finetuned.pt", "vocos_weights": "vocoder/vocos.safetensors", "fast": { "weights": "fast_decoder.safetensors", "mel_mean": -5.9344089481310744, "mel_std": 2.3695238543771113, "delivery": { "n_timesteps": 2, "guidance": 0.0 "guidance": 1.5, "length_scale": 1.04, "pause_scale": 2.5, "n_timesteps": 10, "temperature": 0.667, "sentence_gap": 0.35, "style_scale": 1.5 }, "vocoder": "nvidia/bigvgan_base_24khz_100band", "sample_rate": 24000, "training_step": 20000, "parameters": { "acoustic_model": 41815690, "vocoder": 14020000 }, "default_voice": "en_hifi_92_clean", "recommended_voices": [ "en_hifi_92_clean", "en_dt_0" ], "profiles": { "en_hifi_92_clean": [ -4.5528, -4.8893, -5.2367, -4.5505, -3.4233, -2.8618, -3.097, -4.2703, -4.2467, -4.0435, -3.4204, -3.3618, -3.6058, -3.8797, -4.2246, -3.9774, -4.0689, -3.85, -4.0776, -3.9829, -3.9574, -3.9879, -3.9235, -4.1083, -3.9021, -4.1646, -4.0601, -4.3304, -4.4415, -4.5864, -4.6558, -4.7651, -4.7194, -4.8787, -4.914, -5.0016, -5.1144, -5.1995, -5.2957, -5.383, -5.3533, -5.3153, -5.2753, -5.3689, -5.3588, -5.4987, -5.4719, -5.439, -5.4255, -5.4821, -5.6054, -5.661, -5.7136, -5.7257, -5.7577, -5.7937, -5.7881, -5.7086, -5.6496, -5.5307, -5.432, -5.3035, -5.195, -5.2011, -5.2987, -5.4264, -5.4868, -5.4925, -5.4033, -5.3616, -5.3443, -5.3643, -5.4964, -5.6871, -5.7945, -5.8009, -5.7339, -5.6264, -5.5396, -5.5173, -5.5787, -5.7013, -5.9112, -6.1813, -6.4441, -6.6154, -6.6782, -6.6212, -6.5478, -6.4835, -6.3629, -6.2702, -6.2736, -6.3551, -6.5393, -6.5878, -6.5743, -6.6207, -6.6606, -7.6826 ] }, "styles": [ "reading", "conversational" ], "voice_styles": { "en_dt_0": "conversational" }, "note": "reflow-distilled decoder (teacher: 10 steps x guidance 1.5); same quality in a blind test, ~10x faster acoustic model" }, "voice_encoder": "voice_encoder.safetensors", "voice_encoder_cfg": { "dim": 256, "layers": 6, "kernel": 5, "out_dim": 256, "dropout": 0.1 }} "vocoder_weights": "vocoder/bigvgan_finetuned.pt", "vocoder_config": "vocoder/bigvgan_config.json", "english_duo": { "source": "mmmhusto/TTS-husto v1.0", "branch": "same", "additional_steps": 600, "sha256": "ddb4d3c30f8f1889ac393e82c70c06e5fd6b64ebf6f54bcef0f10a1984c9fadd" }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333{ "gpu": "NVIDIA GeForce RTX 3080 12 GB", "voices": [ "en_hifi_92_clean", "en_dt_0" ], "selected": "same", "trials": { "same": { "extra_blocks": 0, "parameters": 41815690, "initial": [ [ 1.5098551313082378, 1.0120989282925923, 0.17936872753004232 ], [ 1.9588440159956615, 1.0075908998648326, 0.17923927741746107 ] ], "evaluations": [ { "step": 200, "losses": [ [ 1.4717482328414917, 1.0131379961967468, 0.18133296320835748 ], [ 1.9204951028029125, 1.0080778102080028, 0.1802356174836556 ] ], "relative": [ 0.9870050350696665, 0.9882805209572678 ] }, { "step": 400, "losses": [ [ 1.4598548611005147, 1.013105312983195, 0.18081225578983626 ], [ 1.8909514546394348, 1.007993886868159, 0.17932436056435108 ] ], "relative": [ 0.9823973804671339, 0.9785723227948884 ] }, { "step": 600, "losses": [ [ 1.4528387188911438, 1.0134133696556091, 0.18094300168255964 ], [ 1.9014202853043873, 1.0083182950814564, 0.17911982846756777 ] ], "relative": [ 0.9799625216359094, 0.9819384396051078 ] } ], "best_step": 600, "train_per_voice": 1024 }, "deeper": { "extra_blocks": 2, "parameters": 48448266, "initial": [ [ 1.5098551313082378, 1.0120989282925923, 0.17936872753004232 ], [ 1.9588440159956615, 1.0075908998648326, 0.17923927741746107 ] ], "evaluations": [ { "step": 200, "losses": [ [ 1.4654627839724224, 1.0131055116653442, 0.1811825086673101 ], [ 1.9189746777216594, 1.0082007745901744, 0.18028497758011022 ] ], "relative": [ 0.9846105089610747, 0.987851963986712 ] }, { "step": 400, "losses": [ [ 1.462820440530777, 1.0132412314414978, 0.18067264060179392 ], [ 1.947947512070338, 1.008024235566457, 0.1794121308873097 ] ], "relative": [ 0.9834938368827214, 0.9967287410832819 ] }, { "step": 600, "losses": [ [ 1.4676920374234517, 1.0134263634681702, 0.1806071742127339 ], [ 1.9305929243564606, 1.008307049671809, 0.1792681204775969 ] ], "relative": [ 0.9853415474021993, 0.9912558971202845 ] } ], "best_step": 200, "train_per_voice": 1024 }, "broader": { "extra_blocks": 0, "parameters": 41815690, "initial": [ [ 1.5098551313082378, 1.0120989282925923, 0.17936872753004232 ], [ 1.9588440159956615, 1.0075908998648326, 0.17923927741746107 ] ], "evaluations": [ { "step": 200, "losses": [ [ 1.4934502343336742, 1.012210190296173, 0.1795298419892788 ], [ 1.9445515672365825, 1.0081575016180675, 0.17997795281310877 ] ], "relative": [ 0.994027918252272, 0.9958714187127362 ] }, { "step": 400, "losses": [ [ 1.4820024172465007, 1.0122415820757549, 0.1793048537025849 ], [ 1.9542650083700817, 1.0078787803649902, 0.17934046064813933 ] ], "relative": [ 0.9897183949143926, 0.9986680299238564 ] }, { "step": 600, "losses": [ [ 1.4720602730909984, 1.0119865735371907, 0.17924492619931698 ], [ 1.9815805951754253, 1.0081101854642232, 0.17883347409466901 ] ], "relative": [ 0.9859213365820085, 1.0072639631609628 ] } ], "best_step": 200, "train_per_voice": 2048 } }, "test": { "original": { "0": { "n": 8, "pesq": 3.843, "speaker_cosine": 0.753, "word_errors": 2, "words": 78, "wer": 0.026 }, "1": { "n": 8, "pesq": 3.771, "speaker_cosine": 0.663, "word_errors": 5, "words": 85, "wer": 0.059 } }, "baseline": { "0": { "n": 8, "pesq": 3.852, "speaker_cosine": 0.724, "word_errors": 0, "words": 78, "wer": 0.0 }, "1": { "n": 8, "pesq": 3.868, "speaker_cosine": 0.608, "word_errors": 7, "words": 85, "wer": 0.082 } }, "same": { "0": { "n": 8, "pesq": 3.928, "speaker_cosine": 0.73, "word_errors": 0, "words": 78, "wer": 0.0 }, "1": { "n": 8, "pesq": 3.95, "speaker_cosine": 0.622, "word_errors": 7, "words": 85, "wer": 0.082 } }, "deeper": { "0": { "n": 8, "pesq": 3.951, "speaker_cosine": 0.725, "word_errors": 0, "words": 78, "wer": 0.0 }, "1": { "n": 8, "pesq": 3.838, "speaker_cosine": 0.622, "word_errors": 5, "words": 85, "wer": 0.059 } }, "broader": { "0": { "n": 8, "pesq": 3.933, "speaker_cosine": 0.667, "word_errors": 0, "words": 78, "wer": 0.0 }, "1": { "n": 8, "pesq": 3.944, "speaker_cosine": 0.589, "word_errors": 8, "words": 85, "wer": 0.094 } } }}123version https://git-lfs.github.com/spec/v1oid sha256:b2487f01f0a11e3465d66fae5f33a8354952a5d76a83e02a11c2a037e3f7b61asize 139814904123456789101112131415161718192021"""python infer.py "Text to speak." out.wav [--voice en_hifi_8051_other] [--bigvgan BigVGAN | --vocoder vocos] [--fast]"""import argparse
import soundfile as sf
from tts_english import SAMPLE_RATE, TTS
ap = argparse.ArgumentParser()ap.add_argument("text")ap.add_argument("out")ap.add_argument("--voice", default=None, help="default: the studio voice en_hifi_92_clean")ap.add_argument("--bigvgan", default="BigVGAN", help="clone of github.com/NVIDIA/BigVGAN")ap.add_argument("--fast", action="store_true", help="distilled 2-step decoder, ~10x faster acoustic model")ap.add_argument("--vocoder", default="bigvgan", choices=["bigvgan", "vocos"], help="vocos: fast on a CPU and needs no BigVGAN clone")ap.add_argument("--repo", default="mmmhusto/TTS-husto", help="Hub repo or local folder with the weights")ap.add_argument("--seed", type=int, default=0)a = ap.parse_args()tts = TTS.from_pretrained(a.repo, a.bigvgan, vocoder=a.vocoder, fast=a.fast)sf.write(a.out, tts(a.text, a.voice, a.seed), SAMPLE_RATE)print(f"{a.out}: {a.voice or tts.config['default_voice']}")12323version https://git-lfs.github.com/spec/v1oid sha256:b6aa40997901b383515c13941dd94e3dd6bf0f35b883f95b3a7f8ac17a74ca8csize 167893864oid sha256:ddb4d3c30f8f1889ac393e82c70c06e5fd6b64ebf6f54bcef0f10a1984c9faddsize 16728970412345678torchnumpysoundfilehuggingface_hubsafetensorsg2p_enlibrosamatplotlib12323version https://git-lfs.github.com/spec/v1oid sha256:fbcd8fb2866287e32ca99f68b235b5192f53cbd3033d7b236b20f718fb94c24fsize 398924oid sha256:dfc8c51ada9c8b3314d43d0f0e213a03a0c1a341db4ca800cdb2bb468350bd71size 190124123version https://git-lfs.github.com/spec/v1oid sha256:7964e5bfd2943f417a597f20d0e1627387f145e0b0474af03ba236bc3311b6aasize 389324123version https://git-lfs.github.com/spec/v1oid sha256:f6a459043ee8ecc65f81a199fcbc1dd9879b1d1038c4c70c209b9213e8fa8497size 507404123version https://git-lfs.github.com/spec/v1oid sha256:78aeb6ec80dec0b10c84014d6a4946b245927dee42b6eada97945149738405c8size 38932412323version https://git-lfs.github.com/spec/v1oid sha256:d10c41c668363a39e71ac3598bcc46291765feba72fb6289592d680b79faa45asize 364364oid sha256:9771a91d115b8a8cc8bc535293430af98d2ac7ac42268d9e75c2cfa53127cf35size 185324123version https://git-lfs.github.com/spec/v1oid sha256:326e8b53c5198b9b174b64ed5b6a60d0d81837d5e6cf0869747ec17059177784size 231884123version https://git-lfs.github.com/spec/v1oid sha256:bd27b3f06966e11f8463495bf3feb70a08dd9e826d150e966e9ec9c9f37807f9size 239564123version https://git-lfs.github.com/spec/v1oid sha256:de63c91bf3480a9387a7e9f881deef5c7fe7c649df3cfd2ea09c1aade8214e65size 257804123version https://git-lfs.github.com/spec/v1oid sha256:a9686521d935b0b9313ac31e85bf09c6d3e1c83fbaef79f19a2e8bd7f3d8a5d2size 247244123456789101112131415123439 unmodified lines44454661474849503 unmodified lines545556715758596026 unmodified lines878889104909192939495969798991001011021031041058 unmodified lines1141151161211171181191201217 unmodified lines129130131132133134135136"""mmmhusto TTS English: text -> 24 kHz speech.
from tts_english import TTS tts = TTS.from_pretrained("mmmhusto/TTS-husto", bigvgan_dir="BigVGAN") # a clone of github.com/NVIDIA/BigVGAN wav = tts("Good morning, and welcome.") # float32 numpy array, 24 kHz
tts = TTS.from_pretrained("mmmhusto/TTS-husto", vocoder="vocos") # fast vocoder, no BigVGAN clone needed tts = TTS.from_pretrained("mmmhusto/TTS-husto", vocoder="vocos", fast=True) # + 2-step decoder: fastest
voice = tts.clone_voice(recording, sample_rate) # a voice vector from 5-15 s of someone's speech wav = tts("Now I speak with that voice.", voice=voice)
wav = tts.long(article) # any length: sentence by sentence for chunk in tts.stream(article): play(chunk) # the first sentence is ready long before the last""""""English Duo. Load the two-voice model with TTS.from_pretrained(bigvgan_dir="BigVGAN")."""
from __future__ import annotations
39 unmodified lines return out
def load_vocoder(bigvgan_dir: str, model_id: str, device: str, weights: str | None = None):def load_vocoder(bigvgan_dir: str, model_id: str, device: str, weights: str | None = None, config_path: str | None = None): """NVIDIA BigVGAN (MIT) from a clone of its repository, weight norm removed. The weights come from the Hub, or from ``weights``: a generator fine-tuned on this model's own mels (same architecture).""" from huggingface_hub import hf_hub_download3 unmodified lines import bigvgan from env import AttrDict
h = AttrDict(json.load(open(hf_hub_download(model_id, "config.json")))) h = AttrDict(json.load(open(config_path or hf_hub_download(model_id, "config.json")))) voc = bigvgan.BigVGAN(h, use_cuda_kernel=False) state = torch.load(weights or hf_hub_download(model_id, "bigvgan_generator.pt"), map_location="cpu", weights_only=False)26 unmodified lines from safetensors.torch import load_file
def get(name: str) -> str: # a local folder, or a repo on the Hub return str(Path(repo) / name) if Path(repo).is_dir() else hf_hub_download(repo, name, revision="v1.0" if repo == "mmmhusto/TTS-husto" else None) return str(Path(repo) / name) if Path(repo).is_dir() else hf_hub_download(repo, name, revision="v2.0" if repo == "mmmhusto/TTS-husto" else None)
config = json.load(open(get("config.json"))) if not config.get("vocos_weights") and vocoder in (None, "bigvgan") and bigvgan_dir is None: import os candidates = [os.environ.get("SKTTS_BIGVGAN_DIR"), Path("BigVGAN")] bigvgan_dir = next((str(p) for p in candidates if p and (Path(p) / "bigvgan.py").is_file()), None) if bigvgan_dir is None: raise ValueError("Set bigvgan_dir to the local NVIDIA BigVGAN repository.") if fast and not config.get("fast"): raise ValueError("This two-voice model uses the full decoder. Use fast=False.") if vocoder == "vocos" and not (vocoder_weights or config.get("vocos_weights")): raise ValueError("This two-voice model includes BigVGAN. Use vocoder='bigvgan'.") assert config["symbols"] == SYMBOLS, "frontend and checkpoint disagree on the symbol table" model = SkttsV2(len(SYMBOLS), len(config["voices"]), config["mel_mean"], config["mel_std"], cfg=config["model"]) model.load_state_dict(load_file(get("model.safetensors")))8 unmodified lines elif vocoder == "bigvgan" and bigvgan_dir: if vocoder_weights is None and config.get("vocoder_weights"): vocoder_weights = get(config["vocoder_weights"]) voc = load_vocoder(bigvgan_dir, config["vocoder"], device, vocoder_weights) voc = load_vocoder(bigvgan_dir, config["vocoder"], device, vocoder_weights, get(config["vocoder_config"]) if config.get("vocoder_config") else None) else: raise ValueError('vocoder must be "vocos", or "bigvgan" together with bigvgan_dir') tts = cls(model, config, voc, device)7 unmodified lines steps against the recording itself: closer to the speaker (speaker similarity 0.43 against 0.34 without), and about 10 to 40 s on a laptop CPU. Needs the "voice_encoder" file named in config.json. Only clone voices you have the right to use.""" if not self.config.get("voice_encoder"): raise ValueError("English Duo provides two preset voices.") if self._refenc is None: from safetensors.torch import load_file
12312344 unmodified lines910111415161213145 unmodified lines2021222823242526"""tts-english "Text to speak." out.wav [--voice en_hifi_8051_other] [--style conversational] [--fast]
Long texts are read sentence by sentence; ``-`` as the text reads it from standard input.""""""Synthesize English speech with Studio 92 or DailyTalk man."""import argparseimport sys
4 unmodified lines ap.add_argument("out", help="output .wav") ap.add_argument("--voice", default=None, help="default: the studio voice en_hifi_92_clean") ap.add_argument("--style", default=None, choices=["reading", "conversational"]) ap.add_argument("--fast", action="store_true", help="distilled 2-pass decoder, ~10x faster acoustic model") ap.add_argument("--vocoder", default=None, choices=["bigvgan", "vocos"], help="default: bigvgan with --bigvgan, else vocos") ap.add_argument("--bigvgan", default=None, help="clone of github.com/NVIDIA/BigVGAN (best quality)") ap.add_argument("--repo", default="mmmhusto/TTS-husto", help="Hub repo or local folder with the weights") ap.add_argument("--device", default="cpu")5 unmodified lines from . import SAMPLE_RATE, TTS
text = sys.stdin.read() if a.text == "-" else a.text tts = TTS.from_pretrained(a.repo, a.bigvgan, device=a.device, vocoder=a.vocoder, fast=a.fast) tts = TTS.from_pretrained(a.repo, a.bigvgan, device=a.device, vocoder="bigvgan") kw = {"style": a.style} if a.style else {} sf.write(a.out, tts.long(text, a.voice, a.seed, **kw), SAMPLE_RATE) print(f"{a.out}: {a.voice or tts.config['default_voice']}")12345678910111213141516171819202122232425262728293031323334353637383940414243444546{ "resblock": "1", "num_gpus": 0, "batch_size": 32, "learning_rate": 0.0001, "adam_b1": 0.8, "adam_b2": 0.99, "lr_decay": 0.999, "seed": 1234,
"upsample_rates": [8,8,2,2], "upsample_kernel_sizes": [16,16,4,4], "upsample_initial_channel": 512, "resblock_kernel_sizes": [3,7,11], "resblock_dilation_sizes": [[1,3,5], [1,3,5], [1,3,5]],
"activation": "snakebeta", "snake_logscale": true,
"discriminator": "mrd", "resolutions": [[1024, 120, 600], [2048, 240, 1200], [512, 50, 240]], "mpd_reshapes": [2, 3, 5, 7, 11], "use_spectral_norm": false, "discriminator_channel_mult": 1,
"segment_size": 8192, "num_mels": 100, "num_freq": 1025, "n_fft": 1024, "hop_size": 256, "win_size": 1024,
"sampling_rate": 24000,
"fmin": 0, "fmax": 12000, "fmax_for_loss": null,
"num_workers": 4,
"dist_config": { "dist_backend": "nccl", "dist_url": "tcp://localhost:54321", "world_size": 1 }}123version https://git-lfs.github.com/spec/v1oid sha256:5d97576fdbd2e62fabbc4d9e20ee7da518af0711c0c874e9683998179e2862a0size 54134536123version https://git-lfs.github.com/spec/v1oid sha256:2b7ccdbfc9ed71a47de53851865ca8d7b157460cec9d8b778f564267ff37b9e4size 17205480.gitattributes+2-21
README.md+36-385
app.py+27-20
config.json+242-1056
evaluation.jsonAdded+333
fast_decoder.safetensorsDeleted-3
infer.pyDeleted-21
model.safetensors+2-2
requirements.txtAdded+8
samples/story_8051.wav → samples/dailytalk-man.wavRenamed+2-2
samples/fast_story_92.wavDeleted-3
samples/numbers_92.wavDeleted-3
samples/story_92.wavDeleted-3
samples/story_11697.wav → samples/studio-92.wavRenamed+2-2
samples/talk_11697_conversational.wavDeleted-3
samples/talk_11697_reading.wavDeleted-3
samples/talk_92_conversational.wavDeleted-3
samples/talk_92_reading.wavDeleted-3
tts_english/__init__.py+18-19
tts_english/__main__.py+2-7
vocoder/bigvgan_config.jsonAdded+46
vocoder/vocos.safetensorsDeleted-3
voice_encoder.safetensorsDeleted-3