Repository navigation
feat(asr): add experimental Whistle community model - #824
Conversation
|
@BumpyClock Thank you for contributing a new model! Please reuse the existing framework modules (e.g., I did a quick test by rewriting only the first encoder layer’s attention as a GGML graph, and it showed a substantial performance gain while keeping the outputs numerically close. (avg of 20 warmed runs)
|
…odules Address maintainer review on 0xShug0#824: reuse framework modules and GGML graphs instead of model-specific CPU kernels. - Frontend reuses NemoMelFrontend (512-point FFT, 400-sample symmetric Hann, constant padding, natural-log mel, per-bin F64 normalization); Whistle's percentile gain normalization stays local. - The encoder (stem, eight mHC layers, final norm, positional table, and the decoder's cross-attention key/value projections) is one GGML graph built from Conv2d/DepthwiseConv2d/DepthwiseConv1d, Linear, GemmaRMSNorm, RoPE, Silu, and GLU modules. Model-local graph code covers mHC lane mixing with Sinkhorn normalization, the Kronecker-factored Hadamard MLP with its fixed permutations, and 48/64-wide grouped-query attention. - JAX [in, out] kernels are transposed once into the backend weight store; the converter and GGUF layout are unchanged. - Sessions accept the CPU and Metal backends; the host decoder no longer rejects builds without OpenMP. - whistle_assets_test gains --backend, --threads, --full, and a --reference mode that compares mel, encoder memory, and cross K/V against dumps and reports the error as a fraction of each tensor's largest magnitude. Against the previous host implementation on the full sample: CPU within 1.7e-06 of scale, Metal within 1.2e-03, identical transcripts on CPU 1/4 threads and Metal for the sample and seven 20-26 s multilingual clips. Sample CLI wall on M3 Ultra: 580 -> 479 ms (1 thread), 281 -> 224 ms (4 threads), 145 ms on Metal. Validation details in tests/whistle_asr/.
Resolve the README community-model table conflict by keeping main's VibeASR row wording and the Whistle row from this branch.
- Sinkhorn: subtract each row's exact log-sum-exp, recovered from the clamped softmax as sum(p * (x - log p)), instead of log(clamp(softmax)). The earlier form discarded differences between underflowed entries that a later column pass can amplify. - Use RMSNormModule, SiluModule, SigmoidModule, and SoftmaxModule in place of raw ggml calls, and a 1x1 Conv2dModule for the stem pointwise projections. - Remove the duplicate encoder.cpp entry from whistle_assets_test. - whistle_assets_test: reject non-finite reference values and add --dump so the current implementation can produce reference tensors. - Docs: explain the Metal drift (half-precision operand staging in kernel_mul_mm_f32_f32), record the reference-dump recipe, state the remaining host/graph math duplication and the ReLU-only subsampling module, and replace the headline timings with logged three-run measurements of commit 6e0a40c and this revision on the same machine.
|
Thanks for the review and the measurements. The branch now has a revision that moves the frontend and the whole encoder onto framework modules and a GGML graph. What changed
Numerical check against the previous host implementation (full 14.07 s sample, 176 encoder frames; largest |diff| as a fraction of each tensor's largest magnitude, via the new
One caveat on reproducibility: the reference dumps came from the old Transcripts are byte-identical across CPU 1 thread, CPU 4 threads, and Metal for the sample and for seven new 20-26 s synthetic clips (one per language, 45 CLI runs). The old host code was not run on those clips; they compare the new backends against each other. CTest 4/4 on macOS; the full-sample integration checks also pass on Timing (Apple M3 Ultra, macOS 27.0.1, Release, GGML_METAL=ON; CLI
So: single-thread CPU is unchanged within noise (the GGML F32 path is not faster than the hand loops at one thread, and the exact Sinkhorn adds about 1300 small nodes), four threads are modestly faster, Metal is about 1.6x faster than four CPU threads, and peak RSS is up about 150 MiB because encoder weights now live in the backend store while the decoder keeps host copies. Details, exact commands, and the per-language table are in |
Hi @BumpyClock Thanks for the quick turnaround. I'm happy to merge the PR as it stands, and a follow-up PR for the decoder would be much appreciated. |
|
I'll submit the follow up in the next day or so. |
|
The decoder follow-up is up as #843. The decoder now runs as a GGML step graph on |
* webui: let a studio panel run the page's request Model panels are registered per family, and the page always builds and sends the request itself. A conversation view has to send its own request and show the reply as it streams in, while it keeps the page's Run button, Ctrl+Enter, Cancel, elapsed time and status line. This adds that hook without changing what any existing panel does: - A panel entry may list the tasks it covers, such as tasks: ['s2s']. An entry without the list covers every task of its family, as before. - With requestMode 'panel', run() hands the request to the runner the panel registers through the page's registerPanelRunner, which the next commit passes to panels as setPanelRunner; registering returns the function that removes it. It passes the source audio, the resolved seed, Max tokens, Language, the request options and the abort signal that Cancel uses. The hand-off comes before anything is awaited, so the panel can start audio inside the Run click or key press. The reply the panel returns is shown in the Result column; these runs are not added to Run history. Missing source audio, a recording still running, or Run from a tab other than Studio is reported as a warning, like the page's other checks before a run. - With UI management the panel can ask for the entry in a given mode. This uses the page's ensureLoadedMode unchanged, after reloading an entry that is resident with another package or with imported settings that differ, as ensureLoaded does for the other runs. - api.ts gets taskStreamEvents, a reader for /v1/tasks/stream with "stream_format": "sse". It yields each event and then the result, throws the server's error message, and throws TaskStreamClosedError when the stream ends before task.stream.done. The done message carries the whole reply again and comes over many reads, so the reader keeps its pieces and joins them once, when the message ends. No panel uses requestMode 'panel' yet. * webui: LFM2.5-Audio conversation panel for speech-to-speech The LFM2.5-Audio speech-to-speech entries ran one question per Run, as a new conversation each time, and showed the reply only when it was done. The server can now carry a conversation (earlier turns sent as request artifacts) and stream a reply as server-sent events, so this gives the two S2S entries a page of their own, as asked on #828. The panel covers only the S2S entries; ASR and TTS keep the generic controls. It adds a conversation above the page's own Language, Seed, Max tokens, Source audio and Model parameters, which it uses as they are. Each Run: - uploads the recorded or chosen question, and sends it to /v1/tasks/stream with "stream_format": "sse" and return_codes, with each earlier turn as its question's upload path and the reply artifact that turn returned; - plays the reply as it streams in, its 80 ms chunks scheduled back to back on one Web Audio clock, and shows the reply text as it arrives; - adds the turn to a list with the question, the reply text and the reply audio, and clears the source picker for the next question. New conversation starts over, and Leave out drops an old turn from the next request, which is what the server asks for past its 8192-step limit. A failed or stopped turn, or one whose stream closed before its result, is never sent as history; the next Run takes its place. Starting a turn stops the previous reply, and Stop audio stops a reply that is still playing. If the browser does not let live audio start, the panel says so and the reply is in its player when it finishes. Finished turns are kept when the user opens another tab or entry and comes back (leaving the panel stops a turn still running), and a turn on the other checkpoint starts a new conversation. With UI management the entry is loaded in streaming mode when needed; on a server with a config file, an entry in offline mode is run through /v1/tasks/run and its reply shows when it is done. An S2S entry configured under an id that is not the catalog's gets the family's ASR parameters in Model parameters; turns leave those out and send the page's Max tokens. Each turn's players and its Leave out button are named with the turn number for screen readers, and its state badge is a polite live region. The page passes panels three more props for this: modelId, setPanelRunner, which is its registerPanelRunner, and clearSource, its own clearSourceFile. The other panels do not declare them and ignore them. model_params.json gets text_temperature and text_top_k for the two S2S entries, with the server's defaults, and the S2S hints and the model docs describe the conversation. * webui: rebuild the page Rebuilt from this branch's source with the lockfile (node 24.19.0, npm 11.17.0): cd webui/native npm ci npm run build The page on main was built from an older tree. It lacks changes to the model specs or the page from #824, #829, #830, #833, #834, #835, #846, #851, #853 and #854, so this rebuild also brings those into the page. Rebuilding main's own source the same way gives a page that differs from this one only in this branch's changes.
Summary
whistle_asras a community ASR family, following Welcoming Community Models && Using Model Spec v1 for New Models #54NemoMelFrontendmel features, the encoder as one GGML graph on framework modules (CPU and Metal), and a host-side autoregressive decoderwhistle_asrThe port lives under
src/community_models/whistle_asr/andinclude/engine/community_models/whistle_asr/.There are no framework or GGML changes. Recognition does not require Python or the Cactus engine.
Input is 16 kHz mono audio up to 30 seconds. Supported language codes are
en,de,fr,es,it,nl, andpl.Model setup and tested paths
The converter pins
Cactus-Compute/whistlerevisionb358ddadd89b7a713b5aa131f23032d3cca1b251.The source directory contains
whistle.safetensors,config.json, and the upstreamLICENSE.The official
whistle.cactremains outside it and supplies the tokenizer, filterbank, and permutations.The converter verifies input sizes/hashes and preserves FP32 weights with
--type orig.Exact local preparation/conversion commands:
Conversion passed. Inspection reported 116 tensors, six embedded sidecars, an embedded spec, and
model_spec_family=whistle_asr.The tested GGUF is
build/whistle/pr-prep/model/whistle-f32.gguf, 220831648 bytes.There is no downloadable model-manager package. The extracted Safetensors directory also loaded through the production CLI and produced the expected English transcript.
Exact build commands
Windows CPU. Commands ran from the repository root with an existing Ninja configuration:
GGML_NATIVE=OFF, OpenMP enabledAUDIOCPP_MODEL_SET=custom,AUDIOCPP_MODELS=whistle_asrAUDIOCPP_DEPLOYMENT_BUILD=ON,ENGINE_BUILD_TESTS=ONInitial CLI/converter/test build and opt-in model configuration:
Final build and tests after the tokenizer correction:
Builds passed. The final CTest run passed 4/4 in 3.93 seconds. Catalog self-tests passed 2/2; synchronization passed with 115 loaders and 113 specs.
An initial configure without the MSVC environment failed to find
kernel32.lib; repeating in the developer shell passed.Existing unrelated Safetensors catalog warnings remain unchanged.
Exact standalone run commands
English and German through the actual ASR CLI:
Standalone loading also passed with only the GGUF in its model directory, a fresh asset cache, and working directory
C:/Windows:No adjacent sidecars or working-directory
model_specstree were used. All six extracted sidecars matched source hashes.The embedded v1 spec takes precedence over workspace/builtin fallback; the GGUF metadata contains the updated community documentation path.
Repeated requests in one loaded CLI session:
Both requests produced identical transcripts.
coldnames the first request in the session; it does not mean OS-cache-cold.Path tests and transcript comparison
text_output=A fresh adversarial review identified invalid UTF-8 and byte-composed metaspace handling in detokenization.
The model-local decoder now joins visible token bytes, applies UTF-8 replacement decoding, and replaces metaspace globally.
The focused re-review found no remaining Critical or Important issue. This does not establish full-model numerical parity.
English FP32 output, using the complete 14.0719-second repository WAV:
The quantized official reference used
22,500instead oftwenty two thousand five hundred.Both paths produced this transcript for the existing 2.11594-second German WAV:
The cached reference ran with automatic language selection, four threads, and default/full decoder depth:
The
.cacthash matches the pinned converter input. The reference executable's source revision is unknown; its hash is recorded in the validation report.audio.cpp uses greedy decoding, no sampling, and a 320-text-token ceiling.
These are transcript comparisons with quantized official weights, not exact FP32 numerical parity. No pinned FP32 reference runtime was available.
Five-language synthetic checks
ElevenLabs CLI 1.4.0 generated one clip each for French, Spanish, Italian, Dutch, and Polish.
Generation used
eleven_multilingual_v2, voiceJBFqnCBsd6RMkjVDRZzb, seed 42, and rawpcm_16000.Python's standard-library
wavewrapped the PCM as mono signed-16 WAV without resampling.The generation commands, settings, prompts, WAV hashes, durations, and exact transcripts are in the linked five-language report.
Each clip passed automatic and forced-language CLI runs. All ten transcripts match the synthesis prompts after NFKC/case/punctuation normalization, preserving accents.
The CLI does not expose the returned transcript language field, so no measured internal language-tag claim is made.
The quantized reference matches four clips exactly. For Polish, audio.cpp produces
niebo; the reference producesnie bo.This difference is retained. One voice and one short clip per language are synthetic spot checks, not independent human annotations or a general accuracy corpus.
Performance per request
Measured on AMD Ryzen AI MAX+ 395, 16 cores/32 logical processors, Windows 11 Enterprise Insider Preview build 26704.
Build tools were MSVC 19.51.36257.0, CMake 4.4, and Ninja 1.13.2. The CLI used four CPU threads.
CLI wall timing excludes model/session creation and input loading; it includes preparation and inference.
RTF is inference seconds divided by input-audio seconds.
The five-language synthetic runs measured RTF 0.0392522–0.0570413 and peak working set 432–434 MiB.
All recorded RTFs are below the community guidance's 1.0 target. These are single local observations, not performance guarantees or leak testing.
A separate one-thread scratch probe measured asset loading at 23.7752 ms and runtime initialization at 150.822 ms.
Its first/repeated inference took 640.984/661.587 ms, RTF 0.0455505/0.0470146, with peak working set 467447808 bytes.
Those load timings use a different one-thread harness and are not included in the four-thread CLI inference figures.
The recorded timing samples precede the tokenizer correction; subsequent CLI checks verify unchanged transcripts, not a before/after performance claim.
CPU process memory is reported, not VRAM.
Generated artifacts
Local artifact paths:
build/whistle/pr-prep/model/whistle-f32.ggufbuild/whistle/pr-prep/{convert,inspect,cli-en,cli-de,batch,standalone-nonrepo}.logbuild/whistle/pr-prep/multilingual/{fr,es,it,nl,pl}.wavbuild/whistle/pr-prep/multilingual/generation-manifest.jsonbuild/whistle/pr-prep/multilingual/multilingual-validation.jsonbuild/whistle/pr-prep/multilingual/runs3/build/whistle/pr-prep/multilingual/reference-runs/build/whistle/pr-prep/tokenizer-fix/ctest.logbuild/whistle/pr-prep/tokenizer-fix/cli-runs/These are ignored local validation artifacts, not uploaded PR attachments or committed model/audio files.
Exact local input paths, hashes, commands, and output details are preserved in the committed validation reports.
The German clip's original recording provenance remains unestablished.
Backend coverage
No HTTP server runtime test is claimed. This PR does not modify server, framework, or GGML code.
Known limitations
Licensing and provenance
The pinned upstream model card and LICENSE declare Apache-2.0. The converter verifies and embeds that upstream LICENSE.
audio.cpp's repository license is not used as a substitute for model-weight or asset licensing.
Independent tokenizer/filterbank/permutation generation provenance remains unverified in the pinned release.
The contributor reports no copied/adapted reference code; no reference engine or reconstructed code is bundled.
No downloadable package, independently audited redistribution permission, or maintainer approval is claimed.
Documentation
Revision 2: framework modules and a GGML encoder graph
In response to the maintainer review, the frontend now reuses
NemoMelFrontendwith Whistle's gain normalization kept local, and the encoder runs as one GGML graph built fromConv2dModule,DepthwiseConv2dModule,DepthwiseConv1dModule,LinearModule,RMSNormModule,GemmaRMSNormModule,RoPEModule,SiluModule,SigmoidModule,SoftmaxModule, andGLUModule. Whistle-specific math (mHC lane mixing with Sinkhorn normalization, the Kronecker-factored Hadamard MLP, 48/64-wide grouped-query attention) stays inencoder.cpp. Sessions accept the CPU and Metal backends. The decoder still runs on the host. The converter and GGUF layout are unchanged, and no framework or GGML code is modified.Encoder parity against the host-only revision on the full sample: CPU within 4.5e-6 of each tensor's largest magnitude, Metal within 2.6e-3; transcripts byte-identical on CPU 1 thread, CPU 4 threads, and Metal for the sample and seven 20-26 s synthetic clips. Sample CLI wall on an Apple M3 Ultra, three runs each: host code 505-517 ms (1 thread) and 253-259 ms (4 threads); this revision 482-516 ms, 237-238 ms, and 157-164 ms on Metal. See
tests/whistle_asr/VALIDATION.mdandMULTILINGUAL_VALIDATION.md.