This version of PaddleOCR-VL-1.5 has been converted to run on the Axera NPU using w4a16 quantization.
For those who are interested in model conversion, you can try to export axmodel through the original repo:
1git clone -b axllm https://github.com/AXERA-TECH/ax-llm.git
2cd ax-llm
3./install.sh
1chmod +x axllm
2sudo mv axllm /usr/bin/axllm
1chmod +x ./bin/axllm
2./bin/axllm serve . --port 8000
1mkdir -p AXERA-TECH/PaddleOCR-VL-1.5
2cd AXERA-TECH/PaddleOCR-VL-1.5
3hf download AXERA-TECH/PaddleOCR-VL-1.5 --local-dir .
4
5# 下载后目录结构
6tree -L 1
7.
8|-- README.md
9|-- assets
10|-- config.json
11|-- model.embed_tokens.weight.bfloat16.bin
12|-- paddleocr_vl_p128_l0_together.axmodel
13...
14|-- paddleocr_vl_p128_l17_together.axmodel
15|-- paddleocr_vl_post.axmodel
16|-- post_config.json
17|-- python
18|-- tokenizer.model
19|-- vision_cache
20`-- vit_576x768.axmodel
1root@ax650 # axllm run AXERA-TECH/PaddleOCR-VL-1.5/ # 注意使用最新版本的 axllm
220:45:21.515 INF Init:218 | LLM init start
3tokenizer_type = 0
4 95% | ############################## | 20 / 21 [1.97s<2.07s, 10.13 count/s] init post axmodel ok,remain_cmm(4330 MB)
520:45:23.490 INF Init:368 | max_token_len : 2047
620:45:23.490 INF Init:371 | kv_cache_size : 256, kv_cache_num: 2047
720:45:23.490 INF Init:374 | prefill_token_num : 128
820:45:23.490 INF Init:379 | grp: 1, prefill_max_kv_cache_num : 1
920:45:23.490 INF Init:379 | grp: 2, prefill_max_kv_cache_num : 128
1020:45:23.490 INF Init:379 | grp: 3, prefill_max_kv_cache_num : 256
1120:45:23.490 INF Init:379 | grp: 4, prefill_max_kv_cache_num : 384
1220:45:23.490 INF Init:379 | grp: 5, prefill_max_kv_cache_num : 512
1320:45:23.490 INF Init:379 | grp: 6, prefill_max_kv_cache_num : 640
1420:45:23.490 INF Init:384 | prefill_max_token_num : 640
1520:45:23.490 INF Init:27 | LLaMaEmbedSelector use mmap
16100% | ################################ | 21 / 21 [1.98s<1.98s, 10.62 count/s] embed_selector init ok
1720:45:24.028 INF Init:453 | PaddleOCRVL: encoder input nSize=5334336 -> eff_nSize=1333584 (float32 input)
1820:45:24.029 WRN Init:469 | Qwen-VL vision size override: cfg=448x448 bytes=602112, model_input_bytes=5334336 -> 756x588 (factor-search).
1920:45:24.029 INF Init:661 | PaddleOCR-VL token ids: vision_start=101305 image_pad=100295 video_pad=100295
2020:45:24.029 INF Init:686 | VisionModule init ok: type=PaddleOCRVL, tokens_per_block=567, embed_size=1024, out_dtype=fp32
2120:45:24.029 WRN Init:695 | Vision preprocess backend: SimpleCV (OpenCV not found at build time; minor differences vs OpenCV are possible)
2220:45:24.031 INF load_config:282 | load config:
2320:45:24.031 INF load_config:282 | {
2420:45:24.031 INF load_config:282 | "enable_repetition_penalty": false,
2520:45:24.031 INF load_config:282 | "enable_temperature": false,
2620:45:24.031 INF load_config:282 | "enable_top_k_sampling": false,
2720:45:24.031 INF load_config:282 | "enable_top_p_sampling": false,
2820:45:24.031 INF load_config:282 | "penalty_window": 20,
2920:45:24.031 INF load_config:282 | "repetition_penalty": 1.0,
3020:45:24.031 INF load_config:282 | "temperature": 0.6,
3120:45:24.031 INF load_config:282 | "top_k": 1,
3220:45:24.031 INF load_config:282 | "top_p": 0.9
3320:45:24.031 INF load_config:282 | }
3420:45:24.031 INF Init:448 | LLM init ok
35Commands:
36 /q, /exit 退出
37 /reset 重置 kvcache
38 /dd 删除一轮对话
39 /pp 打印历史对话
40Ctrl+C: 停止当前生成
41VLM enabled: after each prompt, input image path (empty = text-only). Use "video:<frames_dir>" for video.
42----------------------------------------
43prompt >> OCR:
44image >> /Path/To/Your/AXERA-TECH/PaddleOCR-VL-1.5/assets/IMG_0462.JPG
4520:45:30.031 INF EncodeForContent:1058 | PaddleOCRVL pixel_values bytes=1333584 min=0 max=255 (w=756 h=588 ps=14)
4620:45:31.726 INF EncodeForContent:1102 | vision cache store: /Path/To/Your/AXERA-TECH/PaddleOCR-VL-1.5/assets/IMG_0462.JPG
4720:45:31.760 INF SetKVCache:747 | prefill_grpid:6 kv_cache_num:640 precompute_len:0 input_num_token:596
4820:45:31.760 INF SetKVCache:749 | current prefill_max_token_num:640
4920:45:31.760 INF SetKVCache:752 | first run
5020:45:31.761 INF Run:805 | input token num : 596, prefill_split_num : 5
5120:45:31.761 INF Run:845 | prefill chunk p=0 history_len=0 grpid=1 kv_cache_num=0 input_tokens=128
5220:45:31.761 INF Run:868 | prefill indices shape: p=0 idx_elems=384 idx_rows=3 pos_rows=3
5320:45:31.815 INF Run:845 | prefill chunk p=1 history_len=128 grpid=2 kv_cache_num=128 input_tokens=128
5420:45:31.816 INF Run:868 | prefill indices shape: p=1 idx_elems=384 idx_rows=3 pos_rows=3
5520:45:31.873 INF Run:845 | prefill chunk p=2 history_len=256 grpid=3 kv_cache_num=256 input_tokens=128
5620:45:31.873 INF Run:868 | prefill indices shape: p=2 idx_elems=384 idx_rows=3 pos_rows=3
5720:45:31.937 INF Run:845 | prefill chunk p=3 history_len=384 grpid=4 kv_cache_num=384 input_tokens=128
5820:45:31.937 INF Run:868 | prefill indices shape: p=3 idx_elems=384 idx_rows=3 pos_rows=3
5920:45:32.006 INF Run:845 | prefill chunk p=4 history_len=512 grpid=5 kv_cache_num=512 input_tokens=84
6020:45:32.006 INF Run:868 | prefill indices shape: p=4 idx_elems=384 idx_rows=3 pos_rows=3
6120:45:32.088 INF Run:1010 | ttft: 327.20 ms
62James Landay-VR
6314175
64
6520:45:32.374 NTC Run:1132 | hit eos,avg 38.47 token/s
6620:45:32.374 INF GetKVCache:721 | precompute_len:597, remaining:43
1root@ax650 # axllm serve AXERA-TECH/PaddleOCR-VL-1.5/ # 注意使用最新版本的 axllm
220:47:54.027 INF Init:218 | LLM init start
3tokenizer_type = 0
4 95% | ############################## | 20 / 21 [1.96s<2.05s, 10.22 count/s] init post axmodel ok,remain_cmm(4330 MB)
520:47:55.983 INF Init:368 | max_token_len : 2047
620:47:55.983 INF Init:371 | kv_cache_size : 256, kv_cache_num: 2047
720:47:55.983 INF Init:374 | prefill_token_num : 128
820:47:55.983 INF Init:379 | grp: 1, prefill_max_kv_cache_num : 1
920:47:55.983 INF Init:379 | grp: 2, prefill_max_kv_cache_num : 128
1020:47:55.983 INF Init:379 | grp: 3, prefill_max_kv_cache_num : 256
1120:47:55.983 INF Init:379 | grp: 4, prefill_max_kv_cache_num : 384
1220:47:55.983 INF Init:379 | grp: 5, prefill_max_kv_cache_num : 512
1320:47:55.983 INF Init:379 | grp: 6, prefill_max_kv_cache_num : 640
1420:47:55.983 INF Init:384 | prefill_max_token_num : 640
1520:47:55.983 INF Init:27 | LLaMaEmbedSelector use mmap
16100% | ################################ | 21 / 21 [1.96s<1.96s, 10.72 count/s] embed_selector init ok
1720:47:56.526 INF Init:453 | PaddleOCRVL: encoder input nSize=5334336 -> eff_nSize=1333584 (float32 input)
1820:47:56.526 WRN Init:469 | Qwen-VL vision size override: cfg=448x448 bytes=602112, model_input_bytes=5334336 -> 756x588 (factor-search).
1920:47:56.526 INF Init:661 | PaddleOCR-VL token ids: vision_start=101305 image_pad=100295 video_pad=100295
2020:47:56.526 INF Init:686 | VisionModule init ok: type=PaddleOCRVL, tokens_per_block=567, embed_size=1024, out_dtype=fp32
2120:47:56.526 WRN Init:695 | Vision preprocess backend: SimpleCV (OpenCV not found at build time; minor differences vs OpenCV are possible)
2220:47:56.528 INF load_config:282 | load config:
2320:47:56.528 INF load_config:282 | {
2420:47:56.528 INF load_config:282 | "enable_repetition_penalty": false,
2520:47:56.528 INF load_config:282 | "enable_temperature": false,
2620:47:56.528 INF load_config:282 | "enable_top_k_sampling": false,
2720:47:56.528 INF load_config:282 | "enable_top_p_sampling": false,
2820:47:56.528 INF load_config:282 | "penalty_window": 20,
2920:47:56.528 INF load_config:282 | "repetition_penalty": 1.0,
3020:47:56.528 INF load_config:282 | "temperature": 0.6,
3120:47:56.528 INF load_config:282 | "top_k": 1,
3220:47:56.528 INF load_config:282 | "top_p": 0.9
3320:47:56.528 INF load_config:282 | }
3420:47:56.528 INF Init:448 | LLM init ok
35Starting server on port 8000 with model 'AXERA-TECH/PaddleOCR-VL-1.5'...
36API URLs:
37 GET http://127.0.0.1:8000/health
38 GET http://127.0.0.1:8000/v1/models
39 POST http://127.0.0.1:8000/v1/chat/completions
40 GET http://10.168.232.217:8000/health
41 GET http://10.168.232.217:8000/v1/models
42 POST http://10.168.232.217:8000/v1/chat/completions
43 GET http://172.17.0.1:8000/health
44 GET http://172.17.0.1:8000/v1/models
45 POST http://172.17.0.1:8000/v1/chat/completions
46Aliases:
47 GET http://127.0.0.1:8000/models
48 POST http://127.0.0.1:8000/chat/completions
49 GET http://10.168.232.217:8000/models
50 POST http://10.168.232.217:8000/chat/completions
51 GET http://172.17.0.1:8000/models
52 POST http://172.17.0.1:8000/chat/completions
53OpenAI API Server starting on http://0.0.0.0:8000
54Max concurrency: 1
55Models: AXERA-TECH/PaddleOCR-VL-1.5
1python3 python/infer_axmodel.py \
2 --hf_model ./python/paddleocr_vl_1-5_tokenizer \
3 --axmodel_path . \
4 --vit_model_path ./vit_576x768.axmodel \
5 --image_path ./assets/IMG_0462.JPG \
6 --task ocr