6.6. Qwen-VL

Qwen2-VL-2B-Instruct

模型下载

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

requirements

python3 -m pip install opencv-python==4.11.0.86 opencv-python-headless==4.11.0.86

批量离线推理

python3 -m vllm_utils.benchmark_vision_language \
--backend vllm \
--demo \
--model=[path of Qwen2-VL-2B-Instruct] \
--model-arch-suffix Image \
--prompt=[your prompt] \
--input-vision-file=[path of your test image] \
--dtype=float16 \
--max-output-len=128 \
--device=gcu \
--tensor-parallel-size 1 \
--max-model-len 32768 \
--trust-remote-code \
--block-size=64

注:

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

性能测试

python3 -m vllm_utils.benchmark_vision_language \
 --backend vllm \
 --perf \
 --model=[path of Qwen2-VL-2B-Instruct] \
 --model-arch-suffix Image \
 --dtype=float16 \
 --num-prompts 1 \
 --batch-size=1 \
 --input-len=1200 \
 --input-vision-shape=1280,720 \
 --max-output-len=100 \
 --device=gcu \
 --tensor-parallel-size 1 \
 --max-model-len 32768 \
 --trust-remote-code \
 --block-size=64

注:

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

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

Qwen2-VL-7B-Instruct-GPTQ-Int4

模型下载

  • 将上述url设定的路径下的内容全部下载到Qwen2-VL-7B-Instruct-GPTQ-Int4文件夹中。

requirements

python3 -m pip install opencv-python==4.11.0.86 opencv-python-headless==4.11.0.86

批量离线推理

python3 -m vllm_utils.benchmark_vision_language \
--backend vllm \
--demo \
--model=[path of Qwen2-VL-7B-Instruct-GPTQ-Int4] \
--model-arch-suffix Image \
--prompt=[your prompt] \
--input-vision-file=[path of your test image] \
--dtype=float16 \
--max-output-len=128 \
--device=gcu \
--tensor-parallel-size 1 \
--max-model-len 32768 \
--trust-remote-code \
--block-size=64 \
--quantization gptq

注:

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

性能测试

python3 -m vllm_utils.benchmark_vision_language \
--backend vllm \
--perf \
--model=[path of Qwen2-VL-7B-Instruct-GPTQ-Int4] \
--model-arch-suffix Image \
--dtype=float16 \
--num-prompts 1 \
--batch-size=1 \
--input-len=1200 \
--input-vision-shape=1280,720 \
--max-output-len=100 \
--device=gcu \
--tensor-parallel-size 1 \
--max-model-len 32768 \
--trust-remote-code \
--block-size=64 \
--quantization gptq

注:

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

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

Qwen2-VL-72B-Instruct-GPTQ-Int8

模型下载

  • 将上述url设定的路径下的内容全部下载到Qwen2-VL-72B-Instruct-GPTQ-Int8文件夹中。

requirements

python3 -m pip install opencv-python==4.11.0.86 opencv-python-headless==4.11.0.86

批量离线推理

图像推理

python3 -m vllm_utils.benchmark_vision_language \
 --backend vllm --demo \
 --model=[path of Qwen2-VL-72B-Instruct-GPTQ-Int8] \
 --model-arch-suffix Image \
 --prompt=[your prompt] \
 --input-vision-file=[path of your test image] \
 --dtype=float16 \
 --max-output-len=128 \
 --device=gcu \
 --tensor-parallel-size 4 \
 --max-model-len 32768 \
 --trust-remote-code \
 --block-size=64 \
 --quantization gptq

视频推理

python3 -m vllm_utils.benchmark_vision_language \
 --backend vllm \
 --demo \
 --model=[path of Qwen2-VL-72B-Instruct-GPTQ-Int8] \
 --model-arch-suffix Video \
 --prompt=[your prompt] \
 --input-vision-file=[path of your test video] \
 --num-frames 12 \
 --dtype=float16 \
 --max-output-len=128 \
 --device=gcu \
 --tensor-parallel-size 4 \
 --max-model-len 32768 \
 --trust-remote-code \
 --block-size=64 \
 --quantization gptq

注:

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

性能测试

单图性能测试

python3 -m vllm_utils.benchmark_vision_language \
 --backend vllm \
 --perf \
 --model=[path of Qwen2-VL-72B-Instruct-GPTQ-Int8] \
 --model-arch-suffix Image \
 --dtype=float16 \
 --batch-size=13 \
 --input-len=1500 \
 --input-vision-shape="448,448;448,448" \
 --mm-per-prompt=2 \
 --max-output-len=8192 \
 --device=gcu \
 --tensor-parallel-size 4 \
 --max-model-len 32768 \
 --max-seq-len-to-capture 32768 \
 --trust-remote-code \
 --block-size=64 \
 --quantization gptq \
 --gpu-memory-utilization 0.945

