Downloads · 30 days
0
king46/F5-Hindi-onnx-fp16
F5-Hindi-onnx-fp16 is a machine learning model from king46. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Local Hindi text-to-speech using an FP16 F5-TTS transformer, ONNX Runtime CUDA, and a short male reference recording. This build is working on a 4 GB GTX 1650 and has produced a continuous 420-word Hindi sample withou…
Downloads · 30 days
0
Access
Public
Updated Aug 10, 2026
Repo size
408 MB
Likes
0
Public
Click a slice to open those files.
.onnx400 MB · 98%
From the Hugging Face model README
Local Hindi text-to-speech using an FP16 F5-TTS transformer, ONNX Runtime CUDA, and a short male reference recording. This build is working on a 4 GB GTX 1650 and has produced a continuous 420-word Hindi sample without reducing the 16-step flow schedule.
The inference driver is
../test_f5_hindi_onnx.py. The Colab audiobook
workflow is
../F5_Hindi_ONNX_Audiobook_Colab.ipynb.
ORT_ENABLE_ALL.These measurements are specific to this machine and should not be treated as universal model benchmarks.
| Component | Tested configuration |
|---|---|
| GPU | NVIDIA GeForce GTX 1650, 4 GiB, Turing/SM 7.5 |
| CPU | Intel Core i5-10300H, 4 cores / 8 threads |
| System RAM | 15 GiB |
| NVIDIA driver | 610.43.03 |
| CUDA | 13.x |
| ONNX Runtime | 1.28.0 GPU package |
| Transformer precision | FP16 |
| Flow steps | 16 |
| Output | PCM S16LE, 24,000 Hz, mono |
| File | Approximate size | Purpose |
|---|---|---|
F5_Transformer.onnx | 292.1 MiB | FP16 F5 flow transformer; executed 16 times per chunk |
F5_Preprocess.onnx | 33.7 MiB | Reference audio, text, mel, rope, and noise preparation |
F5_Decode.onnx | 55.7 MiB | Converts the final mel representation into 24 kHz audio |
F5_Metadata.onnx | 465 bytes | Export metadata graph |
vocab.txt | 355 bytes | Character-to-ID vocabulary with 105 entries |
Sample.wav | 331 KiB | Male Hindi reference voice, 24 kHz mono |
Sample.txt | 223 bytes | Exact transcript corresponding to Sample.wav |
test-output.wav | 471 KiB | Verified short story sample |
test-output-420-words.wav | 7.2 MiB | Verified 420-word long-form sample |
test-output-420-words.txt | 4.9 KiB | Exact text used for the long-form sample |
Do not rename or remove the four ONNX graphs, vocab.txt, Sample.wav, or
Sample.txt unless the paths in the driver are updated too.
Run commands from the repository root, one directory above this folder.
uv for the tested isolated runtime command.UV_CACHE_DIR=/tmp/f5-onnx-uv-cache \
UV_TOOL_DIR=/tmp/f5-onnx-uv-tools \
UV_PYTHON_INSTALL_DIR=/tmp/f5-onnx-uv-python \
uv run --with 'onnxruntime-gpu[cuda,cudnn]>=1.20' \
test_f5_hindi_onnx.py
Expected final line:
TEST_OK provider=CUDAExecutionProvider ... output=.../F5-HINDI/test-output.wav
F5_TEST_WORDS=420 \
F5_CHUNK_CHARACTERS=160 \
UV_CACHE_DIR=/tmp/f5-onnx-uv-cache \
UV_TOOL_DIR=/tmp/f5-onnx-uv-tools \
UV_PYTHON_INSTALL_DIR=/tmp/f5-onnx-uv-python \
uv run --with 'onnxruntime-gpu[cuda,cudnn]>=1.20' \
test_f5_hindi_onnx.py
This command reads part-1/output/Shadow_slave ep1.txt, uses its first 420
story words, transliterates Sunny to सनी, creates 17 chunks, and writes:
F5-HINDI/test-output-420-words.wavF5-HINDI/test-output-420-words.txtTo prepare and validate only the transcript without loading CUDA sessions:
F5_TEST_WORDS=420 \
F5_TRANSCRIPT_ONLY=1 \
UV_CACHE_DIR=/tmp/f5-onnx-uv-cache \
UV_TOOL_DIR=/tmp/f5-onnx-uv-tools \
UV_PYTHON_INSTALL_DIR=/tmp/f5-onnx-uv-python \
uv run --with 'onnxruntime-gpu[cuda,cudnn]>=1.20' \
test_f5_hindi_onnx.py
RTF is wall-clock generation time divided by produced audio duration. An RTF of 1.0 is real-time; lower is faster. These are single-run measurements, not multi-run statistical benchmarks.
| Configuration | Audio | Time | RTF | RMS | Result |
|---|---|---|---|---|---|
Basic CUDA .run() | 9.92 s | 34.97 s | 3.525 | 0.1815 | Working baseline |
| CUDA with I/O binding | 10.05 s | 35.35 s | 3.519 | 0.1800 | Quality preserved; no meaningful speed gain |
| CUDA Graph experiment | 10.05 s | 44.01 s | 4.380 | 0.1800 | Slower; rejected |
| Final CUDA short test | 10.048 s | 35.25 s | 3.509 | 0.1800 | Current configuration |
| Final 420-word test | 156.425 s | 561.05 s | 3.587 | 0.1751 | 17 chunks, successful |
The final 420-word output contains approximately 2 minutes 36 seconds of audio and required approximately 9 minutes 21 seconds to generate. Its duration includes a 180 ms pause appended to every chunk.
The CUDA Graph waveform differed from the CUDA baseline by less than one 16-bit PCM step at its peak (difference peak about -90.3 dBFS). Quality was effectively preserved, but runtime became worse because graph-capture overhead dominated the small number of replays.
One 400-word call is not valid for this export. Preprocessing estimates the
required sequence length, and each ONNX call is limited to max_duration <= 4096. Long-form text therefore uses this pipeline:
vocab.txt.Generating out of order does not reorder the audiobook: chunk filenames retain the original story index, and assembly always reads them in story order.
The first 420-word attempt generated eight chunks and then failed at story chunk 9 with:
Failed to allocate memory for requested buffer of size 304166400
The chunk itself was not too large. On a clean retry it generated successfully. The failure came from variable-length allocations fragmenting the 4 GiB CUDA arena.
The working configuration uses both of these measures:
("CUDAExecutionProvider", {"arena_extend_strategy": "kSameAsRequested"})
This retry completed all 17 chunks without reducing precision or flow steps.
Memcpy node. It may have a small negative effect,
but removing it has not yet been validated.part-1/output/Shadow_slave ep1.txt.Sunny.Sample.wav and the
exact Sample.txt transcript.vocab.txt is a character vocabulary with 105 entries. It covers a practical
subset of Devanagari, common Hindi matras, nukta, ASCII digits, basic ASCII
punctuation, and the danda ।. It is small and predictable, but it is the main
language-coverage limitation.
Sunny, Shadow, acronyms, URLs,
and English technical terms must be transliterated before inference.०१२३४५६७८९ are absent even though ASCII digits 0-9 are
present.ङ is absent. The current driver changes it to anusvara ं so
the sample transcript works. That is acceptable for this tested name but is
not a linguistically correct universal substitution, especially for Sanskrit
text.ऽ, ॥, ॐ, ळ, and
Vedic marks are absent.The driver intentionally raises Unsupported characters before inference.
Do not replace this with silent character deletion; silent deletion can change
names, numbers, and meaning without making the failure visible.
vocab.txtAdding a new line to vocab.txt does not teach the model the sound of that
character. A new vocabulary ID also needs a corresponding trained text
embedding. Changing only the text file can cause an embedding-index error or
untrained, unpredictable pronunciation.
Safe vocabulary expansion requires:
Useful future regression examples should include:
कंगन, गंगा, अँगना, and शङ्कर to distinguish nasal forms.क़िला, ख़बर, ग़ज़ल, ज़मीन, फ़र्क़, ड़, and ढ़ for nukta.क्ष, त्र, ज्ञ, and श्र.CUDA Graph capture kept the output numerically equivalent at 16-bit playback precision but made the short test slower: 44.01 seconds instead of about 35.3 seconds. Dynamic sequence shapes and capture overhead make it a poor default for this workload. It should only be revisited with fixed-shape buckets and multiple repeated calls per captured shape.
ONNX Runtime 1.28 expected TensorRT 10 libraries. A matching TensorRT 10.16 CUDA runtime was tested, but its library wheel exceeded 3 GiB, the temporary runtime expanded to about 20 GiB, and the optimization-level-5 engine build was interrupted before an engine cache was serialized. No TensorRT speed result was obtained.
The temporary project cache and incomplete download were removed. TensorRT is not required by the working CUDA path. Revisit it only on a machine with ample disk/RAM and enough time for a full cold engine build, then compare warm runtime and audio before keeping it.
| Setting | Recommendation |
|---|---|
| Precision | FP16 transformer |
| Flow steps | 16 |
| Chunk size | Start at 160 characters; reduce if a different book exceeds VRAM |
| CUDA arena | kSameAsRequested |
| Generation order | Largest chunk first; assemble by original index |
| GPU workers | 1 |
| Audio writer workers | 1 background worker |
| Pause | 180 ms starting point |
| Reference | Clean 3–12 second Hindi speech with exact transcript |
| Output | 24 kHz mono PCM16 during generation; encode the final audiobook afterward |
CUDAExecutionProvider is unavailableConfirm that an NVIDIA GPU is visible and run with the GPU package, not the CPU package:
nvidia-smi
The driver calls ort.preload_dlls() so CUDA and cuDNN libraries installed by
the ONNX Runtime package can be loaded before sessions are created.
Unsupported charactersDo not remove the assertion. Normalize or transliterate every reported symbol,
then run transcript-only mode again. If the character is genuinely required,
follow the vocabulary fine-tuning process rather than editing vocab.txt
alone.
max_duration exceeds 4096Reduce F5_CHUNK_CHARACTERS. Start with 140 or 120 on a difficult passage.
Byte length and reference-text length affect the estimate, so equal character
counts do not always create equal duration.
arena_extend_strategy=kSameAsRequested.F5_CHUNK_CHARACTERS if the largest chunk itself fails on a clean
process.Check, in order:
Sample.txt exactly matches what is spoken in Sample.wav.The original Hindi checkpoint used for this ONNX package came from
SPRINGLab/F5-Hindi-24KHz,
including model_2500000.safetensors / model_2500000.pt. The original
checkpoint, Vocos files, conversion cache, and training configuration are not
kept in this cleaned runtime folder; they are redownloadable from the model
source.
Before redistributing the ONNX files or generated voices, review the current model license and the reference speaker's consent/usage rights. Use only voices you own or have permission to clone.