Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: CUDA Graph Capture Error with Llama-3.2-11B-Vision-Instruct-bnb-4bit on RTX 4090 #11587

Closed
1 task done
tsubasakong opened this issue Dec 28, 2024 · 3 comments · Fixed by #12127
Closed
1 task done
Assignees
Labels
bug Something isn't working

Comments

@tsubasakong
Copy link

Your current environment

The output of `python collect_env.py`
Collecting environment information...
PyTorch version: 2.5.1+cu124
Is debug build: False
CUDA used to build PyTorch: 12.4
ROCM used to build PyTorch: N/A

OS: Ubuntu 24.04 LTS (x86_64)
GCC version: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.39

Python version: 3.12.8 | packaged by Anaconda, Inc. | (main, Dec 11 2024, 16:31:09) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-6.8.0-36-generic-x86_64-with-glibc2.39
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 4090
Nvidia driver version: 565.77
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):                               72
On-line CPU(s) list:                  0-71
Vendor ID:                            GenuineIntel
Model name:                           Intel(R) Xeon(R) CPU E5-2697 v4 @ 2.30GHz
CPU family:                           6
Model:                                79
Thread(s) per core:                   2
Core(s) per socket:                   18
Socket(s):                            2
Stepping:                             1
CPU(s) scaling MHz:                   44%
CPU max MHz:                          3600.0000
CPU min MHz:                          1200.0000
BogoMIPS:                             4600.16
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 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 pti intel_ppin ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap intel_pt xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts vnmi md_clear flush_l1d
Virtualization:                       VT-x
L1d cache:                            1.1 MiB (36 instances)
L1i cache:                            1.1 MiB (36 instances)
L2 cache:                             9 MiB (36 instances)
L3 cache:                             90 MiB (2 instances)
NUMA node(s):                         2
NUMA node0 CPU(s):                    0-17,36-53
NUMA node1 CPU(s):                    18-35,54-71
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          KVM: Mitigation: VMX disabled
Vulnerability L1tf:                   Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds:                    Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown:               Mitigation; PTI
Vulnerability Mmio stale data:        Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
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; Retpolines; IBPB conditional; IBRS_FW; STIBP conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Mitigation; Clear CPU buffers; SMT vulnerable

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu12==12.4.5.8
[pip3] nvidia-cuda-cupti-cu12==12.4.127
[pip3] nvidia-cuda-nvrtc-cu12==12.4.127
[pip3] nvidia-cuda-runtime-cu12==12.4.127
[pip3] nvidia-cudnn-cu12==9.1.0.70
[pip3] nvidia-cufft-cu12==11.2.1.3
[pip3] nvidia-curand-cu12==10.3.5.147
[pip3] nvidia-cusolver-cu12==11.6.1.9
[pip3] nvidia-cusparse-cu12==12.3.1.170
[pip3] nvidia-ml-py==12.560.30
[pip3] nvidia-nccl-cu12==2.21.5
[pip3] nvidia-nvjitlink-cu12==12.4.127
[pip3] nvidia-nvtx-cu12==12.4.127
[pip3] pyzmq==26.2.0
[pip3] torch==2.5.1
[pip3] torchvision==0.20.1
[pip3] transformers==4.47.1
[pip3] triton==3.1.0
[conda] numpy                     1.26.4                   pypi_0    pypi
[conda] nvidia-cublas-cu12        12.4.5.8                 pypi_0    pypi
[conda] nvidia-cuda-cupti-cu12    12.4.127                 pypi_0    pypi
[conda] nvidia-cuda-nvrtc-cu12    12.4.127                 pypi_0    pypi
[conda] nvidia-cuda-runtime-cu12  12.4.127                 pypi_0    pypi
[conda] nvidia-cudnn-cu12         9.1.0.70                 pypi_0    pypi
[conda] nvidia-cufft-cu12         11.2.1.3                 pypi_0    pypi
[conda] nvidia-curand-cu12        10.3.5.147               pypi_0    pypi
[conda] nvidia-cusolver-cu12      11.6.1.9                 pypi_0    pypi
[conda] nvidia-cusparse-cu12      12.3.1.170               pypi_0    pypi
[conda] nvidia-ml-py              12.560.30                pypi_0    pypi
[conda] nvidia-nccl-cu12          2.21.5                   pypi_0    pypi
[conda] nvidia-nvjitlink-cu12     12.4.127                 pypi_0    pypi
[conda] nvidia-nvtx-cu12          12.4.127                 pypi_0    pypi
[conda] pyzmq                     26.2.0                   pypi_0    pypi
[conda] torch                     2.5.1                    pypi_0    pypi
[conda] torchvision               0.20.1                   pypi_0    pypi
[conda] transformers              4.47.1                   pypi_0    pypi
[conda] triton                    3.1.0                    pypi_0    pypi
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.6.6.post1
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      18-35,54-71     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

