Skip to content

feat(model_spec): ship prebuilt RK3588 engines as rknn packages - #991

Merged
0xShug0 merged 1 commit into
0xShug0:mainfrom
wOvAN:rknn-prebuilt-engine-packages
Oct 19, 2026
Merged

0xShug0 merged 1 commit into
0xShug0:mainfrom
wOvAN:rknn-prebuilt-engine-packages

Conversation

@wOvAN

@wOvAN wOvAN commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

What

The RKNN sidecar path has always ended at "build the engine yourself on a PC with the pinned toolkit venv, then carry the file to the board by hand". The manager transports arbitrary files and never inspects them, so the only thing keeping .rknn out of the catalogue is the closed format enum:

  • schema.cpp: add rknn to source_formats(). One enum entry; the package validators (layout, package) and both managers are format-agnostic.
  • Three new packages in model_specs/, all default: false, all downloading from wOvANAI/rknn-tts-engines (public, LFS, README pins provenance and per-file SHA256SUMS):
    • piper_lessac_medium_decoder_rk3588 → piper-lessac-w93.rknn into Piper-TTS-GGUF/ (19.6 MB)
    • kokoro_82m_generator_rk3588 → generator_w512.rknn into Kokoro-82M-GGUF/ (93.5 MB)
    • qwen3_tts_0_6b_base_speech_decoder_rk3588 → the stateful pair (chunk 64 + chunk 16, 245 + 260 MB) into Qwen3-TTS-12Hz-0.6B-Base-GGUF/
  • docs/build/rockchip-npu.md: the packages lead the model-preparation section; the converter instructions stay as the path for every other SoC and for rebuilding from checkpoints.

Each package installs into the family's GGUF weight directory, so the existing bare-name resolution in engine_resources()/resolve_engine_path (a name that exists next to the model resolves to it; #975 documented it) lets a plan name the engine by file alone — no absolute board paths:

--session-option 'piper_tts.exec_plan={"decoder":{"impl":"rknn","artifacts":{"main":"piper-lessac-w93.rknn"}}}'

The engines are compiled per SoC, so the ids say RK3588. The CosyVoice3 flow ladder is deliberately not published (700–860 MB per rung × eight rungs); the repo and the doc say to build it per aperture.

Validation

PC (x86_64), worktree at 4faef969:

  • tools/check_loader_catalog_sync.py --self-test + full run: ok: ... in sync (394 manager packages, the three new ids included).
  • model_manager_v2.py sizes resolves all three ids against the live repo (19602065 / 93510403 / 504587157 bytes).
  • model_manager_v2.py install for all three: placed as designed (Piper-TTS-GGUF/piper-lessac-w93.rknn etc. — strip_prefix lands them beside the GGUFs) and all four files sha256sum -c OK against the repo's SHA256SUMS.
  • model_spec_system_test (the suite that validates every shipped spec) passes; schema.cpp compiles clean.

RK3588 board (Orange Pi 5 Plus, native aarch64 build with ENGINE_ENABLE_RKNN=ON, rebuilt after the change, 0 errors):

  • The same three install runs succeed from the board (direct HF access, librknnrt 0.9.8 / api 2.3.2).
  • Sidecar sessions run from the installed files with bare-name plans:
    • piper_tts offline, decoder.main=piper-lessac-w93.rknn → 145 KB wav, rms 3004, peak 18719
    • kokoro_tts offline, generator.main=generator_w512.rknn → 409 KB wav
    • qwen3_tts streaming (conv_weight_type=f16, --threads 4, --voice-ref assets/resources/b.wav --reference-text ...), speech_decoder.main/first = the installed pair → 365 KB wav, rms 3570, peak 25727
  • A/B for the resolution path: the installed Kokoro engine is byte-identical to the on-board production engine (sha256 20e09b6e… both), and the bare-name session vs the absolute-path session against it differ only by CPU float accumulation (95.9 dB SNR, max sample delta 79/32767).
  • Server guard A/B on the qwen3 config at --min-free-memory-mb 27300 (window between the two estimates on 30.6 GiB free): the RKNN plan is refused with estimated 3.49 GiB + 27300 MiB headroom exceeds available host memory (29.89 GiB) — 3.49 GiB is weights×1.5 + overhead + the pair's driver residency (594 MiB) — while the identical config with impl: ggml (2.91 GiB estimate) starts and answers /health. Engines installed by the manager are priced by the residency guard.
  • Unit tests already on main (rknn_engine_test, server_config_test, rknn_sidecar_test) pass on the board with the change.

A .rknn sidecar engine today has to be built on a PC with the pinned
rknn-toolkit2 venv and carried to the board by hand; the manager knows
every other weight format and refuses this one at the schema gate. Add
`rknn` to the spec format enum and publish the engines validated on the
RK3588 board as three packages — the Piper w93 decoder, the Kokoro w512
generator, and the Qwen3-TTS 0.6B stateful vocoder pair — downloading
into the family's GGUF weight directory, where the exec-plan resolver
already finds them by bare file name (engine_resources() falls back to
the model path's parent). The engines are compiled per SoC, so the
package ids say RK3588; other targets keep the converter path.
@0xShug0
0xShug0 merged commit 503dfb3 into 0xShug0:main Oct 19, 2026
1 of 7 checks passed
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.

2 participants