Skip to content

feat(pocket-tts): per-language mimi encoder conversion for voice cloning (FluidAudio #793) - #84

Open
Alex-Wengg wants to merge 1 commit into
mainfrom
feat/793-per-lang-mimi-encoder
Open

feat(pocket-tts): per-language mimi encoder conversion for voice cloning (FluidAudio #793)#84
Alex-Wengg wants to merge 1 commit into
mainfrom
feat/793-per-lang-mimi-encoder

Conversation

@Alex-Wengg

Copy link
Copy Markdown
Member

Companion to FluidInference/FluidAudio#871.

Every pocket-tts language pack ships its own mimi codec weights (all 87 mimi state-dict keys differ across languages, 43 of them encoder-side), so the shared English-traced mimi_encoderv2 produced wrong-codec latents for non-English live cloning — the root cause of the residual flaky/garbled non-English cloning that the FluidAudio #797 host-side reprojection could not fix.

convert_mimi_encoder_lang.py:

  • traces one encoder per language: the pack's mimi encoder + its flow_lm.speaker_proj_weight baked in (output lands directly in that pack's conditioning space — no host reprojection)
  • keeps the deployed fixed I/O contract: audio [1,1,240000]conditioning [1,125,1024], fp16
  • verifies CoreML parity against the reference _encode_audio on a real clip before accepting each artifact (all 9 non-English packs ≤1.7% relative, fp16-level)
  • trace-safety shims for pocket_tts 2.1.0: beartype.claw neutralized pre-import; apply_rope + stateless attention forward swapped for numerically identical static-shape versions (their shape arithmetic records int-tensor ops coremltools rejects). The parity reference is computed before the shims are installed so it can't mask them.

Artifacts published as v2.1/<lang>/mimi_encoderv3.{mlpackage,mlmodelc} on FluidInference/pocket-tts-coreml.

End-to-end result (reporter's 5.15 s reference, spanish_24l, 16 seeds): 7/16 intelligible with 4 noise runaways → 15/16, 0 runaways — parity with the PyTorch reference.

🤖 Generated with Claude Code

…ing (FluidAudio #793)

Every pocket-tts language pack ships its own mimi codec weights (all 87
mimi state-dict keys differ across languages, including the 43
encoder-side keys), so the shared English-traced mimi_encoderv2 produced
wrong-codec latents for non-English live cloning — the root cause of the
residual flaky/garbled output that the FluidAudio #797 host-side
reprojection could not fix.

convert_mimi_encoder_lang.py traces one encoder per language (that pack's
mimi encoder + its flow_lm.speaker_proj_weight baked in) with the same
fixed I/O contract as the deployed root encoder (audio [1,1,240000] ->
conditioning [1,125,1024]) and checks CoreML parity against the reference
_encode_audio on a real clip before accepting the artifact (all 9
non-English packs: meanAbsDiff <= 1.7% relative, fp16-level).

Trace-safety shims (pocket_tts 2.1.0): beartype.claw must be neutralized
before first import; apply_rope and the stateless attention forward are
replaced with numerically identical static-shape versions because their
shape arithmetic records int-tensor ops coremltools rejects. The parity
reference is computed before installing the shims so it cannot mask them.

Published as v2.1/<lang>/mimi_encoderv3.{mlpackage,mlmodelc} on
FluidInference/pocket-tts-coreml. Consumed by FluidAudio PR #871.
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