vllm-project / vllm

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

[Bug]: gemma-2-27b error loading with vllm.LLM #6192

Closed jl3676 closed 4 months ago

jl3676 commented 4 months ago

Your current environment

Address sizes:                   43 bits physical, 48 bits virtual
CPU(s):                          128
On-line CPU(s) list:             0-127
Thread(s) per core:              2
Core(s) per socket:              32
Socket(s):                       2
NUMA node(s):                    2
Vendor ID:                       AuthenticAMD
CPU family:                      23
Model:                           49
Model name:                      AMD EPYC 7502 32-Core Processor
Stepping:                        0
Frequency boost:                 enabled
CPU MHz:                         2500.000
CPU max MHz:                     2500.0000
CPU min MHz:                     1500.0000
BogoMIPS:                        5000.23
Virtualization:                  AMD-V
L1d cache:                       2 MiB
L1i cache:                       2 MiB
L2 cache:                        32 MiB
L3 cache:                        256 MiB
NUMA node0 CPU(s):               0-31,64-95
NUMA node1 CPU(s):               32-63,96-127
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:          Mitigation; untrained return thunk; SMT enabled with STIBP protection
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; Retpolines, IBPB conditional, STIBP always-on, RSB filling, PBRSB-eIBRS Not affected
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 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sme sev sev_es

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] nvidia-nccl-cu12==2.20.5
[pip3] torch==2.3.0
[pip3] torchvision==0.18.0
[pip3] transformers==4.42.3
[pip3] triton==2.3.0
[conda] nvidia-nccl-cu12          2.20.5                   pypi_0    pypi
[conda] torch                     2.3.0                    pypi_0    pypi
[conda] torchvision               0.18.0                   pypi_0    pypi
[conda] triton                    2.3.0                    pypi_0    pypi
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.5.1
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0    GPU1    GPU2    GPU3    NIC0    CPU Affinity    NUMA Affinity
GPU0     X      NODE    NODE    SYS     SYS     0-31,64-95      0
GPU1    NODE     X      NODE    SYS     SYS     0-31,64-95      0
GPU2    NODE    NODE     X      SYS     SYS     0-31,64-95      0
GPU3    SYS     SYS     SYS      X      NODE    32-63,96-127    1
NIC0    SYS     SYS     SYS     NODE     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_bond_0

🐛 Describe the bug

When trying to load gemma-2-27b using vllm, I encountered an error after setting the attention backend variable to FLASHINFER. I've included the minimal amount of code to reproduce the error on my cluster and the error log from running this code. I'd appreciate any insights in how to resolve this issue.

from vllm import LLM
import os

os.environ['VLLM_ATTENTION_BACKEND'] = 'FLASHINFER'
model = LLM(model="google/gemma-2-27b-it",
                    dtype="auto",
                    trust_remote_code=True,
                    tokenizer_mode="auto",
                    tensor_parallel_size=4)
