vllm-project / vllm

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

[Usage]: Cannot use FlashAttention backend #4361

Closed chenchunhui97 closed 4 months ago

chenchunhui97 commented 4 months ago

Your current environment

PyTorch version: 2.2.1+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
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: version 3.29.2
Libc version: glibc-2.35

Python version: 3.10.14 (main, Mar 21 2024, 16:24:04) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-6.5.0-28-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.1.66
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3090
Nvidia driver version: 550.54.15
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
架构:                              x86_64
CPU 运行模式:                      32-bit, 64-bit
Address sizes:                      46 bits physical, 48 bits virtual
字节序:                            Little Endian
CPU:                                24
在线 CPU 列表:                     0-23
厂商 ID:                           GenuineIntel
型号名称:                          13th Gen Intel(R) Core(TM) i7-13700
CPU 系列:                          6
型号:                              183
每个核的线程数:                    2
每个座的核数:                      16
座:                                1
步进:                              1
CPU 最大 MHz:                      5200.0000
CPU 最小 MHz:                      800.0000
BogoMIPS:                          4224.00
标记:                              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 sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq tme rdpid movdiri movdir64b fsrm md_clear serialize pconfig arch_lbr ibt flush_l1d arch_capabilities
虚拟化:                            VT-x
L1d 缓存:                          640 KiB (16 instances)
L1i 缓存:                          768 KiB (16 instances)
L2 缓存:                           24 MiB (10 instances)
L3 缓存:                           30 MiB (1 instance)
NUMA 节点:                         1
NUMA 节点0 CPU:                    0-23
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:    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:      Not affected

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] torch==2.2.1
[pip3] triton==2.2.0
[conda] numpy                     1.26.4                   pypi_0    pypi
[conda] torch                     2.2.1                    pypi_0    pypi
[conda] triton                    2.2.0                    pypi_0    pypiROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.4.0.post1
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X  0-23    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

install: pip install -e . or python3 setup.py bdist_wheel --dist-dir=dist then run:

python -m vllm.entrypoints.openai.api_server \
--model /mnt/HD1/workspace/data/Qwen1.5-7B-Chat-IntentsSlots-v1-20240403 \
--port 8007 --max-model-len 4096 --gpu-memory-utilization 0.8

to launch

How would you like to use vllm

I found I canot use Flashattention backend when install it from source file.

INFO 04-25 18:42:52 selector.py:74] Cannot use FlashAttention backend because the flash_attn package is not found. Please install it for better performance.

DefTruth commented 4 months ago

try if you can import flash_attn separately:

>>> import flash_attn
>>> # will hit some error here?

some releated issue: https://github.com/Dao-AILab/flash-attention/issues/919

chenchunhui97 commented 4 months ago
import flash_attn
Python 3.10.14 (main, Mar 21 2024, 16:24:04) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import flash_attn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'flash_attn'

seems I missed to compile and install flash_attntion? but I compile follwing the instruction in portal. how to compile and install it additionaly?

chenchunhui97 commented 4 months ago

try if you can import flash_attn separately:

>>> import flash_attn
>>> # will hit some error here?

some releated issue: Dao-AILab/flash-attention#919

thanks i solved the promble by the releate issue. I installed flash_attn v2.5.6.

chenchunhui97 commented 4 months ago
git clone https://github.com/Dao-AILab/flash-attention
cd flash_attn 
git checkout v2.5.6
python3 setup.py bdist_wheel --dist-dir=dist

then compile and install flash_attn.