6.4. Internvl

InternVL2_5-78B

模型下载

  • 将上述url设定的路径下的内容全部下载到InternVL2_5-78B文件夹中。

注:需要安装以下依赖:

python3 -m pip install decord

环境变量

export VLLM_USE_V1=0
export VLLM_ATTENTION_BACKEND=XFORMERS

批量离线推理

图像推理

python3 -m vllm_utils.benchmark_vision_language \
 --demo \
 --model [path of InternVL2_5-78B] \
 --prompt [your prompt] \
 --input-vision-file [path of your test image] \
 --max-output-len 128 \
 --device gcu \
 --trust-remote-code \
 --max-model-len 32768 \
 --tensor-parallel-size 8 \
 --disable-async-output-proc

视频推理

python3 -m vllm_utils.benchmark_vision_language \
 --demo \
 --model-arch-suffix Video \
 --model [path of InternVL2_5-78B] \
 --prompt [your prompt] \
 --input-vision-file [path of your test video] \
 --num-frames 8 \
 --mm-per-prompt 8 \
 --max-output-len 512 \
 --device gcu \
 --trust-remote-code \
 --max-model-len 32768 \
 --tensor-parallel-size 8 \
 --disable-async-output-proc

注:

  • 默认为graph mode推理,若想使用eager mode,请添加--enforce-eager

  • 示例图片下载地址为image1.jpg;

性能测试

单图性能测试

python3 -m vllm_utils.benchmark_vision_language \
 --perf \
 --model=[path of InternVL2_5-78B] \
 --batch-size=8 \
 --input-len=1024 \
 --input-vision-shape="448,448" \
 --mm-per-prompt=1 \
 --max-output-len=512 \
 --trust-remote-code \
 --device=gcu \
 --block-size 64 \
 --tensor-parallel-size 8 \
 --max-model-len 32768 \
 --gpu-memory-utilization 0.9 \
 --disable-async-output-proc

多图性能测试

python3 -m vllm_utils.benchmark_vision_language \
 --perf \
 --model=[path of InternVL2_5-78B] \
 --batch-size=8 \
 --input-len=1024 \
 --input-vision-shape="448,448;448,448" \
 --mm-per-prompt=2 \
 --max-output-len=512 \
 --trust-remote-code \
 --device=gcu \
 --block-size 64 \
 --tensor-parallel-size 8 \
 --max-model-len 32768 \
 --gpu-memory-utilization 0.9 \
 --disable-async-output-proc

注:

  • 默认为graph mode推理,若想使用eager mode,请添加--enforce-eager

  • 本模型支持的max-model-len为32768;