vllm-project / vllm

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

[Usage]: Cannot use xformers with old GPU #10662

Open baimushan opened 4 days ago

baimushan commented 4 days ago

Your current environment

The output of `python collect_env.py` ```text 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: CentOS Linux 7 (Core) (x86_64) GCC version: (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44) Clang version: Could not collect CMake version: Could not collect Libc version: glibc-2.17 Python version: 3.12.7 | packaged by Anaconda, Inc. | (main, Oct 4 2024, 13:27:36) [GCC 11.2.0] (64-bit runtime) Python platform: Linux-5.10.0-1.0.0.32-x86_64-with-glibc2.17 Is CUDA available: True CUDA runtime version: 12.4.131 CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: Tesla V100-SXM2-32GB GPU 1: Tesla V100-SXM2-32GB GPU 2: Tesla V100-SXM2-32GB GPU 3: Tesla V100-SXM2-32GB GPU 4: Tesla V100-SXM2-32GB GPU 5: Tesla V100-SXM2-32GB GPU 6: Tesla V100-SXM2-32GB GPU 7: Tesla V100-SXM2-32GB Nvidia driver version: 535.129.03 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 Byte Order: Little Endian CPU(s): 48 On-line CPU(s) list: 0-47 Thread(s) per core: 1 Core(s) per socket: 24 Socket(s): 2 NUMA node(s): 2 Vendor ID: GenuineIntel CPU family: 6 Model: 85 Model name: Intel(R) Xeon(R) Gold 6271C CPU @ 2.60GHz Stepping: 7 CPU MHz: 2599.961 CPU max MHz: 2600.0000 CPU min MHz: 1000.0000 BogoMIPS: 5200.00 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 1024K L3 cache: 33792K NUMA node0 CPU(s): 0-23 NUMA node1 CPU(s): 24-47 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 vnmi 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 arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku avx512_vnni md_clear flush_l1d arch_capabilities 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.46.3 [pip3] transformers-stream-generator==0.0.5 [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.46.3 pypi_0 pypi [conda] transformers-stream-generator 0.0.5 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.4.post1 vLLM Build Flags: CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled GPU Topology: GPU0 GPU1 GPU2 GPU3 GPU4 GPU5 GPU6 GPU7 NIC0 CPU Affinity NUMA Affinity GPU NUMA ID GPU0 X NV2 NV2 NV1 NV1 SYS SYS SYS SYS 0-23 0 N/A GPU1 NV2 X NV1 NV1 SYS NV2 SYS SYS SYS 0-23 0 N/A GPU2 NV2 NV1 X NV2 SYS SYS NV1 SYS SYS 0-23 0 N/A GPU3 NV1 NV1 NV2 X SYS SYS SYS NV2 SYS 0-23 0 N/A GPU4 NV1 SYS SYS SYS X NV2 NV2 NV1 SYS 0-23 0 N/A GPU5 SYS NV2 SYS SYS NV2 X NV1 NV1 SYS 0-23 0 N/A GPU6 SYS SYS NV1 SYS NV2 NV1 X NV2 SYS 0-23 0 N/A GPU7 SYS SYS SYS NV2 NV1 NV1 NV2 X SYS 0-23 0 N/A NIC0 SYS SYS SYS SYS SYS SYS SYS SYS 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 ```

Model Input Dumps

No response

🐛 Describe the bug

xformers of new version not support GPU with capability (7, 0) (too old) report error “No operator found for memory_efficient_attention_forward with inputs”

how could i run vllm with v100 ??? what should i do next ?

 pip show xformers
Name: xformers
Version: 0.0.28.post3

pip show vllm
Name: vllm
Version: 0.6.4.post1

Code

from vllm import LLM, SamplingParams
prompts = [
    "Hello, my name is",
    "The president of the United States is",
    "The capital of France is",
    "The future of AI is",
]
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)

model_path_prefix ='/home/users/.cache/modelscope/hub/'
model_name = 'Qwen/Qwen-7B-Chat'
llm = LLM(model=model_path_prefix + model_name,trust_remote_code=True)
#llm = LLM(model="facebook/opt-125m")
#vllm_model = Model(model_path=local_model_dir)
outputs = llm.generate(prompts, sampling_params)

for output in outputs:
    prompt = output.prompt
    generated_text = output.outputs[0].text
    print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")

Error

