Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swift 3.0 微调后量化用swift export 错误 #2949

Open
lampsonSong opened this issue Jan 21, 2025 · 5 comments
Open

swift 3.0 微调后量化用swift export 错误 #2949

lampsonSong opened this issue Jan 21, 2025 · 5 comments

Comments

@lampsonSong
Copy link

Describe the bug
使用
CUDA_VISIBLE_DEVICES=0 swift export --quant_bits 4
--quant_method gptq
--ckpt_dir /train_model_output/Qwen2-VL-7B-Instruct/v0-20250120-171651/checkpoint-30
--merge_lora true --load_dataset_config true
--output_dir /train_model_output/Qwen2-VL-7B-Instruct-GPTQ-int4

报错信息是

Traceback (most recent call last):
File "/root/syh/qwen2vl_sft/ms-swift/swift/cli/export.py", line 5, in
export_main()
File "/root/syh/qwen2vl_sft/ms-swift/swift/llm/export/export.py", line 42, in export_main
return SwiftExport(args).main()
File "/root/syh/qwen2vl_sft/ms-swift/swift/llm/base.py", line 46, in main
result = self.run()
File "/root/syh/qwen2vl_sft/ms-swift/swift/llm/export/export.py", line 25, in run
merge_lora(args)
File "/root/syh/qwen2vl_sft/ms-swift/swift/llm/export/merge_lora.py", line 16, in merge_lora
assert args.quant_method is None, (f'args.quant_method: {args.quant_method}, '
AssertionError: args.quant_method: gptq, quantized model and does not support merge-lora.

查了一下源码,https://github.com/modelscope/ms-swift/blob/main/swift/llm/export/merge_lora.py#L16, 这里不允许--quant_method参数输入值,于是注释了这行,强制让replace_if_exists=True, 代码可以执行,但是转出来的模型没有量化过,占用的显存和量化前是一样的。

好奇,大家都可以执行成功吗?

@Jintao-Huang
Copy link
Collaborator

merge lora和量化的步骤分开

@lampsonSong
Copy link
Author

感谢回复,我分开了merge和量化操作,依然有报错
P.S. 在swift 2.6下量化没问题,当前的报错都是3.0
Image

@Jintao-Huang
Copy link
Collaborator

optimum autogptq和swift版本是什么

@Jintao-Huang
Copy link
Collaborator

你试试使用swift main分支是否存在这个问题

@lampsonSong
Copy link
Author

感谢回复哈,我报的是main分支的bug哈,release/2.6分支的量化是没问题的,这是我的版本信息

Image

刚又拉最新的main分支代码试了一下,还是这样,应该可以复现的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants