Supertonic 2 in PyTorch, with voice-cloning encoders (unofficial)

Unofficial. Not affiliated with or endorsed by Supertone Inc. "Supertonic" is used only to say what these weights are compatible with.

This repository has every module needed to run and train the Supertonic 2 text-to-speech pipeline in PyTorch. It also adds the three modules the official release lacks for zero-shot voice cloning:

  • a speech encoder, audio β†’ latent, mapping speech into the latent space of Supertone's text-to-latent model and vocoder;
  • a TTL style encoder, reference latent β†’ the 50 Γ— 256 style_ttl tokens;
  • a DP style encoder, reference latent β†’ the 8 Γ— 16 style_dp tokens.

The official release ships only ten preset voices (F1–M5) as fixed style embeddings. These encoders compute the same two embeddings from a few seconds of any speaker's audio. The resulting voice-style JSON is in the same format as the presets, so it also works with the official ONNX runtime.

Code (model definitions, inference, training and evaluation): https://github.com/femelo/open-supertonic-tts

About this reimplementation

Supertone released Supertonic 2 only as ONNX graphs, without training code. The PyTorch code behind these modules is an independent reimplementation. It reflects my understanding of the SupertonicTTS paper (Kim et al., arXiv:2503.23108) together with the structure of the released ONNX graphs. It may not be exactly the same model or training procedure as Supertone's.

  • Inference modules: the four converted modules load Supertone's weights into this reimplementation. They reproduce the official ONNX outputs (waveforms within 1e-6 for the same seed and inputs). Internals the ONNX graphs leave open may still differ from Supertone's code.
  • Training: loss weighting, batch expansion, latent normalization, data processing and the speech autoencoder follow my reading of the paper, and gaps were filled by assumption. One example: the paper describes channel-wise latent normalization, but the extra 0.25 scale used here was recovered from the released model files (tts.json, ONNX vocoder), not from the paper. Training with this code is not guaranteed to reproduce Supertone's results.
  • New modules: the speech encoder and the two style encoders are my own models. Supertone did not release a latent encoder or style encoders. They are not Supertone's components, and they were trained without Supertone's (private) training data.
  • Authorship: I wrote the code almost entirely by hand, following my own interpretation of the paper. Claude Code agents were used for debugging, for documentation, and for mapping the public Supertonic weights onto the model as written.
  • Training data and fidelity: the new modules were trained on two kinds of data. The first is the public datasets the paper lists for training the speech autoencoder (Table 9, p. 22). The second is synthetic data from the public Supertonic model, generated with its published voice styles (M1–M5, F1–F5). The modules are therefore only approximations of Supertone's actual components.
  • Training strategy: I devised the training strategy and the order of the stages by hand. Claude Code agents were used to align the speech latents with the latent space the official model expects, and to devise a robust method for training the style encoders.

Files

File Module (open_supertonic_tts…) Params Origin
pt/text_encoder.pt TTLTextEncoder 6.8 M converted from Supertone's ONNX
pt/vector_estimator.pt VectorFieldEstimator (flow-matching text-to-latent) 33.1 M converted from Supertone's ONNX
pt/duration_predictor.pt DurationPredictor 0.34 M converted from Supertone's ONNX
pt/vocoder.pt SpeechDecoder (latent decoder, 44.1 kHz) 25.3 M converted from Supertone's ONNX
pt/speech-encoder.pt SpeechEncoder (latent encoder) 21.9 M trained here
pt/ttl-style-encoder.pt TTLStyleEncoder 3.7 M trained here
pt/dp-style-encoder.pt DPStyleEncoder 0.17 M trained here
voice_styles/*.json preset voices F1–F5, M1–M5 – Supertone, unchanged
tts.json, unicode_indexer.json model config, character table – Supertone, unchanged

The converted modules reproduce the official ONNX graphs: with the same seed, ONNX and PyTorch waveforms agree to within 1e-6. pt/SHA256SUMS lists the checksums of the weight files.

The .pt files are pickled torch.nn.Module objects. They need the open_supertonic_tts package and torch.load(..., weights_only=False). They were saved under the package's former name, supertonic_tts, which open_supertonic_tts resolves once imported. Only load pickles from a source you trust.

Usage

pip install git+https://github.com/femelo/open-supertonic-tts
from open_supertonic_tts import OpenSupertonicTTS

# Downloads this repository with huggingface_hub on first use, then loads from the local cache
tts = OpenSupertonicTTS.from_pretrained("fdemelo/open-supertonic2-pytorch", device="cuda")   # or "cpu"
wav = tts.synthesize("Hello! This is Supertonic in PyTorch.", voice="F1")
tts.save_wav(wav, "hello.wav")

voice = tts.clone_voice("speaker.wav")                        # any format and sample rate; ~3–10 s of clean speech
voice = tts.clone_voice("speaker.wav", refine_steps=150)      # closer voice: per-voice refinement, ~45 s on a GPU
tts.save_wav(tts.synthesize("And now in your voice.", voice=voice, lang="en"), "cloned.wav")
voice.save("speaker.json")                                    # same format as voice_styles/*.json

From the command line:

supertonic-tts clone speaker.wav -o speaker.json                       # add --refine-steps 150 for a closer voice
supertonic-tts synthesize "Bonjour Γ  tous !" --lang fr --voice speaker.json -o bonjour.wav

from_pretrained takes a repository id or a local directory, and detects the weight format from the files:

tts = OpenSupertonicTTS.from_pretrained("fdemelo/open-supertonic2-pytorch")  # this repository (also the default)
tts = OpenSupertonicTTS.from_pretrained("Supertone/supertonic-2")   # official ONNX graphs, identical output;
                                                                     # voice-cloning encoders come from this repository
tts = OpenSupertonicTTS.from_pretrained("supertonic2")              # a local copy: huggingface-cli download
                                                                     # fdemelo/open-supertonic2-pytorch --local-dir supertonic2
tts = OpenSupertonicTTS.from_pretrained("fdemelo/open-supertonic2-pytorch", local_files_only=True)  # offline, from the cache

revision, token and cache_dir are passed to huggingface_hub as well. Voice-style JSON files made here also work with the official ONNX runtime.

References longer than 9 s are split into equal chunks, and their TTL styles are averaged. The DP style always uses the whole reference.

Latent space (for training)

  • Audio front end: 44.1 kHz, RMS-normalized to βˆ’20 dBFS, then a 228-bin log-mel with n_fft 2048 and hop 512 (SpeechPreprocessor).
  • Speech encoder output: 24 channels per mel frame. TemporalLatentCompressor stacks 6 frames into 144-channel latents at about 14.4 Hz.
  • Latent statistics: the encoder is trained to emit latents already normalized the way the text-to-latent model expects, with per-channel ΞΌ β‰ˆ 0 and Οƒ β‰ˆ 0.25.
  • Vocoder: vocoder.pt undoes that normalization (x / 0.25 Β· latent_std + latent_mean, Supertone's constants) before decoding.

Encoder output can therefore go straight into the flow-matching loss, and generated latents straight into the vocoder.

Voice-cloning examples

Two speakers from the VCTK corpus (CC BY 4.0), with the released model as published, seed 0 and default settings. The encoders hear one recording (the reference); the model then reads a sentence from VCTK's "Please call Stella" passage, next to the speaker's own recording of it, once with the encoders' style and once after refinement (150 steps). Similarity is WavLM-SV against that real recording. Each player shows the clip's mel spectrogram; the .wav files are in samples/.

p225 (in the training data)

p225, VCTK's first speaker, is one of the speakers the style encoders were trained on (the reference clip itself was not in the training subset). It was chosen before any results were seen.

Reference given to the encoders
real
Original recording of the sentence
real
Generated: encoders only
synthetic
Generated: encoders + refinement
synthetic

"She can scoop these things into three red bags, and we will go meet her Wednesday at the train station."

  • Encoders only: 0.58, below the nearest preset voice (0.67). With refinement: 0.82. Two real recordings of the speaker score 0.97 against each other. All clips transcribe exactly (Whisper).

p251 (held out)

p251 was held out of the style-encoder training.

Reference given to the encoders
real
Original recording of the sentence
real
Generated: encoders only
synthetic
Generated: encoders + refinement
synthetic

"Six spoons of fresh snow peas, five thick slabs of blue cheese, and maybe a snack for her brother Bob."

  • Encoders only: 0.82, against 0.63 for the nearest preset and 0.95 between two real recordings. With refinement: 0.74 in this run, lower than the encoders alone. Another refinement run of the same voice reached 0.89, which shows how much runs vary. All clips transcribe exactly.
tts = OpenSupertonicTTS.from_pretrained("fdemelo/open-supertonic2-pytorch")
voice = tts.clone_voice("samples/vctk_p225_reference.wav", refine_steps=150)   # refine_steps=0: encoders only
wav = tts.synthesize("She can scoop these things into three red bags, "
                     "and we will go meet her Wednesday at the train station.", voice=voice, lang="en", seed=0)

Source: Yamagishi, Veaux and MacDonald, CSTR VCTK Corpus (version 0.92), University of Edinburgh, doi:10.7488/ds/2645, CC BY 4.0. The recordings are resampled to 44.1 kHz and loudness-normalized.

How the new modules were trained

The full step-by-step procedure, with commands, is in the code repository's training procedure.

Speech encoder. Supertone did not release its latent encoder. A SpeechEncoder was first trained on the corpora listed under Training data, against Supertone's frozen vocoder. Its losses were multi-resolution log-mel L1, adversarial (multi-period and multi-resolution discriminators) and WavLM features. That encoder decoded audio well, but its latents lay outside the region the text-to-latent model produces. It was then aligned with Supertone's latent space using three losses:

  • L1 to 50 k latents generated by the frozen TTS (the ten preset voices Γ— en/es/fr/ko/pt, 10 k per language);
  • multi-resolution STFT reconstruction of real speech through the frozen vocoder;
  • a moment prior (ΞΌ 0, Οƒ 0.25).

Latents it produces from TTS-generated audio reach RΒ² 0.69 against the latents that generated that audio.

Warm start. Both style encoders were first fitted to the ten preset voices: from golden audio, they regressed the preset style embeddings with cosine + MSE losses. On its own this does not generalize to new voices, so it served only as the starting point.

TTL style encoder. The encoder was trained through the frozen TTS itself, because training it with the flow-matching loss through the frozen vector field lets the encoder damp the field and produce mumbled speech. Its style conditions a 5-step, differentiable flow-matching sample, which the frozen vocoder decodes. The loss compares that audio with the target utterance using:

  • WavLM layer-3/6 timbre and texture statistics;
  • an autocorrelation pitch term;
  • an x-vector cosine, from microsoft/unispeech-sat-base-plus-sv (a different model from the evaluation's);
  • a flow-matching term (weight 0.5);
  • a penalty that keeps the tokens on the manifold of the official voice styles.

References are usually another utterance of the same speaker, so the encoder learns the voice rather than copying the recording. The data was 173 k utterances (2–6.3 s) from 2,583 speakers. A final fine-tune read the reference from a channel-degraded copy half the time, using EQ, reverb, band-limiting, noise, codecs (MP3/AAC/Opus/GSM/ΞΌ-law) and clipping.

DP style encoder. Trained through the frozen duration predictor with an L1 loss between log predicted and log real utterance durations. It does not need sampling, since a duration can be compared directly. It used whole references from other utterances of the same speaker, with 50 % degraded, over 362 k utterances from 2,636 speakers.

Held-out evaluation speakers were excluded from all style-encoder training.

Evaluation

The held-out set has 54 speakers: 28 LibriTTS/VCTK (seen_en), 14 UK/Irish/Nigerian English (unseen_en), 6 Spanish, 3 French (Att-HACK), and 3 out-of-domain recordings, one of them JFK's 1961 inaugural address.

For each speaker, a style is taken from one reference clip and three new sentences are synthesized (10 flow steps). The metrics are:

  • SIM-o: speaker similarity (WavLM-base-plus-SV cosine) to a different real utterance of the speaker;
  • WER: Whisper large-v3-turbo transcript vs input text.
System SIM-o all seen_en unseen_en es fr WER
Two real utterances, same speaker (ceiling) 0.962 0.958 0.976 0.969 0.920 –
Two real utterances, different speakers (floor) 0.628 0.593 0.629 0.847 0.525 –
Best preset voice per speaker (oracle pick) 0.786 0.802 0.692 0.861 0.921 1.4 %
These encoders, clean reference 0.796 0.789 0.756 0.881 0.872 1.2 %
These encoders, degraded reference 0.790 0.778 0.760 0.885 0.856 0.9 %

On voices unlike the presets (unseen_en), the encoders beat the best preset by +0.06 SIM. They keep that advantage when the reference is degraded.

The three out-of-domain recordings vary a lot. Similarity to the reference recording (SIM-ref) for two modern recordings is 0.88 and 0.80, against 0.76 and 0.58 for the best preset. For the 1961 JFK recording it is only 0.57, against 0.84 for the best preset. Old, band-limited archival audio is a weak spot (see Limitations).

Duration (DP style from another clip of the speaker) has a median predicted/true ratio of 1.01. The mean |log ratio| is 0.18 with clean references and 0.19 with degraded ones, against 0.23 for the average preset.

The set is small. Differences of about 0.01 SIM are within noise.

Encoders alone vs refinement (VCTK)

A second check used 20 VCTK speakers from the training data (p225–p246). For each, a style is taken from one 4–5 s recording, and the model reads a "Please call Stella" sentence the speaker also recorded. Similarity is WavLM-SV against that real recording (mean of 2 seeds), and WER is Whisper's.

System Speaker similarity Better than the best preset WER
Best preset voice for each speaker (oracle pick) 0.761 – –
These encoders 0.742 7 / 20 0.0 %
These encoders + refinement (150 steps) 0.844 17 / 20 2.1 % (worst 17 %)

With short references and voices this close to the presets, the encoders alone do no better than picking the best preset. Refinement (clone_voice(..., refine_steps=150)) fits the style to the reference by gradient descent through the frozen model, with x-vector, WavLM timbre/texture and pitch losses. A content term and a held-out check reject styles that garble words. It optimizes different models from the WavLM-SV used here. On the held-out speaker p251 it went from 0.81 to 0.89, and on LJSpeech, a voice outside the training data, from 0.82 to 0.86.

Limitations

  • Voice similarity is capped by the frozen TTS. The encoders only choose a point in the style space Supertone's model was trained on. Voices far from that distribution β€” strong accents, children, singing, extreme expressiveness β€” come out as the nearest voice the model can make.
  • Archival and very low-quality recordings: similarity can fall below that of the best preset voice. On the 1961 JFK recording, SIM-ref is 0.57, against 0.84 for the nearest preset. Try a preset (voice_styles/) as well when cloning from such audio.
  • Encoders alone are often only near the voice. Their similarity varies a lot between speakers (0.52–0.84 on the VCTK check) and on average matches picking the best preset. Use refinement for a closer voice.
  • Refinement varies between runs. The same voice can end 0.1 apart in similarity from one run to the next, and the check that rejects garbled styles is not perfect (worst WER 17 % on the VCTK check). Listen to the result, and rerun with another seed if needed. It takes about 45 s per voice on a GPU and much longer on a CPU.
  • Language coverage: style encoders were trained on English, Spanish and French speech only. Korean and Portuguese references are untested. The style can be used to synthesize any of the five languages.
  • Speech encoder fidelity: it approximates Supertone's unreleased encoder (RΒ² 0.69 on TTS-generated latents). For training a new TTS, encode/decode round trips are good but not transparent.
  • Prosody: the style captures timbre and global speaking rate, not the intonation of the reference sentence.
  • Small evaluation set: 54 speakers, with only 3 French and 6 Spanish.

Intended use and misuse

The intended uses are research, accessibility, and personalized speech with the consent of the person whose voice is cloned. The license forbids, among other uses (Attachment A):

  • impersonating anyone without their consent (deepfakes);
  • generating content to deceive or harm;
  • presenting generated speech without disclosing that it is machine-generated.

Anyone who redistributes or deploys these weights must pass these restrictions on to their users.

Training data

Corpus Used for Data license
LibriTTS speech encoder, style encoders CC BY 4.0
VCTK speech encoder, style encoders CC BY 4.0
Hi-Fi TTS speech encoder, style encoders CC BY 4.0
OpenSLR 61, 70–75, 83 (Spanish, Nigerian/UK/Irish English) speech encoder, style encoders CC BY-SA 4.0
Att-HACK (OpenSLR 88) speech encoder, style encoders CC BY-NC-ND 4.0
DAPS speech encoder, style encoders CC BY-NC 4.0
AISHELL-3 speech encoder Apache 2.0
OpenSLR 32, 41–44, 63–66, 69, 76–80, 86 speech encoder CC BY-SA 4.0
EARS speech encoder CC BY-NC 4.0
RAVDESS speech encoder CC BY-NC-SA 4.0
JSUT speech encoder non-commercial (commercial use on request)
PTDB-TUG speech encoder ODbL / DbCL
Speech generated by Supertonic 2 speech encoder (distillation) OpenRAIL-M (output of the model)

Several corpora carry non-commercial terms. This model license does not license the data, and it is not settled whether non-commercial data terms extend to weights trained on that data. If you plan commercial use, review these terms yourself.

License

The weights are released under the BigScience Open RAIL-M License (LICENSE), the same license as Supertonic 2.

  • The converted modules, preset voices and text assets are Supertone Inc.'s model, redistributed in a different format.
  • The speech encoder and style encoders are Derivatives of the Model in the license's sense (Β§1(e)). They were trained on data generated by, and gradients through, the Supertonic 2 model.

The use-based restrictions in Attachment A apply to all of them. See NOTICE for attribution and the list of changes.

The code that defines and trains these modules is a separate repository, under its own license.

Citation

If you use these weights, please cite the original SupertonicTTS paper, arXiv:2503.23108, on which this reimplementation is based:

@article{kim2025supertonictts,
  title   = {SupertonicTTS: Towards Highly Efficient and Streamlined Text-to-Speech System},
  author  = {Kim, Hyeongju and Yang, Jinhyeok and Yu, Yechan and others},
  journal = {arXiv preprint arXiv:2503.23108},
  year    = {2025}
}
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

Model tree for fdemelo/open-supertonic2-pytorch

Finetuned
(2)
this model

Paper for fdemelo/open-supertonic2-pytorch