Skip to content

feat(server): load the Kokoro letter-to-sound model from a data wheel in the default bundle - #1068

Merged
ShaiShmuel merged 2 commits into
mainfrom
feat/kokoro-g2p-wheel
Dec 1, 2026
Merged

ShaiShmuel merged 2 commits into
mainfrom
feat/kokoro-g2p-wheel

Conversation

@ShaiShmuel

@ShaiShmuel ShaiShmuel commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #1066; follow-up to #1063.

What changed

  • The default bundle installs mini-bart-g2p-snapshot, a data-only wheel holding the unmodified cisco-ai/mini-bart-g2p files (config, tokenizer, model.safetensors, license, model card) at the revision models/hexgrad__Kokoro-82M.yaml pins. It is declared by URL in default.yaml. The three default bundle locks pin it by sha256 and gain only this package (recompiled with uv 0.9.28 and the recorded cutoffs).

  • The Kokoro-82M adapter resolves the letter-to-sound model in this order:

    1. a local directory named by g2p_model;
    2. the installed mini_bart_g2p_snapshot package, when its repository and revision equal the configured g2p_model and g2p_revision;
    3. the Hub or its cache, as before.

    A snapshot of another model or revision is never used. The package is optional, because the published server distribution cannot declare a URL requirement, so a plain sie-server install keeps the previous behaviour. One info line records the source.

  • README and NOTICE describe the data wheel.

Why

With the default bundle, load() no longer needs Hub access for the letter-to-sound model. A server without Hub access needs only the Kokoro checkpoint in its cache.

The default bundle grows by about 16 MB installed.

How it was tested

Check Result
mise run lint, mise run typecheck pass
mise run test 21069 passed, 747 skipped
Kokoro adapter and bundle coverage tests 73 passed
python tools/ci/bundle_lock.py check (all targets) pass
test_bundle_image_resolution.py with SIE_RUN_IMAGE_RESOLUTION=1 19 passed
check_public_tree.py pass

The new unit tests use a stubbed package and cover each resolution step: the snapshot is used without a checkpoint lookup; it is ignored when its repository or revision differs, or when another revision is configured; a local directory wins; a missing package or a missing snapshot directory falls back.

Served on one NVIDIA L4 from the recompiled cuda12-default-amd64 lock, with only the Kokoro checkpoint cached and HF_HUB_OFFLINE=1:

  • the model loaded from the installed package, and nothing for cisco-ai/mini-bart-g2p appeared in the Hub cache;
  • out-of-lexicon text was spoken, with no item errors;
  • word error rate matched the previous build: 0.80 to 0.83% on the 826-word passage and 19.0 to 19.1% on the hard text (Whisper small.en);
  • realtime factor 70 to 71x over two runs; the previous build measured on the same day gave 72x;
  • with the package hidden, the same offline load fails, as expected.

Limits

  • Changing g2p_model or g2p_revision away from the pinned values falls back to Hub resolution.
  • Other bundles do not ship the wheel.

Summary by CodeRabbit

  • New Features
    • Default CPU and CUDA bundles now include the pinned Kokoro letter-to-sound model snapshot. When the configured model and revision match, Kokoro can load it without retrieving it from the Hub.
    • Kokoro continues to use an existing local model directory first, and falls back to the Hub or cache when the bundled snapshot is unavailable or doesn’t match the configuration.
  • Documentation
    • Updated setup guidance to explain when the bundled snapshot is used and when Hub or cache resolution applies.

@ShaiShmuel
ShaiShmuel requested a review from a team as a code owner November 30, 2026 17:26
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The default bundle now includes a pinned G2P data wheel. The Kokoro adapter uses a local G2P directory first, then a matching installed snapshot, and otherwise resolves the configured model from the Hub or cache.

Changes: Kokoro G2P Snapshot

Layer / File(s) Summary
Declare and lock the snapshot package
packages/sie_server/bundles/default.yaml, packages/sie_server/bundle-locks/*/pylock.toml, packages/sie_server/bundle-locks/*/manifest.json
The default bundle adds the pinned G2P data wheel. The CPU and CUDA bundle locks add the package, and their manifests update the requirements and lock hashes.
Resolve and document the G2P snapshot
packages/sie_server/src/sie_server/adapters/kokoro/adapter.py, packages/sie_server/tests/adapters/test_kokoro.py, packages/sie_server/README.md, packages/sie_server/src/sie_server/adapters/kokoro/NOTICE
The adapter checks a local directory, then a matching installed snapshot, then Hub or cache resolution. Tests cover matching and fallback cases. The README and NOTICE describe the data wheel and fallback behavior.