[rank0]:   File "/home/users/bai/miniconda3/envs/bai/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
[rank0]:     return func(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File "/home/users/bai/miniconda3/envs/bai/lib/python3.12/site-packages/vllm/worker/worker.py", line 195, in determine_num_available_blocks
[rank0]:     self.model_runner.profile_run()
[rank0]:   File "/home/users/bai/miniconda3/envs/bai/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
[rank0]:     return func(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File "/home/users/bai/miniconda3/envs/bai/lib/python3.12/site-packages/vllm/worker/model_runner.py", line 1316, in profile_run
[rank0]:     self.execute_model(model_input, kv_caches, intermediate_tensors)
[rank0]:   File "/home/users/bai/miniconda3/envs/bai/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
[rank0]:     return func(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File "/home/users/bai/miniconda3/envs/bai/lib/python3.12/site-packages/vllm/worker/model_runner_base.py", line 152, in _wrapper
[rank0]:     raise type(err)(
[rank0]: NotImplementedError: Error in model execution (input dumped to /tmp/err_execute_model_input_20241126-145838.pkl): No operator found for `memory_efficient_attention_forward` with inputs:
[rank0]:      query       : shape=(1, 8192, 32, 128) (torch.float16)
[rank0]:      key         : shape=(1, 8192, 32, 128) (torch.float16)
[rank0]:      value       : shape=(1, 8192, 32, 128) (torch.float16)
[rank0]:      attn_bias   : <class 'xformers.ops.fmha.attn_bias.BlockDiagonalCausalMask'>
[rank0]:      p           : 0.0
[rank0]: `fa2F@v2.5.7-pt` is not supported because:
[rank0]:     xFormers wasn't build with CUDA support
[rank0]:     requires device with capability > (8, 0) but your GPU has capability (7, 0) (too old)
[rank0]: `cutlassF-pt` is not supported because:
[rank0]:     xFormers wasn't build with CUDA support
[rank0]:[W1126 14:58:39.595129646 ProcessGroupNCCL.cpp:1250] Warning: WARNING: process group has NOT been destroyed before we destruct ProcessGroupNCCL. On normal program exit, the application should call destroy_process_group to ensure that any pending NCCL operations have finished in this process. In rare cases this process can exit before this point and block the progress of another member of the process group. This constraint has always been present,  but this warning has only been added since PyTorch 2.4 (function operator())

Before submitting a new issue...

baimushan commented 4 days ago

i reinstall vllm 0.4.1 version. it works

DarkLight1337 commented 4 days ago

For newer versions of vLLM, you can try using other backends (SDPA should always be supported since it's built into PyTorch)

baimushan commented 4 days ago

Thank you @DarkLight1337 do you have any backends recommend ?

DarkLight1337 commented 4 days ago

For newer versions of vLLM, you can try using other backends (SDPA should always be supported since it's built into PyTorch)

As mentioned, you can try SDPA.

baimushan commented 4 days ago

Thank you. I know what it means. ( use TorchSDPABackend)

baimushan commented 4 days ago

Append bad news: AssertionError: Torch SDPA backend is only used for the CPU device. I will try other backend FLASHINFER also not work. keep trying

Isotr0py commented 4 days ago

@baimushan Can you provide the output of python -m xformers.info?

[rank0]: cutlassF-pt is not supported because: [rank0]: xFormers wasn't build with CUDA support

Seems that the xformers installation is broken instead, because cutlassF-pt doesn't have device compute compatibility limitation. For example, here is the output of python -m xformers.info with a pascal GPU:

$ python -m xformers.info
xFormers 0.0.28.post3
memory_efficient_attention.ckF:                    unavailable
memory_efficient_attention.ckB:                    unavailable
memory_efficient_attention.ck_decoderF:            unavailable
memory_efficient_attention.ck_splitKF:             unavailable
memory_efficient_attention.cutlassF-pt:            available
memory_efficient_attention.cutlassB-pt:            available
memory_efficient_attention.fa2F@v2.5.7-pt:         available
memory_efficient_attention.fa2B@v2.5.7-pt:         available
memory_efficient_attention.fa3F@0.0.0:             unavailable
memory_efficient_attention.fa3B@0.0.0:             unavailable
memory_efficient_attention.triton_splitKF:         available
indexing.scaled_index_addF:                        unavailable
indexing.scaled_index_addB:                        unavailable
indexing.index_select:                             unavailable
sequence_parallel_fused.write_values:              available
sequence_parallel_fused.wait_values:               available
sequence_parallel_fused.cuda_memset_32b_async:     available
sp24.sparse24_sparsify_both_ways:                  available
sp24.sparse24_apply:                               available
sp24.sparse24_apply_dense_output:                  available
sp24._sparse24_gemm:                               available
sp24._cslt_sparse_mm_search@0.6.2:                 available
sp24._cslt_sparse_mm@0.6.2:                        available
swiglu.dual_gemm_silu:                             available
swiglu.gemm_fused_operand_sum:                     available
swiglu.fused.p.cpp:                                available
is_triton_available:                               False
pytorch.version:                                   2.5.1+cu124
pytorch.cuda:                                      available
gpu.compute_capability:                            6.1
gpu.name:                                          Quadro P600
dcgm_profiler:                                     unavailable
build.info:                                        available
build.cuda_version:                                1201
build.hip_version:                                 None
build.python_version:                              3.10.15
build.torch_version:                               2.5.1+cu121
build.env.TORCH_CUDA_ARCH_LIST:                    6.0+PTX 7.0 7.5 8.0+PTX 9.0a
build.env.PYTORCH_ROCM_ARCH:                       None
build.env.XFORMERS_BUILD_TYPE:                     Release
build.env.XFORMERS_ENABLE_DEBUG_ASSERTIONS:        None
build.env.NVCC_FLAGS:                              -allow-unsupported-compiler
build.env.XFORMERS_PACKAGE_FROM:                   wheel-v0.0.28.post3
build.nvcc_version:                                12.1.66
source.privacy:                                    open source

I think you can try to reinstall xformers.