modelscope / ms-swift

Use PEFT or Full-parameter to finetune 350+ LLMs or 100+ MLLMs. (LLM: Qwen2.5, Llama3.2, GLM4, Internlm2.5, Yi1.5, Mistral, Baichuan2, DeepSeek, Gemma2, ...; MLLM: Qwen2-VL, Qwen2-Audio, Llama3.2-Vision, Llava, InternVL2, MiniCPM-V-2.6, GLM4v, Xcomposer2.5, Yi-VL, DeepSeek-VL, Phi3.5-Vision, ...)
https://swift.readthedocs.io/zh-cn/latest/Instruction/index.html
Apache License 2.0
3.95k stars 349 forks source link

量化qwen2-audio-7b 报错 #2306

Open Liufeiran123 opened 1 day ago

Liufeiran123 commented 1 day ago

详细报错信息 Traceback (most recent call last): File "/mnt/d/ai/swift/swift/cli/export.py", line 5, in export_main() File "/mnt/d/ai/swift/swift/utils/run_utils.py", line 32, in x_main result = llm_x(args, *kwargs) File "/mnt/d/ai/swift/swift/llm/export.py", line 263, in llm_export gptq_quantizer = gptq_model_quantize(model, template.tokenizer, args.quant_batch_size) File "/mnt/d/ai/swift/swift/llm/export.py", line 162, in gptq_model_quantize gptq_quantizer.quantize_model(model, tokenizer) File "/mnt/d/envs_swift/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(args, **kwargs) File "/mnt/d/envs_swift/lib/python3.10/site-packages/optimum/gptq/quantizer.py", line 570, in quantize_model self.pack_model(model=model, quantizers=quantizers) File "/mnt/d/envs_swift/lib/python3.10/site-packages/optimum/gptq/quantizer.py", line 641, in pack_model self._replace_by_quant_layers(model, quantizers) File "/mnt/d/envs_swift/lib/python3.10/site-packages/optimum/gptq/quantizer.py", line 299, in _replace_by_quant_layers self._replace_by_quant_layers(child, names, name + "." + name1 if name != "" else name1) File "/mnt/d/envs_swift/lib/python3.10/site-packages/optimum/gptq/quantizer.py", line 267, in _replace_by_quant_layers layer = getattr(module, attr) File "/mnt/d/envs_swift/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1729, in getattr raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'") AttributeError: 'Qwen2AudioEncoder' object has no attribute '_supports_sdpa'

slin000111 commented 1 day ago

关于此报错的命令行有吗?

Liufeiran123 commented 1 day ago

swift export --model_type qwen2-audio-7b-instruct --quant_bits 4 --dataset alpaca-zh --quant_method gptq

Jintao-Huang commented 1 day ago

我这里测试一切正常啊 你的transformers版本是?

Liufeiran123 commented 21 hours ago

那很奇怪了,我的 transformers 版本为 4.45.2

Liufeiran123 commented 21 hours ago

optimum 1.23.1