gepard-1.0 for CPUs (ONNX)

gepard-1.0 is NineNineSix's text-to-speech model. It speaks a text in the voice of a short reference clip, and it was made for voice agents. It ships as PyTorch weights that use NVIDIA's NeMo for the sound.

I converted it to ONNX, in full precision, with an 8-bit decoder as an option. It runs with ONNX Runtime, numpy and tokenizers, without PyTorch or NeMo. The sound comes out in pieces of 0.56 s, so the start of a sentence can be played while the model is still making the end of it.

Summary

Full precision (default) 8-bit decoder
Files it needs 2.0 GB 1.2 GB
Memory while speaking 2.3 GB 1.4 GB
Against the original 299 of 300 sentences have exactly the same codes, given the same random seed 1.69% of words wrong, the original 1.34% (2,400 recordings)
Ran to the 28 s limit 3 of 300 sentences, the original 3 15 of 2,400 recordings, the original 7
Speed, Apple M4 Max, 4 threads 0.37 of real time on average, 0.47 on the slowest of 100 sentences 0.27, 0.39
First sound (median) 0.21 s 0.15 s

Things to know before using it:

  • It needs a reference voice. The original gets 14 to 28% of words wrong without one, and 1.3% with one (2,400 recordings with voices the model made itself, transcribed by faster-whisper small).
  • It sometimes does not stop. The original ran to the 28 s limit in 7 of 2,400 recordings, the 8-bit decoder in 15. The difference may be chance (one-sided p = 0.066), but it may not be, so full precision is the default. The runtime cuts sentences at the limit; set max_frames lower if yours are short.
  • The 8-bit decoder failed three word tests before it passed one. The story and the numbers are under "8-bit".
  • I tested it in English only. The word tests used three voices made by the model itself. Afterwards I tried my own voice. I did not measure how much it sounds like me.
  • I measured speed on one Apple M4 Max, without a reference voice (a voice adds 8 positions to the first step). I did not test a phone, a Raspberry Pi, or an Intel or AMD CPU.

This is an unofficial conversion. It is not made or endorsed by NineNineSix or NVIDIA.

Use it

pip install numpy onnxruntime tokenizers soundfile
huggingface-cli download matthiastl/gepard-onnx --local-dir gepard-onnx
cd gepard-onnx
import soundfile as sf
from gepard_onnx import Gepard

tts = Gepard(threads=4)                                            # Gepard(threads=4, precision="int8") for the 8-bit decoder
reference, rate = sf.read("example_voice.wav", dtype="float32")   # 22,050 Hz mono
voice = tts.voice(reference)                                                   # once per voice

for piece in tts.speak("Thanks for calling. How can I help you today?", voice):
    ...                                                                        # float32, 22,050 Hz, as it is made

sf.write("out.wav", tts.say("Thanks for calling. How can I help you today?", voice, seed=1), 22050)

example_voice.wav is 5.3 s of speech the model made by itself. Resample your own clip to 22,050 Hz mono first; its first 15 s are used, as in the original's player, and a last piece shorter than 46 ms is dropped.

How it was checked

The reference is the original in PyTorch, 32-bit, on the CPU, with its own sampling at temperature 0.3 and the same random seed on both sides. I wrote the rules before the runs; they are in results/.

Check Result
Same numbers: 4,438 frames, 142,016 most likely values 100% the same; mean difference of the logits 0.000003
Same speech: 300 sentences with a voice, every code of every frame 299 the same, 1 different
Sentences that ran to 28 s 3, and 3 for the original
Sound decoder, one frame at a time, against NeMo's largest difference at any sample 0.00004
Voice encoder, 3 clips 100% of the codes the same, cosine 1.000000
4 threads, 100 sentences, machine load under 6 at the start average 0.373 of real time, p90 22.6 ms per 46.4 ms frame

The one different sentence first differs at frame 35 and ends one frame later than the original's. The logits of the two differ by at most 0.0001, so a random draw that falls right on a boundary can go either way. I did not trace this one further.

A real voice

I tried it with 15 s of my own voice, with the loudest sample set to 0.7 of full scale. On 20 sentences, full precision had exactly the same codes as the original in all 20. Words wrong: 0.0% for the original, 0.4% for full precision, 0.4% for 8-bit.

8-bit

In the 8-bit decoder, the linear layers have 8-bit weights (259 MB instead of 1,028 MB for that file). The rest is the same as in full precision. I ran four word tests on this same file, each with a rule written before it. The first three failed:

Test Original 8-bit Limit Result
RULE.md: 40 sentences, no voice 8.8% 12.7% at most 1.0 point above fail
RULE-2.md: 300 recordings, no voice 21.9% 24.1% 95% bound on the difference at most +3.0 points fail (+15.2)
RULE-3.md: 300 recordings, with a voice 2.28% 1.78% 95% bound at most +1.0 point fail (+1.06)
RULE-4.md: 2,400 recordings, with a voice, new sentences 1.34% 1.69% 95% bound at most +1.0 point pass (+0.91)

The first two tests used no reference voice, which is not how the model is meant to run: the original's own word errors were many times higher without one. The third was too small. By an estimate from its own data, a version exactly as good as the original would have passed it about 42% of the time, so I kept the same limit for the fourth and used eight times the recordings. I decided before running it that it would be the last.

On the same frames as the checks above, the 8-bit decoder's most likely value equals the original's on 97.5% of 142,016.

The fourth test also compared how often a sentence ran to the 28 s limit: 15 of 2,400 for 8-bit and 7 for the original, p = 0.066 where the rule asked for at least 0.05. That passes, narrowly. I measured the speed of the 8-bit decoder without a voice: 0.27 of real time on 4 threads, 0.40 on 2 and 0.66 on 1.

Files

File What it is
decoder.onnx (1,028 MB) the 14-layer decoder, with its key/value memory
decoder.int8.onnx (259 MB) the same with 8-bit weights, not needed for full precision
text_embedding.f16.npy (509 MB) the table of text tokens, in 16-bit
frame.onnx, heads.onnx a frame's codes to the decoder's input; the decoder's output to the 32 code choices and the stop decision
codec_stream.onnx (127 MB) NVIDIA's NanoCodec decoder, a few frames at a time
codec_encoder.onnx, compressor.onnx a reference clip to a voice
tokenizer.json the original's
gepard_onnx.py the runtime
config.json sources and checksums
scripts/ the conversion and the tests. They expect the original weights under data/ and write to export/ and runs/
results/ the rules, what each run gave, and the timings

Licences

The gepard files and the code are Apache License 2.0 (LICENSE). The two NanoCodec files are under the NVIDIA Open Model License. NOTICE.md says which is which.

Downloads last month
8
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for matthiastl/gepard-onnx

Quantized
(2)
this model