zheqiushui's picture
static bins from llama.cpp axera-dev 6613735ce: no CPU fallback without a kernel directory, Qwen3-TTS first-frame fix
f755ed3 verified
|
Raw History Blame Contribute Delete
4.59 kB
metadata
base_model: openbmb/MiniCPM-OCR-1.0
library_name: llama.cpp

MiniCPM-OCR-1.0 on AX8860 (llama.cpp + ggml-axera)

在爱芯 AX8860 的 NPU 上用 llama.cpp 运行 MiniCPM-OCR-1.0:文档、表格、截图的中英文 OCR,OpenAI 兼容服务。 MiniCPM-OCR-1.0 on the Axera AX8860 NPU with llama.cpp: Chinese/English OCR for documents, tables and screenshots, with an OpenAI-compatible server.

性能 / Performance

图像请求总耗时 / image request, end to end 中位数 / median 1.62 s(图像编码 + prefill + 生成 / encode + prefill + generation)
图像 OCR decode / OCR decode 143.4 tokens/s
文本 decode / text decode 154.9 tokens/s
4k prompt prefill 7784 tokens/s(3908 token 0.50 s)
上下文 / context 4096

sh bench.sh 复现 / reproduce(-c 4096,贪心解码,3 次取中位数 / greedy, median of 3 runs):

项目 / Item 结果 / Result
5 token prompt 0.03 s,decode 154.9 tokens/s
3908 token prompt 0.50 s,decode 143.9 tokens/s(生成 128 token / 128 generated tokens)
图像编码 / image encode 1.61 s(doc_en.png,1782 image tokens)
图像 OCR decode 143.4 tokens/s(10 图各 2 次 / 10 images, 2 requests each)
NPU 内存 / NPU memory (CMM) 加载后 / after load 2.08 GiB,峰值 / peak 3.01 GiB
主机内存 / host RSS 加载后 / after load 182 MiB,峰值 / peak 868 MiB

快速开始 / Quick start

sh run.sh -i images/doc_en.png "Text Recognition:" 256   # 单图 OCR / one image
sh run.sh -b images "Text Recognition:" 256              # 目录内全部 PNG / every PNG in a directory
sh run.sh -s 8080                                        # OpenAI 兼容服务 / server
sh run.sh "The capital of France is" 64                  # 文本补全 / text completion
sh bench.sh                                              # 性能复现 / benchmark

需要 AX8860,SDK V0.5.1 或更新;HF 下载的文件没有执行权限,用 sh 调用即可 / needs an AX8860 with SDK V0.5.1+; call the scripts with sh.

文件 / Files

文件 / File 说明 / Description
gguf/minicpm-ocr-1.0-bf16.gguf 文本权重 / text weights,1.52 GB,md5 590cdaebcd34ee334788319792e96f8e
gguf/mmproj-minicpm-ocr-1.0-bf16.gguf 视觉编码器 / vision encoder,0.9 GB,md5 371156c5cfa978183e505a95a0aa0bf6
bin/ llama.cpp 板端程序(静态链接)/ board programs (static)
kernels/ NPU kernel 3 个:文本 prefill、文本 decode(含输出头)、视觉编码器 + manifest.json / three kernels: text prefill, text decode (with the output head) and the vision encoder + manifest.json
run.sh,chat_template.jinja 运行脚本与服务端对话模板 / run script and the server's chat template
bench.sh,scripts/ 及 prompt 性能复现 / benchmark
images/ 10 张 OCR 测试图与参考文本 / 10 OCR test images with reference text

说明 / Notes

  • 文本权重在加载时由 GGUF 转成 MXFP8,KV 为 BF16;视觉权重为 BF16 / text weights are converted from the GGUF to MXFP8 at load, with a BF16 KV cache; vision weights are BF16.
  • 上下文 4096;包内 10 张图的 prompt 最长 1830 token / context 4096; the longest prompt among the 10 bundled images is 1830 tokens.
  • 服务端默认关闭思考(--reasoning off);run.sh -b 会临时起一个服务(端口 18258)逐图请求 / the server does not think by default; run.sh -b starts a temporary server (port 18258) and sends one request per image.
  • 测试图由脚本用 Noto CJK 字体生成,参考文本在 images/reference.json / the test images are generated with the Noto CJK font; reference text is in images/reference.json.
  • 运行时独占 NPU 4 核;服务端 -np 1 / takes all 4 NPU cores; the server runs -np 1.

正确性 / Correctness

  • 10 张测试图的单图与批量 OCR 在板上均返回正确可读的中英文文本 / single-image and batch OCR of the 10 test images return correct Chinese and English text on the board.
  • 文本 PPL:板上 174.56,CPU 参考 172.74(+1.05%)/ text perplexity: 174.56 on the board against 172.74 on the CPU reference (+1.05%).
  • prompt cache 压力测试 160 个请求,缓存错误 0 / 160-request prompt-cache stress test with no cache error.

源码 / Sources

更新 / Changelog

  • 2026-11-15:首次发布 / first release.