vllm-project / vllm

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

[Bug]: Error while trying to run vLLM microsoft/Phi-3-mini-4k-instruct with OpenVINO backend #10025

Closed sudipto-g closed 4 weeks ago

sudipto-g commented 4 weeks ago

Your current environment

The output of `python collect_env.py` ```text Collecting environment information... WARNING 11-05 06:10:50 _custom_ops.py:19] Failed to import from vllm._C with ModuleNotFoundError("No module named 'vllm._C'") INFO 11-05 06:10:50 importing.py:15] Triton not installed or not compatible; certain GPU-related functions will not be available. PyTorch version: 2.5.0+cpu Is debug build: False CUDA used to build PyTorch: None ROCM used to build PyTorch: N/A OS: Ubuntu 22.04.5 LTS (x86_64) GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 Clang version: Could not collect CMake version: version 3.30.5 Libc version: glibc-2.35 Python version: 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] (64-bit runtime) Python platform: Linux-6.5.0-14-generic-x86_64-with-glibc2.35 Is CUDA available: False CUDA runtime version: No CUDA CUDA_MODULE_LOADING set to: N/A GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA 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): 24 On-line CPU(s) list: 0-23 Vendor ID: GenuineIntel Model name: 13th Gen Intel(R) Core(TM) i9-13900K CPU family: 6 Model: 183 Thread(s) per core: 1 Core(s) per socket: 24 Socket(s): 1 Stepping: 1 Frequency boost: enabled CPU max MHz: 4301.0000 CPU min MHz: 800.0000 BogoMIPS: 5990.40 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 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 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 Virtualization: VT-x L1d cache: 896 KiB (24 instances) L1i cache: 1.3 MiB (24 instances) L2 cache: 32 MiB (12 instances) L3 cache: 36 MiB (1 instance) NUMA node(s): 1 NUMA node0 CPU(s): 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] onnx==1.17.0 [pip3] pyzmq==26.2.0 [pip3] torch==2.5.0+cpu [pip3] transformers==4.46.1 [conda] Could not collect ROCM Version: Could not collect Neuron SDK Version: N/A vLLM Version: 0.6.3.post2.dev217+gccb5376a vLLM Build Flags: CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled GPU Topology: Could not collect ```

Model Input Dumps

No response

🐛 Describe the bug

I'm trying to run a vLLM using the OpenVINO backend. For that, I am following this page.

Using the Dockerfile based installation, I've create the docker image and exec-ed into it, and have modified the script in examples/offline_inference.py to change the LLmodel to microsoft/Phi-3-mini-4k-instruct

When I try running inference using python3 examples/offline_inference.py script , I get the following:

python3 examples/offline_inference.py 
WARNING 11-05 06:02:09 _custom_ops.py:19] Failed to import from vllm._C with ModuleNotFoundError("No module named 'vllm._C'")
INFO 11-05 06:02:09 importing.py:15] Triton not installed or not compatible; certain GPU-related functions will not be available.
INFO 11-05 06:02:13 config.py:323] This model supports multiple tasks: {'generate', 'embedding'}. Defaulting to 'generate'.
WARNING 11-05 06:02:13 config.py:460] Async output processing is only supported for CUDA, TPU, XPU. Disabling it for other platforms.
INFO 11-05 06:02:13 llm_engine.py:247] Initializing an LLM engine (v0.6.3.post2.dev217+gccb5376a) with config: model='microsoft/Phi-3-mini-4k-instruct', speculative_config=None, tokenizer='microsoft/Phi-3-mini-4k-instruct', skip_tokenizer_init=False, tokenizer_mode=auto, revision=None, override_neuron_config=None, rope_scaling=None, rope_theta=None, tokenizer_revision=None, trust_remote_code=False, dtype=torch.bfloat16, max_seq_len=4096, download_dir=None, load_format=LoadFormat.AUTO, tensor_parallel_size=1, pipeline_parallel_size=1, disable_custom_all_reduce=False, quantization=None, enforce_eager=False, kv_cache_dtype=auto, quantization_param_path=None, device_config=cpu, decoding_config=DecodingConfig(guided_decoding_backend='outlines'), observability_config=ObservabilityConfig(otlp_traces_endpoint=None, collect_model_forward_time=False, collect_model_execute_time=False), seed=0, served_model_name=microsoft/Phi-3-mini-4k-instruct, num_scheduler_steps=1, chunked_prefill_enabled=False multi_step_stream_outputs=True, enable_prefix_caching=False, use_async_output_proc=False, use_cached_outputs=False, chat_template_text_format=string, mm_processor_kwargs=None, pooler_config=None)
WARNING 11-05 06:02:14 openvino_executor.py:139] Only float32 dtype is supported on OpenVINO, casting from torch.bfloat16.
WARNING 11-05 06:02:14 openvino_executor.py:144] CUDA graph is not supported on OpenVINO backend, fallback to the eager mode.
INFO 11-05 06:02:14 openvino_executor.py:176] OpenVINO CPU optimal block size is 32, overriding currently set 16
WARNING 11-05 06:02:14 openvino_executor.py:191] Environment variable VLLM_OPENVINO_KVCACHE_SPACE (GB) for OpenVINO backend is not set, using 4 by default.
INFO 11-05 06:02:16 selector.py:198] Cannot use _Backend.FLASH_ATTN backend on OpenVINO.
INFO 11-05 06:02:16 selector.py:135] Using OpenVINO Attention backend.
WARNING 11-05 06:02:16 openvino.py:114] Provided model id microsoft/Phi-3-mini-4k-instruct does not contain OpenVINO IR, the model will be converted to IR with default options. If you need to use specific options for model conversion, use optimum-cli export openvino with desired options.
Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00,  5.37it/s]
`loss_type=None` was set in the config but it is unrecognised.Using the default loss: `ForCausalLMLoss`.
/usr/local/lib/python3.10/dist-packages/transformers/cache_utils.py:458: TracerWarning: Using len to get tensor shape might cause the trace to be incorrect. Recommended usage would be tensor.shape[0]. Passing a tensor of different shape might lead to errors or silently give incorrect results.
  or len(self.key_cache[layer_idx]) == 0  # the layer has no cache
