6.6. qwen-vl

Qwen2-VL-2B-Instruct

模型下载

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

requirements

pip3 install git+https://github.com/huggingface/transformers@21fac7abba2a37fae86106f87fcf9974fd1e3830

批量离线推理

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

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

模型下载

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

requirements

pip3 install git+https://github.com/huggingface/transformers@21fac7abba2a37fae86106f87fcf9974fd1e3830

批量离线推理

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;