Commit Graph

1 Commits

Author SHA1 Message Date
Richard Loyer 2e0b145b51 chantier B TTS #3: orchestration ggml-side bit-exact + WAV E2E sur tablette
Le binaire dist/jni/tts_orchestrate.cpp boucle :
  prefill talker (talker_f32.gguf via engine) -> greedy CB0 depuis logits engine
  -> CB1..15 teacher-forces depuis codes_golden (CP non encore integre, mais
     deja valide bit-exact standalone)
  -> next_embed = talker.tok_embd[CB0] + sum_i cp_codec_embs[i-1, CB(i)] + tts_pad
  -> talker.decodeEmbed(next_embed) -> repeat
  -> dump codes_engine [N=26, 16] sur disque

Resultats end-to-end ('Bonjour je m'appelle Kazeia', N=26 frames, ~2.08s audio) :
  pipeline ggml-side sur tablette (talker engine + decoder existant) :
  - codes engine vs codes Python : 7/26 frames divergent (CB0 only) = sampling
    stochastique Python (subtalker_dosample temp=0.9) vs greedy engine. Attendu.
  - next_embed engine vs step_inputs_py: rmse=0 cos=1.000 a chaque step ou
    CB0 matche -> orchestration sum+pad strictement bit-exact.
  - WAV decoder tablet sur codes_golden vs PY_REF : cos=0.999999, rmse=3.9e-5
    (juste du noise int16 quantization, bit-exact pratique).
  - WAV decoder tablet sur codes_engine vs PY_REF : cos=0.999200, rmse=3.8e-3
    -> divergence audio uniquement du sampling, son audible et coherent.
  - WAV tablet vs host (memes codes) : cos=1.000000 -> decoder ggml deterministe.

Le seul ecart restant (cos=0.9992 engine vs PY_REF) est purement strategique
(sampling vs greedy), pas implementation. Engine ggml-side prouve fonctionnel.

Reste pour P3 finition (sessions suivantes) :
- Integrer le vrai CP runner (cp_runner.cpp) -> remplace teacher-forcing CB1..15
- Speaker Encoder x-vector (8.9M params) OU pre-calcul offline
- BPE tokenizer Qwen3-TTS + text_projection -> production prefill_embeds depuis texte FR
- Assemblage final en JNI (libkazeia_tts ?) utilisable depuis l'app Kotlin

Dump tools: /opt/Kazeia/tts_talker_dump/dump_talker.py (step I/O + logits)
            /opt/Kazeia/tts_talker_dump/dump_talker2.py (pad/bos/eos/codes/tables)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 14:25:18 +02:00