Skip to content

fix(kokoro): accept published GGUF tensor names + emit F16 weights (#9588)#36

Merged
lalalune merged 1 commit into
mainfrom
fix/9588-kokoro-tensor-names-on-main
Jun 25, 2026
Merged

fix(kokoro): accept published GGUF tensor names + emit F16 weights (#9588)#36
lalalune merged 1 commit into
mainfrom
fix/9588-kokoro-tensor-names-on-main

Conversation

@lalalune

Copy link
Copy Markdown
Member

Fixes the loader/converter side of elizaOS/eliza#9588. The fused-lib loader required unprefixed dev tensor names while the published elizaOS Kokoro bundles use the kokoro.* / mainline llama.cpp namespace, so kokoro_init_from_file failed its weight sanity check for every available GGUF and the engine silently fell through to OmniVoice/stub.

Changes

  1. kokoro-tensor-names.h centralizes the accepted tensor-name variants (published kokoro.bert.token_embd.*, mainline kokoro.bert.layer.*, and legacy unprefixed bert.embd.tok.*); require_tensor_any() resolves them at load. Missing required tensors are now a hard load error instead of the old "non-fatal during J2 — treat absent tensors as zero" path that produced noise and masked the failure.
  2. Converter emits weight matrices / conv kernels (ndim >= 2) as F16, biases/norms stay F32 — the dtype layout the fused forward pass expects. All-F32 GGUFs load but synthesize noise. The stub emitter also writes kokoro.gen.conv_post.{weight,bias} for the new required-tensor check.
  3. test_kokoro_tensor_names.cpp (LLAMA_BUILD_TESTS-gated) covers published, mainline, legacy, and missing-tensor cases.

Verification

  • test_kokoro_tensor_names.cpp compiles + passes (clang++ -std=c++17).
  • kokoro.cpp recompiles cleanly against the new header (make kokoro_lib, Apple Metal Release).

The matching eliza submodule pin bump is elizaOS/eliza#9684 (that PR pins to the same delta on the eliza-tracked lineage; this PR lands it on main so future pin bumps don't regress it).

🤖 Generated with Claude Code

…9588)

The fused-lib loader required unprefixed dev tensor names (bert.embd.tok.weight,
pred.F0_proj.weight, dec.gen.conv_post.weight) while the published elizaOS Kokoro
bundles use the kokoro.* namespace and mainline llama.cpp names
(kokoro.bert.layer.attn_q.weight). The loader, the shipped GGUF, and the in-tree
converter all disagreed, so kokoro_init_from_file failed its weight sanity check
for every available GGUF and the engine silently fell through to OmniVoice/stub.

Two root causes, two fixes:

1. Tensor-name mismatch. Centralize the accepted name variants in
   kokoro-tensor-names.h (published + mainline + legacy dev) and look them up via
   require_tensor_any(). Required tensors are now a HARD load error instead of the
   old "non-fatal during J2 — treat absent tensors as zero" path, which produced
   shape-correct but acoustically degraded (noise) output and masked this bug.

2. All-F32 GGUFs load but synthesize noise. The converter now emits weight
   matrices / conv kernels (ndim >= 2) as F16 and keeps biases/norms F32, matching
   the dtype layout the fused forward pass expects. The stub emitter also writes
   kokoro.gen.conv_post.{weight,bias} so it passes the new required-tensor check.

Adds test_kokoro_tensor_names.cpp (LLAMA_BUILD_TESTS-gated) asserting the alias
picker resolves published, mainline, and legacy schemas and returns null when a
tensor is genuinely absent. Closes the loader half of #9588; regenerating +
republishing the bundle GGUF with this converter is the remaining ops step.
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c1a34580-bc32-4189-be54-29befa399da5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/9588-kokoro-tensor-names-on-main

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lalalune lalalune merged commit d3e5d75 into main Jun 25, 2026
16 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant