vllm-project / vllm

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

[Bug]: Cannot find any of ['adapter_name_or_path'] in the model's quantization config #6727

Open fengyunflya opened 3 months ago

fengyunflya commented 3 months ago

Your current environment

The output of `python collect_env.py`

PyTorch version: 2.3.0 Is debug build: False CUDA used to build PyTorch: 12.1 ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.3 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.1 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-35-generic-x86_64-with-glibc2.35 Is CUDA available: True CUDA runtime version: 12.1.105 CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: NVIDIA GeForce RTX 4090 D Nvidia driver version: 550.54.14 cuDNN version: Probably one of the following: /usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.0 /usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.0 /usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.0 /usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.0 /usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.0 /usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.0 /usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.0 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: 43 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 128 On-line CPU(s) list: 0-127 Vendor ID: AuthenticAMD Model name: AMD EPYC 7543 32-Core Processor CPU family: 25 Model: 1 Thread(s) per core: 2 Core(s) per socket: 32 Socket(s): 2 Stepping: 1 Frequency boost: enabled CPU max MHz: 3737.8899 CPU min MHz: 1500.0000 BogoMIPS: 5589.49 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 pcid 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 invpcid_single hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid 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 brs arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm sev sev_es Virtualization: AMD-V L1d cache: 2 MiB (64 instances) L1i cache: 2 MiB (64 instances) L2 cache: 32 MiB (64 instances) L3 cache: 512 MiB (16 instances) NUMA node(s): 8 NUMA node0 CPU(s): 0-7,64-71 NUMA node1 CPU(s): 8-15,72-79 NUMA node2 CPU(s): 16-23,80-87 NUMA node3 CPU(s): 24-31,88-95 NUMA node4 CPU(s): 32-39,96-103 NUMA node5 CPU(s): 40-47,104-111 NUMA node6 CPU(s): 48-55,112-119 NUMA node7 CPU(s): 56-63,120-127 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: Mitigation; Safe RET 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 always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected

Versions of relevant libraries: [pip3] numpy==1.26.4 [pip3] optree==0.11.0 [pip3] torch==2.3.0 [pip3] torchaudio==2.3.0 [pip3] torchelastic==0.2.2 [pip3] torchvision==0.18.0 [pip3] transformers==4.43.1 [pip3] triton==2.3.0 [conda] blas 1.0 mkl
[conda] ffmpeg 4.3 hf484d3e_0 pytorch [conda] libjpeg-turbo 2.0.0 h9bf148f_0 pytorch [conda] mkl 2023.1.0 h213fc3f_46344
[conda] mkl-service 2.4.0 py310h5eee18b_1
[conda] mkl_fft 1.3.8 py310h5eee18b_0
[conda] mkl_random 1.2.4 py310hdb19cb5_0
[conda] numpy 1.26.4 py310h5f9d8c6_0
[conda] numpy-base 1.26.4 py310hb5e798b_0
[conda] optree 0.11.0 pypi_0 pypi [conda] pytorch 2.3.0 py3.10_cuda12.1_cudnn8.9.2_0 pytorch [conda] pytorch-cuda 12.1 ha16c6d3_5 pytorch [conda] pytorch-mutex 1.0 cuda pytorch [conda] torchaudio 2.3.0 py310_cu121 pytorch [conda] torchelastic 0.2.2 pypi_0 pypi [conda] torchtriton 2.3.0 py310 pytorch [conda] torchvision 0.18.0 py310_cu121 pytorch [conda] transformers 4.43.1 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 NIC0 CPU Affinity NUMA Affinity GPU NUMA ID GPU0 X SYS 32-39,96-103 4 N/A NIC0 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_bond_0

🐛 Describe the bug

base_model = 'path_to_base_model' lora_path = 'path_to_lora' merged_path = 'path_to_merged'

bnb_config = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.bfloat16, bnb_4bit_quant_type='nf4', bnb_4bit_use_double_quant=True) model = AutoModelForCausalLM.from_pretrained(base_model, torch_dtype=torch.bfloat16, quantization_config=bnb_config, device_map='auto', trust_remote_code=True) model = PeftModel.from_pretrained(model, lora_path) tokenizer = AutoTokenizer.from_pretrained(base_model, padding_side='left', trust_remote_code=True) model.config.pad_token_id = tokenizer.pad_token_id