/usr/local/lib/python3.10/dist-packages/transformers/modeling_attn_mask_utils.py:116: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if (input_shape[-1] > 1 or self.sliding_window is not None) and self.is_causal:
/usr/local/lib/python3.10/dist-packages/optimum/exporters/onnx/model_patcher.py:306: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if past_key_values_length > 0:
/usr/local/lib/python3.10/dist-packages/transformers/cache_utils.py:443: TracerWarning: Using len to get tensor shape might cause the trace to be incorrect. Recommended usage would be tensor.shape[0]. Passing a tensor of different shape might lead to errors or silently give incorrect results.
  elif len(self.key_cache[layer_idx]) == 0:  # fills previously skipped layers; checking for tensor causes errors
INFO 11-05 06:02:39 openvino_executor.py:78] OpenVINO CPU: # device blocks: 341; # swap blocks: 0
Processed prompts:   0%|                                                                | 0/4 [00:00<?, ?it/s, est. speed input: 0.00 toks/s, output: 0.00 toks/s][rank0]: Traceback (most recent call last):
[rank0]:   File "/workspace/examples/offline_inference.py", line 17, in <module>
[rank0]:     outputs = llm.generate(prompts, sampling_params)
[rank0]:   File "/usr/local/lib/python3.10/dist-packages/vllm/utils.py", line 1060, in inner
[rank0]:     return fn(*args, **kwargs)
[rank0]:   File "/usr/local/lib/python3.10/dist-packages/vllm/entrypoints/llm.py", line 390, in generate
[rank0]:     outputs = self._run_engine(use_tqdm=use_tqdm)
[rank0]:   File "/usr/local/lib/python3.10/dist-packages/vllm/entrypoints/llm.py", line 925, in _run_engine
[rank0]:     step_outputs = self.llm_engine.step()
[rank0]:   File "/usr/local/lib/python3.10/dist-packages/vllm/engine/llm_engine.py", line 1456, in step
[rank0]:     outputs = self.model_executor.execute_model(
[rank0]:   File "/usr/local/lib/python3.10/dist-packages/vllm/executor/openvino_executor.py", line 85, in execute_model
[rank0]:     output = self.driver_worker.execute_model(execute_model_req)
[rank0]:   File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 116, in decorate_context
[rank0]:     return func(*args, **kwargs)
[rank0]:   File "/usr/local/lib/python3.10/dist-packages/vllm/worker/openvino_worker.py", line 408, in execute_model
[rank0]:     output = self.model_runner.execute_model(seq_group_metadata_list,
[rank0]:   File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 116, in decorate_context
[rank0]:     return func(*args, **kwargs)
[rank0]:   File "/usr/local/lib/python3.10/dist-packages/vllm/worker/openvino_model_runner.py", line 332, in execute_model
[rank0]:     ) = self.prepare_input_tensors(seq_group_metadata_list)
[rank0]:   File "/usr/local/lib/python3.10/dist-packages/vllm/worker/openvino_model_runner.py", line 302, in prepare_input_tensors
[rank0]:     ) = self._prepare_model_input(seq_group_metadata_list)
[rank0]:   File "/usr/local/lib/python3.10/dist-packages/vllm/worker/openvino_model_runner.py", line 269, in _prepare_model_input
[rank0]:     attn_metadata = self.attn_backend.make_openvino_metadata(
[rank0]:   File "/usr/local/lib/python3.10/dist-packages/vllm/attention/backends/openvino.py", line 59, in make_openvino_metadata
[rank0]:     return OpenVINOAttentionMetadata(*args, **kwargs)
[rank0]: TypeError: OpenVINOAttentionMetadata.__init__() got an unexpected keyword argument 'multi_modal_placeholder_index_maps'
Processed prompts:   0%|                                                                | 0/4 [00:00<?, ?it/s, est. speed input: 0.00 toks/s, output: 0.00 toks/s]
root@8dbafcc50029:/workspace# 

I'm not quite sure how I should expedite the OpenVINOAttentionMetadata.init() got an unexpected keyword argument 'multi_modal_placeholder_index_maps' error.

Any leads would be much appreciated!

Before submitting a new issue...

DarkLight1337 commented 4 weeks ago

This is similar to https://github.com/vllm-project/vllm/pull/9974#issuecomment-2456055591.

@petersalas do you have time to look into this? I think it's caused by your PR. Also cc @ywang96

petersalas commented 4 weeks ago

Yup, will take a look today.

sudipto-g commented 3 weeks ago

Thank you @petersalas and @DarkLight1337 ! The issue seems to be resolved after pulling in your changes.