vllm-project / vllm

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

[Bug]: Phi-3 vision crash: TypeError: only integer tensors of a single element can be converted to an index #5969

Closed pseudotensor closed 4 months ago

pseudotensor commented 4 months ago

Your current environment

vllm version:

e9de9dd551ac595a9f3825fcd1507deceef4f332
Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.4 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.10.14 (main, May  6 2024, 19:42:50) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-6.5.0-1018-oracle-x86_64-with-glibc2.35
Is CUDA available: N/A
CUDA runtime version: 12.4.99
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: 
GPU 0: NVIDIA H100 80GB HBM3
GPU 1: NVIDIA H100 80GB HBM3
GPU 2: NVIDIA H100 80GB HBM3
GPU 3: NVIDIA H100 80GB HBM3
GPU 4: NVIDIA H100 80GB HBM3
GPU 5: NVIDIA H100 80GB HBM3
GPU 6: NVIDIA H100 80GB HBM3
GPU 7: NVIDIA H100 80GB HBM3

Nvidia driver version: 535.161.07
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.7
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      46 bits physical, 57 bits virtual
Byte Order:                         Little Endian
CPU(s):                             224
On-line CPU(s) list:                0-111
Off-line CPU(s) list:               112-223
Vendor ID:                          GenuineIntel
Model name:                         Intel(R) Xeon(R) Platinum 8480+
CPU family:                         6
Model:                              143
Thread(s) per core:                 1
Core(s) per socket:                 56
Socket(s):                          2
Stepping:                           8
CPU max MHz:                        3800.0000
CPU min MHz:                        0.0000
BogoMIPS:                           4000.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 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 flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid 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_act_window hwp_epp hwp_pkg_req vnmi avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr ibt amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities
Virtualization:                     VT-x
L1d cache:                          5.3 MiB (112 instances)
L1i cache:                          3.5 MiB (112 instances)
L2 cache:                           224 MiB (112 instances)
L3 cache:                           210 MiB (2 instances)
NUMA node(s):                       2
NUMA node0 CPU(s):                  0-55
NUMA node1 CPU(s):                  56-111
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit:        Not affected
Vulnerability L1tf:                 Not affected
Vulnerability Mds:                  Not affected
Vulnerability Meltdown:             Not affected
Vulnerability Mmio stale data:      Not affected
Vulnerability Retbleed:             Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass:    Vulnerable
Vulnerability Spectre v1:           Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers
Vulnerability Spectre v2:           Vulnerable, IBPB: disabled, STIBP: disabled, PBRSB-eIBRS: Vulnerable
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected

