inflect-v2-coreml / README.md
alexwengg's picture
Inflect v2 Micro/Nano CoreML: fixed-shape encoder + bucketed synthesizers (fp16)
7889fea verified
|
Raw
History Blame Contribute Delete
2.92 kB
---
license: apache-2.0
language:
- en
pipeline_tag: text-to-speech
tags:
- coreml
- tts
- vits
- apple-silicon
- ane
base_model:
- owensong/Inflect-Micro-v2
- owensong/Inflect-Nano-v2
---
# Inflect v2 CoreML (Micro + Nano)
Fixed-shape CoreML conversion of [Inflect-Micro-v2](https://huggingface.co/owensong/Inflect-Micro-v2)
(9.36M params) and [Inflect-Nano-v2](https://huggingface.co/owensong/Inflect-Nano-v2) (3.97M params) β€”
ultra-tiny VITS-family end-to-end English TTS, 24 kHz mono, fp16.
Converted by [FluidInference](https://huggingface.co/FluidInference) (mobius);
conversion pipeline, parity checks, and benchmark harness live in the
`models/tts/inflect-v2/coreml/` directory of the mobius repo.
## Contents
```
micro/ 9.4M params, ~19 MB fp16 total per graph set
encoder.mlpackage tokens+mask -> m_p, logs_p, logw [t_text=512]
synthesizer_f{256,384,512,640,768,896,1024,2048}.mlpackage
z_p+mask -> waveform [bucket frames x 256 samples]
upstream_config.json
nano/ 4.0M params, ~8 MB fp16 per graph set (same layout)
symbols.json keithito-style symbol table (178 symbols, add_blank interspersal)
LICENSE Apache-2.0 (upstream)
```
## Inference pipeline
Two deterministic models with everything stochastic or dynamically shaped on the host:
1. espeak-ng `en-us` phonemization (with stress) β†’ symbol ids β†’ intersperse blanks (`pad_id=0`) β†’ pad to 512.
2. `encoder`: β†’ `m_p`, `logs_p`, `logw`.
3. Host: `w = ceil(exp(logw))/speed`; repeat-expand `m_p`/`logs_p` to `y_len` frames;
`z_p = m_p + randn * exp(logs_p) * noise_scale` (default 0.667).
4. Pick the smallest synthesizer bucket β‰₯ `y_len`; zero-pad `z_p`, mask valid frames.
5. `synthesizer`: reverse coupling flow + HiFiGAN β†’ waveform; trim to `y_len * 256` samples.
Buckets are fixed-shape for ANE compatibility; at 128-frame granularity padding
overhead is within ~5% of exact-shape synthesis.
## Benchmarks (M5 Pro, macOS 26.6, GPU, MiniMax-English 100 phrases)
| Variant | Synth p50 / p95 | Agg RTFx | WER* | CER* |
|---|---|---|---|---|
| Micro | 25.7 / 35.5 ms | 245Γ— | 1.43% | 0.44% |
| Nano | 13.2 / 16.9 ms | 460Γ— | 1.92% | 0.57% |
\* Parakeet TDT v3 roundtrip, same scoring path as the
[FluidAudio](https://github.com/FluidInference/FluidAudio) TTS benchmarks.
fp16 parity vs the PyTorch reference: audio correlation > 0.9999, predicted
durations bit-identical.
## Notes
- ANE: the synthesizer's waveform-rate tensors exceed the ANE width limit
(W ≀ 65536) above the 256-frame bucket; f256 reaches 77% ANE residency,
larger buckets run on GPU (which is faster at every size on M-series).
- English only, one voice per variant, no cloning. Sample rate 24 kHz.
- Upstream weights and frontend: Apache-2.0, Β© the Inflect authors. This repo
redistributes converted weights under the same license.