32 Commits

Author SHA1 Message Date
zhifu gao 65bbd29f60 docs: clarify llama.cpp speaker diarization support
Signed-off-by: zhifu gao <18321252+LauraGPT@users.noreply.github.com>
2026-08-13 02:15:55 +00:00
zhifu gao 62b784b2b9 docs: surface llama.cpp runtime v0.2.0 (#3484)
Signed-off-by: LauraGPT <18321252+LauraGPT@users.noreply.github.com>
2026-08-11 14:17:59 +08:00
zhifu gao 500956bc33 fix(vulkan): refresh ggml for AMD submission handling (#3482)
Refresh the pinned llama.cpp revision with AMD Vulkan submission batching and DeviceLost diagnostics, adapt the sampler API, and document Windows troubleshooting. Refs #3479.
2026-08-11 12:19:11 +08:00
Dingyuan Wang b0d44bd792 llama.cpp: add srt output (#3480)
Add optional SRT output to Fun-ASR-Nano, SenseVoiceSmall, and Paraformer llama.cpp runtimes. Preserve existing non-SRT output behavior and document VAD-aligned subtitle generation.
2026-08-11 11:27:36 +08:00
zhifu gao 6c3b47c2e5 docs: publish runtime v0.1.9 download links (#3399) 2026-07-23 19:38:51 +08:00
zhifu gao 9b918d74d7 feat(runtime): publish Windows Vulkan binary (#3398)
Build llama.cpp runtime binaries / build-linux-x64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-windows-x64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-linux-x64-avx2 (push) Has been cancelled
Build llama.cpp runtime binaries / build-windows-x64-avx2 (push) Has been cancelled
Build llama.cpp runtime binaries / build-linux-arm64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-macos-arm64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-windows-x64-vulkan (push) Has been cancelled
Build llama.cpp runtime binaries / build-windows-x64-cuda (push) Has been cancelled
Build llama.cpp runtime binaries / build-linux-x64-vulkan (push) Has been cancelled
Build llama.cpp runtime binaries / release (push) Has been cancelled
* feat(runtime): add Windows Vulkan release asset

* fix(ci): install SPIR-V headers for Windows Vulkan

* fix(runtime): make Windows Vulkan package standalone
2026-07-23 18:49:28 +08:00
zhifu gao 2aa24baa4e Refresh public docs release copy (#3337)
Co-authored-by: LauraGPT <lauragpt@users.noreply.github.com>
2026-07-23 02:55:56 +08:00
zhifu gao 5882f3cf79 docs: surface Vulkan llama.cpp runtime in README
Expose the v0.1.8 Linux Vulkan runtime asset in the top-level README docs.
2026-07-22 19:25:17 +08:00
zhifu gao c7f6edb9e6 docs(runtime): mention Vulkan asset in release notes
Build llama.cpp runtime binaries / build-linux-x64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-windows-x64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-linux-x64-avx2 (push) Has been cancelled
Build llama.cpp runtime binaries / build-windows-x64-avx2 (push) Has been cancelled
Build llama.cpp runtime binaries / build-linux-arm64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-macos-arm64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-windows-x64-cuda (push) Has been cancelled
Build llama.cpp runtime binaries / build-linux-x64-vulkan (push) Has been cancelled
Build llama.cpp runtime binaries / release (push) Has been cancelled
Keep generated runtime release notes aligned with the new Linux Vulkan asset.
2026-07-22 18:44:03 +08:00
zhifu gao e3327be1bd feat(runtime): add Vulkan llama.cpp backend packaging
Add Linux Vulkan packaging and runtime selection for the FunASR llama.cpp SenseVoice GGUF backend.
2026-07-22 18:40:34 +08:00
zhifu gao b798e2679f feat(runtime): add GGUF HTTP transcription wrapper
Expose the llama.cpp/GGUF command-line binaries through a lightweight OpenAI-compatible transcription endpoint.
2026-07-22 18:16:22 +08:00
zhifu gao a2a6ba3ddf docs: clarify Windows CUDA GPU architecture support
Document the current sm_86 Windows CUDA prebuilt limit and direct RTX 50 / Blackwell users to CPU binaries or source builds with CMAKE_CUDA_ARCHITECTURES=120 until a dedicated asset is available.
2026-07-19 18:39:13 +08:00
zhifu gao b006767999 Promote llama.cpp Windows CUDA release in README (#3250)
* Promote llama.cpp Windows CUDA release

* Preserve releases link in llama.cpp README snippets
2026-07-19 04:15:44 +08:00
zhifu gao f1e287edc2 Add Windows CUDA llama.cpp release asset
Build llama.cpp runtime binaries / build-linux-x64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-windows-x64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-linux-x64-avx2 (push) Has been cancelled
Build llama.cpp runtime binaries / build-windows-x64-avx2 (push) Has been cancelled
Build llama.cpp runtime binaries / build-linux-arm64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-macos-arm64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-windows-x64-cuda (push) Has been cancelled
Build llama.cpp runtime binaries / release (push) Has been cancelled
Adds a Windows x64 CUDA release asset for the llama.cpp SenseVoice runtime, with CUDA Toolkit setup, architecture-86 build flags, focused SenseVoice target packaging, docs, and workflow regression tests. Manual workflow dispatch 29656771776 passed all build matrix jobs including build-windows-x64-cuda.
2026-07-19 03:24:07 +08:00
zhifu gao 57721fc8ce Add SenseVoice llama.cpp backend selector (#3247) 2026-07-18 19:16:03 +08:00
zhifu gao 68a21aafbb docs(llama.cpp): fix default GGUF quickstart (#3234)
* docs(llama.cpp): fix default GGUF quickstart

Signed-off-by: 游雁 <zhifu.gzf@alibaba-inc.com>

* fix(llama.cpp): make release quickstart executable

Signed-off-by: 游雁 <zhifu.gzf@alibaba-inc.com>

* fix(llama.cpp): validate Windows release layout

Signed-off-by: 游雁 <zhifu.gzf@alibaba-inc.com>

* test(llama.cpp): require runnable quickstart lines

Signed-off-by: 游雁 <zhifu.gzf@alibaba-inc.com>

---------

Signed-off-by: 游雁 <zhifu.gzf@alibaba-inc.com>
2026-07-15 20:15:07 +08:00
游雁 916c175ec9 test(llama.cpp): validate downloader failure paths 2026-07-15 04:35:18 +00:00
游雁 9c17931645 fix(llama.cpp): download one GGUF variant by default 2026-07-15 04:28:57 +00:00
Maigic 098654e8db fix: initialize ggml timer in funasr nano cli (#3210)
Initialize the ggml timer before the first ggml_time_us() call so Windows builds do not divide by an uninitialized timer frequency.
2026-07-13 23:55:31 +08:00
zhifu gao 9f1d220432 feat: q8_0 export option (--wtype q8_0) for SenseVoice/Paraformer/Nano encoder GGUF (#3013) 2026-06-22 02:39:32 +08:00
zhifu gao 9cc0ebcc66 fix: detok review findings (null gguf_get_arr_str guard + utf-8 tokens.json read) (#3005) 2026-06-20 17:39:32 +08:00
zhifu gao 807bcd5647 feat: print transcription text in the binaries (embed vocab, in-binary detok) (#3004)
Build llama.cpp runtime binaries / build-linux-arm64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-linux-x64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-macos-arm64 (push) Has been cancelled
Build llama.cpp runtime binaries / build-windows-x64 (push) Has been cancelled
Build llama.cpp runtime binaries / release (push) Has been cancelled
SenseVoice and Paraformer binaries now output text directly (whisper-cli style),
no Python detok step.

- export_{sensevoice,paraformer}_gguf.py: embed the vocab as a GGUF string array
  (sv.vocab = SentencePiece pieces; pf.vocab = tokens.json) so the binary is self-contained.
- funasr-sensevoice.cpp: CTC ids -> text (pieces + ▁->space), drop <|...|> meta by
  default; --ids (raw), --keep-tags (keep meta tags).
- funasr-paraformer.cpp: ids -> text (tokens.json, drop @@ continuations); --ids for raw.
- both fall back to ids if the GGUF has no vocab. READMEs updated to text output.

Verified: C++ text == reference detok (sentencepiece / tokens.json) on sample and the
full 002 clip; ids unchanged so CER is unchanged.
2026-06-20 16:39:25 +08:00
zhifu gao 3610b759ce test: numerical regression harness (frozen golden vs ggml/VAD/CIF/CTC output) (#3003)
* test: numerical regression harness (frozen golden vs ggml/VAD/CIF/CTC output)

Adds tests/ — runs each runtime tool on a fixed 6 s clip and diffs against frozen
golden output, catching regressions in the ggml graphs, the FSMN-VAD state machine,
the CIF predictor and CTC decode.

- tests/run_regression.sh: auto-detects which tools are built; VAD model is auto-fetched
  (1.7 MB), ASR GGUFs tested when present or with RUN_FULL=1 (downloads from HF).
  Non-zero exit on any mismatch. BIN_DIR/MODELS_DIR overridable.
- tests/sample.wav (~6 s) + tests/golden/*.txt: golden captured on Linux x86-64 with the
  f16 GGUFs from FunAudioLLM/*-GGUF.

Verified locally: all present tools PASS; default mode fetches VAD + skips absent models.

* test: golden as text (binaries now detok in-process; merge after in-binary-detok)

* test: fix sensevoice golden (correct transcription text)
2026-06-20 16:12:24 +08:00
zhifu gao 49bc9b502d fix: B1 script portability (Hugging Face CLI fallback + friendly missing-dep error) (#3002)
- download-funasr-model.sh: detect `hf` (new CLI) or fall back to `huggingface-cli`
  (older huggingface_hub); fail with an install hint if neither exists.
- convert-funasr-to-gguf.py: catch ModuleNotFoundError and print how to install the
  missing package instead of a raw traceback.
2026-06-20 14:54:33 +08:00
zhifu gao 7cdc280ee0 build: define NOMINMAX/_USE_MATH_DEFINES for MSVC (Windows portability) 2026-06-20 14:41:32 +08:00
zhifu gao 4a93f29333 docs: build note — copy funasr-common alongside the example (shared miniaudio audio loader) (#2996)
Co-authored-by: LauraGPT <LauraGPT@users.noreply.github.com>
2026-06-20 14:14:55 +08:00
zhifu gao 66358c577e feat: B1 packaging — one-command download, standalone convert, CI-friendly CMake (#3000)
Make the runtime a downloadable product (whisper.cpp-style), no manual export needed:

- download-funasr-model.sh: one command to pull pre-converted GGUF from Hugging Face
  (FunAudioLLM/*-GGUF), incl. fsmn-vad for built-in --vad. No Python ML env required.
- convert-funasr-to-gguf.py: one-step HF/ModelScope checkpoint -> GGUF (wraps the
  validated export_*.py; discovered relative to itself so it works in any layout).
- CMakeLists.txt: standalone, CI-friendly top-level build. FetchContent pins llama.cpp
  (provides ggml + llama), static libs -> self-contained binaries in build/bin/, no
  hardcoded paths; builds on Linux/macOS/Windows x64/arm64. `cmake -B build && cmake --build build -j`.
- README: download-first + standalone-build quickstart; links to the HF GGUF repos.

Verified on Linux: all targets build via FetchContent (static, no shared-lib deps);
hf download -> run reproduces canonical output. Additive; runtime/llama.cpp/ only.
2026-06-20 14:14:49 +08:00
zhifu gao 27756664df fix: address FSMN-VAD review findings (portability + robustness) (#2999)
- funasr_vad.h: define M_PI fallback (not guaranteed on MSVC) for cross-platform CI;
  guard against audio shorter than one frame (empty fbank -> OOB in lfr);
  validate required GGUF tensors up front (fail with a message, not a segfault);
  shrink the no_alloc metadata context (512MB -> 16MB); drop a redundant ggml_cont
  on an already-contiguous row slice in the FSMN memory loop.
- export_vad_gguf.py: use a with-statement when reading am.mvn (no fd leak).

No behavior change: VAD segment boundaries are byte-identical on the 184-clip set.
2026-06-20 13:41:26 +08:00
zhifu gao e615ed0dc0 feat: built-in FSMN-VAD (--vad) for all three runtimes — single-binary segmentation (#2998)
Add a native ggml FSMN-VAD front end so the binaries segment long audio themselves,
with no Python at runtime. New `--vad fsmn-vad.gguf` flag on llama-funasr-cli,
llama-funasr-sensevoice and llama-funasr-paraformer runs FSMN-VAD (fbank + LFR + CMVN +
FSMN encoder + E2EVadModel state machine, in funasr-common/funasr_vad.h) and decodes
each speech segment, then concatenates.

- funasr-common/funasr_vad.h: single-header VAD; segment boundaries within ~10 ms of
  PyTorch fsmn-vad.generate on the 184-clip set (DEFAULT_SILENCE_SCHEDULE replicated,
  chunk-stepped silence schedule + speech_noise_thres 0.5).
- funasr-vad/: standalone VAD tool (wav -> [start_ms,end_ms] segments).
- export_vad_gguf.py: export FSMN-VAD encoder + CMVN to GGUF (1.7 MB, 24 tensors).
- BENCHMARKS.md: bare binary with built-in VAD reaches the reference end-to-end —
  full-184 micro-CER SenseVoice 8.01 / Paraformer 9.85 / Fun-ASR-Nano 8.30.

Additive only: no existing code is modified outside runtime/llama.cpp/.
2026-06-20 13:26:27 +08:00
zhifu gao a83e1d9c38 feat: accept any audio input (any rate/channels, wav/mp3/flac) via miniaudio (#2994)
* feat(runtime): accept any audio (any sample-rate/channels, wav/mp3/flac) via miniaudio

Replaces the 16k-mono-PCM16-only WAV reader with a miniaudio-based loader
(funasr-common/funasr_audio.h) that decodes wav/mp3/flac at any sample rate and
channel count, resampling to 16 kHz mono. Verified: a 44.1k stereo file and an 8k
mono file both transcribe correctly across cli/sensevoice/paraformer.

* fix(audio): inline loader (avoid duplicate symbols), null-path guard, check decoder read result (gemini review)

---------

Co-authored-by: LauraGPT <LauraGPT@users.noreply.github.com>
2026-06-19 22:40:02 +08:00
zhifu gao 842e62f875 docs: CPU benchmark vs whisper.cpp (Chinese ASR) (#2992)
* docs: add CPU benchmark vs whisper.cpp (FunASR is more accurate & faster on Chinese)

* docs(benchmark): clarify size column; add reproduction scripts (compute_cer.py + method README)

* docs(benchmark): finalize — canonical micro-CER+normalize_zh, full 184, fp32-ref/Q8-runtime dual values, whisper full set, transparency footnotes

---------

Co-authored-by: LauraGPT <LauraGPT@users.noreply.github.com>
2026-06-19 22:26:14 +08:00
zhifu gao b7da5cc706 Add llama.cpp / GGUF runtime for FunASR models (#2988)
* Add llama.cpp/GGUF runtime for Fun-ASR-Nano, SenseVoice and Paraformer

Run FunASR models entirely on the llama.cpp / ggml stack: CPU / edge, single
binary, no Python at runtime, quantized GGUF weights (like whisper.cpp for
Whisper). Adds runtime/llama.cpp/ with three models sharing a common ggml SAN-M
encoder / FSMN / attention and kaldi fbank front end:

- fun-asr-nano : SAN-M encoder + adaptor + Qwen3-0.6B LLM (audio embeds injected
  via llama_decode embedding input, llava/mtmd style); integrated WAV->text CLI.
- sensevoice   : SAN-M encoder + CTC; WAV->CTC ids.
- paraformer   : SAN-M encoder + CIF predictor + SAN-M decoder (non-autoregressive).

Each ships a GGUF export script and a README (architecture, quickstart, accuracy,
gotchas). Validated against the PyTorch reference (encoder cosine ~1.0; SenseVoice
CTC ids identical; Paraformer text identical; Fun-ASR-Nano CER within 0.02% under
identical conditions). Adds a new directory only; no existing code is modified.

* docs: add comprehensive design document (architecture, GGUF format, validation, gotchas)

* docs: link README to DESIGN.md

* fix: address code review (WAV ch/bits validation, chunk guard, null/leak checks)

Fixes gemini-code-assist findings: validate channels/bits in the WAV reader
(reject non-16-bit/zero-channel instead of dividing by zero), guard chunk size
>=1, null-check fopen/llama_context, and fclose/ggml_free on all paths.

---------

Co-authored-by: LauraGPT <LauraGPT@users.noreply.github.com>
2026-06-19 12:06:42 +08:00