vllm-project / vllm

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

[Bug]: ValueError:Could not broadcast input array from shape (542,) into shape (512,) #9963

Open sherlockma11 opened 4 weeks ago

sherlockma11 commented 4 weeks ago

Your current environment

ValueError:Could not broadcast input array from shape (542,) into shape (512,) ```text Collecting environment information... WARNING 11-03 10:23:50 _custom_ops.py:19] Failed to import from vllm._C with ModuleNotFoundError("No module named 'vllm._C'") /media/iiau/Data/mn/qwen2-VL/vllm-main/vllm/connections.py:8: RuntimeWarning: Failed to read commit hash: No module named 'vllm._version' from vllm.version import __version__ as VLLM_VERSION PyTorch version: 2.4.0+cu121 Is debug build: False CUDA used to build PyTorch: 12.1 ROCM used to build PyTorch: N/A OS: Ubuntu 22.04.3 LTS (x86_64) GCC version: (Ubuntu 9.5.0-1ubuntu1~22.04) 9.5.0 Clang version: Could not collect CMake version: Could not collect Libc version: glibc-2.35 Python version: 3.10.15 (main, Oct 3 2024, 07:27:34) [GCC 11.2.0] (64-bit runtime) Python platform: Linux-6.5.0-26-generic-x86_64-with-glibc2.35 Is CUDA available: True CUDA runtime version: 11.8.89 CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: NVIDIA GeForce RTX 2080 Ti GPU 1: NVIDIA GeForce RTX 2080 Ti GPU 2: NVIDIA GeForce RTX 2080 Ti GPU 3: NVIDIA GeForce RTX 2080 Ti GPU 4: NVIDIA GeForce RTX 2080 Ti GPU 5: NVIDIA GeForce RTX 2080 Ti GPU 6: NVIDIA GeForce RTX 2080 Ti GPU 7: NVIDIA GeForce RTX 2080 Ti Nvidia driver version: 535.161.07 cuDNN version: Could not collect 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 Address sizes: 46 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 64 On-line CPU(s) list: 0-63 Vendor ID: GenuineIntel Model name: Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz CPU family: 6 Model: 85 Thread(s) per core: 2 Core(s) per socket: 16 Socket(s): 2 Stepping: 7 CPU max MHz: 3900.0000 CPU min MHz: 1000.0000 BogoMIPS: 4600.00 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 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 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts vnmi pku ospke avx512_vnni md_clear flush_l1d arch_capabilities Virtualization: VT-x L1d cache: 1 MiB (32 instances) L1i cache: 1 MiB (32 instances) L2 cache: 32 MiB (32 instances) L3 cache: 44 MiB (2 instances) NUMA node(s): 2 NUMA node0 CPU(s): 0-15,32-47 NUMA node1 CPU(s): 16-31,48-63 Vulnerability Gather data sampling: Vulnerable: No microcode Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable Vulnerability Retbleed: Mitigation; Enhanced IBRS Vulnerability Spec rstack overflow: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Mitigation; TSX disabled Versions of relevant libraries: [pip3] numpy==1.26.3 [pip3] nvidia-cublas-cu12==12.1.3.1 [pip3] nvidia-cuda-cupti-cu12==12.1.105 [pip3] nvidia-cuda-nvrtc-cu12==12.1.105 [pip3] nvidia-cuda-runtime-cu12==12.1.105 [pip3] nvidia-cudnn-cu12==9.1.0.70 [pip3] nvidia-cufft-cu12==11.0.2.54 [pip3] nvidia-curand-cu12==10.3.2.106 [pip3] nvidia-cusolver-cu12==11.4.5.107 [pip3] nvidia-cusparse-cu12==12.1.0.106 [pip3] nvidia-ml-py==12.560.30 [pip3] nvidia-nccl-cu12==2.20.5 [pip3] nvidia-nvjitlink-cu12==12.1.105 [pip3] nvidia-nvtx-cu12==12.1.105 [pip3] pyzmq==26.2.0 [pip3] torch==2.4.0 [pip3] torchaudio==2.3.1+cu121 [pip3] torchvision==0.19.0 [pip3] transformers==4.46.1 [pip3] triton==3.0.0 [conda] numpy 1.26.3 pypi_0 pypi [conda] nvidia-cublas-cu12 12.1.3.1 pypi_0 pypi [conda] nvidia-cuda-cupti-cu12 12.1.105 pypi_0 pypi [conda] nvidia-cuda-nvrtc-cu12 12.1.105 pypi_0 pypi [conda] nvidia-cuda-runtime-cu12 12.1.105 pypi_0 pypi [conda] nvidia-cudnn-cu12 9.1.0.70 pypi_0 pypi [conda] nvidia-cufft-cu12 11.0.2.54 pypi_0 pypi [conda] nvidia-curand-cu12 10.3.2.106 pypi_0 pypi [conda] nvidia-cusolver-cu12 11.4.5.107 pypi_0 pypi [conda] nvidia-cusparse-cu12 12.1.0.106 pypi_0 pypi [conda] nvidia-ml-py 12.560.30 pypi_0 pypi [conda] nvidia-nccl-cu12 2.20.5 pypi_0 pypi [conda] nvidia-nvjitlink-cu12 12.1.105 pypi_0 pypi [conda] nvidia-nvtx-cu12 12.1.105 pypi_0 pypi [conda] pyzmq 26.2.0 pypi_0 pypi [conda] torch 2.4.0 pypi_0 pypi [conda] torchaudio 2.3.1+cu121 pypi_0 pypi [conda] torchvision 0.19.0 pypi_0 pypi [conda] transformers 4.46.1 pypi_0 pypi [conda] triton 3.0.0 pypi_0 pypi ROCM Version: Could not collect Neuron SDK Version: N/A vLLM Version: N/A (dev) vLLM Build Flags: CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled GPU Topology: GPU0 GPU1 GPU2 GPU3 GPU4 GPU5 GPU6 GPU7 CPU Affinity NUMA Affinity GPU NUMA ID GPU0 X PIX NODE NODE SYS SYS SYS SYS 0-15,32-47 0 N/A GPU1 PIX X NODE NODE SYS SYS SYS SYS 0-15,32-47 0 N/A GPU2 NODE NODE X PIX SYS SYS SYS SYS 0-15,32-47 0 N/A GPU3 NODE NODE PIX X SYS SYS SYS SYS 0-15,32-47 0 N/A GPU4 SYS SYS SYS SYS X PIX NODE NODE 16-31,48-63 1 N/A GPU5 SYS SYS SYS SYS PIX X NODE NODE 16-31,48-63 1 N/A GPU6 SYS SYS SYS SYS NODE NODE X PIX 16-31,48-63 1 N/A GPU7 SYS SYS SYS SYS NODE NODE PIX X 16-31,48-63 1 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 ```