Sequence Diagram(s)

sequenceDiagram
  participant KokoroAdapter
  participant InstalledSnapshot
  participant HubCache
  KokoroAdapter->>KokoroAdapter: Check for an existing local G2P directory
  alt Local directory exists
    KokoroAdapter-->>KokoroAdapter: Use local directory
  else No local directory
    KokoroAdapter->>InstalledSnapshot: Check repository, revision, and snapshot directory
    alt Matching snapshot exists
      InstalledSnapshot-->>KokoroAdapter: Return snapshot directory
    else Snapshot is missing or does not match
      KokoroAdapter->>HubCache: Resolve configured repository and revision
      HubCache-->>KokoroAdapter: Return resolved directory
    end
  end
Loading

Possibly related PRs

  • superlinked/sie#1063: Introduces the G2P model and revision options that the adapter uses to determine whether the installed snapshot matches.
  • superlinked/sie#1060: Introduces the Kokoro adapter and the model-loading path modified here.
  • superlinked/sie#1066: Updates the sie-server dependency manifest and bundle locks that this PR also changes.

Suggested reviewers: svonava, mamayer19

Merge Risk: Minimal · up to aba3a

The default bundle now ships a pinned letter-to-sound model so Kokoro can load it without Hub access. Fallback to the previous Hub behavior is preserved when the package is absent or does not match the configured model and revision. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the default bundle now loads the Kokoro letter-to-sound model from a data wheel. The changeset adds the mini-bart-g2p-snapshot wheel to the default bundle and locks, a…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the default bundle now loads the Kokoro letter-to-sound model from a data wheel. The changeset adds the mini-bart-g2p-snapshot wheel to the default bundle and locks, and the Kokoro adapter prefers that package when its repository and revision match the configuration. The title is specific and uses the conventional commit format. It omits the revision-match condition and the Hub fallback, which is acceptable for a title.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: f8c5158f-abb5-483d-8fe7-dbf28241d33e
Commits

Reviewing files that changed from the base of the PR and between 2655cd9 and aba3ac3.

Files selected for processing: 4

  • packages/sie_server/bundle-locks/cpu-default-amd64/manifest.json
  • packages/sie_server/bundle-locks/cpu-default-arm64/manifest.json
  • packages/sie_server/bundle-locks/cuda12-default-amd64/manifest.json
  • packages/sie_server/bundles/default.yaml

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Base automatically changed from fix/kokoro-server-manifest to main November 30, 2026 21:23
coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 30, 2026
Add mini-bart-g2p-snapshot to the default bundle by URL. The wheel holds
the unmodified cisco-ai/mini-bart-g2p files (config, tokenizer,
model.safetensors, license, model card) at revision 0fbbf8c5, the
revision models/hexgrad__Kokoro-82M.yaml pins, and exposes their
directory as mini_bart_g2p_snapshot.SNAPSHOT_DIR. It is pure Python data
with no dependencies and adds about 16 MB to an installed environment.

Recompile the three default bundle locks with uv 0.9.28 and the cutoffs
recorded in their manifests (--exclude-newer 2026-10-18T00:00:00Z,
--root-exclude-newer 2026-11-06T20:00:00Z). Each lock gains this one
package, pinned by sha256 1f24568899c541796c37c10b146994c6682073fd61384507e016fa8907408194;
no other package moves. A URL archive carries no upload time, so the
cutoffs do not apply to it.
…d snapshot

The Kokoro-82M adapter resolved cisco-ai/mini-bart-g2p through the Hub
or its cache at load. It now looks in three places, in order:

1. g2p_model names a local directory: use it, as before.
2. The mini_bart_g2p_snapshot package is importable and its REPO_ID and
   REVISION equal the configured g2p_model and g2p_revision: use its
   SNAPSHOT_DIR, with no Hub call and no cache lookup.
3. Otherwise resolve the model from the Hub or its cache, as before.

A snapshot of another model or revision is never used in place of the
configured one. The package is optional: the default bundle installs it
from a URL wheel, which the published server distribution cannot
declare, so a missing package falls through to step 3. One info line
records which source was used. Synthesis is unchanged.

Tests cover each step with a fake package in sys.modules, including that
the letter-to-sound model is not resolved when the snapshot is used.
The README and NOTICE describe the data wheel.
@ShaiShmuel
ShaiShmuel added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 67e439e Dec 1, 2026
52 checks passed
@ShaiShmuel
ShaiShmuel deleted the feat/kokoro-g2p-wheel branch December 1, 2026 09:17
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