vllm-project / vllm

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

[Bug]: Cannot use FlashAttention-2 backend because the vllm_flash_attn package is not found. But I have installed vllm-flash-attn. #7112

Closed xyfZzz closed 1 month ago

xyfZzz commented 3 months ago

Your current environment

Collecting environment information...
/app/apps/anaconda3/envs/vllm_040p1/lib/python3.9/site-packages/requests/__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.16) or char
det (5.2.0)/charset_normalizer (2.0.4) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported "
WARNING 08-03 23:03:20 _custom_ops.py:15] Failed to import from vllm._C with ImportError('libcudart.so.12: cannot open shared object file: No 
such file or directory')
PyTorch version: 2.4.0+cu118
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.6 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.31

Python version: 3.9.12 (main, Apr  5 2022, 06:56:58)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.4.0-148-generic-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: 11.8.89
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA A100-SXM4-80GB
Nvidia driver version: 470.161.03
cuDNN version: Probably one of the following:
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn.so.8.2.4
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.2.4
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.2.4
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.2.4
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.2.4
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.2.4
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.2.4
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
Address sizes:                   46 bits physical, 48 bits virtual
CPU(s):                          16
On-line CPU(s) list:             0-15
Thread(s) per core:              2
Core(s) per socket:              8
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           106
Model name:                      Intel(R) Xeon(R) Platinum 8369B CPU @ 2.90GHz
Stepping:                        6
CPU MHz:                         2899.998
BogoMIPS:                        5799.99
Hypervisor vendor:               KVM
Virtualization type:             full
L1d cache:                       384 KiB
L1i cache:                       256 KiB
L2 cache:                        10 MiB
L3 cache:                        48 MiB
NUMA node0 CPU(s):               0-15
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Retbleed:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht sysca
ll nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pdcm pcid s
se4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ssbd ibrs ibpb stib
p ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_
ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves wbnoinvd arat avx512vbmi avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx51
2_vpopcntdq rdpid arch_capabilities

Versions of relevant libraries:
[pip3] flake8==3.8.2
[pip3] flake8-bugbear==22.9.23
[pip3] flake8-comprehensions==3.10.0
[pip3] flake8-executable==2.1.2
[pip3] flake8-pyi==20.5.0
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.21.5
[pip3] numpydoc==1.2
[pip3] nvidia-nccl-cu11==2.20.5
[pip3] nvidia-nccl-cu12==2.18.1
[pip3] pytorch-crf==0.7.2
[pip3] sentence-transformers==2.2.2
[pip3] torch==2.4.0+cu118
[pip3] torchaudio==0.12.1+cu116
[pip3] torchnet==0.0.4
[pip3] torchstat==0.0.7
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.18.1+cu118
[pip3] transformers==4.42.4
[pip3] transformers-stream-generator==0.0.4
[pip3] triton==3.0.0
[conda] blas                      1.0                         mkl  
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-service               2.4.0            py39h7f8727e_0  
[conda] mkl_fft                   1.3.1            py39hd3c417c_0  
[conda] mkl_random                1.2.2            py39h51133e4_0  
[conda] numpy                     1.21.5           py39he7a7128_1  
[conda] numpy-base                1.21.5           py39hf524024_1  
[conda] numpydoc                  1.2                pyhd3eb1b0_0  
[conda] nvidia-nccl-cu11          2.20.5                   pypi_0    pypi 
[conda] nvidia-nccl-cu12          2.18.1                   pypi_0    pypi 
[conda] pytorch-crf               0.7.2                    pypi_0    pypi
[conda] sentence-transformers     2.2.2                    pypi_0    pypi
[conda] torch                     2.4.0+cu118              pypi_0    pypi 
[conda] torchaudio                0.12.1+cu116             pypi_0    pypi
[conda] torchnet                  0.0.4                    pypi_0    pypi 
[conda] torchstat                 0.0.7                    pypi_0    pypi
[conda] torchsummary              1.5.1                    pypi_0    pypi 
[conda] torchvision               0.18.1+cu118             pypi_0    pypi
[conda] transformers              4.42.4                   pypi_0    pypi 
[conda] transformers-stream-generator 0.0.4                    pypi_0    pypi 
[conda] triton                    3.0.0                    pypi_0    pypi
ROCM Version: Could not collect 
Neuron SDK Version: N/A
vLLM Version: 0.5.3.post1 
vLLM Build Flags: 
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled 
GPU Topology:
GPU0    CPU Affinity    NUMA Affinity
GPU0     X  0-15        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

INFO 08-03 22:48:53 selector.py:189] Cannot use FlashAttention-2 backend because the vllm_flash_attn package is not found. `pip install vllm-flash-attn` for better performance.
INFO 08-03 22:48:53 selector.py:54] Using XFormers backend.

But I have installed vllm-flash-attn:

vllm-flash-attn    2.6.1
duanshengliu commented 2 months ago

@xyfZzz, you can try searching for libcudart.so.12 using the command find / -name libcudart.so.12. This may reveal a path similar to path/to/site-packages/nvidia/cuda_runtime/lib/libcudart.so.12. Execute export LD_LIBRARY_PATH=path/to/site-packages/nvidia/cuda_runtime/lib:$LD_LIBRARY_PATH in your terminal. Alternatively, you can add this line to your ~/.bashrc file and then runsource ~/.bashrc to apply the changes. Try import vllm_flash_attn to verify if this work.

ShuaibinLi commented 1 month ago

libcudart.so.11.0 doesnot work? but how to use libcudart.so.12 using cuda118

duanshengliu commented 1 month ago

@xyfZzz, you can try searching for libcudart.so.12 using the command find / -name libcudart.so.12. This may reveal a path similar to path/to/site-packages/nvidia/cuda_runtime/lib/libcudart.so.12. Execute export LD_LIBRARY_PATH=path/to/site-packages/nvidia/cuda_runtime/lib:$LD_LIBRARY_PATH in your terminal. Alternatively, you can add this line to your ~/.bashrc file and then runsource ~/.bashrc to apply the changes. Try import vllm_flash_attn to verify if this work.

My environment is cuda12. For cuda118, maybe you should take a look at https://github.com/vllm-project/vllm/issues/5232 .

fyuan1316 commented 1 month ago
image

It seems that you are not using the cu118 version of vllm-flash-attn. Could you try switching to that version? @xyfZzz

xyfZzz commented 1 month ago

@duanshengliu @ShuaibinLi @fyuan1316 Thank you very much. After I upgraded the cuda version to 12.4, this warning no longer appeared.