LD_LIBRARY_PATH=/home/administrator/vlm/.venv/lib/python3.12/site-packages/cv2/../../lib64:
CUDA_MODULE_LOADING=LAZY

Model Input Dumps

No response

🐛 Describe the bug

Environment:

  • GPU: RTX 4090 (24GB VRAM)
  • Model: unsloth/Llama-3.2-11B-Vision-Instruct-bnb-4bit
  • vLLM command:
vllm serve unsloth/Llama-3.2-11B-Vision-Instruct-bnb-4bit \
  --quantization="bitsandbytes" \
  --load-format="bitsandbytes" \
  --dtype=bfloat16 \
  --trust_remote_code \
  --gpu-memory-utilization=0.98 \
  --max-model-len=9600 \
  --max-num-seqs 4

Error Description:
The model fails during CUDA graph capture with the error: "CUDA error: operation failed due to a previous error during capture". Memory profile shows:

  • Total GPU Memory: 23.54GB
  • Model Weights: 6.72GB
  • PyTorch Activation Peak: 1.92GB
  • Non-Torch Memory: 0.11GB
  • KV Cache Reserved: 14.32GB

Stack Trace:
The error occurs in mllama.py during the forward pass:

skip_cross_attention = max(attn_metadata.encoder_seq_lens) == 0

This operation is not permitted during stream capture.

Additional Context:
The error persists even with 4-bit quantization enabled. The model initialization completes successfully, but fails during the CUDA graph capture phase.

Question:
Is there a workaround to run this vision model with vLLM on a single RTX 4090? I've tried adjusting memory utilization and sequence parameters without success.

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.
@tsubasakong tsubasakong added the bug Something isn't working label Dec 28, 2024
@jeejeelee
Copy link
Collaborator

jeejeelee commented Dec 29, 2024

Currently, MLLama indeed does not support cudagraph . you could try:

vllm serve unsloth/Llama-3.2-11B-Vision-Instruct-bnb-4bit \
  --quantization="bitsandbytes" \
  --load-format="bitsandbytes" \
  --dtype=bfloat16 \
  --trust_remote_code \
  --gpu-memory-utilization=0.98 \
  --max-model-len=9600 \
  --max-num-seqs 4
  --enforce-eager

@tsubasakong
Copy link
Author

Currently, MLLama indeed does not support cudagraph . you could try:

vllm serve unsloth/Llama-3.2-11B-Vision-Instruct-bnb-4bit \
  --quantization="bitsandbytes" \
  --load-format="bitsandbytes" \
  --dtype=bfloat16 \
  --trust_remote_code \
  --gpu-memory-utilization=0.98 \
  --max-model-len=9600 \
  --max-num-seqs 4
  --enforce-eager

Thank you! I will try it!

@youkaichao
Copy link
Member

as discussed, @heheda12345 will add one line inside

def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
to automatically disable cudagraph, so that the user-experience can be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants