vllm-project / vllm

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

[Bug]: `gemma-2-27b-it-GGUF`: `Architecture gemma2 not supported` #7357

Open alllexx88 opened 1 month ago

alllexx88 commented 1 month ago

Your current environment

The output of `python collect_env.py` ```text Collecting environment information... PyTorch version: 2.4.0+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.30.2 Libc version: glibc-2.35 Python version: 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0] (64-bit runtime) Python platform: Linux-6.5.0-44-generic-x86_64-with-glibc2.35 Is CUDA available: True CUDA runtime version: Could not collect CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: NVIDIA RTX A4000 GPU 1: NVIDIA RTX A4000 GPU 2: NVIDIA RTX A4000 GPU 3: NVIDIA RTX A4000 GPU 4: NVIDIA RTX A4000 GPU 5: NVIDIA RTX A4000 Nvidia driver version: 555.42.02 cuDNN version: Probably one of the following: /usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.7 /usr/lib/x86_64-linux-gnu/libcudnn.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_adv.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.7 /usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.7 /usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.7 /usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.7 /usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.7 /usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.7 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): 120 On-line CPU(s) list: 0-119 Vendor ID: GenuineIntel Model name: Intel(R) Xeon(R) CPU E7-4890 v2 @ 2.80GHz CPU family: 6 Model: 62 Thread(s) per core: 2 Core(s) per socket: 15 Socket(s): 4 Stepping: 7 CPU max MHz: 3400,0000 CPU min MHz: 1200,0000 BogoMIPS: 5586.74 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 arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm cpuid_fault epb pti intel_ppin ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm ida arat pln pts vnmi md_clear flush_l1d Virtualization: VT-x L1d cache: 1,9 MiB (60 instances) L1i cache: 1,9 MiB (60 instances) L2 cache: 15 MiB (60 instances) L3 cache: 150 MiB (4 instances) NUMA node(s): 4 NUMA node0 CPU(s): 0-14,60-74 NUMA node1 CPU(s): 15-29,75-89 NUMA node2 CPU(s): 30-44,90-104 NUMA node3 CPU(s): 45-59,105-119 Vulnerability Gather data sampling: Not affected Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable Vulnerability Meltdown: Mitigation; PTI Vulnerability Mmio stale data: Unknown: No mitigations 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; Retpolines; IBPB conditional; IBRS_FW; STIBP conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected Versions of relevant libraries: [pip3] flashinfer==0.1.3+cu121torch2.4 [pip3] numpy==1.26.4 [pip3] nvidia-nccl-cu12==2.20.5 [pip3] pyzmq==26.1.0 [pip3] torch==2.4.0 [pip3] torchvision==0.19.0 [pip3] transformers==4.44.0 [pip3] triton==3.0.0 [conda] Could not collect ROCM Version: Could not collect Neuron SDK Version: N/A vLLM Version: 0.5.4 vLLM Build Flags: CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled GPU Topology: GPU0 GPU1 GPU2 GPU3 GPU4 GPU5 CPU Affinity NUMA Affinity GPU NUMA ID GPU0 X SYS SYS SYS SYS SYS 0-14,60-74 0 N/A GPU1 SYS X SYS SYS SYS SYS 15-29,75-89 1 N/A GPU2 SYS SYS X PHB SYS SYS 30-44,90-104 2 N/A GPU3 SYS SYS PHB X SYS SYS 30-44,90-104 2 N/A GPU4 SYS SYS SYS SYS X PHB 45-59,105-119 3 N/A GPU5 SYS SYS SYS SYS PHB X 45-59,105-119 3 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

I'm trying to run openai compatible server for bartowski/gemma-2-27b-it-GGUF with a nightly vllm build (downloaded about an hour ago, should be b4e9528f9569d6eb8c29624771a4058fe794cb5a I think), and getting a ValueError: Architecture gemma2 not supported error:

$ VLLM_ATTENTION_BACKEND=FLASHINFER CUDA_DEVICE_ORDER=PCI_BUS_ID CUDA_VISIBLE_DEVICES=0,1,2,3 /opt/vllm/venv/bin/python -m vllm.entrypoints.openai.api_server --port=5003 --host=0.0.0.0 --model gemma-2-27b-it-Q8_0.gguf --tokenizer google/gemma-2-27b-it --seed 1234 --tensor-parallel-size=4
INFO 08-09 16:17:48 api_server.py:352] vLLM API server version 0.5.4
INFO 08-09 16:17:48 api_server.py:353] args: Namespace(host='0.0.0.0', port=5003, uvicorn_log_level='info', allow_credentials=False, allowed_origins=['*'], allowed_methods=['*'], allowed_headers=['*'], api_key=None, lora_modules=None, prompt_adapters=None, chat_template=None, response_role='assistant', ssl_keyfile=None, ssl_certfile=None, ssl_ca_certs=None, ssl_cert_reqs=0, root_path=None, middleware=[], return_tokens_as_token_ids=False, disable_frontend_multiprocessing=False, model='gemma-2-27b-it-Q8_0.gguf', tokenizer='google/gemma-2-27b-it', skip_tokenizer_init=False, revision=None, code_revision=None, tokenizer_revision=None, tokenizer_mode='auto', trust_remote_code=False, download_dir=None, load_format='auto', dtype='auto', kv_cache_dtype='auto', quantization_param_path=None, max_model_len=None, guided_decoding_backend='outlines', distributed_executor_backend=None, worker_use_ray=False, pipeline_parallel_size=1, tensor_parallel_size=4, max_parallel_loading_workers=None, ray_workers_use_nsight=False, block_size=16, enable_prefix_caching=False, disable_sliding_window=False, use_v2_block_manager=False, num_lookahead_slots=0, seed=1234, swap_space=4, cpu_offload_gb=0, gpu_memory_utilization=0.9, num_gpu_blocks_override=None, max_num_batched_tokens=None, max_num_seqs=256, max_logprobs=20, disable_log_stats=False, quantization=None, rope_scaling=None, rope_theta=None, enforce_eager=False, max_context_len_to_capture=None, max_seq_len_to_capture=8192, disable_custom_all_reduce=False, tokenizer_pool_size=0, tokenizer_pool_type='ray', tokenizer_pool_extra_config=None, enable_lora=False, max_loras=1, max_lora_rank=16, lora_extra_vocab_size=256, lora_dtype='auto', long_lora_scaling_factors=None, max_cpu_loras=None, fully_sharded_loras=False, enable_prompt_adapter=False, max_prompt_adapters=1, max_prompt_adapter_token=0, device='auto', scheduler_delay_factor=0.0, enable_chunked_prefill=None, speculative_model=None, num_speculative_tokens=None, speculative_draft_tensor_parallel_size=None, speculative_max_model_len=None, speculative_disable_by_batch_size=None, ngram_prompt_lookup_max=None, ngram_prompt_lookup_min=None, spec_decoding_acceptance_method='rejection_sampler', typical_acceptance_sampler_posterior_threshold=None, typical_acceptance_sampler_posterior_alpha=None, disable_logprobs_during_spec_decoding=None, model_loader_extra_config=None, ignore_patterns=[], preemption_mode=None, served_model_name=None, qlora_adapter_name_or_path=None, otlp_traces_endpoint=None, engine_use_ray=False, disable_log_requests=False, max_log_len=None)
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/opt/vllm/venv/lib/python3.10/site-packages/vllm/entrypoints/openai/api_server.py", line 384, in <module>
    asyncio.run(run_server(args))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/opt/vllm/venv/lib/python3.10/site-packages/vllm/entrypoints/openai/api_server.py", line 355, in run_server
    async with build_async_engine_client(args) as async_engine_client:
  File "/usr/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/opt/vllm/venv/lib/python3.10/site-packages/vllm/entrypoints/openai/api_server.py", line 100, in build_async_engine_client
    if (model_is_embedding(args.model, args.trust_remote_code)
  File "/opt/vllm/venv/lib/python3.10/site-packages/vllm/entrypoints/openai/api_server.py", line 64, in model_is_embedding
    return ModelConfig(model=model_name,
  File "/opt/vllm/venv/lib/python3.10/site-packages/vllm/config.py", line 162, in __init__
    self.hf_config = get_config(self.model, trust_remote_code, revision,
  File "/opt/vllm/venv/lib/python3.10/site-packages/vllm/transformers_utils/config.py", line 75, in get_config
    raise e
  File "/opt/vllm/venv/lib/python3.10/site-packages/vllm/transformers_utils/config.py", line 59, in get_config
    config = AutoConfig.from_pretrained(
  File "/opt/vllm/venv/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 976, in from_pretrained
    config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/opt/vllm/venv/lib/python3.10/site-packages/transformers/configuration_utils.py", line 632, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/opt/vllm/venv/lib/python3.10/site-packages/transformers/configuration_utils.py", line 719, in _get_config_dict
    config_dict = load_gguf_checkpoint(resolved_config_file, return_tensors=False)["config"]
  File "/opt/vllm/venv/lib/python3.10/site-packages/transformers/modeling_gguf_pytorch_utils.py", line 100, in load_gguf_checkpoint
    raise ValueError(f"Architecture {architecture} not supported")
ValueError: Architecture gemma2 not supported

The venv was a clear one, with only the downloaded nightly wheel explicetly installed, followed by flashinfer install.

mgoin commented 1 month ago

This seems like it might be an issue with transformers gguf support since the error is in transformers/modeling_gguf_pytorch_utils.py, do you have an idea @Isotr0py ?

Per this dictionary in transformers, it seems they may only have GGUF support for Llama, Mistral, and Qwen2 architectures - is that accurate? https://github.com/huggingface/transformers/blob/e7f4ace0929600606424efd4cd91947bd567d323/src/transformers/integrations/ggml.py#L123-L170

Isotr0py commented 1 month ago

Yes, the transformers only support extracting config and tokenizer from above architectures' gguf model. If we want to support gemma2-gguf, we need to wait transformers support this architecture firstly.

mgoin commented 1 month ago

Okay thank you for clarifying! @alllexx88 I would recommend opening an issue on the transformers repo to resolve this https://github.com/huggingface/transformers/issues?q=is%3Aissue+is%3Aopen+gguf

alllexx88 commented 1 month ago

@mgoin @Isotr0py thanks a lot! I'll try to open an issue soon

alllexx88 commented 1 month ago

I created a relevant issue: https://github.com/huggingface/transformers/issues/32577