Kazeia-engine/dist/jni
Richard Loyer 7a998dec6b chantier B TTS #4: P3.1+P3.2 = x_vector + prefill_embeds depuis input_ids (bit-exact)
P3.1 - x_vector Damien dumpe offline : tts.model.extract_speaker_embedding(damien_15s_24k.wav)
-> f32[1024] = 4 KB. Embed dans l'app comme ressource. Pas de port du speaker
encoder Python (8.9M params), voix fixe = pre-calcul trivial.

P3.2 - reproduction C++ de la construction Python des talker_input_embeds.
Reference modeling_qwen3_tts.py:2124-2233 (mode x_vector_only + non_streaming).
Sequence prefill (19 positions pour 'Bonjour je m'appelle Kazeia', 8 tokens texte):
  0..2  : text_projection(text_embed[input_ids[:3]])                  role <im_start>assistant\n
  3..7  : tts_pad + tok_embd[think/think_bos/lang_fr/think_eos/x_vec]  5 positions codec prefix
  8     : tts_bos + tok_embd[codec_pad]                                 1 position
  9..N+8: text_projection(text_embed[input_ids[3:-5]]) + tok_embd[codec_pad]   text body
  N+9   : tts_eos + tok_embd[codec_pad]
  N+10  : tts_pad + tok_embd[codec_bos]
ou tts_*_embed = text_projection(text_embed[tts_bos/eos/pad_token_id]).chunk(3).

Composants : text_embed [151936, 2048] f32 (1.21 GB, a quantiser en P3.5),
text_projection ResizeMLP(2048->2048->1024, SiLU, bias=True), tok_embd talker
[3072, 1024], x_vector [1024], constants (special token ids).

Validation host (g++ -O2) sur phrase 'Bonjour je m'appelle Kazeia' :
  mean_rmse = 3.2e-8, max_abs = 1.8e-6 sur les 19 positions vs prefill_embeds
  capture du dump Python -> noise pure du f32 (eps ~1.2e-7).
Construction bit-exact.

Reste pour usage texte arbitraire : tokenizer BPE Qwen3 en C++ (llama_vocab
supporte cela en standard, a brancher en P3.4 quand on assemble la lib finale).
Pour l'instant input_ids dumpes depuis Python pour 1 phrase fixe = suffisant
pour P3.3 (integration CP) et P3.4 (assemblage).

Fixtures /opt/Kazeia/tts_talker_dump/ : text_embed.bin, tp_fc1_w/b.bin,
tp_fc2_w/b.bin, damien_xvector.bin, input_ids_full.bin, manifest_text.txt.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 15:05:23 +02:00
..
EngineLlmEngine.kt chantier B TTS #1: API JNI embeds-only + M-RoPE qwen3 dense 2026-05-28 13:37:17 +02:00
build_prefill.cpp chantier B TTS #4: P3.1+P3.2 = x_vector + prefill_embeds depuis input_ids (bit-exact) 2026-05-28 15:05:23 +02:00
dual_ctx.cpp dist: prefill HTP = CASSÉ (sortie charabia), prefill obligatoirement CPU 2026-05-27 09:42:59 +02:00
dual_ctx_mt.cpp dist: JNI option C câblé (prefill HTP / decode CPU), validé multi-tour 2026-05-27 10:24:55 +02:00
kazeia_engine_jni.cpp chantier B TTS #2: fix M-RoPE positions en embeds-mode + validation bit-exact 2026-05-28 13:54:03 +02:00
test_engine.c Valide device: generate() bout-en-bout OK (test_native), bridge pret integration 2026-05-24 22:05:44 +02:00
test_engine.cpp Valide device: generate() bout-en-bout OK (test_native), bridge pret integration 2026-05-24 22:05:44 +02:00
test_jni_native.cpp dist: multi-tour propre (generateRaw + ChatSession) + JNI validé end-to-end natif 2026-05-27 11:18:20 +02:00
test_native.cpp v4 fix #277: ngl0 CPU decode 14tok/s, 4s/tour, usable 2026-05-25 10:18:31 +02:00
test_talker.cpp chantier B TTS #1: API JNI embeds-only + M-RoPE qwen3 dense 2026-05-28 13:37:17 +02:00
test_talker_replay.cpp chantier B TTS #2: fix M-RoPE positions en embeds-mode + validation bit-exact 2026-05-28 13:54:03 +02:00
tts_orchestrate.cpp chantier B TTS #3: orchestration ggml-side bit-exact + WAV E2E sur tablette 2026-05-28 14:25:18 +02:00