Skip to content

Commit 941307a

Browse files
committed
fix(llama.cpp): make release quickstart executable
Signed-off-by: 游雁 <zhifu.gzf@alibaba-inc.com>
1 parent 3c35440 commit 941307a

4 files changed

Lines changed: 87 additions & 12 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Test llama.cpp downloader
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- 'README.md'
8+
- 'README_zh.md'
9+
- 'runtime/llama.cpp/download-funasr-model.sh'
10+
- 'runtime/llama.cpp/tests/test_download_funasr_model.sh'
11+
- '.github/workflows/test-llamacpp-downloader.yml'
12+
push:
13+
branches:
14+
- main
15+
paths:
16+
- 'README.md'
17+
- 'README_zh.md'
18+
- 'runtime/llama.cpp/download-funasr-model.sh'
19+
- 'runtime/llama.cpp/tests/test_download_funasr_model.sh'
20+
- '.github/workflows/test-llamacpp-downloader.yml'
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
contract:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Run downloader and README contract tests
31+
run: bash runtime/llama.cpp/tests/test_download_funasr_model.sh

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,20 @@ docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-
246246
Run **SenseVoice / Paraformer / Fun-ASR-Nano** as a **single self-contained binary** on CPU and edge devices — this is to FunASR what [whisper.cpp](https://github.com/ggml-org/whisper.cpp) is to Whisper, but with **~3× lower CER than whisper.cpp on Chinese**. Built-in FSMN-VAD, no Python at runtime.
247247

248248
```bash
249-
# 1) Grab a prebuilt binary from Releases (Linux / macOS / Windows), then:
249+
# Linux / macOS: run from the extracted release directory
250250
bash download-funasr-model.sh sensevoice ./gguf # or: paraformer | nano
251-
llama-funasr-sensevoice -m ./gguf/sensevoice-small-q8.gguf --vad ./gguf/fsmn-vad.gguf -a audio.wav
251+
./llama-funasr-sensevoice -m ./gguf/sensevoice-small-q8.gguf --vad ./gguf/fsmn-vad.gguf -a audio.wav
252252
# → 欢迎大家来体验达摩院推出的语音识别模型
253253
```
254254

255-
**Prebuilt binaries:** [Releases](../../releases) · **Download & quickstart:** [funasr.com/llama-cpp](https://www.funasr.com/llama-cpp.html) · **GGUF models:** [Hugging Face](https://huggingface.co/FunAudioLLM) · **Docs & benchmarks:** [runtime/llama.cpp/](./runtime/llama.cpp/)
255+
```powershell
256+
# Windows PowerShell: run from the extracted archive root (with the `hf` CLI installed)
257+
hf download FunAudioLLM/SenseVoiceSmall-GGUF sensevoice-small-q8.gguf --local-dir .\gguf
258+
hf download FunAudioLLM/fsmn-vad-GGUF fsmn-vad.gguf --local-dir .\gguf
259+
.\pkg\llama-funasr-sensevoice.exe -m .\gguf\sensevoice-small-q8.gguf --vad .\gguf\fsmn-vad.gguf -a audio.wav
260+
```
261+
262+
**Prebuilt binaries:** [Releases](https://github.com/modelscope/FunASR/releases) · **Download & quickstart:** [funasr.com/llama-cpp](https://www.funasr.com/llama-cpp.html) · **GGUF models:** [Hugging Face](https://huggingface.co/FunAudioLLM) · **Docs & benchmarks:** [runtime/llama.cpp/](./runtime/llama.cpp/)
256263

257264
[OpenAI API example →](./examples/openai_api/) · [Gradio demo →](./examples/openai_api/GRADIO.md) · [Client recipes →](./examples/openai_api/CLIENTS.md) · [JavaScript/TypeScript recipes →](./examples/openai_api/JAVASCRIPT.md) · [Kubernetes template →](./examples/openai_api/kubernetes/) · [Workflow recipes →](./examples/openai_api/WORKFLOWS.md) · [Postman collection →](./examples/openai_api/POSTMAN.md) · [OpenAPI spec →](./examples/openai_api/OPENAPI.md) · [Security guide →](./examples/openai_api/SECURITY.md) · [Deployment matrix →](./docs/deployment_matrix.md) · [Deployment docs →](./runtime/readme.md) · [Agent integration →](https://modelscope.github.io/FunASR/agent.html)
258265

README_zh.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,20 @@ docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-
279279
在 CPU 和边缘设备上用单个自包含二进制运行 **SenseVoice / Paraformer / Fun-ASR-Nano**,无需 Python 运行环境,并内置 FSMN-VAD。
280280

281281
```bash
282-
# 1) 从 Releases 下载 Linux / macOS / Windows 预编译包,然后执行:
282+
# Linux / macOS:在解压后的发布目录中执行
283283
bash download-funasr-model.sh sensevoice ./gguf # 也可使用 paraformer 或 nano
284-
llama-funasr-sensevoice -m ./gguf/sensevoice-small-q8.gguf --vad ./gguf/fsmn-vad.gguf -a audio.wav
284+
./llama-funasr-sensevoice -m ./gguf/sensevoice-small-q8.gguf --vad ./gguf/fsmn-vad.gguf -a audio.wav
285285
# -> 欢迎大家来体验达摩院推出的语音识别模型
286286
```
287287

288-
**预编译二进制:** [Releases](../../releases) · **下载与快速开始:** [funasr.com/llama-cpp](https://www.funasr.com/llama-cpp.html) · **GGUF 模型:** [Hugging Face](https://huggingface.co/FunAudioLLM) · **文档与评测:** [runtime/llama.cpp/](./runtime/llama.cpp/)
288+
```powershell
289+
# Windows PowerShell:在解压根目录执行(需已安装 `hf` CLI)
290+
hf download FunAudioLLM/SenseVoiceSmall-GGUF sensevoice-small-q8.gguf --local-dir .\gguf
291+
hf download FunAudioLLM/fsmn-vad-GGUF fsmn-vad.gguf --local-dir .\gguf
292+
.\pkg\llama-funasr-sensevoice.exe -m .\gguf\sensevoice-small-q8.gguf --vad .\gguf\fsmn-vad.gguf -a audio.wav
293+
```
294+
295+
**预编译二进制:** [Releases](https://github.com/modelscope/FunASR/releases) · **下载与快速开始:** [funasr.com/llama-cpp](https://www.funasr.com/llama-cpp.html) · **GGUF 模型:** [Hugging Face](https://huggingface.co/FunAudioLLM) · **文档与评测:** [runtime/llama.cpp/](./runtime/llama.cpp/)
289296

290297
[OpenAI API 示例 →](./examples/openai_api/README_zh.md) · [Gradio Demo →](./examples/openai_api/GRADIO_zh.md) · [客户端配方 →](./examples/openai_api/CLIENTS.md) · [JavaScript/TypeScript 配方 →](./examples/openai_api/JAVASCRIPT_zh.md) · [Kubernetes 模板 →](./examples/openai_api/kubernetes/README_zh.md) · [工作流配方 →](./examples/openai_api/WORKFLOWS_zh.md) · [Postman 集合 →](./examples/openai_api/POSTMAN_zh.md) · [OpenAPI 规范 →](./examples/openai_api/OPENAPI_zh.md) · [安全指南 →](./examples/openai_api/SECURITY_zh.md) · [部署选型 →](./docs/deployment_matrix_zh.md) · [部署文档 →](./runtime/readme_cn.md) · [Agent 集成 →](https://modelscope.github.io/FunASR/agent.html)
291298

runtime/llama.cpp/tests/test_download_funasr_model.sh

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ bash "$SCRIPT" sensevoice "$TMP/out" >/dev/null
6363
assert_log "download FunAudioLLM/SenseVoiceSmall-GGUF sensevoice-small-q8.gguf --local-dir $TMP/out"
6464
assert_log "download FunAudioLLM/fsmn-vad-GGUF fsmn-vad.gguf --local-dir $TMP/out"
6565
assert_no_log "--include *.gguf"
66+
DEFAULT_SENSEVOICE_MODEL=$(awk '$1 == "download" && $2 == "FunAudioLLM/SenseVoiceSmall-GGUF" { print $3; exit }' "$HF_LOG")
67+
[[ -n "$DEFAULT_SENSEVOICE_MODEL" ]]
6668

6769
reset_case
6870
bash "$SCRIPT" paraformer "$TMP/out" f16 >/dev/null
@@ -109,21 +111,49 @@ grep -F "no GGUF files found in $TMP/out" "$TMP/stderr" >/dev/null
109111

110112
assert_readme_quickstart() {
111113
local readme=$1
112-
if ! grep -F "bash download-funasr-model.sh sensevoice ./gguf" "$readme" >/dev/null; then
114+
local section_prefix=$2
115+
local section
116+
local quickstart
117+
118+
if ! section=$(awk -v prefix="$section_prefix" '
119+
!found && index($0, prefix) == 1 { found = 1 }
120+
found && /^---$/ { exit }
121+
found { print }
122+
END { if (!found) exit 1 }
123+
' "$readme"); then
124+
printf 'missing CPU/edge section in %s\n' "$readme" >&2
125+
exit 1
126+
fi
127+
128+
if ! quickstart=$(printf '%s\n' "$section" | awk '
129+
!seen && /^```bash$/ { seen = 1; in_block = 1; next }
130+
in_block && /^```$/ { complete = 1; exit }
131+
in_block { print }
132+
END { if (!seen || !complete) exit 1 }
133+
'); then
134+
printf 'missing Bash quickstart block in %s\n' "$readme" >&2
135+
exit 1
136+
fi
137+
138+
if ! grep -F "bash download-funasr-model.sh sensevoice ./gguf" <<<"$quickstart" >/dev/null; then
113139
printf 'missing default SenseVoice download command in %s\n' "$readme" >&2
114140
exit 1
115141
fi
116-
if ! grep -F "llama-funasr-sensevoice -m ./gguf/sensevoice-small-q8.gguf --vad ./gguf/fsmn-vad.gguf -a audio.wav" "$readme" >/dev/null; then
142+
if ! grep -F "./llama-funasr-sensevoice -m ./gguf/$DEFAULT_SENSEVOICE_MODEL --vad ./gguf/fsmn-vad.gguf -a audio.wav" <<<"$quickstart" >/dev/null; then
117143
printf 'README command does not run the default sensevoice-small-q8.gguf in %s\n' "$readme" >&2
118144
exit 1
119145
fi
120-
if grep -F "SenseVoiceSmall-f16.gguf" "$readme" >/dev/null; then
121-
printf 'stale SenseVoice filename in %s\n' "$readme" >&2
146+
if ! grep -F ".\\pkg\\llama-funasr-sensevoice.exe -m .\\gguf\\$DEFAULT_SENSEVOICE_MODEL --vad .\\gguf\\fsmn-vad.gguf -a audio.wav" <<<"$section" >/dev/null; then
147+
printf 'missing Windows PowerShell quickstart in %s\n' "$readme" >&2
148+
exit 1
149+
fi
150+
if ! grep -F '[Releases](https://github.com/modelscope/FunASR/releases)' <<<"$section" >/dev/null; then
151+
printf 'non-portable Releases link in %s\n' "$readme" >&2
122152
exit 1
123153
fi
124154
}
125155

126-
assert_readme_quickstart "$REPO_ROOT/README.md"
127-
assert_readme_quickstart "$REPO_ROOT/README_zh.md"
156+
assert_readme_quickstart "$REPO_ROOT/README.md" '### CPU / Edge'
157+
assert_readme_quickstart "$REPO_ROOT/README_zh.md" '### CPU / 边缘部署'
128158

129159
echo "download-funasr-model contract tests passed"

0 commit comments

Comments
 (0)