vllm serve Qwen2-VL-7B --dtype half --port 8000 --tensor-parallel-size 4 --pipeline-parallel-size 2 --gpu-memory-utilization 0.7 --limit_mm_per_prompt image=4 --max_model_len 8784

I deployed Qwen2-vl and I don't know what requests other people have sent, and here is the error reported

image image (1)

Model Input Dumps

🐛 Describe the bug

Before submitting a new issue...

sherlockma11 commented 4 weeks ago

Sorry,I can't give much information.Because I don't know what input it received.

therealcyberlord commented 3 weeks ago

Hi! I ran into a similar issue and was able to resolve it by setting max_seq_len_to_capture to a higher value. The default seems to be 8192, so if your inputs are longer than that, it could cause problems.

FuryMartin commented 2 weeks ago

Hi! I ran into a similar issue and was able to resolve it by setting max_seq_len_to_capture to a higher value. The default seems to be 8192, so if your inputs are longer than that, it could cause problems.

This works for me, too. Thanks!

rpvelloso commented 2 days ago

+1 (docker 0.6.3.post1 with llama 3.2 3B Instruct fp16)

INFO 11-29 09:04:25 engine.py:290] Added request chat-c16b9317f80c418486bfda9b04c3d8e6. INFO: 10.18.14.36:53830 - "POST /v1/chat/completions HTTP/1.1" 400 Bad Request INFO: 10.18.14.36:54474 - "POST /v1/chat/completions HTTP/1.1" 400 Bad Request ERROR 11-29 09:04:28 engine.py:158] ValueError('could not broadcast input array from shape (681,) into shape (512,)') ERROR 11-29 09:04:28 engine.py:158] Traceback (most recent call last): ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/engine/multiprocessing/engine.py", line 156, in start ERROR 11-29 09:04:28 engine.py:158] self.run_engine_loop() ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/engine/multiprocessing/engine.py", line 219, in run_engine_loop ERROR 11-29 09:04:28 engine.py:158] request_outputs = self.engine_step() ERROR 11-29 09:04:28 engine.py:158] ^^^^^^^^^^^^^^^^^^ ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/engine/multiprocessing/engine.py", line 237, in engine_step ERROR 11-29 09:04:28 engine.py:158] raise e ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/engine/multiprocessing/engine.py", line 228, in engine_step ERROR 11-29 09:04:28 engine.py:158] return self.engine.step() ERROR 11-29 09:04:28 engine.py:158] ^^^^^^^^^^^^^^^^^^ ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/engine/llm_engine.py", line 1389, in step ERROR 11-29 09:04:28 engine.py:158] outputs = self.model_executor.execute_model( ERROR 11-29 09:04:28 engine.py:158] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/executor/distributed_gpu_executor.py", line 82, in execute_model ERROR 11-29 09:04:28 engine.py:158] driver_outputs = self._driver_execute_model(execute_model_req) ERROR 11-29 09:04:28 engine.py:158] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/executor/multiproc_gpu_executor.py", line 155, in _driver_execute_model ERROR 11-29 09:04:28 engine.py:158] return self.driver_worker.execute_model(execute_model_req) ERROR 11-29 09:04:28 engine.py:158] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/worker/worker_base.py", line 303, in execute_model ERROR 11-29 09:04:28 engine.py:158] inputs = self.prepare_input(execute_model_req) ERROR 11-29 09:04:28 engine.py:158] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/worker/worker_base.py", line 291, in prepare_input ERROR 11-29 09:04:28 engine.py:158] return self._get_driver_input_and_broadcast(execute_model_req) ERROR 11-29 09:04:28 engine.py:158] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/worker/worker_base.py", line 253, in _get_driver_input_and_broadcast ERROR 11-29 09:04:28 engine.py:158] self.model_runner.prepare_model_input( ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/worker/model_runner.py", line 1586, in prepare_model_input ERROR 11-29 09:04:28 engine.py:158] model_input = self._prepare_model_input_tensors( ERROR 11-29 09:04:28 engine.py:158] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/worker/model_runner.py", line 1196, in _prepare_model_input_tensors ERROR 11-29 09:04:28 engine.py:158] return builder.build() # type: ignore ERROR 11-29 09:04:28 engine.py:158] ^^^^^^^^^^^^^^^ ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/worker/model_runner.py", line 867, in build ERROR 11-29 09:04:28 engine.py:158] attn_metadata = self.attn_metadata_builder.build( ERROR 11-29 09:04:28 engine.py:158] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ERROR 11-29 09:04:28 engine.py:158] File "/usr/local/lib/python3.12/dist-packages/vllm/attention/backends/utils.py", line 215, in build ERROR 11-29 09:04:28 engine.py:158] input_block_tables[i, :len(block_table)] = block_table ERROR 11-29 09:04:28 engine.py:158] ~~~~~~^^^^^^^^^^^^^^^^^^^^^^ ERROR 11-29 09:04:28 engine.py:158] ValueError: could not broadcast input array from shape (681,) into shape (512,) (VllmWorkerProcess pid=68) INFO 11-29 09:04:28 multiproc_worker_utils.py:240] Worker exiting CRITICAL 11-29 09:04:29 launcher.py:99] MQLLMEngine is already dead, terminating server process INFO: 10.18.14.36:54474 - "POST /v1/chat/completions HTTP/1.1" 500 Internal Server Error INFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [1] INFO 11-29 09:04:30 multiproc_worker_utils.py:120] Killing local vLLM worker processes Process SpawnProcess-1: Traceback (most recent call last): File "/usr/lib/python3.12/multiprocessing/process.py", line 317, in _bootstrap util._exit_function() File "/usr/lib/python3.12/multiprocessing/util.py", line 360, in _exit_function p.join() File "/usr/lib/python3.12/multiprocessing/process.py", line 149, in join res = self._popen.wait(timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/multiprocessing/popen_fork.py", line 43, in wait return self.poll(os.WNOHANG if timeout == 0.0 else 0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/multiprocessing/popen_fork.py", line 27, in poll pid, sts = os.waitpid(self.pid, flag) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/vllm/engine/multiprocessing/engine.py", line 386, in signal_handler raise KeyboardInterrupt("MQLLMEngine terminated") KeyboardInterrupt: MQLLMEngine terminated