merged_model = model.merge_and_unload() merged_model.save_pretrained(merged_path)

llm = LLM(model=merged_path, tokenizer=base_model )

ValueError: Cannot find any of ['adapter_name_or_path'] in the model's quantization config.

sshahbuddin5 commented 3 months ago

Have you found a solution to the problem? I am encountering the same issue when loading my finetuned model using vLLM.

fengyunflya commented 3 months ago

Have you found a solution to the problem? I am encountering the same issue when loading my finetuned model using vLLM.

Not yet...

soooocold commented 3 months ago

Same problem +1

sshahbuddin5 commented 3 months ago

Have you found a solution to the problem? I am encountering the same issue when loading my finetuned model using vLLM.

Not yet...

I was successful in working around the issue by removing the BNB quantization configuration from my model.

ShawonAshraf commented 3 months ago

Same problem here. VLLM looks for a key in the model configs which doesn't exist? I wonder if they overlooked any changes in the more recent versions of bitsandbytes somehow.

jokmingwong commented 3 months ago

Same problems when using qwen2 bitsandbytes code:

 python benchmark_throughput.py --model unsloth/Qwen2-7B-Instruct-bnb-4bit --trust-remote-code --quantization bitsandbytes --input-len 4096 --output-len 128 --load-format bitsandbytes

And the key error occured: ValueError: Cannot find any of ['adapter_name_or_path'] in the model's quantization config

jokmingwong commented 3 months ago

This commit solved this issue: https://github.com/vllm-project/vllm/commit/87525fab925edf549611a1a74a40699b0b5e316e You can build from source after this commit to use the bitsandbytes quantization method.

fengyunflya commented 3 months ago

This commit solved this issue: 87525fa You can build from source after this commit to use the bitsandbytes quantization method.

Thanks, may I ask how to use their commit? should I use newest version?

ShawonAshraf commented 3 months ago

The commit has been merged, so should we just update to the newest release to make things work?

fengyunflya commented 3 months ago

The commit has been merged, so should we just update to the newest release to make things work?

Tried newest release, still not working...

sunil448832 commented 3 months ago

Same problem.

ShawonAshraf commented 3 months ago

The commit has been merged, so should we just update to the newest release to make things work?

Tried newest release, still not working...

The commit that fixed the issue hasn't made into a new release yet. So your best bet would be to build vllm from source.

vjagannath786 commented 3 months ago

The commit has been merged, so should we just update to the newest release to make things work?

Tried newest release, still not working...

The commit that fixed the issue hasn't made into a new release yet. So your best bet would be to build vllm from source.

Able to install from source ? Getting lot of issues while installing from source.

chenqianfzh commented 3 months ago

adapter_name_or_path in vLLM QLoRA is a CLI parameter to input by the user. It is supposed to be the path/name to the Lora repo.

ShawonAshraf commented 3 months ago

adapter_name_or_path in vLLM QLoRA is a CLI parameter to input by the user. It is supposed to be the path/name to the Lora repo.

That's if you're supplying a different Qlora config. This issue is related to the bnb configs. The solution hasn't made it into the new release yet.

ShawonAshraf commented 2 months ago

The issue is resolved with the new 0.5.4 release. You all should update your vllm version.

fengyunflya commented 2 months ago

The issue is resolved with the new 0.5.4 release. You all should update your vllm version.

Hi, can you show a simple example how to load it? I first merged the Qlora model and save it to '/root/finetuned', and then llm = LLM(model='/root/finetuned', tokenizer='/root/finetuned'), but it still has error: ValueError: BitAndBytes with enforce_eager = False is not supported yet.

jokmingwong commented 2 months ago

The issue is resolved with the new 0.5.4 release. You all should update your vllm version.

Hi, can you show a simple example how to load it? I first merged the Qlora model and save it to '/root/finetuned', and then llm = LLM(model='/root/finetuned', tokenizer='/root/finetuned'), but it still has error: ValueError: BitAndBytes with enforce_eager = False is not supported yet.

Just enable enforce eager by changing the code to LLM(model='/root/finetuned', tokenizer='/root/finetuned', enforce_eager=True). It will enforce eager execution and disable CUDA graph.