多图性能测试

python3 -m vllm_utils.benchmark_vision_language \
 --backend vllm \
 --perf \
 --model=[path of Qwen2-VL-72B-Instruct-GPTQ-Int8] \
 --model-arch-suffix Image \
 --dtype=float16 \
 --batch-size=32 \
 --input-len=1500 \
 --input-vision-shape="448,448" \
 --max-output-len=4096 \
 --device=gcu \
 --tensor-parallel-size 4 \
 --max-model-len 32768 \
 --max-seq-len-to-capture 32768 \
 --trust-remote-code \
 --block-size=64 \
 --quantization gptq \
 --gpu-memory-utilization 0.9

注:

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

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

Qwen2.5-VL-3B-Instruct

模型下载

  • 将上述url设定的路径下的内容全部下载到Qwen2.5-VL-3B-Instruct文件夹中。

注:需要安装以下依赖:

python3 -m pip install transformers==4.52.3 opencv-python==4.11.0.86 opencv-python-headless==4.11.0.86

批量离线推理

图像推理

python3 -m vllm_utils.benchmark_vision_language \
 --backend vllm \
 --demo \
 --model=[path of Qwen2.5-VL-3B-Instruct] \
 --model-arch-suffix Image \
 --prompt=[your prompt] \
 --input-vision-file=[path of your test image] \
 --dtype=bfloat16 \
 --max-output-len=128 \
 --device=gcu \
 --tensor-parallel-size 1 \
 --max-model-len 32768 \
 --trust-remote-code \
 --block-size=64

视频推理

python3 -m vllm_utils.benchmark_vision_language \
 --backend vllm \
 --demo \
 --model=[path of Qwen2.5-VL-3B-Instruct] \
 --model-arch-suffix Video \
 --prompt=[your prompt] \
 --input-vision-file=[path of your test video] \
 --num-frames 6 \
 --dtype=bfloat16 \
 --max-output-len=128 \
 --device=gcu \
 --tensor-parallel-size 1 \
 --max-model-len 32768 \
 --trust-remote-code \
 --block-size=64

注:

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

性能测试

python3 -m vllm_utils.benchmark_vision_language \
 --backend vllm \
 --perf \
 --model=[path of Qwen2.5-VL-3B-Instruct] \
 --model-arch-suffix Image \
 --dtype=bfloat16 \
 --batch-size=1 \
 --input-len=1200 \
 --input-vision-shape="1280,720" \
 --max-output-len=100 \
 --device=gcu \
 --tensor-parallel-size 1 \
 --max-model-len 32768 \
 --trust-remote-code \
 --block-size=64 \
 --gpu-memory-utilization 0.9

注:

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

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

QVQ-72B-Preview

模型下载

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

requirements

python3 -m pip install opencv-python==4.11.0.86 opencv-python-headless==4.11.0.86

批量离线推理

图像推理

python3 -m vllm_utils.benchmark_vision_language \
 --backend vllm \
 --demo \
 --model=[path of QVQ-72B-Preview] \
 --model-arch-suffix Image \
 --prompt=[your prompt] \
 --input-vision-file=[path of your test image] \
 --dtype=bfloat16 \
 --max-output-len=8196 \
 --device=gcu \
 --tensor-parallel-size 8 \
 --max-model-len 32768 \
 --trust-remote-code \
 --block-size=64

视频推理

python3 -m vllm_utils.benchmark_vision_language \
 --backend vllm \
 --demo \
 --model=[path of QVQ-72B-Preview] \
 --model-arch-suffix Video \
 --prompt=[your prompt] \
 --input-vision-file=[path of your test video] \
 --num-frames 12 \
 --dtype=bfloat16 \
 --max-output-len=8196 \
 --device=gcu \
 --tensor-parallel-size 8 \
 --max-model-len 32768 \
 --trust-remote-code \
 --block-size=64

注:

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

性能测试

python3 -m vllm_utils.benchmark_vision_language \
 --backend vllm \
 --perf \
 --model=[path of QVQ-72B-Preview] \
 --model-arch-suffix Image \
 --dtype=bfloat16 \
 --batch-size=1 \
 --input-len=2048 \
 --input-vision-shape="1280,720" \
 --max-output-len=2048 \
 --device=gcu \
 --tensor-parallel-size 8 \
 --max-model-len 32768 \
 --trust-remote-code \
 --block-size=64 \
 --gpu-memory-utilization 0.9

注:

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

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