WARNING 07-07 10:41:33 utils.py:562] Gemma 2 uses sliding window attention for every odd layer, which is currently not supported by vLLM. Disabling sliding window and capping the max length to the sliding window size (4096).
INFO 07-07 10:41:33 config.py:698] Defaulting to use mp for distributed inference
INFO 07-07 10:41:33 llm_engine.py:169] Initializing an LLM engine (v0.5.1) with config: model='google/gemma-2-27b-it', speculative_config=None, tokenizer='google/gemma-2-27b-it', skip_tokenizer_init=False, tokenizer_mode=auto, revision=None, rope_scaling=None, rope_theta=None, tokenizer_revision=None, trust_remote_code=True, dtype=torch.bfloat16, max_seq_len=4096, download_dir=None, load_format=LoadFormat.AUTO, tensor_parallel_size=4, pipeline_parallel_size=1, disable_custom_all_reduce=False, quantization=None, enforce_eager=False, kv_cache_dtype=auto, quantization_param_path=None, device_config=cuda, decoding_config=DecodingConfig(guided_decoding_backend='outlines'), observability_config=ObservabilityConfig(otlp_traces_endpoint=None), seed=0, served_model_name=google/gemma-2-27b-it, use_v2_block_manager=False, enable_prefix_caching=False)
(VllmWorkerProcess pid=1835003) INFO 07-07 10:41:34 selector.py:79] Using Flashinfer backend.
(VllmWorkerProcess pid=1835003) WARNING 07-07 10:41:34 selector.py:80] Flashinfer will be stuck on llama-2-7b, please avoid using Flashinfer as the backend when running on llama-2-7b.
(VllmWorkerProcess pid=1835003) INFO 07-07 10:41:34 multiproc_worker_utils.py:215] Worker ready; awaiting tasks
(VllmWorkerProcess pid=1835004) INFO 07-07 10:41:34 selector.py:79] Using Flashinfer backend.
(VllmWorkerProcess pid=1835004) WARNING 07-07 10:41:34 selector.py:80] Flashinfer will be stuck on llama-2-7b, please avoid using Flashinfer as the backend when running on llama-2-7b.
(VllmWorkerProcess pid=1835004) INFO 07-07 10:41:34 multiproc_worker_utils.py:215] Worker ready; awaiting tasks
INFO 07-07 10:41:34 selector.py:79] Using Flashinfer backend.
WARNING 07-07 10:41:34 selector.py:80] Flashinfer will be stuck on llama-2-7b, please avoid using Flashinfer as the backend when running on llama-2-7b.
(VllmWorkerProcess pid=1835005) INFO 07-07 10:41:34 selector.py:79] Using Flashinfer backend.
(VllmWorkerProcess pid=1835005) WARNING 07-07 10:41:34 selector.py:80] Flashinfer will be stuck on llama-2-7b, please avoid using Flashinfer as the backend when running on llama-2-7b.
(VllmWorkerProcess pid=1835005) INFO 07-07 10:41:34 multiproc_worker_utils.py:215] Worker ready; awaiting tasks
INFO 07-07 10:41:34 utils.py:741] Found nccl from library libnccl.so.2
(VllmWorkerProcess pid=1835004) INFO 07-07 10:41:34 utils.py:741] Found nccl from library libnccl.so.2
(VllmWorkerProcess pid=1835003) INFO 07-07 10:41:34 utils.py:741] Found nccl from library libnccl.so.2
(VllmWorkerProcess pid=1835005) INFO 07-07 10:41:34 utils.py:741] Found nccl from library libnccl.so.2
(VllmWorkerProcess pid=1835004) INFO 07-07 10:41:34 pynccl.py:63] vLLM is using nccl==2.20.5
INFO 07-07 10:41:34 pynccl.py:63] vLLM is using nccl==2.20.5
(VllmWorkerProcess pid=1835003) INFO 07-07 10:41:34 pynccl.py:63] vLLM is using nccl==2.20.5
(VllmWorkerProcess pid=1835005) INFO 07-07 10:41:34 pynccl.py:63] vLLM is using nccl==2.20.5
(VllmWorkerProcess pid=1835005) WARNING 07-07 10:41:35 custom_all_reduce.py:118] Custom allreduce is disabled because it's not supported on more than two PCIe-only GPUs. To silence this warning, specify disable_custom_all_reduce=True explicitly.
WARNING 07-07 10:41:35 custom_all_reduce.py:118] Custom allreduce is disabled because it's not supported on more than two PCIe-only GPUs. To silence this warning, specify disable_custom_all_reduce=True explicitly.
(VllmWorkerProcess pid=1835004) WARNING 07-07 10:41:35 custom_all_reduce.py:118] Custom allreduce is disabled because it's not supported on more than two PCIe-only GPUs. To silence this warning, specify disable_custom_all_reduce=True explicitly.
(VllmWorkerProcess pid=1835003) WARNING 07-07 10:41:35 custom_all_reduce.py:118] Custom allreduce is disabled because it's not supported on more than two PCIe-only GPUs. To silence this warning, specify disable_custom_all_reduce=True explicitly.
(VllmWorkerProcess pid=1835005) INFO 07-07 10:41:35 selector.py:79] Using Flashinfer backend.
(VllmWorkerProcess pid=1835005) WARNING 07-07 10:41:35 selector.py:80] Flashinfer will be stuck on llama-2-7b, please avoid using Flashinfer as the backend when running on llama-2-7b.
(VllmWorkerProcess pid=1835004) INFO 07-07 10:41:35 selector.py:79] Using Flashinfer backend.
(VllmWorkerProcess pid=1835003) INFO 07-07 10:41:35 selector.py:79] Using Flashinfer backend.
(VllmWorkerProcess pid=1835004) WARNING 07-07 10:41:35 selector.py:80] Flashinfer will be stuck on llama-2-7b, please avoid using Flashinfer as the backend when running on llama-2-7b.
(VllmWorkerProcess pid=1835003) WARNING 07-07 10:41:35 selector.py:80] Flashinfer will be stuck on llama-2-7b, please avoid using Flashinfer as the backend when running on llama-2-7b.
INFO 07-07 10:41:35 selector.py:79] Using Flashinfer backend.
WARNING 07-07 10:41:35 selector.py:80] Flashinfer will be stuck on llama-2-7b, please avoid using Flashinfer as the backend when running on llama-2-7b.
(VllmWorkerProcess pid=1835004) INFO 07-07 10:41:35 weight_utils.py:218] Using model weights format ['*.safetensors']
(VllmWorkerProcess pid=1835003) INFO 07-07 10:41:35 weight_utils.py:218] Using model weights format ['*.safetensors']
INFO 07-07 10:41:35 weight_utils.py:218] Using model weights format ['*.safetensors']
(VllmWorkerProcess pid=1835005) INFO 07-07 10:41:36 weight_utils.py:218] Using model weights format ['*.safetensors']
(VllmWorkerProcess pid=1835004) INFO 07-07 10:41:40 model_runner.py:255] Loading model weights took 12.8146 GB
(VllmWorkerProcess pid=1835005) INFO 07-07 10:41:40 model_runner.py:255] Loading model weights took 12.8146 GB
INFO 07-07 10:41:40 model_runner.py:255] Loading model weights took 12.8146 GB
(VllmWorkerProcess pid=1835003) INFO 07-07 10:41:40 model_runner.py:255] Loading model weights took 12.8146 GB
[rank0]: Traceback (most recent call last):
[rank0]:   File "/home/jingjingl/harm_project/src/gen_harm_analysis_open_LLM.py", line 260, in <module>
[rank0]:     main()
[rank0]:   File "/home/jingjingl/harm_project/src/gen_harm_analysis_open_LLM.py", line 257, in main
[rank0]:     generate_harm_analysis(dataset_input, example_ids, model_id, dataset_name, step, file_name_prefix)
[rank0]:   File "/home/jingjingl/harm_project/src/gen_harm_analysis_open_LLM.py", line 125, in generate_harm_analysis
[rank0]:     model = LLM(model="google/gemma-2-27b-it",
[rank0]:   File "/home/jingjingl/.conda/envs/harm_project/lib/python3.10/site-packages/vllm/entrypoints/llm.py", line 149, in __init__
[rank0]:     self.llm_engine = LLMEngine.from_engine_args(
[rank0]:   File "/home/jingjingl/.conda/envs/harm_project/lib/python3.10/site-packages/vllm/engine/llm_engine.py", line 414, in from_engine_args
[rank0]:     engine = cls(
[rank0]:   File "/home/jingjingl/.conda/envs/harm_project/lib/python3.10/site-packages/vllm/engine/llm_engine.py", line 256, in __init__
[rank0]:     self._initialize_kv_caches()
[rank0]:   File "/home/jingjingl/.conda/envs/harm_project/lib/python3.10/site-packages/vllm/engine/llm_engine.py", line 353, in _initialize_kv_caches
[rank0]:     self.model_executor.determine_num_available_blocks())
[rank0]:   File "/home/jingjingl/.conda/envs/harm_project/lib/python3.10/site-packages/vllm/executor/distributed_gpu_executor.py", line 38, in determine_num_available_blocks
[rank0]:     num_blocks = self._run_workers("determine_num_available_blocks", )
[rank0]:   File "/home/jingjingl/.conda/envs/harm_project/lib/python3.10/site-packages/vllm/executor/multiproc_gpu_executor.py", line 130, in _run_workers
[rank0]:     driver_worker_output = driver_worker_method(*args, **kwargs)
[rank0]:   File "/home/jingjingl/.conda/envs/harm_project/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
[rank0]:     return func(*args, **kwargs)
[rank0]:   File "/home/jingjingl/.conda/envs/harm_project/lib/python3.10/site-packages/vllm/worker/worker.py", line 173, in determine_num_available_blocks
[rank0]:     self.model_runner.profile_run()
[rank0]:   File "/home/jingjingl/.conda/envs/harm_project/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
[rank0]:     return func(*args, **kwargs)
[rank0]:   File "/home/jingjingl/.conda/envs/harm_project/lib/python3.10/site-packages/vllm/worker/model_runner.py", line 874, in profile_run
[rank0]:     self.execute_model(model_input, kv_caches, intermediate_tensors)
[rank0]:   File "/home/jingjingl/.conda/envs/harm_project/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
[rank0]:     return func(*args, **kwargs)
[rank0]:   File "/home/jingjingl/.conda/envs/harm_project/lib/python3.10/site-packages/vllm/worker/model_runner.py", line 1201, in execute_model
[rank0]:     BatchDecodeWithPagedKVCacheWrapper(
[rank0]: TypeError: 'NoneType' object is not callable
ERROR 07-07 10:41:40 multiproc_worker_utils.py:120] Worker VllmWorkerProcess pid 1835005 died, exit code: -15
INFO 07-07 10:41:41 multiproc_worker_utils.py:123] Killing local vLLM worker processes
/home/jingjingl/.conda/envs/harm_project/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 2 leaked shared_memory objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
robertgshaw2-neuralmagic commented 4 months ago

This issue occurs when we fail to import FlashInfer

Make sure you have it installed (with the proper Pytorch version (2.3) + CUDA version (likely 12.1)).

wget https://github.com/flashinfer-ai/flashinfer/releases/download/v0.0.8/flashinfer-0.0.8+cu121torch2.3-cp310-cp310-linux_x86_64.whl
pip install flashinfer-0.0.8+cu121torch2.3-cp310-cp310-linux_x86_64.whl