6.4. MiniCPM-V¶
MiniCPM-V-2_6¶
模型下载¶
url: MiniCPM-V-2_6
branch: main
commit id: 92e829ff803337da801b16396faad9356ce2ed86
将上述url设定的路径下的内容全部下载到
MiniCPM-V-2_6
文件夹中。
requirements¶
python3 -m pip install decord==0.6.0 opencv-python==4.11.0.86 opencv-python-headless==4.11.0.86 pyarrow==20.0.0
批量离线推理¶
图像推理¶
python3.10 -m vllm_utils.benchmark_vision_language \
--demo \
--model=[path of MiniCPM-V-2_6] \
--model-arch-suffix Image \
--prompt=[your prompt] \
--input-vision-file=[path of your test image] \
--max-output-len 128 \
--device gcu \
--trust-remote-code \
--max-model-len 16384 \
--max-num-seqs 64 \
--dtype=float16
视频推理¶
python3.10 -m vllm_utils.benchmark_vision_language \
--demo \
--model=[path of MiniCPM-V-2_6] \
--model-arch-suffix Video \
--prompt=[your prompt] \
--input-vision-file=[path of your test video] \
--max-output-len 128 \
--device gcu \
--trust-remote-code \
--max-model-len 16384 \
--num-frames 64 \
--max-num-seqs 64 \
--dtype=float16
注:
默认为graph mode推理,若想使用eager mode,请添加
--enforce-eager
;--max-output-len
可按需调整;
性能测试¶
python3 -m vllm_utils.benchmark_vision_language \
--perf \
--model=[path of MiniCPM-V-2_6] \
--model-arch-suffix Image \
--batch-size 1 \
--max-output-len 128 \
--device gcu \
--trust-remote-code \
--max-model-len 16384 \
--input-vision-shape 1080,1080 \
--input-len 1024 \
--max-num-seqs 64 \
--block-size 64 \
--dtype=float16
注:
默认为graph mode推理,若想使用eager mode,请添加
--enforce-eager
;本模型支持的
max-model-len
为32768;
数据集测试¶
python3.10 -m vllm_utils.benchmark_vision_language \
--acc \
--model-arch-suffix Video \
--dataset-name=videomme \
--dataset-file=[path of Video-MME] \
--model=[path of MiniCPM-V-2_6] \
--max-output-len 128 \
--device=gcu \
--trust-remote-code \
--max-model-len 16384 \
--mm-per-prompt 8 \
--num-frames 8 \
--max-num-seqs 32 \
--dtype=float16 \
--disable-mm-preprocessor-cache \
--mm-per-prompt 8
注:
需将Video-MME文件下载到本地,并设置
--dataset-file
指向其存储路径;默认为graph mode推理,若想使用eager mode,请添加
--enforce-eager
;
MiniCPM-o-2_6¶
模型下载¶
url: MiniCPM-V-2_6
branch: main
commit id: 0ba1da4ad01a8366797a839d176fce854b905436
将上述url设定的路径下的内容全部下载到
MiniCPM-o-2_6
文件夹中。
requirements¶
python3 -m pip install decord==0.6.0 opencv-python==4.11.0.86 opencv-python-headless==4.11.0.86
批量离线推理¶
图像推理¶
python3.10 -m vllm_utils.benchmark_vision_language \
--backend vllm \
--demo \
--model=[path of MiniCPM-o-2_6] \
--model-arch-suffix Image \
--dtype=bfloat16 \
--prompt=[your prompt] \
--input-vision-file=[path of your test image] \
--max-output-len 100 \
--device gcu \
--max-model-len 16384 \
--trust-remote-code \
--block-size 64
视频推理¶
python3.10 -m vllm_utils.benchmark_vision_language \
--backend vllm \
--demo \
--model=[path of MiniCPM-o-2_6] \
--model-arch-suffix Video \
--prompt=[your prompt] \
--input-vision-file=[path of your test video] \
--max-output-len 128 \
--device gcu \
--trust-remote-code \
--max-model-len 16384 \
--num-frames 16 \
--dtype=bfloat16 \
--block-size=64
注:
默认为graph mode推理,若想使用eager mode,请添加
--enforce-eager
;--max-output-len
可按需调整;
性能测试¶
python3 -m vllm_utils.benchmark_vision_language \
--backend vllm \
--perf \
--model=[path of MiniCPM-o-2_6] \
--model-arch-suffix Image \
--dtype=bfloat16 \
--batch-size 1 \
--input-len 2048 \
--input-vision-shape "448,448" \
--max-output-len 2048 \
--device gcu \
--trust-remote-code \
--max-model-len 16384 \
--block-size=64
注:
默认为graph mode推理,若想使用eager mode,请添加
--enforce-eager
;本模型支持的
max-model-len
为16384;