vllm-project / vllm

A high-throughput and memory-efficient inference and serving engine for LLMs
https://docs.vllm.ai
Apache License 2.0
29.69k stars 4.48k forks source link

[Bug]: internvl2 multi-prompt input with one image each get RuntimeError #8361

Closed guozhiyao closed 1 month ago

guozhiyao commented 1 month ago

Your current environment

The output of `python collect_env.py` ```text Collecting environment information... PyTorch version: 2.4.0 Is debug build: False CUDA used to build PyTorch: 12.4 ROCM used to build PyTorch: N/A OS: Alibaba Group Enterprise Linux Server 7.2 (Paladin) (x86_64) GCC version: (GCC) 10.2.1 20200825 (Alibaba 10.2.1-3 2.17) Clang version: Could not collect CMake version: version 3.22.1 Libc version: glibc-2.32 Python version: 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0] (64-bit runtime) Python platform: Linux-5.10.112-005.ali5000.al8.x86_64-x86_64-with-glibc2.32 Is CUDA available: True CUDA runtime version: 12.4.99 CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: NVIDIA L20 Nvidia driver version: 535.161.08 cuDNN version: Probably one of the following: /usr/lib64/libcudnn.so.9.0.0 /usr/lib64/libcudnn_adv.so.9.0.0 /usr/lib64/libcudnn_cnn.so.9.0.0 /usr/lib64/libcudnn_engines_precompiled.so.9.0.0 /usr/lib64/libcudnn_engines_runtime_compiled.so.9.0.0 /usr/lib64/libcudnn_graph.so.9.0.0 /usr/lib64/libcudnn_heuristic.so.9.0.0 /usr/lib64/libcudnn_ops.so.9.0.0 HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True CPU: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 128 On-line CPU(s) list: 8-15,72-78 Off-line CPU(s) list: 0-7,16-71,79-127 Thread(s) per core: 0 Core(s) per socket: 32 Socket(s): 2 NUMA node(s): 2 Vendor ID: GenuineIntel CPU family: 6 Model: 143 Model name: Intel(R) Xeon(R) Gold 6462C Stepping: 8 CPU MHz: 3899.765 CPU max MHz: 3900.0000 CPU min MHz: 800.0000 BogoMIPS: 6600.00 Virtualization: VT-x L1d cache: 48K L1i cache: 32K L2 cache: 2048K L3 cache: 61440K NUMA node0 CPU(s): 0-31,64-95 NUMA node1 CPU(s): 32-63,96-127 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 invpcid_single intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm uintr md_clear serialize tsxldtrk pconfig arch_lbr amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities Versions of relevant libraries: [pip3] numpy==1.26.4 [pip3] nvidia-ml-py==12.560.30 [pip3] nvidia-ml-py3==7.352.0 [pip3] pynvml==11.5.0 [pip3] pyzmq==26.2.0 [pip3] torch==2.4.0 [pip3] torchaudio==2.4.0a0+69d4077 [pip3] torchmetrics==1.4.1 [pip3] torchvision==0.19.0 [pip3] transformers==4.44.2 [pip3] triton==3.0.0 [conda] Could not collect ROCM Version: Could not collect Neuron SDK Version: N/A vLLM Version: 0.6.0@32e7db25365415841ebc7c4215851743fbb1bad1 vLLM Build Flags: CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled GPU Topology: GPU0 CPU Affinity NUMA Affinity GPU NUMA ID GPU0 X 8-15,72-78 0 N/A Legend: X = Self SYS = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI) NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node PHB = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU) PXB = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge) PIX = Connection traversing at most a single PCIe bridge NV# = Connection traversing a bonded set of # NVLinks ```

🐛 Describe the bug

I init the mode with

from vllm import LLM, SamplingParams

load_dir=""OpenGVLab/InternVL2-8B""
llm = LLM(
    model=load_dir,
    trust_remote_code=True,
    max_num_seqs=5,
    max_model_len=8192,
)

tokenizer = AutoTokenizer.from_pretrained(load_dir, trust_remote_code=True)

stop_tokens = ["<|endoftext|>", "<|im_start|>", "<|im_end|>", "<|end|>"]
stop_token_ids = [tokenizer.convert_tokens_to_ids(i) for i in stop_tokens]

sampling_params = SamplingParams(temperature=0.2,
                                 max_tokens=8192,
                                 top_p=0.5,
                                 repetition_penalty=1.0,
                                 stop_token_ids=stop_token_ids)

I run the inference with

llm.generate(prompt, sampling_params=sampling_params)

and the prompt is as below

[{'multi_modal_data': {'image': <PIL.Image.Image image mode=RGB size=800x800 at 0x7FE280267490>}, 'prompt': '<s><|im_start|>user\n{prompt_text}<image><|im_end|>\n<|im_start|>assistant\n'}, {'multi_modal_data': {'image': <PIL.Image.Image image mode=RGB size=500x500 at 0x7FE280267430>}, 'prompt': '<s><|im_start|>user\n{prompt_text}<image><|im_end|>\n<|im_start|>assistant\n'}, {'multi_modal_data': {'image': <PIL.Image.Image image mode=RGB size=800x800 at 0x7FE2982D40A0>}, 'prompt': '<s><|im_start|>user\n{prompt_text}<image><|im_end|>\n<|im_start|>assistant\n'}]

where the {prompt_text} is some text.

And I meet the

image

Before submitting a new issue...

DarkLight1337 commented 1 month ago

Does the problem occur when you only pass in one prompt at a time?

guozhiyao commented 1 month ago

Does the problem occur when you only pass in one prompt at a time?

@DarkLight1337 I have tested it, and it works correctly this way.

res = []
for p in prompt:
       tmp = llm.generate(p, *args, **kwargs, sampling_params=sampling_params)[0]
       res.append(tmp)