Skip to content

Add zipvoice + pocket zero-shot voice-cloning support - #21

Closed
willwade wants to merge 2 commits into
sync-registry-v2026-08-18from
zipvoice-pocket-support
Closed

Add zipvoice + pocket zero-shot voice-cloning support#21
willwade wants to merge 2 commits into
sync-registry-v2026-08-18from
zipvoice-pocket-support

Conversation

@willwade

Copy link
Copy Markdown
Contributor

Stacked on #20 (needs the v2026-08-18 registry for the new model ids). Adds full engine support for the two new zero-shot model families so they synthesise instead of erroring with Unsupported SherpaOnnx model_type.

What's added

Config builders (sherpa-onnx crate 1.13.5 already ships both config types):

  • build_zipvoice_config — encoder/decoder (int8 preferred), tokens/lexicon/espeak-ng-data, plus the non-bundled vocos_24khz.onnx vocoder resolved model-dir-first then the shared base dir (same convention as Matcha). Missing vocoder → clear error with the download URL, not a C++ create() failure.
  • build_pocket_config — int8 preference for lm_flow/lm_main/decoder; encoder + text_conditioner are never quantised upstream so plain .onnx is picked; JSON sidecars.

Zero-shot reference handling — both models clone a voice from a reference clip delivered via GenerationConfig:

  • New credentials: referenceAudio (path to 16-bit PCM wav) and referenceText (zipvoice requires the clip's exact transcript)
  • Defaults: the bundled test_wavs/ clip; known transcript for sherpa-onnx's leijun-1.wav is built in
  • Minimal RIFF reader (16-bit PCM, stereo downmix, actionable errors for float/other formats)
  • num_steps from the sherpa-onnx docs (zipvoice 4, pocket 2)

CI: 3 new live tests (linux-only, like supertonic) + workflow downloads incl. the vocos vocoder.

Validation

  • 9 new unit tests: builder int8/plain resolution, vocoder fallback + error, wav reader round-trip/rejection, reference-wav ordering, transcript override/known/error paths
  • Live tests run locally against the real modelszipvoice_clones_bundled_reference_voice, zipvoice_reference_transcript_override, pocket_synthesises_with_bundled_reference all synthesise non-empty audio
  • Full suite green (189 lib + all integration), clippy clean

After #20 merges this PR can be retargeted to main (GitHub does it automatically).

…nx engine

Both model types from registry v2026-08-18 now synthesise instead of
erroring with 'Unsupported SherpaOnnx model_type':

- build_zipvoice_config: encoder/decoder (int8 preferred), tokens,
  lexicon, espeak-ng-data, and the non-bundled vocos_24khz.onnx
  vocoder resolved from the model dir then the shared base dir (the
  matcha convention) — a missing vocoder errors with the download URL
  instead of failing inside sherpa-onnx's create().
- build_pocket_config: lm_flow/lm_main/decoder int8 preference;
  encoder + text_conditioner are never quantised upstream, so the
  plain .onnx files are picked; vocab.json + token_scores.json
  sidecars.
- Zero-shot cloning needs a reference clip via GenerationConfig:
  referenceAudio/referenceText credentials override the bundled
  test_wavs clip (zipvoice additionally requires the clip's exact
  transcript; the bundled leijun-1.wav transcript is known). Adds a
  minimal RIFF reader for 16-bit PCM wavs (stereo downmix, clear
  errors for other formats). num_steps defaults from the sherpa-onnx
  docs (zipvoice 4, pocket 2).
- Live tests + workflow steps for both models (linux-only, like
  supertonic) incl. the vocos vocoder download.

Verified locally against the downloaded models: all three new live
tests synthesise non-empty audio; 9 new unit tests cover the config
builders, wav reader, and reference resolution.
Attributes on expressions are still experimental on the stable
toolchain CI pins; the function-level allow covers the same downmix
cast.
@willwade
willwade deleted the branch sync-registry-v2026-08-18 August 18, 2026 04:28
@willwade willwade closed this Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant