Repository navigation
whisper.cpp backend: export a usable encoder bundle, and fix the stale fork docs - #275
Merged
Merged
Conversation
ggml-org/whisper.cpp#3905 merged 2026-09-18, so the two "in a fork" notes in the encoder benchmark README are stale. Records how it is enabled (the ANEFORGE_ENCODER / ANEFORGE_DYLIB env vars) and adds the integration to the feature list, where it was missing entirely.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…out, any size) export_bundle.py produced a bundle that could not be used with the whisper.cpp ANEForge backend: make_encoder() gives randomly-initialised weights, and build(attn="mha") is the generic [seq,d] layout the README clocks at ~33 ms, not the channels-first query-tiled encoder the 5.7 ms and 2x-vs-CoreML numbers come from. It was also whisper-tiny only. Defaults now to the trained checkpoint via real_encoder() and build_cf, adds --model (dimensions read from the HF config through the new set_dims), --layout, --compress, and keeps the old behaviour behind an explicitly-labelled --random. The manifest records which model, layout and dims produced the bundle. Verified: tiny exports at cosine 0.999970 and the C++ runner loads it the way whisper.cpp does at 5.569 ms/call, matching the benchmarked 5.7 ms; base exports at cosine 0.999961 with dims picked up from the config (d=512, layers=6, heads=8).
sbryngelson
added a commit
that referenced
this pull request
Sep 18, 2026
#276) #275 fixed the weights and the layout but not the file contract. whisper.cpp's ANEForge backend reads ports.txt (three "name nelems" lines in mel, pos, output order) and pos.f16 from the bundle root; export_bundle.py wrote neither, so the bundle still could not be loaded upstream. The verification in #275 went through our own whisper_ane_run.cpp, which reads manifest.json instead -- a different contract, which is why it passed. Ports are matched by shape rather than creation order: mel comes back as t1 and pos as t0, so position would have swapped them. Verified by compiling whisper.cpp's own src/aneforge/whisper-aneforge.cpp against the bundle: whisper_aneforge_init() succeeds ("encoder ready (mel=t1 pos=t0 out=t1383)") and the encode output matches the torch reference at cosine 0.999970.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ggml-org/whisper.cpp#3905merged on 2026-09-18, so the encoder is an optional backend upstream. Two things on this side hadn't caught up: the benchmark README still said "in a fork" in two places, andexport_bundle.py-- the only thing that produces whatANEFORGE_ENCODERloads -- emitted a bundle nobody could use.The bundle was unusable
This is the part that isn't docs.
export_bundle.pycalledmake_encoder()(randomly-initialised weights) andbuild(attn="mha")-- the generic[seq,d]layout this README clocks at ~33 ms, not the channels-first query-tiled encoder the 5.7 ms and 2x-vs-CoreML numbers come from. It was whisper-tiny only.So anyone told to point
ANEFORGE_ENCODERat a bundle would have got one that transcribes noise and runs slower than Metal.How
Default to the trained checkpoint (
real_encoder) in the benchmarked layout (build_cf).--modeltakes any Whisper repo id tiny..medium; the dimensions come from its HF config through a newset_dims, since the graph builders read them as module globals.--compress int4matches how medium is benchmarked,--layout seqkeeps the old build for comparison, and--randomkeeps the old weights behind an explicit flag that says the bundle does not transcribe. The manifest records model, layout and dims.Docs: both "in a fork" notes now point at the upstream PR, the README gains the export recipe and the two env vars, and the feature list gains the integration, which it was missing entirely.
Verification
ruff check .cleanNo benchmark numbers changed. The existing caveats -- encoder only, energy measured against eager MPS, single-clip transcript rather than dataset WER -- stay as they were.