Versions of relevant libraries:
[pip3] No relevant packages
[conda] No relevant packages
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: N/A
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0    GPU1    GPU2    GPU3    GPU4    GPU5    GPU6    GPU7    NIC0    NIC1    NIC2    NIC3    NIC4    NIC5    NIC6    NIC7    NIC8    NIC9    NIC10   NIC11   NIC12   NIC13   NIC14   NIC15   NIC16   NIC17   CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      NV18    NV18    NV18    NV18    NV18    NV18    NV18    PXB     PXB     NODE    NODE    NODE    NODE    NODE    NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     0-55    0               N/A
GPU1    NV18     X      NV18    NV18    NV18    NV18    NV18    NV18    NODE    NODE    NODE    PXB     PXB     NODE    NODE    NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     0-55    0               N/A
GPU2    NV18    NV18     X      NV18    NV18    NV18    NV18    NV18    NODE    NODE    NODE    NODE    NODE    PXB     PXB     NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     0-55    0               N/A
GPU3    NV18    NV18    NV18     X      NV18    NV18    NV18    NV18    NODE    NODE    NODE    NODE    NODE    NODE    NODE    PXB     PXB     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     0-55    0               N/A
GPU4    NV18    NV18    NV18    NV18     X      NV18    NV18    NV18    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     PXB     PXB     NODE    NODE    NODE    NODE    NODE    NODE    NODE    56-111  1               N/A
GPU5    NV18    NV18    NV18    NV18    NV18     X      NV18    NV18    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     NODE    NODE    NODE    PXB     PXB     NODE    NODE    NODE    NODE    56-111  1               N/A
GPU6    NV18    NV18    NV18    NV18    NV18    NV18     X      NV18    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     NODE    NODE    NODE    NODE    NODE    PXB     PXB     NODE    NODE    56-111  1               N/A
GPU7    NV18    NV18    NV18    NV18    NV18    NV18    NV18     X      SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     NODE    NODE    NODE    NODE    NODE    NODE    NODE    PXB     PXB     56-111  1               N/A
NIC0    PXB     NODE    NODE    NODE    SYS     SYS     SYS     SYS      X      PIX     NODE    NODE    NODE    NODE    NODE    NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS
NIC1    PXB     NODE    NODE    NODE    SYS     SYS     SYS     SYS     PIX      X      NODE    NODE    NODE    NODE    NODE    NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS
NIC2    NODE    NODE    NODE    NODE    SYS     SYS     SYS     SYS     NODE    NODE     X      NODE    NODE    NODE    NODE    NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS
NIC3    NODE    PXB     NODE    NODE    SYS     SYS     SYS     SYS     NODE    NODE    NODE     X      PIX     NODE    NODE    NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS
NIC4    NODE    PXB     NODE    NODE    SYS     SYS     SYS     SYS     NODE    NODE    NODE    PIX      X      NODE    NODE    NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS
NIC5    NODE    NODE    PXB     NODE    SYS     SYS     SYS     SYS     NODE    NODE    NODE    NODE    NODE     X      PIX     NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS
NIC6    NODE    NODE    PXB     NODE    SYS     SYS     SYS     SYS     NODE    NODE    NODE    NODE    NODE    PIX      X      NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS
NIC7    NODE    NODE    NODE    PXB     SYS     SYS     SYS     SYS     NODE    NODE    NODE    NODE    NODE    NODE    NODE     X      PIX     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS
NIC8    NODE    NODE    NODE    PXB     SYS     SYS     SYS     SYS     NODE    NODE    NODE    NODE    NODE    NODE    NODE    PIX      X      SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS
NIC9    SYS     SYS     SYS     SYS     PXB     NODE    NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS      X      PIX     NODE    NODE    NODE    NODE    NODE    NODE    NODE
NIC10   SYS     SYS     SYS     SYS     PXB     NODE    NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     PIX      X      NODE    NODE    NODE    NODE    NODE    NODE    NODE
NIC11   SYS     SYS     SYS     SYS     NODE    NODE    NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     NODE    NODE     X      NODE    NODE    NODE    NODE    NODE    NODE
NIC12   SYS     SYS     SYS     SYS     NODE    PXB     NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     NODE    NODE    NODE     X      PIX     NODE    NODE    NODE    NODE
NIC13   SYS     SYS     SYS     SYS     NODE    PXB     NODE    NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     NODE    NODE    NODE    PIX      X      NODE    NODE    NODE    NODE
NIC14   SYS     SYS     SYS     SYS     NODE    NODE    PXB     NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     NODE    NODE    NODE    NODE    NODE     X      PIX     NODE    NODE
NIC15   SYS     SYS     SYS     SYS     NODE    NODE    PXB     NODE    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     NODE    NODE    NODE    NODE    NODE    PIX      X      NODE    NODE
NIC16   SYS     SYS     SYS     SYS     NODE    NODE    NODE    PXB     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     NODE    NODE    NODE    NODE    NODE    NODE    NODE     X      PIX
NIC17   SYS     SYS     SYS     SYS     NODE    NODE    NODE    PXB     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     NODE    NODE    NODE    NODE    NODE    NODE    NODE    PIX      X 

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

NIC Legend:

  NIC0: mlx5_0
  NIC1: mlx5_1
  NIC2: mlx5_2
  NIC3: mlx5_3
  NIC4: mlx5_4
  NIC5: mlx5_5
  NIC6: mlx5_6
  NIC7: mlx5_7
  NIC8: mlx5_8
  NIC9: mlx5_9
  NIC10: mlx5_10
  NIC11: mlx5_11
  NIC12: mlx5_12
  NIC13: mlx5_13
  NIC14: mlx5_14
  NIC15: mlx5_15
  NIC16: mlx5_16
  NIC17: mlx5_17
(base) ubuntu@compute-permanent-node-406:~/vllm$ 

Build:

git clone https://github.com/vllm-project/vllm.git
cd ~/vllm
conda create -n vllm -y
conda activate vllm
conda install python=3.10 -y
pip install -e .
pip install hf_transfer
pip install torchvision

Ran:

cd ~/vllm/

# https://github.com/vllm-project/vllm/blob/afed90a0344b1b0ce6aae46efc630adb489ec769/examples/phi3v_example.py#L15
export NCCL_IGNORE_DISABLED_P2P=1
export CUDA_VISIBLE_DEVICES=5
python -m vllm.entrypoints.openai.api_server --port=5063 \
      --host=0.0.0.0 --model microsoft/Phi-3-vision-128k-instruct \
      --tensor-parallel-size=1 --seed 1234 \
      --trust-remote-code \
      --tensor-parallel-size=1 \
      --max-num-batched-tokens=131072 --max-log-len=100 \
      --image-input-type=pixel_values \
      --image-token-id=32044 \
      --image-input-shape="1,3,1008,1344" \
      --image-feature-size=1921 \
      --download-dir=$HOME/.cache/huggingface/hub &> vllm_phi3_vision.log &
disown %1

🐛 Describe the bug

WARNING 06-28 17:03:32 phi3v.py:322] Dynamic image shape is currently not supported. Resizing input image to (1344, 1008).
WARNING 06-28 17:03:32 phi3v.py:322] Dynamic image shape is currently not supported. Resizing input image to (1344, 1008).
ERROR 06-28 17:03:32 async_llm_engine.py:53] Engine background task failed
ERROR 06-28 17:03:32 async_llm_engine.py:53] Traceback (most recent call last):
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/vllm/vllm/engine/async_llm_engine.py", line 43, in _log_task_completion
ERROR 06-28 17:03:32 async_llm_engine.py:53]     return_value = task.result()
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/vllm/vllm/engine/async_llm_engine.py", line 550, in run_engine_loop
ERROR 06-28 17:03:32 async_llm_engine.py:53]     has_requests_in_progress = await self.engine_step()
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/vllm/vllm/engine/async_llm_engine.py", line 523, in engine_step
ERROR 06-28 17:03:32 async_llm_engine.py:53]     request_outputs = await self.engine.step_async()
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/vllm/vllm/engine/async_llm_engine.py", line 236, in step_async
ERROR 06-28 17:03:32 async_llm_engine.py:53]     output = await self.model_executor.execute_model_async(
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/vllm/vllm/executor/gpu_executor.py", line 121, in execute_model_async
ERROR 06-28 17:03:32 async_llm_engine.py:53]     output = await make_async(self.driver_worker.execute_model
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/miniconda3/envs/vllm/lib/python3.10/concurrent/futures/thread.py", line 58, in run
ERROR 06-28 17:03:32 async_llm_engine.py:53]     result = self.fn(*self.args, **self.kwargs)
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/miniconda3/envs/vllm/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
ERROR 06-28 17:03:32 async_llm_engine.py:53]     return func(*args, **kwargs)
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/vllm/vllm/worker/worker.py", line 290, in execute_model
ERROR 06-28 17:03:32 async_llm_engine.py:53]     output = self.model_runner.execute_model(seq_group_metadata_list,
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/miniconda3/envs/vllm/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
ERROR 06-28 17:03:32 async_llm_engine.py:53]     return func(*args, **kwargs)
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/vllm/vllm/worker/model_runner.py", line 753, in execute_model
ERROR 06-28 17:03:32 async_llm_engine.py:53]     hidden_states = model_executable(
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/miniconda3/envs/vllm/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
ERROR 06-28 17:03:32 async_llm_engine.py:53]     return self._call_impl(*args, **kwargs)
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/miniconda3/envs/vllm/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
ERROR 06-28 17:03:32 async_llm_engine.py:53]     return forward_call(*args, **kwargs)
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/vllm/vllm/model_executor/models/phi3v.py", line 376, in forward
ERROR 06-28 17:03:32 async_llm_engine.py:53]     inputs_embeds = self.vision_embed_tokens(
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/miniconda3/envs/vllm/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
ERROR 06-28 17:03:32 async_llm_engine.py:53]     return self._call_impl(*args, **kwargs)
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/miniconda3/envs/vllm/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
ERROR 06-28 17:03:32 async_llm_engine.py:53]     return forward_call(*args, **kwargs)
ERROR 06-28 17:03:32 async_llm_engine.py:53]   File "/home/ubuntu/vllm/vllm/model_executor/models/phi3v.py", line 220, in forward
ERROR 06-28 17:03:32 async_llm_engine.py:53]     sub_img = sub_img[:B_]
ERROR 06-28 17:03:32 async_llm_engine.py:53] TypeError: only integer tensors of a single element can be converted to an index

Ran fine for few days, then hit this. Unclear exactly what triggered.

DarkLight1337 commented 4 months ago

It is the same as #5885, which has been fixed already. Are you sure you are using the latest main branch?

pseudotensor commented 4 months ago

I shared my sha: e9de9dd551ac595a9f3825fcd1507deceef4f332

I'm trying latest main now and will see. If you think it's already fixed, then should be able to close this issue.

ywang96 commented 4 months ago

@pseudotensor Sounds good - I'm going to close this issue now, but please report back if you find the issue persist!